11 static int status
= EXIT_SUCCESS
;
13 #ifdef HAVE_PROCESS_VM_READV
15 static void test_process_vm_readv()
17 char lbuf
[] = "123456";
18 char rbuf
[] = "ABCDEF";
23 lvec
[0].iov_base
= lbuf
+ 1;
25 lvec
[1].iov_base
= lbuf
+ 3;
28 rvec
[0].iov_base
= rbuf
+ 1;
30 rvec
[1].iov_base
= rbuf
+ 4;
33 if (process_vm_readv(getpid(),
37 perror("process_vm_readv");
38 status
= EXIT_FAILURE
;
41 if (strcmp(lbuf
, "1B3CE6") != 0) {
42 fprintf(stderr
, "Expected: \"1B3CE6\"; Got: \"%s\"\n", lbuf
);
43 status
= EXIT_FAILURE
;
47 #endif /* defined( HAVE_PROCESS_VM_READV ) */
49 #ifdef HAVE_PROCESS_VM_WRITEV
51 static void test_process_vm_writev()
53 char lbuf
[] = "123456";
54 char rbuf
[] = "ABCDEF";
59 lvec
[0].iov_base
= lbuf
+ 1;
61 lvec
[1].iov_base
= lbuf
+ 3;
64 rvec
[0].iov_base
= rbuf
+ 1;
66 rvec
[1].iov_base
= rbuf
+ 4;
69 if (process_vm_writev(getpid(),
73 perror("process_vm_writev");
74 status
= EXIT_FAILURE
;
77 if (strcmp(rbuf
, "A24D5F") != 0) {
78 fprintf(stderr
, "Expected: \"A24D5F\"; Got: \"%s\"\n", rbuf
);
79 status
= EXIT_FAILURE
;
83 #endif /* defined( HAVE_PROCESS_VM_WRITEV ) */
85 int main(int argc
, char *argv
[])
87 #ifdef HAVE_PROCESS_VM_READV
88 test_process_vm_readv();
90 #ifdef HAVE_PROCESS_VM_WRITEV
91 test_process_vm_writev();