mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:17:45 +00:00
Kernel: Add FileDescription read/write API that bypasses current offset
Forcing users of a FileDescription to seek before they can read/write makes it inherently racy. This patch adds variants of read/write that simply ignore the "current offset" of the description in favor of a caller-supplied offset.
This commit is contained in:
parent
ace8b9a0ee
commit
d1395f2eb9
2 changed files with 18 additions and 0 deletions
|
@ -51,6 +51,10 @@ public:
|
|||
KResultOr<size_t> write(const UserOrKernelBuffer& data, size_t);
|
||||
KResult stat(::stat&);
|
||||
|
||||
// NOTE: These ignore the current offset of this file description.
|
||||
KResultOr<size_t> read(UserOrKernelBuffer&, u64 offset, size_t);
|
||||
KResultOr<size_t> write(u64 offset, UserOrKernelBuffer const&, size_t);
|
||||
|
||||
KResult chmod(mode_t);
|
||||
|
||||
bool can_read() const;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue