[Glibc-bsd-commits] r3156 - in trunk/glibc-ports/kfreebsd: . sys

Petr Salinger ps-guest at alioth.debian.org
Tue Aug 10 09:05:21 UTC 2010


Author: ps-guest
Date: 2010-08-10 09:05:09 +0000 (Tue, 10 Aug 2010)
New Revision: 3156

Added:
   trunk/glibc-ports/kfreebsd/pselect.c
Modified:
   trunk/glibc-ports/kfreebsd/Makefile
   trunk/glibc-ports/kfreebsd/sys/syscall.h
   trunk/glibc-ports/kfreebsd/syscalls.list
Log:
use pselect() syscall when available



Modified: trunk/glibc-ports/kfreebsd/Makefile
===================================================================
--- trunk/glibc-ports/kfreebsd/Makefile	2010-08-10 05:57:35 UTC (rev 3155)
+++ trunk/glibc-ports/kfreebsd/Makefile	2010-08-10 09:05:09 UTC (rev 3156)
@@ -90,7 +90,7 @@
 # for INLINE_SYSCALL
 sysdep_routines += sys_fork sys_execve sys_sigaction sys_close sys_fcntl
 sysdep_routines += sys_clock_getres sys_clock_gettime sys_clock_settime
-sysdep_routines += sys_shm_open sys_shm_unlink
+sysdep_routines += sys_shm_open sys_shm_unlink sys_pselect
 endif
 
 ifeq ($(subdir),posix)

Added: trunk/glibc-ports/kfreebsd/pselect.c
===================================================================
--- trunk/glibc-ports/kfreebsd/pselect.c	                        (rev 0)
+++ trunk/glibc-ports/kfreebsd/pselect.c	2010-08-10 09:05:09 UTC (rev 3156)
@@ -0,0 +1,72 @@
+/* Copyright (C) 2006, 2007, 2010 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   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 <errno.h>
+#include <signal.h>
+#include <time.h>
+#include <sys/poll.h>
+#include <kernel-features.h>
+#include <sysdep-cancel.h>
+
+
+#ifndef __ASSUME_PSELECT
+static int __generic_pselect (int nfds, fd_set *readfds, fd_set *writefds,
+			      fd_set *exceptfds,
+			      const struct timespec *timeout,
+			      const sigset_t *sigmask);
+#endif
+
+extern int __syscall_pselect (int nfds, fd_set *readfds, fd_set *writefds,
+			      fd_set *exceptfds,
+			      const struct timespec *timeout,
+			      const sigset_t *sigmask) __THROW;
+
+int 
+__pselect (int nfds, fd_set *readfds, fd_set *writefds,
+			      fd_set *exceptfds,
+			      const struct timespec *timeout,
+			      const sigset_t *sigmask)
+{
+  int result;
+
+  if (SINGLE_THREAD_P)
+    result = INLINE_SYSCALL (pselect, 6, nfds, readfds, writefds, exceptfds, 
+			     timeout, sigmask);
+  else
+    {
+      int oldtype = LIBC_CANCEL_ASYNC ();
+      result = INLINE_SYSCALL (pselect, 6, nfds, readfds, writefds, exceptfds, 
+  			       timeout, sigmask);
+      LIBC_CANCEL_RESET (oldtype);
+    }
+
+#ifndef __ASSUME_PSELECT
+  if (result == -1 && errno == ENOSYS)
+    return __generic_pselect (nfds, readfds, writefds, exceptfds,
+                                timeout, sigmask);
+#endif
+
+  return result;
+}
+weak_alias (__pselect, pselect)
+strong_alias (__pselect, __libc_pselect)
+
+#ifndef __ASSUME_PSELECT
+# define __pselect static __generic_pselect
+# include <misc/pselect.c>
+#endif

Modified: trunk/glibc-ports/kfreebsd/sys/syscall.h
===================================================================
--- trunk/glibc-ports/kfreebsd/sys/syscall.h	2010-08-10 05:57:35 UTC (rev 3155)
+++ trunk/glibc-ports/kfreebsd/sys/syscall.h	2010-08-10 09:05:09 UTC (rev 3156)
@@ -319,11 +319,6 @@
 #define	SYS_nfsclnt	375
 #define	SYS_eaccess	376
 #define	SYS_nmount	378
-#define	SYS_kse_exit	379
-#define	SYS_kse_wakeup	380
-#define	SYS_kse_create	381
-#define	SYS_kse_thr_interrupt	382
-#define	SYS_kse_release	383
 #define	SYS_mac_get_proc	384
 #define	SYS_mac_set_proc	385
 #define	SYS_mac_get_fd	386
@@ -376,7 +371,6 @@
 #define	SYS_extattr_list_fd	437
 #define	SYS_extattr_list_file	438
 #define	SYS_extattr_list_link	439
-#define	SYS_kse_switchin	440
 #define	SYS_ksem_timedwait	441
 #define	SYS_thr_suspend	442
 #define	SYS_thr_wake	443
@@ -441,6 +435,7 @@
 #define	SYS_jail_get	506
 #define	SYS_jail_set	507
 #define	SYS_jail_remove	508
-#define	SYS_MAXSYSCALL	509
+#define	SYS_pselect	522
+#define	SYS_MAXSYSCALL	523
 
 #endif

Modified: trunk/glibc-ports/kfreebsd/syscalls.list
===================================================================
--- trunk/glibc-ports/kfreebsd/syscalls.list	2010-08-10 05:57:35 UTC (rev 3155)
+++ trunk/glibc-ports/kfreebsd/syscalls.list	2010-08-10 09:05:09 UTC (rev 3156)
@@ -184,3 +184,4 @@
 sys_shm_open		-	shm_open		i:sii		__syscall_shm_open
 sys_shm_unlink		-	shm_unlink		i:s		__syscall_shm_unlink
 readlink		-	readlink       		i:spi   	__syscall_readlink __readlink readlink
+sys_pselect		-	pselect			i:iPPPPP	__syscall_pselect




More information about the Glibc-bsd-commits mailing list