OLD | NEW |
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ | 1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
2 /* This Source Code Form is subject to the terms of the Mozilla Public | 2 /* This Source Code Form is subject to the terms of the Mozilla Public |
3 * License, v. 2.0. If a copy of the MPL was not distributed with this | 3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
5 | 5 |
6 /* | 6 /* |
7 *------------------------------------------------------------------------ | 7 *------------------------------------------------------------------------ |
8 * File: uxwrap.c | 8 * File: uxwrap.c |
9 * | 9 * |
10 * Our wrapped versions of the Unix select() and poll() system calls. | 10 * Our wrapped versions of the Unix select() and poll() system calls. |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 * select() -- | 63 * select() -- |
64 * | 64 * |
65 * Wrap up the select system call so that we can deschedule | 65 * Wrap up the select system call so that we can deschedule |
66 * a thread that tries to wait for i/o. | 66 * a thread that tries to wait for i/o. |
67 * | 67 * |
68 *----------------------------------------------------------------------- | 68 *----------------------------------------------------------------------- |
69 */ | 69 */ |
70 | 70 |
71 #if defined(HPUX9) | 71 #if defined(HPUX9) |
72 int select(size_t width, int *rl, int *wl, int *el, const struct timeval *tv) | 72 int select(size_t width, int *rl, int *wl, int *el, const struct timeval *tv) |
73 #elif defined(NEXTSTEP) | |
74 int wrap_select(int width, fd_set *rd, fd_set *wr, fd_set *ex, | |
75 const struct timeval *tv) | |
76 #elif defined(AIX_RENAME_SELECT) | 73 #elif defined(AIX_RENAME_SELECT) |
77 int wrap_select(unsigned long width, void *rl, void *wl, void *el, | 74 int wrap_select(unsigned long width, void *rl, void *wl, void *el, |
78 struct timeval *tv) | 75 struct timeval *tv) |
79 #elif defined(_PR_SELECT_CONST_TIMEVAL) | 76 #elif defined(_PR_SELECT_CONST_TIMEVAL) |
80 int select(int width, fd_set *rd, fd_set *wr, fd_set *ex, | 77 int select(int width, fd_set *rd, fd_set *wr, fd_set *ex, |
81 const struct timeval *tv) | 78 const struct timeval *tv) |
82 #else | 79 #else |
83 int select(int width, fd_set *rd, fd_set *wr, fd_set *ex, struct timeval *tv) | 80 int select(int width, fd_set *rd, fd_set *wr, fd_set *ex, struct timeval *tv) |
84 #endif | 81 #endif |
85 { | 82 { |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 | _PR_UNIX_POLL_ERR))) { | 248 | _PR_UNIX_POLL_ERR))) { |
252 FD_SET(unixpd->osfd, wr); | 249 FD_SET(unixpd->osfd, wr); |
253 nbits++; | 250 nbits++; |
254 } | 251 } |
255 if (ex && (unixpd->in_flags & _PR_UNIX_POLL_WRITE) | 252 if (ex && (unixpd->in_flags & _PR_UNIX_POLL_WRITE) |
256 && (unixpd->out_flags & PR_POLL_EXCEPT)) { | 253 && (unixpd->out_flags & PR_POLL_EXCEPT)) { |
257 FD_SET(unixpd->osfd, ex); | 254 FD_SET(unixpd->osfd, ex); |
258 nbits++; | 255 nbits++; |
259 } | 256 } |
260 PR_ASSERT(nbits > 0); | 257 PR_ASSERT(nbits > 0); |
261 #if defined(HPUX) || defined(SOLARIS) || defined(SUNOS4) || defined(OSF1) || def
ined(AIX) | 258 #if defined(HPUX) || defined(SOLARIS) || defined(OSF1) || defined(AIX) |
262 retVal += nbits; | 259 retVal += nbits; |
263 #else /* IRIX */ | 260 #else /* IRIX */ |
264 retVal += 1; | 261 retVal += 1; |
265 #endif | 262 #endif |
266 } | 263 } |
267 } | 264 } |
268 } | 265 } |
269 | 266 |
270 PR_ASSERT(tv || retVal != 0); | 267 PR_ASSERT(tv || retVal != 0); |
271 PR_LOG(_pr_io_lm, PR_LOG_MIN, ("select returns %d", retVal)); | 268 PR_LOG(_pr_io_lm, PR_LOG_MIN, ("select returns %d", retVal)); |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
507 PR_DELETE(unixpds); | 504 PR_DELETE(unixpds); |
508 return ready; | 505 return ready; |
509 } | 506 } |
510 | 507 |
511 #endif /* !defined(LINUX) */ | 508 #endif /* !defined(LINUX) */ |
512 | 509 |
513 #endif /* defined(_PR_PTHREADS) || defined(_PR_GLOBAL_THREADS_ONLY) */ | 510 #endif /* defined(_PR_PTHREADS) || defined(_PR_GLOBAL_THREADS_ONLY) */ |
514 | 511 |
515 /* uxwrap.c */ | 512 /* uxwrap.c */ |
516 | 513 |
OLD | NEW |