From 5c983cdd089ef485b6f903efcf9e597eb1cb37ab Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sat, 21 Jan 2006 08:21:04 +0000 Subject: * sysdeps/unix/sysv/linux/pselect.c (__pselect): Allow actual system call code to be redefined in macro CALL_PSELECT6. * sysdeps/unix/sysv/linux/i386/Makefile [subdir=misc] (sysdep_routines): Add call_pselect6. * sysdeps/unix/sysv/linux/i386/call_pselect6.c: New file. * sysdeps/unix/sysv/linux/i386/pselect.c: New file. * misc/Makefile (tests): Add tst-pselect. * misc/tst-pselect.c: New file. * sysdeps/unix/sysv/linux/pselect.c: Fix typo in declaration. * sysdeps/unix/sysv/linux/xmknodat.c (__xmknodat): Cast k_dev value to unsigned int to match kernel. --- sysdeps/unix/sysv/linux/i386/Makefile | 2 +- sysdeps/unix/sysv/linux/i386/call_pselect6.S | 65 ++++++++++++++++++++++++++++ sysdeps/unix/sysv/linux/i386/pselect.c | 18 ++++++++ 3 files changed, 84 insertions(+), 1 deletion(-) create mode 100644 sysdeps/unix/sysv/linux/i386/call_pselect6.S create mode 100644 sysdeps/unix/sysv/linux/i386/pselect.c (limited to 'sysdeps/unix/sysv/linux/i386') 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 , 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 + +#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 + +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" -- cgit 1.4.1