2
0

signal.inc 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. {
  2. This file is part of the Free Pascal run time library.
  3. Copyright (c) 2001 by Free Pascal development team
  4. This file implements all the types/constants related
  5. to signal for Solaris.
  6. See the file COPYING.FPC, included in this distribution,
  7. for details about the copyright.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11. **********************************************************************}
  12. const
  13. {************************ signals *****************************}
  14. { more can be provided. Herein are only included the required }
  15. { values. }
  16. {**************************************************************}
  17. SIGABRT = 6; { abnormal termination }
  18. SIGALRM = 14; { alarm clock (used with alarm() }
  19. SIGFPE = 8; { illegal arithmetic operation }
  20. SIGHUP = 1; { Hangup }
  21. SIGILL = 4; { Illegal instruction }
  22. SIGINT = 2; { Interactive attention signal }
  23. SIGKILL = 9; { Kill, cannot be caught }
  24. SIGPIPE = 13; { Broken pipe signal }
  25. SIGQUIT = 3; { Interactive termination signal }
  26. SIGSEGV = 11; { Detection of invalid memory reference }
  27. SIGTERM = 15; { Termination request }
  28. SIGUSR1 = 16; { Application defined signal 1 }
  29. SIGUSR2 = 17; { Application defined signal 2 }
  30. SIGCHLD = 18; { Child process terminated / stopped }
  31. SIGCONT = 25; { Continue if stopped }
  32. SIGSTOP = 23; { Stop signal. cannot be cuaght }
  33. SIGSTP = 24; { Interactive stop signal }
  34. SIGTTIN = 26; { Background read from TTY }
  35. SIGTTOU = 27; { Background write to TTY }
  36. SIGBUS = 10; { Access to undefined memory }
  37. { Solaris specific signals }
  38. SIGTRAP = 5; { trace trap (not reset when caught) }
  39. SIGIOT = 6; { IOT instruction }
  40. SIGEMT = 7; { EMT instruction }
  41. SIGSYS = 12; { bad argument to system call }
  42. SIGCLD = 18; { child status change }
  43. SIGPWR = 19; { power-fail restart }
  44. SIGWINCH = 20; { window size change }
  45. SIGURG = 21; { urgent socket condition }
  46. SIGPOLL = 22; { pollable event occurred }
  47. SIGIO = SIGPOLL;{ socket I/O possible (SIGPOLL alias) }
  48. SIGVTALRM = 28; { virtual timer expired }
  49. SIGPROF = 29; { profiling timer expired }
  50. SIGXCPU = 30; { exceeded cpu limit }
  51. SIGXFSZ = 31; { exceeded file size limit }
  52. SIGWAITING = 32; { process's lwps are blocked }
  53. SIGLWP = 33; { special signal used by thread library }
  54. SIGFREEZE = 34; { special signal used by CPR }
  55. SIGTHAW = 35; { special signal used by CPR }
  56. SIGCANCEL = 36; { thread cancellation signal used by libthread }
  57. SIGLOST = 37; { resource lost (eg, record-lock lost) }
  58. SIG_BLOCK = 1;
  59. SIG_UNBLOCK = 2;
  60. SIG_SETMASK = 3;
  61. SIG_DFL = 0 ;
  62. SIG_IGN = 1 ;
  63. SIG_ERR = -1 ;
  64. { definitions for the sa_flags field }
  65. SA_ONSTACK = $00000001;
  66. SA_RESETHAND = $00000002;
  67. SA_RESTART = $00000004;
  68. SA_SIGINFO = $00000008;
  69. SA_NODEFER = $00000010;
  70. SA_NOCLDWAIT = $00010000;
  71. SA_WAITSIG = $00010000;
  72. {$ifdef cpu64}
  73. SI_PAD_SIZE = ((256 div sizeof(cint)) - 4);
  74. {$else}
  75. SI_PAD_SIZE = ((128 div sizeof(cint)) - 3);
  76. {$endif}
  77. type
  78. SigSet = array[0..wordsinsigset-1] of cint;
  79. sigset_t= SigSet;
  80. PSigSet = ^SigSet;
  81. psigset_t=psigset;
  82. TSigSet = SigSet;
  83. t_pdata = record
  84. case longint of
  85. 1 : ( _kill : record
  86. _uid : uid_t;
  87. _value : cint; { signal sent? }
  88. end );
  89. 2 : ( _cld : record
  90. _utime : clock_t;
  91. _status : cint;
  92. _stime : clock_t;
  93. end );
  94. end;
  95. t_proc = record
  96. _pid: pid_t;
  97. _pdata: t_pdata;
  98. end;
  99. psiginfo = ^tsiginfo;
  100. tsiginfo = record
  101. si_signo : cint;
  102. si_code : cint;
  103. si_errno : cint;
  104. {$ifdef cpu64}
  105. si_pad : cint;
  106. {$endif cpu64}
  107. _sifields : record
  108. case longint of
  109. 0 : ( _pad : array[0..(SI_PAD_SIZE)-1] of cint );
  110. 1 : ( _proc : t_proc);
  111. 3 : ( _rctl : record
  112. _entity : longint; { int32_t }
  113. end );
  114. 5 : ( _sigfault : record
  115. _addr : pointer;
  116. _trapno : cint;
  117. _pc : pointer;
  118. end );
  119. 6 : ( _sigpoll : record
  120. _fd : longint;
  121. _band : longint;
  122. end );
  123. end;
  124. end;
  125. { CPU dependent TSigContext }
  126. {$i sighndh.inc}
  127. type
  128. SignalHandler = Procedure(Sig : Longint);cdecl;
  129. PSignalHandler = ^SignalHandler;
  130. SignalRestorer = Procedure;cdecl;
  131. PSignalRestorer = ^SignalRestorer;
  132. SigActionHandler = procedure(sig : longint; SigInfo: PSigInfo; SigContext: PSigContext);cdecl;
  133. {$ifdef x86_64}
  134. SigActionRec = record // this needs correct 8-byte alignment for hander
  135. Sa_Flags : cuint;
  136. sa_handler : SigActionHandler;
  137. Sa_Mask : SigSet;
  138. end;
  139. {$else not x86_64}
  140. SigActionRec = packed record // this is temporary for the migration
  141. Sa_Flags : cuint;
  142. sa_handler : SigActionHandler;
  143. Sa_Mask : SigSet;
  144. sa_resv : array[1..2] of cint; { for non-_LP64 platforms only }
  145. end;
  146. {$endif not x86_64}
  147. TSigActionRec = SigActionRec;
  148. PSigActionRec = ^SigActionRec;