You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
81 lines
2.3 KiB
81 lines
2.3 KiB
# --- SDE-COPYRIGHT-NOTE-BEGIN --- |
|
# This copyright note is auto-generated by ./scripts/Create-CopyPatch. |
|
# |
|
# Filename: package/.../util-linux/sak_blocking.patch |
|
# Copyright (C) 2004 - 2006 The T2 SDE Project |
|
# Copyright (C) 1998 - 2003 Clifford Wolf |
|
# |
|
# More information can be found in the files COPYING and README. |
|
# |
|
# This patch file is dual-licensed. It is available under the license the |
|
# patched project is licensed under, as long as it is an OpenSource license |
|
# as defined at http://www.opensource.org/ (e.g. BSD, X11) or 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. |
|
# --- SDE-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); |
|
}
|
|
|