pthread_cancelstub.c revision 1.14.6.2 1 1.14.6.2 matt /* $NetBSD: pthread_cancelstub.c,v 1.14.6.2 2008/01/09 01:36:34 matt Exp $ */
2 1.2 thorpej
3 1.2 thorpej /*-
4 1.14 ad * Copyright (c) 2002, 2007 The NetBSD Foundation, Inc.
5 1.2 thorpej * All rights reserved.
6 1.2 thorpej *
7 1.2 thorpej * This code is derived from software contributed to The NetBSD Foundation
8 1.14 ad * by Nathan J. Williams and Andrew Doran.
9 1.2 thorpej *
10 1.2 thorpej * Redistribution and use in source and binary forms, with or without
11 1.2 thorpej * modification, are permitted provided that the following conditions
12 1.2 thorpej * are met:
13 1.2 thorpej * 1. Redistributions of source code must retain the above copyright
14 1.2 thorpej * notice, this list of conditions and the following disclaimer.
15 1.2 thorpej * 2. Redistributions in binary form must reproduce the above copyright
16 1.2 thorpej * notice, this list of conditions and the following disclaimer in the
17 1.2 thorpej * documentation and/or other materials provided with the distribution.
18 1.2 thorpej * 3. All advertising materials mentioning features or use of this software
19 1.2 thorpej * must display the following acknowledgement:
20 1.2 thorpej * This product includes software developed by the NetBSD
21 1.2 thorpej * Foundation, Inc. and its contributors.
22 1.2 thorpej * 4. Neither the name of The NetBSD Foundation nor the names of its
23 1.2 thorpej * contributors may be used to endorse or promote products derived
24 1.2 thorpej * from this software without specific prior written permission.
25 1.2 thorpej *
26 1.2 thorpej * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27 1.2 thorpej * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28 1.2 thorpej * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 1.2 thorpej * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30 1.2 thorpej * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 1.2 thorpej * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 1.2 thorpej * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 1.2 thorpej * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 1.2 thorpej * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 1.2 thorpej * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 1.2 thorpej * POSSIBILITY OF SUCH DAMAGE.
37 1.2 thorpej */
38 1.5 lukem
39 1.5 lukem #include <sys/cdefs.h>
40 1.14.6.2 matt __RCSID("$NetBSD: pthread_cancelstub.c,v 1.14.6.2 2008/01/09 01:36:34 matt Exp $");
41 1.6 thorpej
42 1.6 thorpej /*
43 1.11 kleink * This is necessary because the names are always weak (they are not
44 1.11 kleink * POSIX functions).
45 1.6 thorpej */
46 1.6 thorpej #define fsync_range _fsync_range
47 1.11 kleink #define pollts _pollts
48 1.2 thorpej
49 1.10 kleink /*
50 1.10 kleink * XXX this is necessary to get the prototypes for the __sigsuspend14
51 1.10 kleink * XXX and __msync13 internal names, instead of the application-visible
52 1.10 kleink * XXX sigsuspend and msync names. It's kind of gross, but we're pretty
53 1.10 kleink * XXX intimate with libc already.
54 1.10 kleink */
55 1.10 kleink #define __LIBC12_SOURCE__
56 1.10 kleink
57 1.2 thorpej #include <sys/msg.h>
58 1.2 thorpej #include <sys/types.h>
59 1.2 thorpej #include <sys/uio.h>
60 1.2 thorpej #include <sys/wait.h>
61 1.14.6.1 matt #include <aio.h>
62 1.2 thorpej #include <fcntl.h>
63 1.14.6.1 matt #include <mqueue.h>
64 1.2 thorpej #include <poll.h>
65 1.2 thorpej #include <stdarg.h>
66 1.2 thorpej #include <unistd.h>
67 1.2 thorpej
68 1.2 thorpej #include <signal.h>
69 1.2 thorpej #include <sys/mman.h>
70 1.12 kleink #include <sys/select.h>
71 1.3 nathanw #include <sys/socket.h>
72 1.2 thorpej
73 1.13 christos #include <compat/sys/mman.h>
74 1.13 christos
75 1.2 thorpej #include "pthread.h"
76 1.2 thorpej #include "pthread_int.h"
77 1.2 thorpej
78 1.10 kleink int pthread__cancel_stub_binder;
79 1.10 kleink
80 1.3 nathanw int _sys_accept(int, struct sockaddr *, socklen_t *);
81 1.14.6.1 matt int _sys_aio_suspend(const struct aiocb * const [], int,
82 1.14.6.1 matt const struct timespec *);
83 1.2 thorpej int _sys_close(int);
84 1.3 nathanw int _sys_connect(int, const struct sockaddr *, socklen_t);
85 1.2 thorpej int _sys_fcntl(int, int, ...);
86 1.9 kleink int _sys_fdatasync(int);
87 1.2 thorpej int _sys_fsync(int);
88 1.6 thorpej int _sys_fsync_range(int, int, off_t, off_t);
89 1.14.6.1 matt int _sys_mq_send(mqd_t, const char *, size_t, unsigned);
90 1.14.6.1 matt ssize_t _sys_mq_receive(mqd_t, char *, size_t, unsigned *);
91 1.14.6.1 matt int _sys_mq_timedsend(mqd_t, const char *, size_t, unsigned,
92 1.14.6.1 matt const struct timespec *);
93 1.14.6.1 matt ssize_t _sys_mq_timedreceive(mqd_t, char *, size_t, unsigned *,
94 1.14.6.1 matt const struct timespec *);
95 1.2 thorpej ssize_t _sys_msgrcv(int, void *, size_t, long, int);
96 1.2 thorpej int _sys_msgsnd(int, const void *, size_t, int);
97 1.2 thorpej int _sys___msync13(void *, size_t, int);
98 1.2 thorpej int _sys_open(const char *, int, ...);
99 1.2 thorpej int _sys_poll(struct pollfd *, nfds_t, int);
100 1.11 kleink int _sys_pollts(struct pollfd *, nfds_t, const struct timespec *,
101 1.11 kleink const sigset_t *);
102 1.2 thorpej ssize_t _sys_pread(int, void *, size_t, off_t);
103 1.11 kleink int _sys_pselect(int, fd_set *, fd_set *, fd_set *,
104 1.11 kleink const struct timespec *, const sigset_t *);
105 1.2 thorpej ssize_t _sys_pwrite(int, const void *, size_t, off_t);
106 1.2 thorpej ssize_t _sys_read(int, void *, size_t);
107 1.2 thorpej ssize_t _sys_readv(int, const struct iovec *, int);
108 1.2 thorpej int _sys_select(int, fd_set *, fd_set *, fd_set *, struct timeval *);
109 1.2 thorpej int _sys_wait4(pid_t, int *, int, struct rusage *);
110 1.2 thorpej ssize_t _sys_write(int, const void *, size_t);
111 1.2 thorpej ssize_t _sys_writev(int, const struct iovec *, int);
112 1.14 ad int _sys___sigsuspend14(const sigset_t *);
113 1.14 ad int _sigtimedwait(const sigset_t * __restrict, siginfo_t * __restrict,
114 1.14 ad const struct timespec * __restrict);
115 1.14 ad int __sigsuspend14(const sigset_t *);
116 1.2 thorpej
117 1.7 nathanw #define TESTCANCEL(id) do { \
118 1.7 nathanw if (__predict_false((id)->pt_cancel)) \
119 1.14.6.2 matt pthread__cancelled(); \
120 1.8 cl } while (/*CONSTCOND*/0)
121 1.7 nathanw
122 1.2 thorpej
123 1.2 thorpej int
124 1.3 nathanw accept(int s, struct sockaddr *addr, socklen_t *addrlen)
125 1.3 nathanw {
126 1.3 nathanw int retval;
127 1.3 nathanw pthread_t self;
128 1.3 nathanw
129 1.3 nathanw self = pthread__self();
130 1.7 nathanw TESTCANCEL(self);
131 1.3 nathanw retval = _sys_accept(s, addr, addrlen);
132 1.7 nathanw TESTCANCEL(self);
133 1.3 nathanw
134 1.3 nathanw return retval;
135 1.3 nathanw }
136 1.3 nathanw
137 1.3 nathanw int
138 1.14.6.1 matt aio_suspend(const struct aiocb * const list[], int nent,
139 1.14.6.1 matt const struct timespec *timeout)
140 1.14.6.1 matt {
141 1.14.6.1 matt int retval;
142 1.14.6.1 matt pthread_t self;
143 1.14.6.1 matt
144 1.14.6.1 matt self = pthread__self();
145 1.14.6.1 matt TESTCANCEL(self);
146 1.14.6.1 matt retval = _sys_aio_suspend(list, nent, timeout);
147 1.14.6.1 matt TESTCANCEL(self);
148 1.14.6.1 matt
149 1.14.6.1 matt return retval;
150 1.14.6.1 matt }
151 1.14.6.1 matt
152 1.14.6.1 matt int
153 1.2 thorpej close(int d)
154 1.2 thorpej {
155 1.2 thorpej int retval;
156 1.2 thorpej pthread_t self;
157 1.2 thorpej
158 1.2 thorpej self = pthread__self();
159 1.7 nathanw TESTCANCEL(self);
160 1.2 thorpej retval = _sys_close(d);
161 1.7 nathanw TESTCANCEL(self);
162 1.3 nathanw
163 1.3 nathanw return retval;
164 1.3 nathanw }
165 1.3 nathanw
166 1.3 nathanw int
167 1.3 nathanw connect(int s, const struct sockaddr *addr, socklen_t namelen)
168 1.3 nathanw {
169 1.3 nathanw int retval;
170 1.3 nathanw pthread_t self;
171 1.3 nathanw
172 1.3 nathanw self = pthread__self();
173 1.7 nathanw TESTCANCEL(self);
174 1.3 nathanw retval = _sys_connect(s, addr, namelen);
175 1.7 nathanw TESTCANCEL(self);
176 1.2 thorpej
177 1.2 thorpej return retval;
178 1.2 thorpej }
179 1.2 thorpej
180 1.2 thorpej int
181 1.2 thorpej fcntl(int fd, int cmd, ...)
182 1.2 thorpej {
183 1.2 thorpej int retval;
184 1.2 thorpej pthread_t self;
185 1.2 thorpej va_list ap;
186 1.2 thorpej
187 1.2 thorpej self = pthread__self();
188 1.7 nathanw TESTCANCEL(self);
189 1.2 thorpej va_start(ap, cmd);
190 1.2 thorpej retval = _sys_fcntl(fd, cmd, va_arg(ap, void *));
191 1.2 thorpej va_end(ap);
192 1.7 nathanw TESTCANCEL(self);
193 1.2 thorpej
194 1.2 thorpej return retval;
195 1.2 thorpej }
196 1.2 thorpej
197 1.2 thorpej int
198 1.9 kleink fdatasync(int d)
199 1.9 kleink {
200 1.9 kleink int retval;
201 1.9 kleink pthread_t self;
202 1.9 kleink
203 1.9 kleink self = pthread__self();
204 1.9 kleink TESTCANCEL(self);
205 1.9 kleink retval = _sys_fdatasync(d);
206 1.9 kleink TESTCANCEL(self);
207 1.9 kleink
208 1.9 kleink return retval;
209 1.9 kleink }
210 1.9 kleink
211 1.9 kleink int
212 1.2 thorpej fsync(int d)
213 1.2 thorpej {
214 1.2 thorpej int retval;
215 1.2 thorpej pthread_t self;
216 1.2 thorpej
217 1.2 thorpej self = pthread__self();
218 1.7 nathanw TESTCANCEL(self);
219 1.2 thorpej retval = _sys_fsync(d);
220 1.7 nathanw TESTCANCEL(self);
221 1.2 thorpej
222 1.2 thorpej return retval;
223 1.2 thorpej }
224 1.2 thorpej
225 1.6 thorpej int
226 1.6 thorpej fsync_range(int d, int f, off_t s, off_t e)
227 1.6 thorpej {
228 1.6 thorpej int retval;
229 1.6 thorpej pthread_t self;
230 1.6 thorpej
231 1.6 thorpej self = pthread__self();
232 1.7 nathanw TESTCANCEL(self);
233 1.6 thorpej retval = _sys_fsync_range(d, f, s, e);
234 1.7 nathanw TESTCANCEL(self);
235 1.6 thorpej
236 1.6 thorpej return retval;
237 1.6 thorpej }
238 1.6 thorpej
239 1.14.6.1 matt int
240 1.14.6.1 matt mq_send(mqd_t mqdes, const char *msg_ptr, size_t msg_len, unsigned msg_prio)
241 1.14.6.1 matt {
242 1.14.6.1 matt int retval;
243 1.14.6.1 matt pthread_t self;
244 1.14.6.1 matt
245 1.14.6.1 matt self = pthread__self();
246 1.14.6.1 matt TESTCANCEL(self);
247 1.14.6.1 matt retval = _sys_mq_send(mqdes, msg_ptr, msg_len, msg_prio);
248 1.14.6.1 matt TESTCANCEL(self);
249 1.14.6.1 matt
250 1.14.6.1 matt return retval;
251 1.14.6.1 matt }
252 1.14.6.1 matt
253 1.14.6.1 matt ssize_t
254 1.14.6.1 matt mq_receive(mqd_t mqdes, char *msg_ptr, size_t msg_len, unsigned *msg_prio)
255 1.14.6.1 matt {
256 1.14.6.2 matt ssize_t retval;
257 1.14.6.1 matt pthread_t self;
258 1.14.6.1 matt
259 1.14.6.1 matt self = pthread__self();
260 1.14.6.1 matt TESTCANCEL(self);
261 1.14.6.1 matt retval = _sys_mq_receive(mqdes, msg_ptr, msg_len, msg_prio);
262 1.14.6.1 matt TESTCANCEL(self);
263 1.14.6.1 matt
264 1.14.6.1 matt return retval;
265 1.14.6.1 matt }
266 1.14.6.1 matt
267 1.14.6.1 matt int
268 1.14.6.1 matt mq_timedsend(mqd_t mqdes, const char *msg_ptr, size_t msg_len,
269 1.14.6.1 matt unsigned msg_prio, const struct timespec *abst)
270 1.14.6.1 matt {
271 1.14.6.1 matt int retval;
272 1.14.6.1 matt pthread_t self;
273 1.14.6.1 matt
274 1.14.6.1 matt self = pthread__self();
275 1.14.6.1 matt TESTCANCEL(self);
276 1.14.6.1 matt retval = _sys_mq_timedsend(mqdes, msg_ptr, msg_len, msg_prio, abst);
277 1.14.6.1 matt TESTCANCEL(self);
278 1.14.6.1 matt
279 1.14.6.1 matt return retval;
280 1.14.6.1 matt }
281 1.14.6.1 matt
282 1.14.6.1 matt ssize_t
283 1.14.6.1 matt mq_timedreceive(mqd_t mqdes, char *msg_ptr, size_t msg_len, unsigned *msg_prio,
284 1.14.6.1 matt const struct timespec *abst)
285 1.14.6.1 matt {
286 1.14.6.2 matt ssize_t retval;
287 1.14.6.1 matt pthread_t self;
288 1.14.6.1 matt
289 1.14.6.1 matt self = pthread__self();
290 1.14.6.1 matt TESTCANCEL(self);
291 1.14.6.1 matt retval = _sys_mq_timedreceive(mqdes, msg_ptr, msg_len, msg_prio, abst);
292 1.14.6.1 matt TESTCANCEL(self);
293 1.14.6.1 matt
294 1.14.6.1 matt return retval;
295 1.14.6.1 matt }
296 1.14.6.1 matt
297 1.2 thorpej ssize_t
298 1.2 thorpej msgrcv(int msgid, void *msgp, size_t msgsz, long msgtyp, int msgflg)
299 1.2 thorpej {
300 1.2 thorpej ssize_t retval;
301 1.2 thorpej pthread_t self;
302 1.2 thorpej
303 1.2 thorpej self = pthread__self();
304 1.7 nathanw TESTCANCEL(self);
305 1.2 thorpej retval = _sys_msgrcv(msgid, msgp, msgsz, msgtyp, msgflg);
306 1.7 nathanw TESTCANCEL(self);
307 1.2 thorpej
308 1.2 thorpej return retval;
309 1.2 thorpej }
310 1.2 thorpej
311 1.2 thorpej int
312 1.2 thorpej msgsnd(int msgid, const void *msgp, size_t msgsz, int msgflg)
313 1.2 thorpej {
314 1.2 thorpej int retval;
315 1.2 thorpej pthread_t self;
316 1.2 thorpej
317 1.2 thorpej self = pthread__self();
318 1.7 nathanw TESTCANCEL(self);
319 1.2 thorpej retval = _sys_msgsnd(msgid, msgp, msgsz, msgflg);
320 1.7 nathanw TESTCANCEL(self);
321 1.2 thorpej
322 1.2 thorpej return retval;
323 1.2 thorpej }
324 1.2 thorpej
325 1.2 thorpej int
326 1.2 thorpej __msync13(void *addr, size_t len, int flags)
327 1.2 thorpej {
328 1.2 thorpej int retval;
329 1.2 thorpej pthread_t self;
330 1.2 thorpej
331 1.2 thorpej self = pthread__self();
332 1.7 nathanw TESTCANCEL(self);
333 1.2 thorpej retval = _sys___msync13(addr, len, flags);
334 1.7 nathanw TESTCANCEL(self);
335 1.2 thorpej
336 1.2 thorpej return retval;
337 1.2 thorpej }
338 1.2 thorpej
339 1.2 thorpej int
340 1.2 thorpej open(const char *path, int flags, ...)
341 1.2 thorpej {
342 1.2 thorpej int retval;
343 1.2 thorpej pthread_t self;
344 1.2 thorpej va_list ap;
345 1.2 thorpej
346 1.2 thorpej self = pthread__self();
347 1.7 nathanw TESTCANCEL(self);
348 1.2 thorpej va_start(ap, flags);
349 1.2 thorpej retval = _sys_open(path, flags, va_arg(ap, mode_t));
350 1.2 thorpej va_end(ap);
351 1.7 nathanw TESTCANCEL(self);
352 1.2 thorpej
353 1.2 thorpej return retval;
354 1.2 thorpej }
355 1.2 thorpej
356 1.2 thorpej int
357 1.2 thorpej poll(struct pollfd *fds, nfds_t nfds, int timeout)
358 1.2 thorpej {
359 1.2 thorpej int retval;
360 1.2 thorpej pthread_t self;
361 1.2 thorpej
362 1.2 thorpej self = pthread__self();
363 1.7 nathanw TESTCANCEL(self);
364 1.2 thorpej retval = _sys_poll(fds, nfds, timeout);
365 1.7 nathanw TESTCANCEL(self);
366 1.2 thorpej
367 1.2 thorpej return retval;
368 1.2 thorpej }
369 1.2 thorpej
370 1.11 kleink int
371 1.11 kleink pollts(struct pollfd *fds, nfds_t nfds, const struct timespec *ts,
372 1.11 kleink const sigset_t *sigmask)
373 1.11 kleink {
374 1.11 kleink int retval;
375 1.11 kleink pthread_t self;
376 1.11 kleink
377 1.11 kleink self = pthread__self();
378 1.11 kleink TESTCANCEL(self);
379 1.11 kleink retval = _sys_pollts(fds, nfds, ts, sigmask);
380 1.11 kleink TESTCANCEL(self);
381 1.11 kleink
382 1.11 kleink return retval;
383 1.11 kleink }
384 1.11 kleink
385 1.2 thorpej ssize_t
386 1.2 thorpej pread(int d, void *buf, size_t nbytes, off_t offset)
387 1.2 thorpej {
388 1.2 thorpej ssize_t retval;
389 1.2 thorpej pthread_t self;
390 1.2 thorpej
391 1.2 thorpej self = pthread__self();
392 1.7 nathanw TESTCANCEL(self);
393 1.2 thorpej retval = _sys_pread(d, buf, nbytes, offset);
394 1.7 nathanw TESTCANCEL(self);
395 1.2 thorpej
396 1.2 thorpej return retval;
397 1.2 thorpej }
398 1.2 thorpej
399 1.11 kleink int
400 1.11 kleink pselect(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
401 1.11 kleink const struct timespec *timeout, const sigset_t *sigmask)
402 1.11 kleink {
403 1.11 kleink int retval;
404 1.11 kleink pthread_t self;
405 1.11 kleink
406 1.11 kleink self = pthread__self();
407 1.11 kleink TESTCANCEL(self);
408 1.11 kleink retval = _sys_pselect(nfds, readfds, writefds, exceptfds, timeout,
409 1.11 kleink sigmask);
410 1.11 kleink TESTCANCEL(self);
411 1.11 kleink
412 1.11 kleink return retval;
413 1.11 kleink }
414 1.11 kleink
415 1.2 thorpej ssize_t
416 1.2 thorpej pwrite(int d, const void *buf, size_t nbytes, off_t offset)
417 1.2 thorpej {
418 1.2 thorpej ssize_t retval;
419 1.2 thorpej pthread_t self;
420 1.2 thorpej
421 1.2 thorpej self = pthread__self();
422 1.7 nathanw TESTCANCEL(self);
423 1.2 thorpej retval = _sys_pwrite(d, buf, nbytes, offset);
424 1.7 nathanw TESTCANCEL(self);
425 1.2 thorpej
426 1.2 thorpej return retval;
427 1.2 thorpej }
428 1.2 thorpej
429 1.2 thorpej ssize_t
430 1.2 thorpej read(int d, void *buf, size_t nbytes)
431 1.2 thorpej {
432 1.2 thorpej ssize_t retval;
433 1.2 thorpej pthread_t self;
434 1.2 thorpej
435 1.2 thorpej self = pthread__self();
436 1.7 nathanw TESTCANCEL(self);
437 1.2 thorpej retval = _sys_read(d, buf, nbytes);
438 1.7 nathanw TESTCANCEL(self);
439 1.2 thorpej
440 1.2 thorpej return retval;
441 1.2 thorpej }
442 1.2 thorpej
443 1.2 thorpej ssize_t
444 1.2 thorpej readv(int d, const struct iovec *iov, int iovcnt)
445 1.2 thorpej {
446 1.2 thorpej ssize_t retval;
447 1.2 thorpej pthread_t self;
448 1.2 thorpej
449 1.2 thorpej self = pthread__self();
450 1.7 nathanw TESTCANCEL(self);
451 1.2 thorpej retval = _sys_readv(d, iov, iovcnt);
452 1.7 nathanw TESTCANCEL(self);
453 1.2 thorpej
454 1.2 thorpej return retval;
455 1.2 thorpej }
456 1.2 thorpej
457 1.2 thorpej int
458 1.2 thorpej select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
459 1.2 thorpej struct timeval *timeout)
460 1.2 thorpej {
461 1.2 thorpej int retval;
462 1.2 thorpej pthread_t self;
463 1.2 thorpej
464 1.2 thorpej self = pthread__self();
465 1.7 nathanw TESTCANCEL(self);
466 1.2 thorpej retval = _sys_select(nfds, readfds, writefds, exceptfds, timeout);
467 1.7 nathanw TESTCANCEL(self);
468 1.2 thorpej
469 1.2 thorpej return retval;
470 1.2 thorpej }
471 1.2 thorpej
472 1.2 thorpej pid_t
473 1.2 thorpej wait4(pid_t wpid, int *status, int options, struct rusage *rusage)
474 1.2 thorpej {
475 1.2 thorpej pid_t retval;
476 1.2 thorpej pthread_t self;
477 1.2 thorpej
478 1.2 thorpej self = pthread__self();
479 1.7 nathanw TESTCANCEL(self);
480 1.2 thorpej retval = _sys_wait4(wpid, status, options, rusage);
481 1.7 nathanw TESTCANCEL(self);
482 1.2 thorpej
483 1.2 thorpej return retval;
484 1.2 thorpej }
485 1.2 thorpej
486 1.2 thorpej ssize_t
487 1.2 thorpej write(int d, const void *buf, size_t nbytes)
488 1.2 thorpej {
489 1.2 thorpej ssize_t retval;
490 1.2 thorpej pthread_t self;
491 1.2 thorpej
492 1.2 thorpej self = pthread__self();
493 1.7 nathanw TESTCANCEL(self);
494 1.2 thorpej retval = _sys_write(d, buf, nbytes);
495 1.7 nathanw TESTCANCEL(self);
496 1.2 thorpej
497 1.2 thorpej return retval;
498 1.2 thorpej }
499 1.2 thorpej
500 1.2 thorpej ssize_t
501 1.2 thorpej writev(int d, const struct iovec *iov, int iovcnt)
502 1.2 thorpej {
503 1.2 thorpej ssize_t retval;
504 1.2 thorpej pthread_t self;
505 1.2 thorpej
506 1.2 thorpej self = pthread__self();
507 1.7 nathanw TESTCANCEL(self);
508 1.2 thorpej retval = _sys_writev(d, iov, iovcnt);
509 1.7 nathanw TESTCANCEL(self);
510 1.2 thorpej
511 1.2 thorpej return retval;
512 1.2 thorpej }
513 1.2 thorpej
514 1.14 ad int
515 1.14 ad __sigsuspend14(const sigset_t *sigmask)
516 1.14 ad {
517 1.14 ad pthread_t self;
518 1.14 ad int retval;
519 1.14 ad
520 1.14 ad self = pthread__self();
521 1.14 ad TESTCANCEL(self);
522 1.14 ad retval = _sys___sigsuspend14(sigmask);
523 1.14 ad TESTCANCEL(self);
524 1.14 ad
525 1.14 ad return retval;
526 1.14 ad }
527 1.14 ad
528 1.14 ad int
529 1.14 ad sigtimedwait(const sigset_t * __restrict set, siginfo_t * __restrict info,
530 1.14 ad const struct timespec * __restrict timeout)
531 1.14 ad {
532 1.14 ad pthread_t self;
533 1.14 ad int retval;
534 1.14 ad
535 1.14 ad self = pthread__self();
536 1.14 ad TESTCANCEL(self);
537 1.14 ad retval = _sigtimedwait(set, info, timeout);
538 1.14 ad TESTCANCEL(self);
539 1.14 ad
540 1.14 ad return retval;
541 1.14 ad }
542 1.2 thorpej
543 1.14.6.1 matt __strong_alias(_aio_suspend, aio_suspend)
544 1.2 thorpej __strong_alias(_close, close)
545 1.2 thorpej __strong_alias(_fcntl, fcntl)
546 1.9 kleink __strong_alias(_fdatasync, fdatasync)
547 1.2 thorpej __strong_alias(_fsync, fsync)
548 1.6 thorpej __weak_alias(fsync_range, _fsync_range)
549 1.14.6.1 matt __strong_alias(_mq_send, mq_send)
550 1.14.6.1 matt __strong_alias(_mq_receive, mq_receive)
551 1.14.6.1 matt __strong_alias(_mq_timedsend, mq_timedsend)
552 1.14.6.1 matt __strong_alias(_mq_timedreceive, mq_timedreceive)
553 1.2 thorpej __strong_alias(_msgrcv, msgrcv)
554 1.2 thorpej __strong_alias(_msgsnd, msgsnd)
555 1.2 thorpej __strong_alias(___msync13, __msync13)
556 1.2 thorpej __strong_alias(_open, open)
557 1.2 thorpej __strong_alias(_poll, poll)
558 1.11 kleink __weak_alias(pollts, _pollts)
559 1.2 thorpej __strong_alias(_pread, pread)
560 1.11 kleink __strong_alias(_pselect, pselect)
561 1.2 thorpej __strong_alias(_pwrite, pwrite)
562 1.2 thorpej __strong_alias(_read, read)
563 1.2 thorpej __strong_alias(_readv, readv)
564 1.2 thorpej __strong_alias(_select, select)
565 1.2 thorpej __strong_alias(_wait4, wait4)
566 1.2 thorpej __strong_alias(_write, write)
567 1.2 thorpej __strong_alias(_writev, writev)
568