summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ppp/sig.c
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>2001-08-20 10:25:23 +0000
committerbrian <brian@FreeBSD.org>2001-08-20 10:25:23 +0000
commitc400ea8f0ca0851ba87d9c155f3b411528c0e614 (patch)
tree14780c0e1d04bc43d0a4ce0f975df613169797c7 /usr.sbin/ppp/sig.c
parent5329ff37f27804cf290f81e20db6c6509183fa4a (diff)
downloadFreeBSD-src-c400ea8f0ca0851ba87d9c155f3b411528c0e614.zip
FreeBSD-src-c400ea8f0ca0851ba87d9c155f3b411528c0e614.tar.gz
Add some comments to explain what's going on here
Diffstat (limited to 'usr.sbin/ppp/sig.c')
-rw-r--r--usr.sbin/ppp/sig.c30
1 files changed, 21 insertions, 9 deletions
diff --git a/usr.sbin/ppp/sig.c b/usr.sbin/ppp/sig.c
index 59928e5..a42194b 100644
--- a/usr.sbin/ppp/sig.c
+++ b/usr.sbin/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
@@ -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()
{
OpenPOWER on IntegriCloud