mirror of
https://git.musl-libc.org/git/musl
synced 2025-01-06 23:02:10 +03:00
add preadv2 and pwritev2 syscall wrappers, flag value macros
This commit is contained in:
parent
f247462b08
commit
81cced6ebe
@ -39,6 +39,13 @@ ssize_t pwritev (int, const struct iovec *, int, off_t);
|
||||
#ifdef _GNU_SOURCE
|
||||
ssize_t process_vm_writev(pid_t, const struct iovec *, unsigned long, const struct iovec *, unsigned long, unsigned long);
|
||||
ssize_t process_vm_readv(pid_t, const struct iovec *, unsigned long, const struct iovec *, unsigned long, unsigned long);
|
||||
ssize_t preadv2 (int, const struct iovec *, int, off_t, int);
|
||||
ssize_t pwritev2 (int, const struct iovec *, int, off_t, int);
|
||||
#define RWF_HIPRI 0x00000001
|
||||
#define RWF_DSYNC 0x00000002
|
||||
#define RWF_SYNC 0x00000004
|
||||
#define RWF_NOWAIT 0x00000008
|
||||
#define RWF_APPEND 0x00000010
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
17
src/linux/preadv2.c
Normal file
17
src/linux/preadv2.c
Normal file
@ -0,0 +1,17 @@
|
||||
#define _GNU_SOURCE
|
||||
#include <sys/uio.h>
|
||||
#include <unistd.h>
|
||||
#include "syscall.h"
|
||||
|
||||
ssize_t preadv2(int fd, const struct iovec *iov, int count, off_t ofs, int flags)
|
||||
{
|
||||
#ifdef SYS_preadv
|
||||
if (!flags) {
|
||||
if (ofs==-1) return readv(fd, iov, count);
|
||||
return syscall_cp(SYS_preadv, fd, iov, count,
|
||||
(long)(ofs), (long)(ofs>>32));
|
||||
}
|
||||
#endif
|
||||
return syscall_cp(SYS_preadv2, fd, iov, count,
|
||||
(long)(ofs), (long)(ofs>>32), flags);
|
||||
}
|
17
src/linux/pwritev2.c
Normal file
17
src/linux/pwritev2.c
Normal file
@ -0,0 +1,17 @@
|
||||
#define _GNU_SOURCE
|
||||
#include <sys/uio.h>
|
||||
#include <unistd.h>
|
||||
#include "syscall.h"
|
||||
|
||||
ssize_t pwritev2(int fd, const struct iovec *iov, int count, off_t ofs, int flags)
|
||||
{
|
||||
#ifdef SYS_pwritev
|
||||
if (!flags) {
|
||||
if (ofs==-1) return writev(fd, iov, count);
|
||||
return syscall_cp(SYS_pwritev, fd, iov, count,
|
||||
(long)(ofs), (long)(ofs>>32));
|
||||
}
|
||||
#endif
|
||||
return syscall_cp(SYS_pwritev2, fd, iov, count,
|
||||
(long)(ofs), (long)(ofs>>32), flags);
|
||||
}
|
Loading…
Reference in New Issue
Block a user