|
Packit Service |
50ad14 |
/*
|
|
Packit Service |
50ad14 |
* Tiny test program for the `spawn console' key
|
|
Packit Service |
50ad14 |
* (should not use signal; should not use sleep)
|
|
Packit Service |
50ad14 |
* aeb - 941025
|
|
Packit Service |
50ad14 |
*
|
|
Packit Service |
50ad14 |
*/
|
|
Packit Service |
50ad14 |
#include "config.h"
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
#include <stdio.h>
|
|
Packit Service |
50ad14 |
#include <stdlib.h>
|
|
Packit Service |
50ad14 |
#include <signal.h>
|
|
Packit Service |
50ad14 |
#include <errno.h>
|
|
Packit Service |
50ad14 |
#include <unistd.h>
|
|
Packit Service |
50ad14 |
#include <fcntl.h>
|
|
Packit Service |
50ad14 |
#include <sys/ioctl.h>
|
|
Packit Service |
50ad14 |
#include <linux/kd.h>
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
#include "version.h"
|
|
Packit Service |
50ad14 |
#include "kbd.h"
|
|
Packit Service |
50ad14 |
#include "kbd_error.h"
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
static void
|
|
Packit Service |
50ad14 |
sighup(int n __attribute__((unused)))
|
|
Packit Service |
50ad14 |
{
|
|
Packit Service |
50ad14 |
if (system("openvt -s -l -- login -h spawn") == -1) {
|
|
Packit Service |
50ad14 |
kbd_error(EXIT_FAILURE, errno, "system");
|
|
Packit Service |
50ad14 |
}
|
|
Packit Service |
50ad14 |
signal(SIGHUP, sighup);
|
|
Packit Service |
50ad14 |
}
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
int main(int argc __attribute__((unused)), char *argv[])
|
|
Packit Service |
50ad14 |
{
|
|
Packit Service |
50ad14 |
int fd;
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
set_progname(argv[0]);
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
fd = open("/dev/tty0", 0);
|
|
Packit Service |
50ad14 |
if (fd < 0 && errno == ENOENT)
|
|
Packit Service |
50ad14 |
fd = open("/dev/vc/0", 0);
|
|
Packit Service |
50ad14 |
if (fd < 0)
|
|
Packit Service |
50ad14 |
fd = 0;
|
|
Packit Service |
50ad14 |
signal(SIGHUP, sighup);
|
|
Packit Service |
50ad14 |
if (ioctl(fd, KDSIGACCEPT, (long)SIGHUP))
|
|
Packit Service |
50ad14 |
kbd_error(EXIT_FAILURE, errno, "ioctl KDSIGACCEPT");
|
|
Packit Service |
50ad14 |
while (1)
|
|
Packit Service |
50ad14 |
sleep(3600);
|
|
Packit Service |
50ad14 |
return EXIT_SUCCESS;
|
|
Packit Service |
50ad14 |
}
|