1 05-06-2007 Mike Frysinger <vapier@gentoo.org>
3 * sysdeps/unix/make-syscalls.sh: Document "C" syscall signature.
4 * sysdeps/unix/sysv/linux/syscalls.list (fdatasync): Add "C" to args.
5 * io/lockf.c: Handle pthread cancellation.
6 * nptl/tst-cancel-wrappers.sh: Set C["fdatasync"] and C["lockf"] to 1.
7 * nptl/tst-cancel4.c (tf_fdatasync): New test.
9 --- sysdeps/unix/make-syscalls.sh
10 +++ sysdeps/unix/make-syscalls.sh
12 # a: unchecked address (e.g., 1st arg to mmap)
13 # b: non-NULL buffer (e.g., 2nd arg to read; return value from mmap)
14 # B: optionally-NULL buffer (e.g., 4th arg to getsockopt)
15 +# C: pthread cancellation endpoint
16 # f: buffer of 2 ints (e.g., 4th arg to socketpair)
18 # i: scalar (any signedness & size: int, long, long long, enum, whatever)
19 --- sysdeps/unix/sysv/linux/syscalls.list
20 +++ sysdeps/unix/sysv/linux/syscalls.list
22 epoll_ctl EXTRA epoll_ctl i:iiip epoll_ctl
23 epoll_wait EXTRA epoll_wait Ci:ipii epoll_wait
24 epoll_pwait EXTRA epoll_pwait Ci:ipiipi epoll_pwait
25 -fdatasync - fdatasync i:i fdatasync
26 +fdatasync - fdatasync Ci:i fdatasync
27 flock - flock i:ii __flock flock
28 fork - fork i: __libc_fork __fork fork
29 get_kernel_syms EXTRA get_kernel_syms i:p get_kernel_syms
34 #include <sys/types.h>
36 +#include <sysdep-cancel.h> /* Must come before <fcntl.h>. */
43 /* lockf() is a cancellation point but so is fcntl() if F_SETLKW is
44 - used. Therefore we don't have to care about cancellation here,
45 - the fcntl() function will take care of it. */
46 - return __fcntl (fd, cmd, &fl);
47 + used. Therefore we don't have to care about cancellation in that
48 + case as the fcntl() function will take care of it. */
49 + if (SINGLE_THREAD_P || cmd == F_SETLKW)
50 + return __fcntl (fd, cmd, &fl);
52 + int oldtype = LIBC_CANCEL_ASYNC ();
54 + int result = __fcntl (fd, cmd, &fl);
56 + LIBC_CANCEL_RESET (oldtype);
60 --- nptl/tst-cancel-wrappers.sh
61 +++ nptl/tst-cancel-wrappers.sh
62 @@ -26,7 +26,9 @@ C["close"]=1
72 --- nptl/tst-cancel4.c
73 +++ nptl/tst-cancel4.c
74 @@ -1571,6 +1571,47 @@ tf_fsync (void *arg)
78 +tf_fdatasync (void *arg)
81 + // XXX If somebody can provide a portable test case in which fdatasync()
82 + // blocks we can enable this test to run in both rounds.
85 + tempfd = open ("Makefile", O_RDONLY);
88 + printf ("%s: cannot open Makefile\n", __FUNCTION__);
92 + int r = pthread_barrier_wait (&b2);
93 + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
95 + printf ("%s: barrier_wait failed\n", __FUNCTION__);
99 + r = pthread_barrier_wait (&b2);
100 + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
102 + printf ("%s: 2nd barrier_wait failed\n", __FUNCTION__);
106 + pthread_cleanup_push (cl, NULL);
108 + fdatasync (tempfd);
110 + pthread_cleanup_pop (0);
112 + printf ("%s: fdatasync returned\n", __FUNCTION__);
122 @@ -2078,6 +2119,7 @@ static struct
123 ADD_TEST (pread, 2, 1),
124 ADD_TEST (pwrite, 2, 1),
125 ADD_TEST (fsync, 2, 1),
126 + ADD_TEST (fdatasync, 2, 1),
127 ADD_TEST (msync, 2, 1),
128 ADD_TEST (sendto, 2, 1),
129 ADD_TEST (sendmsg, 2, 1),