[Glibc-bsd-commits] r4645 - trunk/glibc-ports/kfreebsd/fbtl
Petr Salinger
ps-guest at alioth.debian.org
Mon Jul 8 12:48:16 UTC 2013
Author: ps-guest
Date: 2013-06-28 16:16:42 +0000 (Fri, 28 Jun 2013)
New Revision: 4645
Added:
trunk/glibc-ports/kfreebsd/fbtl/sigtimedwait.c
trunk/glibc-ports/kfreebsd/fbtl/sigwait.c
trunk/glibc-ports/kfreebsd/fbtl/sigwaitinfo.c
Modified:
trunk/glibc-ports/kfreebsd/fbtl/Makefile
Log:
wrap sig*wait* as needed
Modified: trunk/glibc-ports/kfreebsd/fbtl/Makefile
===================================================================
--- trunk/glibc-ports/kfreebsd/fbtl/Makefile 2013-06-28 16:15:55 UTC (rev 4644)
+++ trunk/glibc-ports/kfreebsd/fbtl/Makefile 2013-06-28 16:16:42 UTC (rev 4645)
@@ -34,6 +34,8 @@
ifeq ($(subdir),fbtl)
routines += sys_thr_kill sys_thr_self
+routines += sys_sigwaitinfo sys_sigwait sys_sigtimedwait
+libpthread-routines += ptw-sys_sigwaitinfo ptw-sys_sigwait ptw-sys_sigtimedwait
libpthread-routines += ptw-sys_sigprocmask ptw-sys_umtx
libpthread-routines += ptw-sys_thr_kill
libpthread-routines += ptw-sys_thr_kill2
@@ -41,8 +43,6 @@
libpthread-routines += ptw-sys_thr_self
libpthread-routines += ptw-sys_thr_set_name
libpthread-routines += ptw-sys_thr_exit
-librt-routines += sys_sigwaitinfo
-routines += sys_sigwaitinfo
endif
ifeq ($(subdir),posix)
Added: trunk/glibc-ports/kfreebsd/fbtl/sigtimedwait.c
===================================================================
--- trunk/glibc-ports/kfreebsd/fbtl/sigtimedwait.c (rev 0)
+++ trunk/glibc-ports/kfreebsd/fbtl/sigtimedwait.c 2013-06-28 16:16:42 UTC (rev 4645)
@@ -0,0 +1,72 @@
+/* Copyright (C) 1997-2013 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <signal.h>
+#include <string.h>
+
+#include <sysdep-cancel.h>
+#include <sys/syscall.h>
+#include <nptl/pthreadP.h>
+
+static int
+do_sigtimedwait (const sigset_t *set, siginfo_t *info,
+ const struct timespec *timeout)
+{
+#ifdef SIGCANCEL
+ sigset_t tmpset;
+ if (set != NULL
+ && (__builtin_expect (__sigismember (set, SIGCANCEL), 0)
+# ifdef SIGSETXID
+ || __builtin_expect (__sigismember (set, SIGSETXID), 0)
+# endif
+ ))
+ {
+ /* Create a temporary mask without the bit for SIGCANCEL set. */
+ tmpset = *set;
+ __sigdelset (&tmpset, SIGCANCEL);
+# ifdef SIGSETXID
+ __sigdelset (&tmpset, SIGSETXID);
+# endif
+ set = &tmpset;
+ }
+#endif
+
+ return INLINE_SYSCALL (sigtimedwait, 3, set, info, timeout);
+}
+
+
+/* Return any pending signal or wait for one for the given time. */
+int
+__sigtimedwait (set, info, timeout)
+ const sigset_t *set;
+ siginfo_t *info;
+ const struct timespec *timeout;
+{
+ if (SINGLE_THREAD_P)
+ return do_sigtimedwait (set, info, timeout);
+
+ int oldtype = LIBC_CANCEL_ASYNC ();
+
+ int result = do_sigtimedwait (set, info, timeout);
+
+ LIBC_CANCEL_RESET (oldtype);
+
+ return result;
+}
+libc_hidden_def (__sigtimedwait)
+weak_alias (__sigtimedwait, sigtimedwait)
Added: trunk/glibc-ports/kfreebsd/fbtl/sigwait.c
===================================================================
--- trunk/glibc-ports/kfreebsd/fbtl/sigwait.c (rev 0)
+++ trunk/glibc-ports/kfreebsd/fbtl/sigwait.c 2013-06-28 16:16:42 UTC (rev 4645)
@@ -0,0 +1,73 @@
+/* Copyright (C) 1997-2013 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <signal.h>
+#define __need_NULL
+#include <stddef.h>
+#include <string.h>
+
+#include <sysdep-cancel.h>
+#include <sys/syscall.h>
+#include <nptl/pthreadP.h>
+
+
+/* Return any pending signal or wait for one for the given time. */
+static int
+do_sigwait (const sigset_t *set, int *sig)
+{
+#ifdef SIGCANCEL
+ sigset_t tmpset;
+ if (set != NULL
+ && (__builtin_expect (__sigismember (set, SIGCANCEL), 0)
+# ifdef SIGSETXID
+ || __builtin_expect (__sigismember (set, SIGSETXID), 0)
+# endif
+ ))
+ {
+ /* Create a temporary mask without the bit for SIGCANCEL set. */
+ tmpset = *set;
+ __sigdelset (&tmpset, SIGCANCEL);
+# ifdef SIGSETXID
+ __sigdelset (&tmpset, SIGSETXID);
+# endif
+ set = &tmpset;
+ }
+#endif
+
+ return INLINE_SYSCALL (sigwait, 2, set, sig);
+}
+
+int
+__sigwait (set, sig)
+ const sigset_t *set;
+ int *sig;
+{
+ if (SINGLE_THREAD_P)
+ return do_sigwait (set, sig);
+
+ int oldtype = LIBC_CANCEL_ASYNC ();
+
+ int result = do_sigwait (set, sig);
+
+ LIBC_CANCEL_RESET (oldtype);
+
+ return result;
+}
+libc_hidden_def (__sigwait)
+weak_alias (__sigwait, sigwait)
+strong_alias (__sigwait, __libc_sigwait)
Added: trunk/glibc-ports/kfreebsd/fbtl/sigwaitinfo.c
===================================================================
--- trunk/glibc-ports/kfreebsd/fbtl/sigwaitinfo.c (rev 0)
+++ trunk/glibc-ports/kfreebsd/fbtl/sigwaitinfo.c 2013-06-28 16:16:42 UTC (rev 4645)
@@ -0,0 +1,74 @@
+/* Copyright (C) 1997-2013 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <signal.h>
+#define __need_NULL
+#include <stddef.h>
+#include <string.h>
+
+#include <sysdep-cancel.h>
+#include <sys/syscall.h>
+#include <nptl/pthreadP.h>
+
+
+static int
+do_sigwaitinfo (const sigset_t *set, siginfo_t *info)
+{
+#ifdef SIGCANCEL
+ sigset_t tmpset;
+ if (set != NULL
+ && (__builtin_expect (__sigismember (set, SIGCANCEL), 0)
+# ifdef SIGSETXID
+ || __builtin_expect (__sigismember (set, SIGSETXID), 0)
+# endif
+ ))
+ {
+ /* Create a temporary mask without the bit for SIGCANCEL set. */
+ tmpset = *set;
+ __sigdelset (&tmpset, SIGCANCEL);
+# ifdef SIGSETXID
+ __sigdelset (&tmpset, SIGSETXID);
+# endif
+ set = &tmpset;
+ }
+#endif
+
+ return INLINE_SYSCALL (sigwaitinfo, 2, set, info);
+}
+
+
+/* Return any pending signal or wait for one for the given time. */
+int
+__sigwaitinfo (set, info)
+ const sigset_t *set;
+ siginfo_t *info;
+{
+ if (SINGLE_THREAD_P)
+ return do_sigwaitinfo (set, info);
+
+ int oldtype = LIBC_CANCEL_ASYNC ();
+
+ int result = do_sigwaitinfo (set, info);
+
+ LIBC_CANCEL_RESET (oldtype);
+
+ return result;
+}
+libc_hidden_def (__sigwaitinfo)
+weak_alias (__sigwaitinfo, sigwaitinfo)
+strong_alias (__sigwaitinfo, __libc_sigwaitinfo)
More information about the Glibc-bsd-commits
mailing list