libroot/posix/stdio: Remove unused portions.
[haiku.git] / src / system / libroot / posix / sys / select.c
blob96948cebf231404b6aeda7cc5dbe7fb0d5606ac3
1 /*
2 * Copyright 2002-2007, Axel Dörfler, axeld@pinc-software.de.
3 * All rights reserved.
4 * Distributed under the terms of the MIT License.
5 */
8 #include <sys/select.h>
10 #include <errno.h>
11 #include <pthread.h>
13 #include <syscall_utils.h>
15 #include <errno_private.h>
16 #include <symbol_versioning.h>
17 #include <syscalls.h>
19 #include <signal_private.h>
22 int __pselect_beos(int numBits, struct fd_set *readBits,
23 struct fd_set *writeBits, struct fd_set *errorBits,
24 const struct timespec *tv, const sigset_t *beosSignalMask);
25 int __pselect(int numBits, struct fd_set *readBits, struct fd_set *writeBits,
26 struct fd_set *errorBits, const struct timespec *tv,
27 const sigset_t *sigMask);
30 int
31 __pselect_beos(int numBits, struct fd_set *readBits, struct fd_set *writeBits,
32 struct fd_set *errorBits, const struct timespec *tv,
33 const sigset_t *beosSignalMask)
35 int status;
36 sigset_t signalMask;
37 bigtime_t timeout = -1LL;
38 if (tv)
39 timeout = tv->tv_sec * 1000000LL + tv->tv_nsec / 1000LL;
41 if (beosSignalMask != NULL)
42 signalMask = from_beos_sigset(*beosSignalMask);
44 status = _kern_select(numBits, readBits, writeBits, errorBits, timeout,
45 beosSignalMask != NULL ? &signalMask : NULL);
47 RETURN_AND_SET_ERRNO_TEST_CANCEL(status);
51 int
52 __pselect(int numBits, struct fd_set *readBits, struct fd_set *writeBits,
53 struct fd_set *errorBits, const struct timespec *tv,
54 const sigset_t *sigMask)
56 int status;
57 bigtime_t timeout = -1LL;
58 if (tv)
59 timeout = tv->tv_sec * 1000000LL + tv->tv_nsec / 1000LL;
61 status = _kern_select(numBits, readBits, writeBits, errorBits, timeout,
62 sigMask);
64 RETURN_AND_SET_ERRNO_TEST_CANCEL(status);
68 int
69 select(int numBits, struct fd_set *readBits, struct fd_set *writeBits,
70 struct fd_set *errorBits, struct timeval *tv)
72 int status;
73 bigtime_t timeout = -1LL;
74 if (tv)
75 timeout = tv->tv_sec * 1000000LL + tv->tv_usec;
77 status = _kern_select(numBits, readBits, writeBits, errorBits, timeout,
78 NULL);
80 RETURN_AND_SET_ERRNO_TEST_CANCEL(status);
84 DEFINE_LIBROOT_KERNEL_SYMBOL_VERSION("__pselect_beos", "pselect@", "BASE");
86 DEFINE_LIBROOT_KERNEL_SYMBOL_VERSION("__pselect", "pselect@@", "1_ALPHA4");