signal.inc 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299
  1. {$PACKRECORDS C}
  2. {
  3. $Id$
  4. Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
  5. @APPLE_LICENSE_HEADER_START@
  6. The contents of this file constitute Original Code as defined in and
  7. are subject to the Apple Public Source License Version 1.1 (the
  8. "License"). You may not use this file except in compliance with the
  9. License. Please obtain a copy of the License at
  10. http://www.apple.com/publicsource and read it before using this file.
  11. This Original Code and all software distributed under the License are
  12. distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
  13. EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
  14. INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
  15. FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
  16. License for the specific language governing rights and limitations
  17. under the License.
  18. @APPLE_LICENSE_HEADER_END@
  19. }
  20. { Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved }
  21. {
  22. Copyright (c) 1982, 1986, 1989, 1991, 1993
  23. The Regents of the University of California. All rights reserved.
  24. (c) UNIX System Laboratories, Inc.
  25. All or some portions of this file are derived from material licensed
  26. to the University of California by American Telephone and Telegraph
  27. Co. or Unix System Laboratories, Inc. and are reproduced herein with
  28. the permission of UNIX System Laboratories, Inc.
  29. Redistribution and use in source and binary forms, with or without
  30. modification, are permitted provided that the following conditions
  31. are met:
  32. 1. Redistributions of source code must retain the above copyright
  33. notice, this list of conditions and the following disclaimer.
  34. 2. Redistributions in binary form must reproduce the above copyright
  35. notice, this list of conditions and the following disclaimer in the
  36. documentation and/or other materials provided with the distribution.
  37. 3. All advertising materials mentioning features or use of this software
  38. must display the following acknowledgement:
  39. This product includes software developed by the University of
  40. California, Berkeley and its contributors.
  41. 4. Neither the name of the University nor the names of its contributors
  42. may be used to endorse or promote products derived from this software
  43. without specific prior written permission.
  44. THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  45. ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  46. IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  47. ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  48. FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  49. DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  50. OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  51. HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  52. LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  53. OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  54. SUCH DAMAGE.
  55. @(#)signal.h 8.2 (Berkeley) 1/21/94
  56. }
  57. {$ifdef cpupowerpc}
  58. {$include powerpc/sig_cpu.inc} { sigcontext }
  59. {$else cpupowerpc}
  60. {$ifdef cpui386}
  61. {$include i386/sig_cpu.inc} { sigcontext }
  62. {$else cpui386}
  63. {$error Unsupported cpu type!}
  64. {$endif cpui386}
  65. {$endif cpupowerpc}
  66. const
  67. SA_NOCLDSTOP = 8;
  68. SA_ONSTACK = $001; { take signal on signal stack }
  69. SA_RESTART = $002; { restart system call on signal return }
  70. SA_RESETHAND = $004; { reset to SIG_DFL when taking signal }
  71. SA_NODEFER = $010; { don't mask the signal we're delivering }
  72. SA_NOCLDWAIT = $020; { don't keep zombies around }
  73. SA_SIGINFO = $040; { signal handler with SA_SIGINFO args }
  74. SA_USERTRAMP = $100; { SUNOS compat: Do not bounce off kernel's sigtramp }
  75. { hangup }
  76. SIGHUP = 1;
  77. { interrupt }
  78. SIGINT = 2;
  79. { quit }
  80. SIGQUIT = 3;
  81. { illegal instruction (not reset when caught) }
  82. SIGILL = 4;
  83. { trace trap (not reset when caught) }
  84. SIGTRAP = 5;
  85. { abort() }
  86. SIGABRT = 6;
  87. { compatibility }
  88. SIGIOT = SIGABRT;
  89. { EMT instruction }
  90. SIGEMT = 7;
  91. { floating point exception }
  92. SIGFPE = 8;
  93. { kill (cannot be caught or ignored) }
  94. SIGKILL = 9;
  95. { bus error }
  96. SIGBUS = 10;
  97. { segmentation violation }
  98. SIGSEGV = 11;
  99. { bad argument to system call }
  100. SIGSYS = 12;
  101. { write on a pipe with no one to read it }
  102. SIGPIPE = 13;
  103. { alarm clock }
  104. SIGALRM = 14;
  105. { software termination signal from kill }
  106. SIGTERM = 15;
  107. { urgent condition on IO channel }
  108. SIGURG = 16;
  109. { sendable stop signal not from tty }
  110. SIGSTOP = 17;
  111. { stop signal from tty }
  112. SIGTSTP = 18;
  113. { continue a stopped process }
  114. SIGCONT = 19;
  115. { to parent on child stop or exit }
  116. SIGCHLD = 20;
  117. { to readers pgrp upon background tty read }
  118. SIGTTIN = 21;
  119. { like TTIN for output if (tp->t_local&LTOSTOP) }
  120. SIGTTOU = 22;
  121. { input/output possible signal }
  122. SIGIO = 23;
  123. { exceeded CPU time limit }
  124. SIGXCPU = 24;
  125. { exceeded file size limit }
  126. SIGXFSZ = 25;
  127. { virtual time alarm }
  128. SIGVTALRM = 26;
  129. { profiling time alarm }
  130. SIGPROF = 27;
  131. { window size changes }
  132. SIGWINCH = 28;
  133. { information request }
  134. SIGINFO = 29;
  135. { user defined signal 1 }
  136. SIGUSR1 = 30;
  137. { user defined signal 2 }
  138. SIGUSR2 = 31;
  139. SIG_DFL = 0;
  140. SIG_IGN = 1;
  141. SIG_ERR = -1;
  142. type
  143. sigset_t = array[0..0] of cuint;
  144. Sigval = Record
  145. Case Boolean OF
  146. { Members as suggested by Annex C of POSIX 1003.1b. }
  147. false : (sigval_int : cint);
  148. True : (sigval_ptr : Pointer);
  149. End;
  150. TSigInfo_t = record
  151. si_signo, { signal number }
  152. si_errno, { errno association }
  153. {
  154. * Cause of signal, one of the SI_ macros or signal-specific
  155. * values, i.e. one of the FPE_... values for SIGFPE. This
  156. * value is equivalent to the second argument to an old-style
  157. * FreeBSD signal handler.
  158. }
  159. si_code, { signal code }
  160. si_pid : cint; { sending process }
  161. si_uid : cuint; { sender's ruid }
  162. si_status : cint; { exit value }
  163. si_addr : Pointer; { faulting instruction }
  164. si_value : SigVal; { signal value }
  165. si_band : cuint; { band event for SIGPOLL }
  166. pad : array[0..6] of cint; { Reserved for Future Use }
  167. end;
  168. SignalHandler = Procedure(Sig : Longint);cdecl;
  169. PSignalHandler = ^SignalHandler;
  170. SignalRestorer = Procedure;cdecl;
  171. PSignalRestorer = ^SignalRestorer;
  172. TSigAction = procedure (Sig: cint; var info : tsiginfo_t;Var SigContext:SigContextRec); cdecl;
  173. TSigset=sigset_t;
  174. Sigset=sigset_t;
  175. PSigSet = ^TSigSet;
  176. SigActionRec = packed record
  177. {
  178. case byte of
  179. 0: (Sh: SignalHandler; Sa_Flags: longint; Sa_Mask: SigSet);
  180. 1: (sa_handler: TSigAction);
  181. }
  182. Sa_Handler: TSigAction;
  183. Sa_Flags: longint;
  184. Sa_Mask: TSigSet;
  185. end;
  186. PSigActionRec = ^SigActionRec;
  187. {
  188. Flags for sigprocmask:
  189. }
  190. const
  191. { block specified signal set }
  192. SIG_BLOCK = 1;
  193. { unblock specified signal set }
  194. SIG_UNBLOCK = 2;
  195. { set specified signal set }
  196. SIG_SETMASK = 3;
  197. { type of signal function }
  198. {
  199. Structure used in sigaltstack call.
  200. }
  201. { signal stack base }
  202. { signal stack length }
  203. { SA_DISABLE and/or SA_ONSTACK }
  204. type
  205. sigaltstack = record
  206. ss_sp : ^char;
  207. ss_size : longint;
  208. ss_flags : longint;
  209. end;
  210. { minimum allowable stack }
  211. const
  212. MINSIGSTKSZ = 8192;
  213. { recommended stack size }
  214. { already defined in another BSD include file }
  215. // SIGSTKSZ = MINSIGSTKSZ + 32768;
  216. {
  217. 4.3 compatibility:
  218. Signal vector "template" used in sigvec call.
  219. }
  220. type
  221. sigvec = record
  222. { signal handler }
  223. sv_handler : procedure ;
  224. { signal mask to apply }
  225. sv_mask : longint;
  226. { see signal options below }
  227. sv_flags : longint;
  228. end;
  229. const
  230. SV_ONSTACK = SA_ONSTACK;
  231. { same bit, opposite sense }
  232. SV_INTERRUPT = SA_RESTART;
  233. { Codes for SIGFPE }
  234. FPE_NOOP = 0; { if only I knew... }
  235. FPE_FLTDIV = 1; { floating point divide by zero }
  236. FPE_INTDIV = FPE_FLTDIV;
  237. FPE_FLTOVF = 2; { floating point overflow }
  238. FPE_FLTUND = 3; { floating point underflow }
  239. FPE_FLTRES = 4; { floating point inexact result }
  240. FPE_FLTINV = 5; { invalid floating point operation }
  241. (*
  242. {
  243. Structure used in sigstack call.
  244. }
  245. { signal stack pointer }
  246. { current status }
  247. type
  248. sigstack = record
  249. ss_sp : ^char;
  250. ss_onstack : longint;
  251. end;
  252. *)
  253. {
  254. $Log$
  255. Revision 1.4 2004-01-04 20:05:38 jonas
  256. * first working version of the Darwin/Mac OS X (for PowerPC) RTL
  257. Several non-essential units are still missing, but make cycle works
  258. Revision 1.3 2003/08/21 22:25:17 olle
  259. - removed parameter from fpc_iocheck
  260. Revision 1.2 2003/05/25 12:59:57 jonas
  261. * several fixes, addition of Mach trap numbers (thye are simply syscalls
  262. with a negative number)
  263. Revision 1.1 2002/09/08 09:06:07 jonas
  264. + initial revision, h2pas of sys/signal.h
  265. }