libc: add pread, pwrite; sys_pread, sys_pwrite
This commit is contained in:
parent
b96c18b508
commit
2eb7d97464
@ -106,4 +106,7 @@ extern long pathconf(const char *path, int name);
|
||||
|
||||
extern int getgroups(int size, gid_t list[]);
|
||||
|
||||
ssize_t pread(int fd, void *buf, size_t count, off_t offset);
|
||||
ssize_t pwrite(int fd, const void *buf, size_t count, off_t offset);
|
||||
|
||||
_End_C_Header
|
||||
|
11
libc/unistd/pread.c
Normal file
11
libc/unistd/pread.c
Normal file
@ -0,0 +1,11 @@
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <syscall.h>
|
||||
#include <syscall_nums.h>
|
||||
|
||||
DEFN_SYSCALL4(pread, SYS_PREAD, int, void *, size_t, off_t);
|
||||
|
||||
ssize_t pread(int fd, void *buf, size_t count, off_t offset) {
|
||||
__sets_errno(syscall_pread(fd,buf,count,offset));
|
||||
}
|
||||
|
11
libc/unistd/pwrite.c
Normal file
11
libc/unistd/pwrite.c
Normal file
@ -0,0 +1,11 @@
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <syscall.h>
|
||||
#include <syscall_nums.h>
|
||||
|
||||
DEFN_SYSCALL4(pwrite, SYS_PWRITE, int, const void *, size_t, off_t);
|
||||
|
||||
ssize_t pwrite(int fd, const void *buf, size_t count, off_t offset) {
|
||||
__sets_errno(syscall_pwrite(fd,buf,count,offset));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user