functional: add mntent test
[libc-test.git] / src / regression / syscall-sign-extend.c
blobea47ab3437f49e70a5567c14a09fd614c9b95e42
1 // commit 5f95f965e933c5b155db75520ac27c92ddbcf400 2014-03-18
2 // syscall should not sign extend pointers on x32
3 #define _GNU_SOURCE
4 #include <errno.h>
5 #include <fcntl.h>
6 #include <string.h>
7 #include <sys/syscall.h>
8 #include <unistd.h>
9 #include "test.h"
11 #define T(f) (!(f) && (t_error(#f " failed: %s\n", strerror(errno)), 0))
13 int main(void)
15 char buf[1] = {1};
16 int fd;
17 int r;
19 // test syscall with pointer
20 T((fd = open("/dev/zero", O_RDONLY)) >= 0);
21 T((r = syscall(SYS_read, fd, buf, 1)) == 1);
22 if (buf[0] != 0)
23 t_error("read %d instead of 0\n", buf[0]);
25 return t_status;