Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src Add bsd_signal as required by POSIX (from GSoC 2016, Charles...
details: https://anonhg.NetBSD.org/src/rev/a70c586fd905
branches: trunk
changeset: 345656:a70c586fd905
user: christos <christos%NetBSD.org@localhost>
date: Fri Jun 03 23:57:37 2016 +0000
description:
Add bsd_signal as required by POSIX (from GSoC 2016, Charles Cui)
diffstat:
lib/libc/gen/signal.c | 20 ++++++++++++++++++--
sys/sys/signal.h | 3 ++-
2 files changed, 20 insertions(+), 3 deletions(-)
diffs (55 lines):
diff -r 2fa28a5eb0b0 -r a70c586fd905 lib/libc/gen/signal.c
--- a/lib/libc/gen/signal.c Fri Jun 03 21:55:50 2016 +0000
+++ b/lib/libc/gen/signal.c Fri Jun 03 23:57:37 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: signal.c,v 1.13 2012/06/25 22:32:44 abs Exp $ */
+/* $NetBSD: signal.c,v 1.14 2016/06/03 23:57:37 christos Exp $ */
/*
* Copyright (c) 1985, 1989, 1993
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)signal.c 8.1 (Berkeley) 6/4/93";
#else
-__RCSID("$NetBSD: signal.c,v 1.13 2012/06/25 22:32:44 abs Exp $");
+__RCSID("$NetBSD: signal.c,v 1.14 2016/06/03 23:57:37 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@@ -64,3 +64,19 @@
return (SIG_ERR);
return (osa.sa_handler);
}
+
+void
+(*bsd_signal(int sig, void (*func)(int)))(int)
+{
+ struct sigaction act, oact;
+
+ act.sa_handler = func;
+ act.sa_flags = SA_RESTART;
+
+ sigemptyset(&act.sa_mask);
+ sigaddset(&act.sa_mask, sig);
+ if (sigaction(sig, &act, &oact) < 0)
+ return (SIG_ERR);
+
+ return (oact.sa_handler);
+}
diff -r 2fa28a5eb0b0 -r a70c586fd905 sys/sys/signal.h
--- a/sys/sys/signal.h Fri Jun 03 21:55:50 2016 +0000
+++ b/sys/sys/signal.h Fri Jun 03 23:57:37 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: signal.h,v 1.67 2011/01/10 13:56:44 christos Exp $ */
+/* $NetBSD: signal.h,v 1.68 2016/06/03 23:57:37 christos Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1991, 1993
@@ -235,6 +235,7 @@
*/
__BEGIN_DECLS
void (*signal(int, void (*)(int)))(int);
+void (*bsd_signal(int, void (*)(int)))(int);
#if (_POSIX_C_SOURCE - 0) >= 200112L || defined(_NETBSD_SOURCE)
int sigqueue(pid_t, int, const union sigval);
#endif
Home |
Main Index |
Thread Index |
Old Index