# --- ROCK-COPYRIGHT-NOTE-BEGIN --- # # This copyright note is auto-generated by ./scripts/Create-CopyPatch. # Please add additional copyright information _after_ the line containing # the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by # the ./scripts/Create-CopyPatch script. Do not edit this copyright text! # # ROCK Linux: rock-src/package/base/util-linux/sak_blocking.patch # ROCK Linux is Copyright (C) 1998 - 2003 Clifford Wolf # # This program 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 2 of the License, or # (at your option) any later version. A copy of the GNU General Public # License can be found at Documentation/COPYING. # # Many people helped and are helping developing ROCK Linux. Please # have a look at http://www.rocklinux.org/ and the Documentation/TEAM # file for details. # # --- ROCK-COPYRIGHT-NOTE-END --- --- ./login-utils/agetty.c.orig Sun Mar 4 21:43:50 2001 +++ ./login-utils/agetty.c Wed Mar 21 10:17:47 2001 @@ -231,10 +231,14 @@ int bcode P_((char *s)); void usage P_((void)); void error P_((const char *, ...)); +void sak_blocking P_((int signr)); #undef P_ /* The following is used for understandable diagnostics. */ +/* message file for SAK blocking */ +char *sakmsg="/dev/null"; + char *progname; /* Fake hostname for ut_host specified on command line. */ @@ -393,7 +397,7 @@ extern int optind; /* getopt */ int c; - while (isascii(c = getopt(argc, argv, "I:LH:f:hil:mt:wn"))) { + while (isascii(c = getopt(argc, argv, "I:LH:f:hil:mt:s:wn"))) { switch (c) { case 'I': if (!(op->initstring = malloc(strlen(optarg)))) { @@ -464,6 +468,10 @@ if ((op->timeout = atoi(optarg)) <= 0) error(_("bad timeout value: %s"), optarg); break; + case 's': /* SAK blocking after time out */ + signal(SIGALRM,sak_blocking); + sakmsg = optarg; + break; case 'w': op->flags |= F_WAITCRLF; break; @@ -1251,4 +1259,26 @@ #endif (void) sleep((unsigned) 10); /* be kind to init(8) */ exit(1); +} + +/* signal handler for alarm() timeout when doing SAK blocking */ + +void sak_blocking(int signr) { + char buf[512]; + int fd,rc,i; + + if (signr != SIGALRM) return; + alarm(0); + + /* print the SAK Message */ + fd=open(sakmsg,O_RDONLY); + if (fd >= 0) { + while ( (rc=read(fd,buf,512)) > 0 ) + write(1,buf,rc); + close(fd); + } + + /* lock */ + for (i=1; i<=30; i++) signal(i,SIG_IGN); + while (1) sleep(600); }