diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2014-06-09 21:19:09 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2014-06-09 21:26:20 +0300 |
commit | cf4ab27d35038a7e4b1d5db119729c142b15abb7 (patch) | |
tree | 2f5df3d4fdac6aa0b7af32e87d24585327aabae2 /src/sysdep.c | |
parent | 17c44ea5af850bd03d4eeb245bb8fb35e7d07d90 (diff) | |
download | pies-cf4ab27d35038a7e4b1d5db119729c142b15abb7.tar.gz pies-cf4ab27d35038a7e4b1d5db119729c142b15abb7.tar.bz2 |
Implement ctrlaltdel and kbrequest processes.
* src/sysdep.c: New file.
* src/Makefile.am (pies_SOURCES): Add sysdep.c
* src/pies.c (ACTION_*): Move to pies.h
(sig_handler): Call sysvinit_sigtrans, return immediately
if it handles the signal.
(setsigvhan): New function.
(add_extra_sigv): New function.
(signal_setup): Rewrite.
(main): Handle ACTION_CTRLALTDEL and ACTION_KBREQUEST.
* src/pies.h (PIES_COMP_DEFAULT)
(PIES_COMP_WAIT,PIES_COMP_MASK): New defines.
(pies_action): New enum, add new actions: ACTION_CTRLALTDEL
and ACTION_KBREQUEST.
(setsigvhan, add_extra_sigv)
(sysvinit_sigtrans,sysvinit_runlevel_setup)
(sysvinit_sysdep_begin): New protos.
(sysvinit_request) <pad>: Rename to data.
* src/sysvinit.c (enablecomp): Change meaning of the data pointer.
(sysvinit_runlevel_setup): Change signature. Remove static qualifier.
All uses changed.
(sysvinit_setenv): New static.
(sysvinit_fifo_handler): Handle INIT_CMD_SETENV.
(sysvinit_sigtrans): New function.
(sysvinit_begin): Set up new signals.
Call sysvinit_sysdep_begin.
Diffstat (limited to 'src/sysdep.c')
-rw-r--r-- | src/sysdep.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/src/sysdep.c b/src/sysdep.c new file mode 100644 index 0000000..c59b561 --- /dev/null +++ b/src/sysdep.c @@ -0,0 +1,44 @@ +/* This file is part of GNU Pies. + Copyright (C) 2014 Sergey Poznyakoff + + GNU Pies is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + GNU Pies is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GNU Pies. If not, see <http://www.gnu.org/licenses/>. */ + +#include "pies.h" + +#if defined __linux__ +#include <sys/types.h> +#include <sys/ioctl.h> +#include <sys/kd.h> +#include <sys/reboot.h> + +void +sysvinit_sysdep_begin (void) +{ + int fd; + + reboot (RB_DISABLE_CAD); + fd = open (console_device, O_RDWR | O_NOCTTY); + if (fd != -1) { + ioctl (fd, KDSIGACCEPT, SIGWINCH); + close (fd); + } else + ioctl (0, KDSIGACCEPT, SIGWINCH); +} + +#else +void +sysvinit_sysdep_begin (void) +{ +} +#endif |