sigs.c 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. /*
  2. * sigs.c - External routines to deal with signals
  3. *
  4. * Author: Leigh Stoller
  5. * Computer Science Dept.
  6. * University of Utah
  7. * Date: 18-Aug-1986
  8. * Status: Open Source: BSD License
  9. *
  10. * Redistribution and use in source and binary forms, with or without
  11. * modification, are permitted provided that the following conditions are met:
  12. *
  13. * * Redistributions of source code must retain the relevant copyright
  14. * notice, this list of conditions and the following disclaimer.
  15. * * Redistributions in binary form must reproduce the above copyright
  16. * notice, this list of conditions and the following disclaimer in the
  17. * documentation and/or other materials provided with the distribution.
  18. *
  19. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  20. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
  21. * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  22. * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNERS OR
  23. * CONTRIBUTORS
  24. * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  25. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  26. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  27. * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  28. * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  29. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  30. * POSSIBILITY OF SUCH DAMAGE.
  31. *
  32. ******************************************************************************
  33. */
  34. /*
  35. * There used to be a collection of comments here describing revisions
  36. * made from about 1982 to 1989. I think those are by now of interest
  37. * to archaeologists! So anybody who wants to see them can consult older
  38. * copies of this file in the repositories. It is neverthless proper to
  39. * record the names of those who (in addition to the original author)
  40. * have contributed:
  41. * Chris Burdorf
  42. */
  43. #include <unistd.h>
  44. #include <stdio.h>
  45. #include <signal.h>
  46. #include <inttypes.h>
  47. #include <sys/stat.h>
  48. #include "psl.h"
  49. #if 0
  50. /* This bit will need review! */
  51. #include <ieeefp.h>
  52. fp_rnd fp_round;
  53. fp_except fp_mask,fp_stick;
  54. int fp_first=0;
  55. #endif
  56. int forminit(FILE **, FILE **);
  57. struct sigaction act;
  58. void _(sun3_sigset)(int sig, void (*action)())
  59. { TR;
  60. struct sigaction act = {0};
  61. if (signal(sig, SIG_IGN) != SIG_IGN)
  62. { //#signal(sig, action);
  63. act.sa_sigaction = action;
  64. act.sa_flags = SA_SIGINFO | SA_RESTART;
  65. sigaction(sig, &act, (void*)0);
  66. }
  67. #if 0
  68. if (sig == SIGFPE && fp_first == 0)
  69. { fp_first=1;
  70. fp_round = fpgetround();
  71. fp_mask = fpgetmask();
  72. fp_stick = fpgetsticky();
  73. }
  74. #endif
  75. }
  76. void _(sun3_sigrelse)(int sig, void (*action)())
  77. { TR;
  78. #if 0
  79. if (sig == SIGFPE)
  80. { fpsetsticky(0);
  81. fpsetround(FP_RN);
  82. fpsetmask(fp_mask);
  83. }
  84. signal(sig, action);
  85. #endif
  86. }
  87. int _(ieee_handler)(char *x, int y)
  88. { TR;
  89. return mkfifo(x, y);
  90. }
  91. int _(ieee_flags)(int64_t x1, intptr_t x2, intptr_t x3, int64_t x4)
  92. { TR;
  93. if (x1 == 10) return forminit((FILE **)x2, (FILE **)x3);
  94. else return 0;
  95. }
  96. /* end of sigs.c */