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.

82 lines
2.3 KiB

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