/*
- * $Id: afp_dsi.c,v 1.49 2010-01-18 12:55:28 franklahm Exp $
+ * $Id: afp_dsi.c,v 1.50 2010-02-08 13:39:56 franklahm Exp $
*
* Copyright (c) 1999 Adrian Sun (asun@zoology.washington.edu)
* Copyright (c) 1990,1993 Regents of The University of Michigan.
reload_request = 1;
}
+/* ---------------------------------
+ * SIGINT: enable max_debug LOGging
+ */
+volatile static sig_atomic_t debug_request = 0;
+
+static void afp_dsi_debug(int sig _U_)
+{
+ debug_request = 1;
+}
+
/* ---------------------- */
#ifdef SERVERTEXT
static void afp_dsi_getmesg (int sig _U_)
sigaddset(&action.sa_mask, SIGALRM);
sigaddset(&action.sa_mask, SIGTERM);
sigaddset(&action.sa_mask, SIGUSR1);
+ sigaddset(&action.sa_mask, SIGINT);
#ifdef SERVERTEXT
sigaddset(&action.sa_mask, SIGUSR2);
#endif
sigaddset(&action.sa_mask, SIGALRM);
sigaddset(&action.sa_mask, SIGHUP);
sigaddset(&action.sa_mask, SIGUSR1);
+ sigaddset(&action.sa_mask, SIGINT);
#ifdef SERVERTEXT
sigaddset(&action.sa_mask, SIGUSR2);
#endif
sigaddset(&action.sa_mask, SIGTERM);
sigaddset(&action.sa_mask, SIGUSR1);
sigaddset(&action.sa_mask, SIGHUP);
+ sigaddset(&action.sa_mask, SIGINT);
action.sa_flags = SA_RESTART;
if ( sigaction( SIGUSR2, &action, NULL) < 0 ) {
LOG(log_error, logtype_afpd, "afp_over_dsi: sigaction: %s", strerror(errno) );
sigaddset(&action.sa_mask, SIGALRM);
sigaddset(&action.sa_mask, SIGHUP);
sigaddset(&action.sa_mask, SIGTERM);
+ sigaddset(&action.sa_mask, SIGINT);
#ifdef SERVERTEXT
sigaddset(&action.sa_mask, SIGUSR2);
#endif
afp_dsi_die(EXITERR_SYS);
}
+ /* SIGINT - enable max_debug LOGging to /tmp/afpd.PID.XXXXXX */
+ action.sa_handler = afp_dsi_debug;
+ sigfillset( &action.sa_mask );
+ action.sa_flags = SA_RESTART;
+ if ( sigaction( SIGINT, &action, NULL) < 0 ) {
+ LOG(log_error, logtype_afpd, "afp_over_dsi: sigaction: %s", strerror(errno) );
+ afp_dsi_die(EXITERR_SYS);
+ }
+
#ifndef DEBUGGING
/* tickle handler */
action.sa_handler = alarm_handler;
sigaddset(&action.sa_mask, SIGHUP);
sigaddset(&action.sa_mask, SIGTERM);
sigaddset(&action.sa_mask, SIGUSR1);
+ sigaddset(&action.sa_mask, SIGINT);
#ifdef SERVERTEXT
sigaddset(&action.sa_mask, SIGUSR2);
#endif
child.tickle = 0;
child.flags &= ~CHILD_SLEEPING;
dsi_sleep(dsi, 0); /* wake up */
+
if (reload_request) {
reload_request = 0;
load_volumes(child.obj);
}
+ if (debug_request) {
+ char logstr[50];
+ debug_request = 0;
+
+ /* The first SIGINT enables debugging, the second one kills us */
+ action.sa_handler = afp_dsi_die;
+ sigfillset( &action.sa_mask );
+ action.sa_flags = SA_RESTART;
+ if ( sigaction( SIGINT, &action, NULL ) < 0 ) {
+ LOG(log_error, logtype_afpd, "afp_over_dsi: sigaction: %s", strerror(errno) );
+ afp_dsi_die(EXITERR_SYS);
+ }
+
+ sprintf(logstr, "default log_maxdebug /tmp/afpd.%u.XXXXXX", getpid());
+ setuplog(logstr);
+ }
+
if (cmd == DSIFUNC_TICKLE) {
/* timer is not every 30 seconds anymore, so we don't get killed on the client side. */
if ((child.flags & CHILD_DIE))
.\" Title: afpd
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.74.3 <http://docbook.sf.net/>
-.\" Date: 06 Jan 2004
+.\" Date: 08 Feb 2010
.\" Manual: Netatalk 2.1beta
.\" Source: Netatalk 2.1beta
.\" Language: English
.\"
-.TH "AFPD" "8" "06 Jan 2004" "Netatalk 2.1beta" "Netatalk 2.1beta"
+.TH "AFPD" "8" "08 Feb 2010" "Netatalk 2.1beta" "Netatalk 2.1beta"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.RS 4
Sending a
\fBSIGHUP\fR
-to afpd will cause it to reload its configuration files\&.
+to afpd will cause it to reload its configuration files\&. The master
+\fBafpd\fR
+process will reread all files while the children
+\fBafpd\fR
+processes will only reread the volume configuration\&.
+.RE
+.PP
+SIGINT
+.RS 4
+Sending a
+\fBSIGINT\fR
+to a child
+\fBafpd\fR
+enables
+\fImax_debug\fR
+logging for this process\&. The log is sent to fhe file
+/tmp/afpd\&.PID\&.XXXXXX\&. Sending another
+\fBSIGINT\fR
+will terminate the process\&.
.RE
.PP
SIGUSR1
The
\fBafpd\fR
process will look in the message directory configured at build time for a file named message\&.pid\&. For each one found, a the contents will be sent as a message to the associated AFP client\&. The file is removed after the message is sent\&. This should only be sent to a child
-\fBafpd\fR\&. Warning: If the \-\-with\-message\-dir option was not used, this will kill the
-\fBafpd\fR
-process
+\fBafpd\fR\&.
.sp
To shut down a user\'s
\fBafpd\fR