ifplugd: the SIGHUP handling and repeated setenv calls
Maxim Kryžanovský
xmaks at email.cz
Fri Apr 16 14:07:06 UTC 2010
Hi Denis,
if you do not mind, I have two questions about ifplugd.
1. How to handle the SIGHUP signal? The ifplugd-0.28 writes to log:
switch (sig) {
case SIGINT:
case SIGTERM: goto cleanup;
case SIGQUIT: goto finish;
case SIGCHLD: break;
case SIGHUP:
daemon_log(LOG_INFO, "SIGHUP: %s, link detected on %s: %s",
paused ? "Suspended" : "Running",
interface,
status == IFSTATUS_DOWN ? "no" : "yes"
);
if (use_ifmonitor)
daemon_log(LOG_INFO, "SIGHUP: Interface %s", disabled ? "disabled" : "enabled");
break;
case SIGUSR1:
daemon_log(LOG_INFO, "SIGUSR1: Daemon suspended (#%i)", ++paused);
break;
case SIGUSR2:
if (paused > 0) {
daemon_log(LOG_INFO, "SIGUSR2: Daemon resumed (#%i)", paused);
paused --;
}
break;
default:
daemon_log(LOG_INFO, "Ignoring unknown signal %s", strsignal(sig));
break;
}
Do we need to inherit it?
2. What may happen with repeated setenv() calls?
if (status != G.iface_last_status) {
//TODO: is it safe to repeatedly do this?
setenv(IFPLUGD_ENV_PREVIOUS, strstatus(G.iface_last_status), 1);
setenv(IFPLUGD_ENV_CURRENT, strstatus(status), 1);
G.iface_last_status = status;
}
Thanks.
--
max
More information about the busybox
mailing list