summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorbrian <brian@cvs.openbsd.org>2001-08-21 04:09:21 +0000
committerbrian <brian@cvs.openbsd.org>2001-08-21 04:09:21 +0000
commitb172591d82574ff20079f986c732e794f4573222 (patch)
treebcb553defa9917115765f53bab65b5d17d3922a5 /usr.sbin
parent60a433e10040bb959397a4bb1cf1daeabcb3182c (diff)
Add some comments to make it clearer how we're handling signals.
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/ppp/ppp/sig.c32
1 files changed, 22 insertions, 10 deletions
diff --git a/usr.sbin/ppp/ppp/sig.c b/usr.sbin/ppp/ppp/sig.c
index 546106655e9..4ec2591af13 100644
--- a/usr.sbin/ppp/ppp/sig.c
+++ b/usr.sbin/ppp/ppp/sig.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 1997 Brian Somers <brian@Awfulhak.org>
+ * Copyright (c) 1997 - 1999, 2001 Brian Somers <brian@Awfulhak.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $OpenBSD: sig.c,v 1.4 2000/02/27 01:38:28 brian Exp $
+ * $OpenBSD: sig.c,v 1.5 2001/08/21 04:09:20 brian Exp $
*/
#include <sys/types.h>
@@ -38,8 +38,14 @@ static int necessary; /* Anything set ? */
static sig_type handler[NSIG]; /* all start at SIG_DFL */
-/* Record a signal in the "caused" array */
-
+/*
+ * Record a signal in the "caused" array
+ *
+ * This function is the only thing actually called in signal context. It
+ * records that a signal has been caused and that sig_Handle() should be
+ * called (in non-signal context) as soon as possible to process that
+ * signal.
+ */
static void
signal_recorder(int sig)
{
@@ -49,10 +55,11 @@ signal_recorder(int sig)
/*
- * Set up signal_recorder, and record handler as the function to ultimately
- * call in handle_signal()
-*/
-
+ * Set up signal_recorder to handle the given sig and record ``fn'' as
+ * the function to ultimately call in sig_Handle(). ``fn'' will not be
+ * called in signal context (as sig_Handle() is not called in signal
+ * context).
+ */
sig_type
sig_signal(int sig, sig_type fn)
{
@@ -77,8 +84,13 @@ sig_signal(int sig, sig_type fn)
}
-/* Call the handlers for any pending signals */
-
+/*
+ * Call the handlers for any pending signals
+ *
+ * This function is called from a non-signal context - in fact, it's
+ * called every time select() in DoLoop() returns - just in case
+ * select() returned due to a signal being recorded by signal_recorder().
+ */
int
sig_Handle()
{