OpenSDE Packages Database (without history before r20070)
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

  1. # --- T2-COPYRIGHT-NOTE-BEGIN ---
  2. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  3. #
  4. # T2 SDE: package/.../util-linux/sak_blocking.patch
  5. # Copyright (C) 2004 - 2006 The T2 SDE Project
  6. # Copyright (C) 1998 - 2003 Clifford Wolf
  7. #
  8. # More information can be found in the files COPYING and README.
  9. #
  10. # This patch file is dual-licensed. It is available under the license the
  11. # patched project is licensed under, as long as it is an OpenSource license
  12. # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
  13. # of the GNU General Public License as published by the Free Software
  14. # Foundation; either version 2 of the License, or (at your option) any later
  15. # version.
  16. # --- T2-COPYRIGHT-NOTE-END ---
  17. --- ./login-utils/agetty.c.orig Sun Mar 4 21:43:50 2001
  18. +++ ./login-utils/agetty.c Wed Mar 21 10:17:47 2001
  19. @@ -231,10 +231,14 @@
  20. int bcode P_((char *s));
  21. void usage P_((void));
  22. void error P_((const char *, ...));
  23. +void sak_blocking P_((int signr));
  24. #undef P_
  25. /* The following is used for understandable diagnostics. */
  26. +/* message file for SAK blocking */
  27. +char *sakmsg="/dev/null";
  28. +
  29. char *progname;
  30. /* Fake hostname for ut_host specified on command line. */
  31. @@ -393,7 +397,7 @@
  32. extern int optind; /* getopt */
  33. int c;
  34. - while (isascii(c = getopt(argc, argv, "I:LH:f:hil:mt:wn"))) {
  35. + while (isascii(c = getopt(argc, argv, "I:LH:f:hil:mt:s:wn"))) {
  36. switch (c) {
  37. case 'I':
  38. if (!(op->initstring = malloc(strlen(optarg)))) {
  39. @@ -464,6 +468,10 @@
  40. if ((op->timeout = atoi(optarg)) <= 0)
  41. error(_("bad timeout value: %s"), optarg);
  42. break;
  43. + case 's': /* SAK blocking after time out */
  44. + signal(SIGALRM,sak_blocking);
  45. + sakmsg = optarg;
  46. + break;
  47. case 'w':
  48. op->flags |= F_WAITCRLF;
  49. break;
  50. @@ -1251,4 +1259,26 @@
  51. #endif
  52. (void) sleep((unsigned) 10); /* be kind to init(8) */
  53. exit(1);
  54. +}
  55. +
  56. +/* signal handler for alarm() timeout when doing SAK blocking */
  57. +
  58. +void sak_blocking(int signr) {
  59. + char buf[512];
  60. + int fd,rc,i;
  61. +
  62. + if (signr != SIGALRM) return;
  63. + alarm(0);
  64. +
  65. + /* print the SAK Message */
  66. + fd=open(sakmsg,O_RDONLY);
  67. + if (fd >= 0) {
  68. + while ( (rc=read(fd,buf,512)) > 0 )
  69. + write(1,buf,rc);
  70. + close(fd);
  71. + }
  72. +
  73. + /* lock */
  74. + for (i=1; i<=30; i++) signal(i,SIG_IGN);
  75. + while (1) sleep(600);
  76. }