From 9cf9c39e48342a5d4007824d49b88132d93d83e3 Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Sat, 23 Jun 2012 21:38:47 -0400 Subject: [PATCH] add process_vm_readv and process_vm_writev syscall wrappers based on a patch submitted by Kristian L. --- include/sys/uio.h | 9 +++++++++ src/linux/process_vm.c | 13 +++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 src/linux/process_vm.c diff --git a/include/sys/uio.h b/include/sys/uio.h index f77db33a..7a75a542 100644 --- a/include/sys/uio.h +++ b/include/sys/uio.h @@ -9,11 +9,20 @@ extern "C" { #define __NEED_ssize_t #define __NEED_struct_iovec +#ifdef _GNU_SOURCE +#define __NEED_pid_t +#endif + #include ssize_t readv (int, const struct iovec *, int); ssize_t writev (int, const struct iovec *, int); +#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); +#endif + #ifdef __cplusplus } #endif diff --git a/src/linux/process_vm.c b/src/linux/process_vm.c new file mode 100644 index 00000000..7703bdf0 --- /dev/null +++ b/src/linux/process_vm.c @@ -0,0 +1,13 @@ +#define _GNU_SOURCE +#include +#include "syscall.h" + +ssize_t process_vm_writev(pid_t pid, const struct iovec *lvec, unsigned long liovcnt, const struct iovec *rvec, unsigned long riovcnt, unsigned long flags) +{ + return syscall(SYS_process_vm_writev, pid, lvec, liovcnt, rvec, riovcnt, flags); +} + +ssize_t process_vm_readv(pid_t pid, const struct iovec *lvec, unsigned long liovcnt, const struct iovec *rvec, unsigned long riovcnt, unsigned long flags) +{ + return syscall(SYS_process_vm_readv, pid, lvec, liovcnt, rvec, riovcnt, flags); +} -- 2.25.1