OSDN Git Service

Last portion of libc_hidden_proto removal.
[uclinux-h8/uClibc.git] / libc / sysdeps / linux / common / select.c
1 /* vi: set sw=4 ts=4: */
2 /*
3  * select() for uClibc
4  *
5  * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
6  *
7  * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
8  */
9
10 #include <sys/syscall.h>
11 #include <sys/select.h>
12
13 extern __typeof(select) __libc_select;
14
15 #if !defined(__NR__newselect) && !defined(__NR_select) && defined __USE_XOPEN2K
16 # define __NR___libc_pselect6 __NR_pselect6
17 _syscall6(int, __libc_pselect6, int, n, fd_set *, readfds, fd_set *, writefds,
18         fd_set *, exceptfds, const struct timespec *, timeout,
19         const sigset_t *, sigmask)
20
21 int __libc_select(int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
22                   struct timeval *timeout)
23 {
24         struct timespec _ts, *ts = 0;
25         if (timeout) {
26                 _ts.tv_sec = timeout->tv_sec;
27                 _ts.tv_nsec = timeout->tv_usec * 1000;
28                 ts = &_ts;
29         }
30         return __libc_pselect6(n, readfds, writefds, exceptfds, ts, 0);
31 }
32
33 #else
34
35 #ifdef __NR__newselect
36 # define __NR___libc_select __NR__newselect
37 #else
38 # define __NR___libc_select __NR_select
39 #endif
40 _syscall5(int, __libc_select, int, n, fd_set *, readfds, fd_set *, writefds,
41                   fd_set *, exceptfds, struct timeval *, timeout)
42
43 #endif
44
45 /* libc_hidden_proto(select) */
46 weak_alias(__libc_select,select)
47 libc_hidden_weak(select)