diff options
Diffstat (limited to 'sysdeps/unix/sysv')
-rw-r--r-- | sysdeps/unix/sysv/linux/i386/Makefile | 2 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/i386/call_pselect6.S | 65 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/i386/pselect.c | 18 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/pselect.c | 20 |
4 files changed, 98 insertions, 7 deletions
diff --git a/sysdeps/unix/sysv/linux/i386/Makefile b/sysdeps/unix/sysv/linux/i386/Makefile index 7db3e3eeac..9e84975635 100644 --- a/sysdeps/unix/sysv/linux/i386/Makefile +++ b/sysdeps/unix/sysv/linux/i386/Makefile @@ -1,5 +1,5 @@ ifeq ($(subdir),misc) -sysdep_routines += ioperm iopl vm86 +sysdep_routines += ioperm iopl vm86 call_pselect6 sysdep_headers += sys/elf.h sys/perm.h sys/reg.h sys/vm86.h sys/debugreg.h sys/io.h endif diff --git a/sysdeps/unix/sysv/linux/i386/call_pselect6.S b/sysdeps/unix/sysv/linux/i386/call_pselect6.S new file mode 100644 index 0000000000..a356f1dfa9 --- /dev/null +++ b/sysdeps/unix/sysv/linux/i386/call_pselect6.S @@ -0,0 +1,65 @@ +/* Copyright (C) 2006 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2006. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <sysdep.h> + +#ifdef __NR_pselect6 + .text +ENTRY(__call_pselect6) + .hidden __call_pselect6 + pushl %ebx + cfi_adjust_cfa_offset (4) + pushl %esi + cfi_adjust_cfa_offset (4) + pushl %edi + cfi_adjust_cfa_offset (4) + pushl %ebp + cfi_adjust_cfa_offset (4) + cfi_rel_offset (ebp, 0) + cfi_rel_offset (edi, 4) + cfi_rel_offset (esi, 8) + cfi_rel_offset (ebx, 12) + + movl $__NR_pselect6, %eax + movl 20(%esp), %ebx + movl 24(%esp), %ecx + movl 28(%esp), %edx + movl 32(%esp), %esi + movl 36(%esp), %edi + movl 40(%esp), %ebp + + /* The syscall handling cannot handle 6 parameters. Yet. */ + int $0x80 + + popl %ebp + cfi_adjust_cfa_offset (-4) + cfi_restore (ebp) + popl %edi + cfi_adjust_cfa_offset (-4) + cfi_restore (edi) + popl %esi + cfi_adjust_cfa_offset (-4) + cfi_restore (esi) + popl %ebx + cfi_adjust_cfa_offset (-4) + cfi_restore (ebx) + + ret +END(__call_pselect6) +#endif diff --git a/sysdeps/unix/sysv/linux/i386/pselect.c b/sysdeps/unix/sysv/linux/i386/pselect.c new file mode 100644 index 0000000000..2646608786 --- /dev/null +++ b/sysdeps/unix/sysv/linux/i386/pselect.c @@ -0,0 +1,18 @@ +#include <sys/select.h> + +extern int __call_pselect6 (int nfds, fd_set *readfds, fd_set *writefds, + fd_set *exceptfds, const struct timespec *timeout, + void *data) attribute_hidden; + + +#define CALL_PSELECT6(nfds, readfds, writefds, exceptfds, timeout, data) \ + ({ int r = __call_pselect6 (nfds, readfds, writefds, exceptfds, timeout, \ + data); \ + if (r < 0 && r > -4096) \ + { \ + __set_errno (-r); \ + r = -1; \ + } \ + r; }) + +#include "../pselect.c" diff --git a/sysdeps/unix/sysv/linux/pselect.c b/sysdeps/unix/sysv/linux/pselect.c index 6fd4d3e071..0dd744f527 100644 --- a/sysdeps/unix/sysv/linux/pselect.c +++ b/sysdeps/unix/sysv/linux/pselect.c @@ -29,7 +29,7 @@ static int __generic_pselect (int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, const struct timespec *timeout, - const sigset_t *sigmask) + const sigset_t *sigmask); int @@ -51,7 +51,7 @@ __pselect (int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, be created. */ struct { - sigset_t *ss; + const sigset_t *ss; size_t ss_len; } data; @@ -60,15 +60,21 @@ __pselect (int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, int result; +#ifndef CALL_PSELECT6 +# define CALL_PSELECT6(nfds, readfds, writefds, exceptfds, timeout, data) \ + INLINE_SYSCALL (pselect6, 6, nfds, readfds, writefds, exceptfds, \ + timeout, data) +#endif + if (SINGLE_THREAD_P) - result = INLINE_SYSCALL (pselect6, 6, nfds, readfds, writefds, exceptfds, - timeout, &data); + result = CALL_PSELECT6 (nfds, readfds, writefds, exceptfds, timeout, + &data); else { int oldtype = LIBC_CANCEL_ASYNC (); - result = INLINE_SYSCALL (pselect6, 6, nfds, readfds, writefds, exceptfds, - timeout, &data); + result = CALL_PSELECT6 (nfds, readfds, writefds, exceptfds, timeout, + &data); LIBC_CANCEL_RESET (oldtype); } @@ -81,6 +87,8 @@ __pselect (int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, return result; } +weak_alias (__pselect, pselect) +strong_alias (__pselect, __libc_pselect) # ifndef __ASSUME_PSELECT # define __pselect static __generic_pselect |