mirror of the now-defunct rocklinux.org
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.

86 lines
2.5 KiB

  1. # --- ROCK-COPYRIGHT-NOTE-BEGIN ---
  2. #
  3. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  4. # Please add additional copyright information _after_ the line containing
  5. # the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by
  6. # the ./scripts/Create-CopyPatch script. Do not edit this copyright text!
  7. #
  8. # ROCK Linux: rock-src/package/base/util-linux/sak_blocking.patch
  9. # ROCK Linux is Copyright (C) 1998 - 2003 Clifford Wolf
  10. #
  11. # This program is free software; you can redistribute it and/or modify
  12. # it under the terms of the GNU General Public License as published by
  13. # the Free Software Foundation; either version 2 of the License, or
  14. # (at your option) any later version. A copy of the GNU General Public
  15. # License can be found at Documentation/COPYING.
  16. #
  17. # Many people helped and are helping developing ROCK Linux. Please
  18. # have a look at http://www.rocklinux.org/ and the Documentation/TEAM
  19. # file for details.
  20. #
  21. # --- ROCK-COPYRIGHT-NOTE-END ---
  22. --- ./login-utils/agetty.c.orig Sun Mar 4 21:43:50 2001
  23. +++ ./login-utils/agetty.c Wed Mar 21 10:17:47 2001
  24. @@ -231,10 +231,14 @@
  25. int bcode P_((char *s));
  26. void usage P_((void));
  27. void error P_((const char *, ...));
  28. +void sak_blocking P_((int signr));
  29. #undef P_
  30. /* The following is used for understandable diagnostics. */
  31. +/* message file for SAK blocking */
  32. +char *sakmsg="/dev/null";
  33. +
  34. char *progname;
  35. /* Fake hostname for ut_host specified on command line. */
  36. @@ -393,7 +397,7 @@
  37. extern int optind; /* getopt */
  38. int c;
  39. - while (isascii(c = getopt(argc, argv, "I:LH:f:hil:mt:wn"))) {
  40. + while (isascii(c = getopt(argc, argv, "I:LH:f:hil:mt:s:wn"))) {
  41. switch (c) {
  42. case 'I':
  43. if (!(op->initstring = malloc(strlen(optarg)))) {
  44. @@ -464,6 +468,10 @@
  45. if ((op->timeout = atoi(optarg)) <= 0)
  46. error(_("bad timeout value: %s"), optarg);
  47. break;
  48. + case 's': /* SAK blocking after time out */
  49. + signal(SIGALRM,sak_blocking);
  50. + sakmsg = optarg;
  51. + break;
  52. case 'w':
  53. op->flags |= F_WAITCRLF;
  54. break;
  55. @@ -1251,4 +1259,26 @@
  56. #endif
  57. (void) sleep((unsigned) 10); /* be kind to init(8) */
  58. exit(1);
  59. +}
  60. +
  61. +/* signal handler for alarm() timeout when doing SAK blocking */
  62. +
  63. +void sak_blocking(int signr) {
  64. + char buf[512];
  65. + int fd,rc,i;
  66. +
  67. + if (signr != SIGALRM) return;
  68. + alarm(0);
  69. +
  70. + /* print the SAK Message */
  71. + fd=open(sakmsg,O_RDONLY);
  72. + if (fd >= 0) {
  73. + while ( (rc=read(fd,buf,512)) > 0 )
  74. + write(1,buf,rc);
  75. + close(fd);
  76. + }
  77. +
  78. + /* lock */
  79. + for (i=1; i<=30; i++) signal(i,SIG_IGN);
  80. + while (1) sleep(600);
  81. }