LJ Archive

Spawn Console

/*
 * Tiny test program for the `spawn console' key
 * aeb - 941025
 */
#include signal.h
#include linux/kd.h

void
sighup(){
    system("open -s -l bash");
    signal(SIGHUP, sighup);
}

main(){
    int fd;

    fd = open("/dev/console", 0);
    if (fd < 0)
      fd = 0;
    signal(SIGHUP, sighup);
    ioctl(fd, KDSIGACCEPT, (long) SIGHUP);
    while(1)
      sleep(3600);
}
Listing of spawn_console.c
LJ Archive