diff options
author | "Steven J. Hill" <sjhill@realitydiluted.com> | 2006-08-24 02:58:45 +0000 |
---|---|---|
committer | "Steven J. Hill" <sjhill@realitydiluted.com> | 2006-08-24 02:58:45 +0000 |
commit | 01f422c12f5799a44832eb26967a906edfc2ba55 (patch) | |
tree | 1e8bdcaab1f4da088cc1c490bf96c361a663e0c4 /libc/sysdeps/linux/common/poll.c | |
parent | d2db9bdb4c79afcd4b09353346cd4eaf63b6cd2c (diff) | |
download | uClibc-alpine-01f422c12f5799a44832eb26967a906edfc2ba55.tar.bz2 uClibc-alpine-01f422c12f5799a44832eb26967a906edfc2ba55.tar.xz |
Well, this is everything for my NPTL implementation. The 'uClibc-nptl' branch is now the exact code that I have. I am going to re-run tests now to verify everything one more time. The next step after that is to merge from trunk with the latest stuff from Mike and Peter.
Diffstat (limited to 'libc/sysdeps/linux/common/poll.c')
-rw-r--r-- | libc/sysdeps/linux/common/poll.c | 66 |
1 files changed, 44 insertions, 22 deletions
diff --git a/libc/sysdeps/linux/common/poll.c b/libc/sysdeps/linux/common/poll.c index c957f1edf..61c6d18ea 100644 --- a/libc/sysdeps/linux/common/poll.c +++ b/libc/sysdeps/linux/common/poll.c @@ -17,16 +17,33 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#define getdtablesize __getdtablesize -#define select __select - #include "syscalls.h" #include <sys/poll.h> +libc_hidden_proto(poll) + #ifdef __NR_poll -#define __NR___poll __NR_poll -attribute_hidden _syscall3(int, __poll, struct pollfd *, fds, +# ifdef __UCLIBC__HAS_THREADS__ +# include <sysdep-cancel.h> + +/* The real implementation. */ +int poll (struct pollfd *fds, nfsd_t nfds, int timeout) +{ + if (SINGLE_THREAD_P) + return INLINE_SYSCALL (poll, 3, fds, nfds, timeout); + + int oldtype = LIBC_CANCEL_ASYNC (); + + int result = INLINE_SYSCALL (poll, 3, fds, nfds, timeout); + + LIBC_CANCEL_RESET (oldtype); + + return result; +} +# else +_syscall3(int, poll, struct pollfd *, fds, unsigned long int, nfds, int, timeout); +# endif #else #include <alloca.h> @@ -37,6 +54,11 @@ attribute_hidden _syscall3(int, __poll, struct pollfd *, fds, #include <sys/param.h> #include <unistd.h> +libc_hidden_proto(memcpy) +libc_hidden_proto(memset) +libc_hidden_proto(getdtablesize) +libc_hidden_proto(select) + /* uClinux 2.0 doesn't have poll, emulate it using select */ /* Poll the file descriptors described by the NFDS structures starting at @@ -45,7 +67,7 @@ attribute_hidden _syscall3(int, __poll, struct pollfd *, fds, Returns the number of file descriptors with events, zero if timed out, or -1 for errors. */ -int attribute_hidden __poll(struct pollfd *fds, nfds_t nfds, int timeout) +int poll(struct pollfd *fds, nfds_t nfds, int timeout) { static int max_fd_size; struct timeval tv; @@ -65,9 +87,9 @@ int attribute_hidden __poll(struct pollfd *fds, nfds_t nfds, int timeout) /* We can't call FD_ZERO, since FD_ZERO only works with sets of exactly __FD_SETSIZE size. */ - __memset (rset, 0, bytes); - __memset (wset, 0, bytes); - __memset (xset, 0, bytes); + memset (rset, 0, bytes); + memset (wset, 0, bytes); + memset (xset, 0, bytes); for (f = fds; f < &fds[nfds]; ++f) { @@ -89,13 +111,13 @@ int attribute_hidden __poll(struct pollfd *fds, nfds_t nfds, int timeout) nwset = alloca (nbytes); nxset = alloca (nbytes); - __memset ((char *) nrset + bytes, 0, nbytes - bytes); - __memset ((char *) nwset + bytes, 0, nbytes - bytes); - __memset ((char *) nxset + bytes, 0, nbytes - bytes); + memset ((char *) nrset + bytes, 0, nbytes - bytes); + memset ((char *) nwset + bytes, 0, nbytes - bytes); + memset ((char *) nxset + bytes, 0, nbytes - bytes); - rset = __memcpy (nrset, rset, bytes); - wset = __memcpy (nwset, wset, bytes); - xset = __memcpy (nxset, xset, bytes); + rset = memcpy (nrset, rset, bytes); + wset = memcpy (nwset, wset, bytes); + xset = memcpy (nxset, xset, bytes); bytes = nbytes; } @@ -129,9 +151,9 @@ int attribute_hidden __poll(struct pollfd *fds, nfds_t nfds, int timeout) struct timeval sngl_tv; /* Clear the original set. */ - __memset (rset, 0, bytes); - __memset (wset, 0, bytes); - __memset (xset, 0, bytes); + memset (rset, 0, bytes); + memset (wset, 0, bytes); + memset (xset, 0, bytes); /* This means we don't wait for input. */ sngl_tv.tv_sec = 0; @@ -148,9 +170,9 @@ int attribute_hidden __poll(struct pollfd *fds, nfds_t nfds, int timeout) { int n; - __memset (sngl_rset, 0, bytes); - __memset (sngl_wset, 0, bytes); - __memset (sngl_xset, 0, bytes); + memset (sngl_rset, 0, bytes); + memset (sngl_wset, 0, bytes); + memset (sngl_xset, 0, bytes); if (f->events & POLLIN) FD_SET (f->fd, sngl_rset); @@ -204,4 +226,4 @@ int attribute_hidden __poll(struct pollfd *fds, nfds_t nfds, int timeout) } #endif -strong_alias(__poll,poll) +libc_hidden_def(poll) |