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