Changeset 22499
- Timestamp:
- 10/10/07 10:13:34 (14 months ago)
- Files:
-
- 1 modified
-
haiku/trunk/src/system/libroot/posix/sys/select.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
haiku/trunk/src/system/libroot/posix/sys/select.c
r7977 r22499 1 1 /* 2 ** Copyright 2002-2004, Axel Dörfler, axeld@pinc-software.de. All rights reserved.3 ** Distributed under the terms of the OpenBeOS License.4 */2 * Copyright 2002-2007, Axel Dörfler, axeld@pinc-software.de. All rights reserved. 3 * Distributed under the terms of the OpenBeOS License. 4 */ 5 5 6 6 7 #include <errno.h> 7 8 #include <sys/select.h> 8 9 #include <syscalls.h> 10 11 12 #define RETURN_AND_SET_ERRNO(err) \ 13 if (err < 0) { \ 14 errno = err; \ 15 return -1; \ 16 } \ 17 return err; 9 18 10 19 … … 13 22 struct fd_set *errorBits, const struct timespec *tv, const sigset_t *sigMask) 14 23 { 24 int status; 15 25 bigtime_t timeout = -1LL; 16 26 if (tv) 17 27 timeout = tv->tv_sec * 1000000LL + tv->tv_nsec / 1000LL; 18 28 19 return _kern_select(numBits, readBits, writeBits, errorBits, timeout, sigMask); 29 status = _kern_select(numBits, readBits, writeBits, errorBits, timeout, sigMask); 30 31 RETURN_AND_SET_ERRNO(status); 20 32 } 21 33 … … 25 37 struct fd_set *errorBits, struct timeval *tv) 26 38 { 39 int status; 27 40 bigtime_t timeout = -1LL; 28 41 if (tv) 29 42 timeout = tv->tv_sec * 1000000LL + tv->tv_usec; 30 43 31 return _kern_select(numBits, readBits, writeBits, errorBits, timeout, NULL); 44 status = _kern_select(numBits, readBits, writeBits, errorBits, timeout, NULL); 45 46 RETURN_AND_SET_ERRNO(status); 32 47 } 33
