summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2015-06-10 17:24:20 -0700
committerElliott Hughes <enh@google.com>2015-06-10 18:55:06 -0700
commit25ac753f474492ffa3625ca6b5aae254bb205c33 (patch)
tree9ba53d98920b5c870fa22200ea59bd23f26019dd
parenteeb1d33a31de854c7d9713fd365291ff1b4780fa (diff)
downloadbionic-25ac753f474492ffa3625ca6b5aae254bb205c33.zip
bionic-25ac753f474492ffa3625ca6b5aae254bb205c33.tar.gz
bionic-25ac753f474492ffa3625ca6b5aae254bb205c33.tar.bz2
Add process_vm_readv and process_vm_writev.
Bug: http://b/21761353 Change-Id: Ic8ef3f241d62d2a4271fbc783c8af50257bac498 (cherry picked from commit be57a40d2973739c4fb0aa1cfb0014f34aeec2bd)
-rw-r--r--libc/SYSCALLS.TXT3
-rw-r--r--libc/arch-arm/syscalls/process_vm_readv.S22
-rw-r--r--libc/arch-arm/syscalls/process_vm_writev.S22
-rw-r--r--libc/arch-arm64/syscalls/process_vm_readv.S14
-rw-r--r--libc/arch-arm64/syscalls/process_vm_writev.S14
-rw-r--r--libc/arch-mips/syscalls/process_vm_readv.S19
-rw-r--r--libc/arch-mips/syscalls/process_vm_writev.S19
-rw-r--r--libc/arch-mips64/syscalls/process_vm_readv.S25
-rw-r--r--libc/arch-mips64/syscalls/process_vm_writev.S25
-rw-r--r--libc/arch-x86/syscalls/process_vm_readv.S46
-rw-r--r--libc/arch-x86/syscalls/process_vm_writev.S46
-rw-r--r--libc/arch-x86_64/syscalls/process_vm_readv.S16
-rw-r--r--libc/arch-x86_64/syscalls/process_vm_writev.S16
-rw-r--r--libc/include/sys/uio.h9
-rw-r--r--tests/Android.mk1
-rw-r--r--tests/sys_uio_test.cpp27
16 files changed, 322 insertions, 2 deletions
diff --git a/libc/SYSCALLS.TXT b/libc/SYSCALLS.TXT
index 4890b89..ffab9f6 100644
--- a/libc/SYSCALLS.TXT
+++ b/libc/SYSCALLS.TXT
@@ -308,6 +308,9 @@ int inotify_rm_watch(int, unsigned int) all
int __pselect6:pselect6(int, fd_set*, fd_set*, fd_set*, timespec*, void*) all
int __ppoll:ppoll(pollfd*, unsigned int, timespec*, const sigset_t*, size_t) all
+ssize_t process_vm_readv(pid_t, const struct iovec*, unsigned long, const struct iovec*, unsigned long, unsigned long) all
+ssize_t process_vm_writev(pid_t, const struct iovec*, unsigned long, const struct iovec*, unsigned long, unsigned long) all
+
int __set_tid_address:set_tid_address(int*) all
int setfsgid(gid_t) all
diff --git a/libc/arch-arm/syscalls/process_vm_readv.S b/libc/arch-arm/syscalls/process_vm_readv.S
new file mode 100644
index 0000000..48c49dc
--- /dev/null
+++ b/libc/arch-arm/syscalls/process_vm_readv.S
@@ -0,0 +1,22 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(process_vm_readv)
+ mov ip, sp
+ stmfd sp!, {r4, r5, r6, r7}
+ .cfi_def_cfa_offset 16
+ .cfi_rel_offset r4, 0
+ .cfi_rel_offset r5, 4
+ .cfi_rel_offset r6, 8
+ .cfi_rel_offset r7, 12
+ ldmfd ip, {r4, r5, r6}
+ ldr r7, =__NR_process_vm_readv
+ swi #0
+ ldmfd sp!, {r4, r5, r6, r7}
+ .cfi_def_cfa_offset 0
+ cmn r0, #(MAX_ERRNO + 1)
+ bxls lr
+ neg r0, r0
+ b __set_errno_internal
+END(process_vm_readv)
diff --git a/libc/arch-arm/syscalls/process_vm_writev.S b/libc/arch-arm/syscalls/process_vm_writev.S
new file mode 100644
index 0000000..4c21c43
--- /dev/null
+++ b/libc/arch-arm/syscalls/process_vm_writev.S
@@ -0,0 +1,22 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(process_vm_writev)
+ mov ip, sp
+ stmfd sp!, {r4, r5, r6, r7}
+ .cfi_def_cfa_offset 16
+ .cfi_rel_offset r4, 0
+ .cfi_rel_offset r5, 4
+ .cfi_rel_offset r6, 8
+ .cfi_rel_offset r7, 12
+ ldmfd ip, {r4, r5, r6}
+ ldr r7, =__NR_process_vm_writev
+ swi #0
+ ldmfd sp!, {r4, r5, r6, r7}
+ .cfi_def_cfa_offset 0
+ cmn r0, #(MAX_ERRNO + 1)
+ bxls lr
+ neg r0, r0
+ b __set_errno_internal
+END(process_vm_writev)
diff --git a/libc/arch-arm64/syscalls/process_vm_readv.S b/libc/arch-arm64/syscalls/process_vm_readv.S
new file mode 100644
index 0000000..1dd113b
--- /dev/null
+++ b/libc/arch-arm64/syscalls/process_vm_readv.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(process_vm_readv)
+ mov x8, __NR_process_vm_readv
+ svc #0
+
+ cmn x0, #(MAX_ERRNO + 1)
+ cneg x0, x0, hi
+ b.hi __set_errno_internal
+
+ ret
+END(process_vm_readv)
diff --git a/libc/arch-arm64/syscalls/process_vm_writev.S b/libc/arch-arm64/syscalls/process_vm_writev.S
new file mode 100644
index 0000000..fb29cf8
--- /dev/null
+++ b/libc/arch-arm64/syscalls/process_vm_writev.S
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(process_vm_writev)
+ mov x8, __NR_process_vm_writev
+ svc #0
+
+ cmn x0, #(MAX_ERRNO + 1)
+ cneg x0, x0, hi
+ b.hi __set_errno_internal
+
+ ret
+END(process_vm_writev)
diff --git a/libc/arch-mips/syscalls/process_vm_readv.S b/libc/arch-mips/syscalls/process_vm_readv.S
new file mode 100644
index 0000000..22b74f0
--- /dev/null
+++ b/libc/arch-mips/syscalls/process_vm_readv.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(process_vm_readv)
+ .set noreorder
+ .cpload t9
+ li v0, __NR_process_vm_readv
+ syscall
+ bnez a3, 1f
+ move a0, v0
+ j ra
+ nop
+1:
+ la t9,__set_errno_internal
+ j t9
+ nop
+ .set reorder
+END(process_vm_readv)
diff --git a/libc/arch-mips/syscalls/process_vm_writev.S b/libc/arch-mips/syscalls/process_vm_writev.S
new file mode 100644
index 0000000..dd1dc4b
--- /dev/null
+++ b/libc/arch-mips/syscalls/process_vm_writev.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(process_vm_writev)
+ .set noreorder
+ .cpload t9
+ li v0, __NR_process_vm_writev
+ syscall
+ bnez a3, 1f
+ move a0, v0
+ j ra
+ nop
+1:
+ la t9,__set_errno_internal
+ j t9
+ nop
+ .set reorder
+END(process_vm_writev)
diff --git a/libc/arch-mips64/syscalls/process_vm_readv.S b/libc/arch-mips64/syscalls/process_vm_readv.S
new file mode 100644
index 0000000..f3c7372
--- /dev/null
+++ b/libc/arch-mips64/syscalls/process_vm_readv.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(process_vm_readv)
+ .set push
+ .set noreorder
+ li v0, __NR_process_vm_readv
+ syscall
+ bnez a3, 1f
+ move a0, v0
+ j ra
+ nop
+1:
+ move t0, ra
+ bal 2f
+ nop
+2:
+ .cpsetup ra, t1, 2b
+ LA t9,__set_errno_internal
+ .cpreturn
+ j t9
+ move ra, t0
+ .set pop
+END(process_vm_readv)
diff --git a/libc/arch-mips64/syscalls/process_vm_writev.S b/libc/arch-mips64/syscalls/process_vm_writev.S
new file mode 100644
index 0000000..0e8140b
--- /dev/null
+++ b/libc/arch-mips64/syscalls/process_vm_writev.S
@@ -0,0 +1,25 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(process_vm_writev)
+ .set push
+ .set noreorder
+ li v0, __NR_process_vm_writev
+ syscall
+ bnez a3, 1f
+ move a0, v0
+ j ra
+ nop
+1:
+ move t0, ra
+ bal 2f
+ nop
+2:
+ .cpsetup ra, t1, 2b
+ LA t9,__set_errno_internal
+ .cpreturn
+ j t9
+ move ra, t0
+ .set pop
+END(process_vm_writev)
diff --git a/libc/arch-x86/syscalls/process_vm_readv.S b/libc/arch-x86/syscalls/process_vm_readv.S
new file mode 100644
index 0000000..64965f6
--- /dev/null
+++ b/libc/arch-x86/syscalls/process_vm_readv.S
@@ -0,0 +1,46 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(process_vm_readv)
+ pushl %ebx
+ .cfi_def_cfa_offset 8
+ .cfi_rel_offset ebx, 0
+ pushl %ecx
+ .cfi_adjust_cfa_offset 4
+ .cfi_rel_offset ecx, 0
+ pushl %edx
+ .cfi_adjust_cfa_offset 4
+ .cfi_rel_offset edx, 0
+ pushl %esi
+ .cfi_adjust_cfa_offset 4
+ .cfi_rel_offset esi, 0
+ pushl %edi
+ .cfi_adjust_cfa_offset 4
+ .cfi_rel_offset edi, 0
+ pushl %ebp
+ .cfi_adjust_cfa_offset 4
+ .cfi_rel_offset ebp, 0
+ mov 28(%esp), %ebx
+ mov 32(%esp), %ecx
+ mov 36(%esp), %edx
+ mov 40(%esp), %esi
+ mov 44(%esp), %edi
+ mov 48(%esp), %ebp
+ movl $__NR_process_vm_readv, %eax
+ int $0x80
+ cmpl $-MAX_ERRNO, %eax
+ jb 1f
+ negl %eax
+ pushl %eax
+ call __set_errno_internal
+ addl $4, %esp
+1:
+ popl %ebp
+ popl %edi
+ popl %esi
+ popl %edx
+ popl %ecx
+ popl %ebx
+ ret
+END(process_vm_readv)
diff --git a/libc/arch-x86/syscalls/process_vm_writev.S b/libc/arch-x86/syscalls/process_vm_writev.S
new file mode 100644
index 0000000..555c822
--- /dev/null
+++ b/libc/arch-x86/syscalls/process_vm_writev.S
@@ -0,0 +1,46 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(process_vm_writev)
+ pushl %ebx
+ .cfi_def_cfa_offset 8
+ .cfi_rel_offset ebx, 0
+ pushl %ecx
+ .cfi_adjust_cfa_offset 4
+ .cfi_rel_offset ecx, 0
+ pushl %edx
+ .cfi_adjust_cfa_offset 4
+ .cfi_rel_offset edx, 0
+ pushl %esi
+ .cfi_adjust_cfa_offset 4
+ .cfi_rel_offset esi, 0
+ pushl %edi
+ .cfi_adjust_cfa_offset 4
+ .cfi_rel_offset edi, 0
+ pushl %ebp
+ .cfi_adjust_cfa_offset 4
+ .cfi_rel_offset ebp, 0
+ mov 28(%esp), %ebx
+ mov 32(%esp), %ecx
+ mov 36(%esp), %edx
+ mov 40(%esp), %esi
+ mov 44(%esp), %edi
+ mov 48(%esp), %ebp
+ movl $__NR_process_vm_writev, %eax
+ int $0x80
+ cmpl $-MAX_ERRNO, %eax
+ jb 1f
+ negl %eax
+ pushl %eax
+ call __set_errno_internal
+ addl $4, %esp
+1:
+ popl %ebp
+ popl %edi
+ popl %esi
+ popl %edx
+ popl %ecx
+ popl %ebx
+ ret
+END(process_vm_writev)
diff --git a/libc/arch-x86_64/syscalls/process_vm_readv.S b/libc/arch-x86_64/syscalls/process_vm_readv.S
new file mode 100644
index 0000000..597649e
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/process_vm_readv.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(process_vm_readv)
+ movq %rcx, %r10
+ movl $__NR_process_vm_readv, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno_internal
+1:
+ ret
+END(process_vm_readv)
diff --git a/libc/arch-x86_64/syscalls/process_vm_writev.S b/libc/arch-x86_64/syscalls/process_vm_writev.S
new file mode 100644
index 0000000..397c007
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/process_vm_writev.S
@@ -0,0 +1,16 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(process_vm_writev)
+ movq %rcx, %r10
+ movl $__NR_process_vm_writev, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno_internal
+1:
+ ret
+END(process_vm_writev)
diff --git a/libc/include/sys/uio.h b/libc/include/sys/uio.h
index 0251716..187ec22 100644
--- a/libc/include/sys/uio.h
+++ b/libc/include/sys/uio.h
@@ -34,8 +34,13 @@
__BEGIN_DECLS
-int readv(int, const struct iovec *, int);
-int writev(int, const struct iovec *, int);
+int readv(int, const struct iovec*, int);
+int writev(int, const struct iovec*, int);
+
+#if defined(__USE_GNU)
+ssize_t process_vm_readv(pid_t, const struct iovec*, unsigned long, const struct iovec*, unsigned long, unsigned long);
+ssize_t process_vm_writev(pid_t, const struct iovec*, unsigned long, const struct iovec*, unsigned long, unsigned long);
+#endif
__END_DECLS
diff --git a/tests/Android.mk b/tests/Android.mk
index 37f7b4f..29e9e1e 100644
--- a/tests/Android.mk
+++ b/tests/Android.mk
@@ -106,6 +106,7 @@ libBionicStandardTests_src_files := \
sys_sysinfo_test.cpp \
sys_time_test.cpp \
sys_types_test.cpp \
+ sys_uio_test.cpp \
sys_vfs_test.cpp \
sys_xattr_test.cpp \
system_properties_test.cpp \
diff --git a/tests/sys_uio_test.cpp b/tests/sys_uio_test.cpp
new file mode 100644
index 0000000..c7af8a7
--- /dev/null
+++ b/tests/sys_uio_test.cpp
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <gtest/gtest.h>
+
+#include <sys/uio.h>
+
+TEST(sys_uio, process_vm_readv_ESRCH) {
+ ASSERT_EQ(0, process_vm_readv(0, nullptr, 0, nullptr, 0, 0));
+}
+
+TEST(sys_uio, process_vm_writev_ESRCH) {
+ ASSERT_EQ(0, process_vm_writev(0, nullptr, 0, nullptr, 0, 0));
+}