lock LPT control circuit when receiving SIGTERM
This commit is contained in:
parent
4c1fb5fa9d
commit
989ca201e4
19
yasnd.c
19
yasnd.c
@ -139,6 +139,22 @@ void check_host(int num,host_decl* host)
|
||||
host->helper_pid=pid;
|
||||
}
|
||||
|
||||
/*
|
||||
Function, that turn on first LPT port pin and turn off others.
|
||||
This is needed to lock LPT control circuit, when
|
||||
management computer is rebooted
|
||||
*/
|
||||
void lpt_lock()
|
||||
{
|
||||
if (ioperm (lpt_port, 3, 1))
|
||||
{
|
||||
log_event("Error: LPT port access error");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
// Lock circuit
|
||||
outb (1, lpt_port);
|
||||
}
|
||||
|
||||
/*
|
||||
Function, that turn on only one LPT port pin, defined by it argument, wait a second,
|
||||
and turn off all pins. That is enough to reset specified host.
|
||||
@ -248,6 +264,9 @@ void signal_handler(int signum)
|
||||
if (signum==SIGTERM)
|
||||
{
|
||||
log_event("SIGTERM captured, daemon stopping");
|
||||
// block LPT control circuit
|
||||
if (lpt_enable)
|
||||
lpt_lock();
|
||||
// close log decriptor
|
||||
closelog();
|
||||
// free resources
|
||||
|
Loading…
Reference in New Issue
Block a user