d: Merge upstream dmd, druntime 4ca4140e58, phobos 454dff14d.
[official-gcc.git] / libphobos / libdruntime / core / sys / posix / signal.d
blobf722bc4df628f4efa2ad8e12c6c2fef8a6064f80
1 /**
2 * D header file for POSIX.
4 * Copyright: Copyright Sean Kelly 2005 - 2009.
5 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
6 * Authors: Sean Kelly,
7 Alex Rønne Petersen
8 * Standards: The Open Group Base Specifications Issue 6, IEEE Std 1003.1, 2004 Edition
9 * Source: $(DRUNTIMESRC core/sys/posix/_signal.d)
12 module core.sys.posix.signal;
14 import core.sys.posix.config;
15 public import core.stdc.signal;
16 public import core.sys.posix.sys.types; // for pid_t
17 public import core.sys.posix.time; // for timespec
19 version (OSX)
20 version = Darwin;
21 else version (iOS)
22 version = Darwin;
23 else version (TVOS)
24 version = Darwin;
25 else version (WatchOS)
26 version = Darwin;
28 version (ARM) version = ARM_Any;
29 version (AArch64) version = ARM_Any;
30 version (HPPA) version = HPPA_Any;
31 version (MIPS32) version = MIPS_Any;
32 version (MIPS64) version = MIPS_Any;
33 version (PPC) version = PPC_Any;
34 version (PPC64) version = PPC_Any;
35 version (RISCV32) version = RISCV_Any;
36 version (RISCV64) version = RISCV_Any;
37 version (S390) version = IBMZ_Any;
38 version (SPARC) version = SPARC_Any;
39 version (SPARC64) version = SPARC_Any;
40 version (SystemZ) version = IBMZ_Any;
41 version (X86) version = X86_Any;
42 version (X86_64) version = X86_Any;
44 version (Posix):
45 extern (C):
46 //nothrow: // this causes http://issues.dlang.org/show_bug.cgi?id=12738 (which has been fixed)
47 //@system:
50 // Required
53 SIG_DFL (defined in core.stdc.signal)
54 SIG_ERR (defined in core.stdc.signal)
55 SIG_IGN (defined in core.stdc.signal)
57 sig_atomic_t (defined in core.stdc.signal)
59 SIGEV_NONE
60 SIGEV_SIGNAL
61 SIGEV_THREAD
63 union sigval
65 int sival_int;
66 void* sival_ptr;
69 SIGRTMIN
70 SIGRTMAX
72 SIGABRT (defined in core.stdc.signal)
73 SIGALRM
74 SIGBUS
75 SIGCHLD
76 SIGCONT
77 SIGFPE (defined in core.stdc.signal)
78 SIGHUP
79 SIGILL (defined in core.stdc.signal)
80 SIGINT (defined in core.stdc.signal)
81 SIGKILL
82 SIGPIPE
83 SIGQUIT
84 SIGSEGV (defined in core.stdc.signal)
85 SIGSTOP
86 SIGTERM (defined in core.stdc.signal)
87 SIGTSTP
88 SIGTTIN
89 SIGTTOU
90 SIGUSR1
91 SIGUSR2
92 SIGURG
94 struct sigaction_t
96 sigfn_t sa_handler;
97 sigset_t sa_mask;
98 sigactfn_t sa_sigaction;
101 sigfn_t signal(int sig, sigfn_t func); (defined in core.stdc.signal)
102 int raise(int sig); (defined in core.stdc.signal)
105 //SIG_DFL (defined in core.stdc.signal)
106 //SIG_ERR (defined in core.stdc.signal)
107 //SIG_IGN (defined in core.stdc.signal)
109 //sig_atomic_t (defined in core.stdc.signal)
111 private alias void function(int) sigfn_t;
112 private alias void function(int, siginfo_t*, void*) sigactfn_t;
114 // nothrow versions
115 nothrow @nogc
117 private alias void function(int) sigfn_t2;
118 private alias void function(int, siginfo_t*, void*) sigactfn_t2;
121 enum
123 SIGEV_SIGNAL,
124 SIGEV_NONE,
125 SIGEV_THREAD
128 union sigval
130 int sival_int;
131 void* sival_ptr;
134 version (Solaris)
136 import core.sys.posix.unistd;
138 @property int SIGRTMIN() nothrow @nogc {
139 __gshared static int sig = -1;
140 if (sig == -1) {
141 sig = cast(int)sysconf(_SC_SIGRT_MIN);
143 return sig;
146 @property int SIGRTMAX() nothrow @nogc {
147 __gshared static int sig = -1;
148 if (sig == -1) {
149 sig = cast(int)sysconf(_SC_SIGRT_MAX);
151 return sig;
154 else version (FreeBSD)
156 // Note: it appears that FreeBSD (prior to 7) and OSX do not support realtime signals
157 // https://github.com/freebsd/freebsd/blob/e79c62ff68fc74d88cb6f479859f6fae9baa5101/sys/sys/signal.h#L117
158 enum SIGRTMIN = 65;
159 enum SIGRTMAX = 126;
161 else version (DragonFlyBSD)
163 enum SIGRTMIN = 35;
164 enum SIGRTMAX = 126;
166 else version (NetBSD)
168 enum SIGRTMIN = 33;
169 enum SIGRTMAX = 63;
171 else version (linux)
173 // Note: CRuntime_Bionic switched to calling these functions
174 // since Lollipop, and Glibc, UClib and Musl all implement them
175 // the same way since it's part of LSB.
176 private extern (C) nothrow @nogc
178 int __libc_current_sigrtmin();
179 int __libc_current_sigrtmax();
182 @property int SIGRTMIN() nothrow @nogc {
183 __gshared static int sig = -1;
184 if (sig == -1) {
185 sig = __libc_current_sigrtmin();
187 return sig;
190 @property int SIGRTMAX() nothrow @nogc {
191 __gshared static int sig = -1;
192 if (sig == -1) {
193 sig = __libc_current_sigrtmax();
195 return sig;
199 version (linux)
201 version (X86_Any)
203 //SIGABRT (defined in core.stdc.signal)
204 enum SIGALRM = 14;
205 enum SIGBUS = 7;
206 enum SIGCHLD = 17;
207 enum SIGCONT = 18;
208 //SIGFPE (defined in core.stdc.signal)
209 enum SIGHUP = 1;
210 //SIGILL (defined in core.stdc.signal)
211 //SIGINT (defined in core.stdc.signal)
212 enum SIGKILL = 9;
213 enum SIGPIPE = 13;
214 enum SIGQUIT = 3;
215 //SIGSEGV (defined in core.stdc.signal)
216 enum SIGSTOP = 19;
217 //SIGTERM (defined in core.stdc.signal)
218 enum SIGTSTP = 20;
219 enum SIGTTIN = 21;
220 enum SIGTTOU = 22;
221 enum SIGUSR1 = 10;
222 enum SIGUSR2 = 12;
223 enum SIGURG = 23;
225 else version (HPPA_Any)
227 //SIGABRT (defined in core.stdc.signal)
228 enum SIGALRM = 14;
229 enum SIGBUS = 10;
230 enum SIGCHLD = 18;
231 enum SIGCONT = 26;
232 //SIGFPE (defined in core.stdc.signal)
233 enum SIGHUP = 1;
234 //SIGILL (defined in core.stdc.signal)
235 //SIGINT (defined in core.stdc.signal)
236 enum SIGKILL = 9;
237 enum SIGPIPE = 13;
238 enum SIGQUIT = 3;
239 //SIGSEGV (defined in core.stdc.signal)
240 enum SIGSTOP = 24;
241 //SIGTERM (defined in core.stdc.signal)
242 enum SIGTSTP = 25;
243 enum SIGTTIN = 27;
244 enum SIGTTOU = 28;
245 enum SIGUSR1 = 16;
246 enum SIGUSR2 = 17;
247 enum SIGURG = 29;
249 else version (MIPS_Any)
251 //SIGABRT (defined in core.stdc.signal)
252 enum SIGALRM = 14;
253 enum SIGBUS = 10;
254 enum SIGCHLD = 18;
255 enum SIGCONT = 25;
256 //SIGFPE (defined in core.stdc.signal)
257 enum SIGHUP = 1;
258 //SIGILL (defined in core.stdc.signal)
259 //SIGINT (defined in core.stdc.signal)
260 enum SIGKILL = 9;
261 enum SIGPIPE = 13;
262 enum SIGQUIT = 3;
263 //SIGSEGV (defined in core.stdc.signal)
264 enum SIGSTOP = 23;
265 //SIGTERM (defined in core.stdc.signal)
266 enum SIGTSTP = 24;
267 enum SIGTTIN = 26;
268 enum SIGTTOU = 27;
269 enum SIGUSR1 = 16;
270 enum SIGUSR2 = 17;
271 enum SIGURG = 21;
273 else version (PPC_Any)
275 //SIGABRT (defined in core.stdc.signal)
276 enum SIGALRM = 14;
277 enum SIGBUS = 7;
278 enum SIGCHLD = 17;
279 enum SIGCONT = 18;
280 //SIGFPE (defined in core.stdc.signal)
281 enum SIGHUP = 1;
282 //SIGILL (defined in core.stdc.signal)
283 //SIGINT (defined in core.stdc.signal)
284 enum SIGKILL = 9;
285 enum SIGPIPE = 13;
286 enum SIGQUIT = 3;
287 //SIGSEGV (defined in core.stdc.signal)
288 enum SIGSTOP = 19;
289 //SIGTERM (defined in core.stdc.signal)
290 enum SIGTSTP = 20;
291 enum SIGTTIN = 21;
292 enum SIGTTOU = 22;
293 enum SIGUSR1 = 10;
294 enum SIGUSR2 = 12;
295 enum SIGURG = 23;
297 else version (ARM_Any)
299 //SIGABRT (defined in core.stdc.signal)
300 enum SIGALRM = 14;
301 enum SIGBUS = 7;
302 enum SIGCHLD = 17;
303 enum SIGCONT = 18;
304 //SIGFPE (defined in core.stdc.signal)
305 enum SIGHUP = 1;
306 //SIGILL (defined in core.stdc.signal)
307 //SIGINT (defined in core.stdc.signal)
308 enum SIGKILL = 9;
309 enum SIGPIPE = 13;
310 enum SIGQUIT = 3;
311 //SIGSEGV (defined in core.stdc.signal)
312 enum SIGSTOP = 19;
313 //SIGTERM (defined in core.stdc.signal)
314 enum SIGTSTP = 20;
315 enum SIGTTIN = 21;
316 enum SIGTTOU = 22;
317 enum SIGUSR1 = 10;
318 enum SIGUSR2 = 12;
319 enum SIGURG = 23;
321 else version (RISCV_Any)
323 //SIGABRT (defined in core.stdc.signal)
324 enum SIGALRM = 14;
325 enum SIGBUS = 7;
326 enum SIGCHLD = 17;
327 enum SIGCONT = 18;
328 //SIGFPE (defined in core.stdc.signal)
329 enum SIGHUP = 1;
330 //SIGILL (defined in core.stdc.signal)
331 //SIGINT (defined in core.stdc.signal)
332 enum SIGKILL = 9;
333 enum SIGPIPE = 13;
334 enum SIGQUIT = 3;
335 //SIGSEGV (defined in core.stdc.signal)
336 enum SIGSTOP = 19;
337 //SIGTERM (defined in core.stdc.signal)
338 enum SIGTSTP = 20;
339 enum SIGTTIN = 21;
340 enum SIGTTOU = 22;
341 enum SIGUSR1 = 10;
342 enum SIGUSR2 = 12;
343 enum SIGURG = 23;
345 else version (SPARC_Any)
347 //SIGABRT (defined in core.stdc.signal)
348 enum SIGALRM = 14;
349 enum SIGBUS = 10;
350 enum SIGCHLD = 20;
351 enum SIGCONT = 19;
352 //SIGFPE (defined in core.stdc.signal)
353 enum SIGHUP = 1;
354 //SIGILL (defined in core.stdc.signal)
355 //SIGINT (defined in core.stdc.signal)
356 enum SIGKILL = 9;
357 enum SIGPIPE = 13;
358 enum SIGQUIT = 3;
359 //SIGSEGV (defined in core.stdc.signal)
360 enum SIGSTOP = 17;
361 //SIGTERM (defined in core.stdc.signal)
362 enum SIGTSTP = 18;
363 enum SIGTTIN = 21;
364 enum SIGTTOU = 22;
365 enum SIGUSR1 = 30;
366 enum SIGUSR2 = 31;
367 enum SIGURG = 16;
369 else version (IBMZ_Any)
371 //SIGABRT (defined in core.stdc.signal)
372 enum SIGALRM = 14;
373 enum SIGBUS = 7;
374 enum SIGCHLD = 17;
375 enum SIGCONT = 18;
376 //SIGFPE (defined in core.stdc.signal)
377 enum SIGHUP = 1;
378 //SIGILL (defined in core.stdc.signal)
379 //SIGINT (defined in core.stdc.signal)
380 enum SIGKILL = 9;
381 enum SIGPIPE = 13;
382 enum SIGQUIT = 3;
383 //SIGSEGV (defined in core.stdc.signal)
384 enum SIGSTOP = 19;
385 //SIGTERM (defined in core.stdc.signal)
386 enum SIGTSTP = 20;
387 enum SIGTTIN = 21;
388 enum SIGTTOU = 22;
389 enum SIGUSR1 = 10;
390 enum SIGUSR2 = 12;
391 enum SIGURG = 23;
393 else
394 static assert(0, "unimplemented");
396 else version (Darwin)
398 //SIGABRT (defined in core.stdc.signal)
399 enum SIGALRM = 14;
400 enum SIGBUS = 10;
401 enum SIGCHLD = 20;
402 enum SIGCONT = 19;
403 //SIGFPE (defined in core.stdc.signal)
404 enum SIGHUP = 1;
405 //SIGILL (defined in core.stdc.signal)
406 //SIGINT (defined in core.stdc.signal)
407 enum SIGKILL = 9;
408 enum SIGPIPE = 13;
409 enum SIGQUIT = 3;
410 //SIGSEGV (defined in core.stdc.signal)
411 enum SIGSTOP = 17;
412 //SIGTERM (defined in core.stdc.signal)
413 enum SIGTSTP = 18;
414 enum SIGTTIN = 21;
415 enum SIGTTOU = 22;
416 enum SIGUSR1 = 30;
417 enum SIGUSR2 = 31;
418 enum SIGURG = 16;
420 else version (FreeBSD)
422 //SIGABRT (defined in core.stdc.signal)
423 enum SIGALRM = 14;
424 enum SIGBUS = 10;
425 enum SIGCHLD = 20;
426 enum SIGCONT = 19;
427 //SIGFPE (defined in core.stdc.signal)
428 enum SIGHUP = 1;
429 //SIGILL (defined in core.stdc.signal)
430 //SIGINT (defined in core.stdc.signal)
431 enum SIGKILL = 9;
432 enum SIGPIPE = 13;
433 enum SIGQUIT = 3;
434 //SIGSEGV (defined in core.stdc.signal)
435 enum SIGSTOP = 17;
436 //SIGTERM (defined in core.stdc.signal)
437 enum SIGTSTP = 18;
438 enum SIGTTIN = 21;
439 enum SIGTTOU = 22;
440 enum SIGUSR1 = 30;
441 enum SIGUSR2 = 31;
442 enum SIGURG = 16;
444 else version (NetBSD)
446 //SIGABRT (defined in core.stdc.signal)
447 enum SIGALRM = 14;
448 enum SIGBUS = 10;
449 enum SIGCHLD = 20;
450 enum SIGCONT = 19;
451 //SIGFPE (defined in core.stdc.signal)
452 enum SIGHUP = 1;
453 //SIGILL (defined in core.stdc.signal)
454 //SIGINT (defined in core.stdc.signal)
455 enum SIGKILL = 9;
456 enum SIGPIPE = 13;
457 enum SIGQUIT = 3;
458 //SIGSEGV (defined in core.stdc.signal)
459 enum SIGSTOP = 17;
460 //SIGTERM (defined in core.stdc.signal)
461 enum SIGTSTP = 18;
462 enum SIGTTIN = 21;
463 enum SIGTTOU = 22;
464 enum SIGUSR1 = 30;
465 enum SIGUSR2 = 31;
466 enum SIGURG = 16;
468 else version (OpenBSD)
470 //SIGABRT (defined in core.stdc.signal)
471 enum SIGALRM = 14;
472 enum SIGBUS = 10;
473 enum SIGCHLD = 20;
474 enum SIGCONT = 19;
475 //SIGFPE (defined in core.stdc.signal)
476 enum SIGHUP = 1;
477 //SIGILL (defined in core.stdc.signal)
478 //SIGINT (defined in core.stdc.signal)
479 enum SIGKILL = 9;
480 enum SIGPIPE = 13;
481 enum SIGQUIT = 3;
482 //SIGSEGV (defined in core.stdc.signal)
483 enum SIGSTOP = 17;
484 //SIGTERM (defined in core.stdc.signal)
485 enum SIGTSTP = 18;
486 enum SIGTTIN = 21;
487 enum SIGTTOU = 22;
488 enum SIGUSR1 = 30;
489 enum SIGUSR2 = 31;
490 enum SIGURG = 16;
492 else version (DragonFlyBSD)
494 //SIGABRT (defined in core.stdc.signal)
495 enum SIGALRM = 14;
496 enum SIGBUS = 10;
497 enum SIGCHLD = 20;
498 enum SIGCONT = 19;
499 //SIGFPE (defined in core.stdc.signal)
500 enum SIGHUP = 1;
501 //SIGILL (defined in core.stdc.signal)
502 //SIGINT (defined in core.stdc.signal)
503 enum SIGKILL = 9;
504 enum SIGPIPE = 13;
505 enum SIGQUIT = 3;
506 //SIGSEGV (defined in core.stdc.signal)
507 enum SIGSTOP = 17;
508 //SIGTERM (defined in core.stdc.signal)
509 enum SIGTSTP = 18;
510 enum SIGTTIN = 21;
511 enum SIGTTOU = 22;
512 enum SIGUSR1 = 30;
513 enum SIGUSR2 = 31;
514 enum SIGURG = 16;
516 else version (Solaris)
518 //SIGABRT (defined in core.stdc.signal)
519 enum SIGALRM = 14;
520 enum SIGBUS = 10;
521 enum SIGCHLD = 18;
522 enum SIGCONT = 25;
523 //SIGFPE (defined in core.stdc.signal)
524 enum SIGHUP = 1;
525 //SIGILL (defined in core.stdc.signal)
526 //SIGINT (defined in core.stdc.signal)
527 enum SIGKILL = 9;
528 enum SIGPIPE = 13;
529 enum SIGQUIT = 3;
530 //SIGSEGV (defined in core.stdc.signal)
531 enum SIGSTOP = 23;
532 //SIGTERM (defined in core.stdc.signal)
533 enum SIGTSTP = 24;
534 enum SIGTTIN = 26;
535 enum SIGTTOU = 27;
536 enum SIGUSR1 = 16;
537 enum SIGUSR2 = 17;
538 enum SIGURG = 21;
540 else
542 static assert(false, "Unsupported platform");
545 version (linux)
547 version (CRuntime_Musl)
549 struct sigaction_t
551 union
553 sigfn_t sa_handler;
554 sigactfn_t sa_sigaction;
556 sigset_t sa_mask;
557 int sa_flags;
558 void function() sa_restorer;
561 else version (CRuntime_Bionic)
563 version (D_LP64)
565 struct sigaction_t
567 int sa_flags;
568 union
570 sigfn_t sa_handler;
571 sigactfn_t sa_sigaction;
573 sigset_t sa_mask;
574 void function() sa_restorer;
577 else
579 struct sigaction_t
581 union
583 sigfn_t sa_handler;
584 sigactfn_t sa_sigaction;
586 sigset_t sa_mask;
587 int sa_flags;
588 void function() sa_restorer;
592 else version (SystemZ)
594 struct sigaction_t
596 static if ( true /* __USE_POSIX199309 */ )
598 union
600 sigfn_t sa_handler;
601 sigactfn_t sa_sigaction;
604 else
606 sigfn_t sa_handler;
608 version (CRuntime_Glibc)
610 int __glibc_reserved0;
611 int sa_flags;
613 else
615 c_ulong sa_flags;
618 void function() sa_restorer;
620 sigset_t sa_mask;
623 else version (HPPA_Any)
625 struct sigaction_t
627 static if ( true /* __USE_POSIX199309 */ )
629 union
631 sigfn_t sa_handler;
632 sigactfn_t sa_sigaction;
635 else
637 sigfn_t sa_handler;
639 version (CRuntime_Glibc)
641 version (D_LP64)
642 int __glibc_reserved0;
643 int sa_flags;
645 else
647 c_ulong sa_flags;
649 sigset_t sa_mask;
652 else version (MIPS_Any)
654 struct sigaction_t
656 int sa_flags;
658 static if ( true /* __USE_POSIX199309 */ )
660 union
662 sigfn_t sa_handler;
663 sigactfn_t sa_sigaction;
666 else
668 sigfn_t sa_handler;
670 sigset_t sa_mask;
671 void function() sa_restorer;
673 version (CRuntime_Glibc)
675 static if ((void*).sizeof < 8)
676 int[1] sa_resv;
680 else version (SPARC_Any)
682 struct sigaction_t
684 static if ( true /* __USE_POSIX199309 */ )
686 union
688 sigfn_t sa_handler;
689 sigactfn_t sa_sigaction;
692 else
694 sigfn_t sa_handler;
696 version (CRuntime_Glibc)
698 sigset_t sa_mask;
699 version (D_LP64)
700 int __glibc_reserved0;
701 int sa_flags;
702 void function() sa_restorer;
704 else
706 c_ulong sa_flags;
707 void function() sa_restorer;
708 sigset_t sa_mask;
712 else
714 struct sigaction_t
716 static if ( true /* __USE_POSIX199309 */ )
718 union
720 sigfn_t sa_handler;
721 sigactfn_t sa_sigaction;
724 else
726 sigfn_t sa_handler;
728 sigset_t sa_mask;
729 int sa_flags;
731 void function() sa_restorer;
735 else version (FreeBSD)
737 struct sigaction_t
739 union
741 sigfn_t sa_handler;
742 sigactfn_t sa_sigaction;
744 int sa_flags;
745 sigset_t sa_mask;
748 else version (NetBSD)
750 struct sigaction_t
752 union
754 sigfn_t sa_handler;
755 sigactfn_t sa_sigaction;
757 sigset_t sa_mask;
758 int sa_flags;
761 else version (OpenBSD)
763 struct sigaction_t
765 union
767 sigfn_t __sa_handler;
768 alias sa_handler = __sa_handler;
769 sigactfn_t __sa_sigaction;
770 alias sa_sigaction = __sa_sigaction;
772 sigset_t sa_mask;
773 int sa_flags;
776 else version (DragonFlyBSD)
778 struct sigaction_t
780 union
782 sigfn_t sa_handler;
783 sigactfn_t sa_sigaction;
785 int sa_flags;
786 sigset_t sa_mask;
789 else version (Solaris)
791 struct sigaction_t
793 int sa_flags;
795 union
797 sigfn_t sa_handler;
798 sigactfn_t sa_sigaction;
801 sigset_t sa_mask;
802 version (D_LP64) {}
803 else
804 int[2] sa_resv;
807 else version (Darwin)
809 struct sigaction_t
811 static if ( true /* __USE_POSIX199309 */ )
813 union
815 sigfn_t sa_handler;
816 sigactfn_t sa_sigaction;
819 else
821 sigfn_t sa_handler;
823 sigset_t sa_mask;
824 int sa_flags;
827 else
829 static assert(false, "Unsupported platform");
833 // C Extension (CX)
836 SIG_HOLD
838 sigset_t
839 pid_t (defined in core.sys.types)
841 SIGABRT (defined in core.stdc.signal)
842 SIGFPE (defined in core.stdc.signal)
843 SIGILL (defined in core.stdc.signal)
844 SIGINT (defined in core.stdc.signal)
845 SIGSEGV (defined in core.stdc.signal)
846 SIGTERM (defined in core.stdc.signal)
848 SA_NOCLDSTOP (CX|XSI)
849 SIG_BLOCK
850 SIG_UNBLOCK
851 SIG_SETMASK
853 struct siginfo_t
855 int si_signo;
856 int si_code;
858 version (XSI)
860 int si_errno;
861 pid_t si_pid;
862 uid_t si_uid;
863 void* si_addr;
864 int si_status;
865 c_long si_band;
867 version (RTS)
869 sigval si_value;
873 SI_USER
874 SI_QUEUE
875 SI_TIMER
876 SI_ASYNCIO
877 SI_MESGQ
880 nothrow @nogc
883 version (linux)
885 enum SIG_HOLD = cast(sigfn_t2) 2;
887 private enum _SIGSET_NWORDS = 1024 / (8 * c_ulong.sizeof);
889 struct sigset_t
891 c_ulong[_SIGSET_NWORDS] __val;
894 enum SA_NOCLDSTOP = 1; // (CX|XSI)
896 version (MIPS_Any)
898 enum SIG_BLOCK = 1;
899 enum SIG_UNBLOCK = 2;
900 enum SIG_SETMASK = 3;
902 else version (SPARC_Any)
904 enum SIG_BLOCK = 1;
905 enum SIG_UNBLOCK = 2;
906 enum SIG_SETMASK = 4;
908 else
910 enum SIG_BLOCK = 0;
911 enum SIG_UNBLOCK = 1;
912 enum SIG_SETMASK = 2;
915 private enum __SI_MAX_SIZE = 128;
917 static if ( __WORDSIZE == 64 )
919 private enum __SI_PAD_SIZE = ((__SI_MAX_SIZE / int.sizeof) - 4);
921 else
923 private enum __SI_PAD_SIZE = ((__SI_MAX_SIZE / int.sizeof) - 3);
926 struct siginfo_t
928 int si_signo;
929 version (MIPS_Any) // __SI_SWAP_ERRNO_CODE
931 int si_code;
932 int si_errno;
934 else
936 int si_errno;
937 int si_code;
940 union _sifields_t
942 int[__SI_PAD_SIZE] _pad;
944 // kill()
945 struct _kill_t
947 pid_t si_pid;
948 uid_t si_uid;
949 } _kill_t _kill;
950 // POSIX.1b timers.
951 struct _timer_t
953 int si_tid;
954 int si_overrun;
955 sigval si_sigval;
956 } _timer_t _timer;
958 // POSIX.1b signals
959 struct _rt_t
961 pid_t si_pid;
962 uid_t si_uid;
963 sigval si_sigval;
964 } _rt_t _rt;
966 // SIGCHLD
967 struct _sigchild_t
969 pid_t si_pid;
970 uid_t si_uid;
971 int si_status;
972 clock_t si_utime;
973 clock_t si_stime;
974 } _sigchild_t _sigchld;
976 // SIGILL, SIGFPE, SIGSEGV, SIGBUS
977 struct _sigfault_t
979 void* si_addr;
980 } _sigfault_t _sigfault;
982 // SIGPOLL
983 struct _sigpoll_t
985 c_long si_band;
986 int si_fd;
987 } _sigpoll_t _sigpoll;
988 } _sifields_t _sifields;
990 nothrow @nogc:
991 @property ref pid_t si_pid() return { return _sifields._kill.si_pid; }
992 @property ref uid_t si_uid() return { return _sifields._kill.si_uid; }
993 @property ref void* si_addr() return { return _sifields._sigfault.si_addr; }
994 @property ref int si_status() return { return _sifields._sigchld.si_status; }
995 @property ref c_long si_band() return { return _sifields._sigpoll.si_band; }
996 @property ref sigval si_value() return { return _sifields._rt.si_sigval; }
999 enum
1001 SI_ASYNCNL = -60,
1002 SI_TKILL = -6,
1003 SI_SIGIO,
1004 SI_ASYNCIO,
1005 SI_MESGQ,
1006 SI_TIMER,
1007 SI_QUEUE,
1008 SI_USER,
1009 SI_KERNEL = 0x80
1012 else version (Darwin)
1014 enum SIG_HOLD = cast(sigfn_t2) 5;
1016 alias uint sigset_t;
1018 enum SA_NOCLDSTOP = 8; // (CX|XSI)
1020 enum SIG_BLOCK = 1;
1021 enum SIG_UNBLOCK = 2;
1022 enum SIG_SETMASK = 3;
1024 struct siginfo_t
1026 int si_signo;
1027 int si_errno;
1028 int si_code;
1029 pid_t si_pid;
1030 uid_t si_uid;
1031 int si_status;
1032 void* si_addr;
1033 sigval si_value;
1034 int si_band;
1035 uint[7] pad;
1038 enum SI_USER = 0x10001;
1039 enum SI_QUEUE = 0x10002;
1040 enum SI_TIMER = 0x10003;
1041 enum SI_ASYNCIO = 0x10004;
1042 enum SI_MESGQ = 0x10005;
1044 else version (FreeBSD)
1046 enum SIG_HOLD = cast(sigfn_t2) 3;
1048 struct sigset_t
1050 uint[4] __bits;
1053 enum SA_NOCLDSTOP = 8;
1055 enum SIG_BLOCK = 1;
1056 enum SIG_UNBLOCK = 2;
1057 enum SIG_SETMASK = 3;
1059 struct siginfo_t
1061 int si_signo;
1062 int si_errno;
1063 int si_code;
1064 pid_t si_pid;
1065 uid_t si_uid;
1066 int si_status;
1067 void* si_addr;
1068 sigval si_value;
1069 union __reason
1071 struct __fault
1073 int _trapno;
1075 __fault _fault;
1076 struct __timer
1078 int _timerid;
1079 int _overrun;
1081 __timer _timer;
1082 struct __mesgq
1084 int _mqd;
1086 __mesgq _mesgq;
1087 struct __poll
1089 c_long _band;
1091 __poll _poll;
1092 struct ___spare___
1094 c_long __spare1__;
1095 int[7] __spare2__;
1097 ___spare___ __spare__;
1099 __reason _reason;
1101 @property ref c_long si_band() return { return _reason._poll._band; }
1104 enum SI_USER = 0x10001;
1105 enum SI_QUEUE = 0x10002;
1106 enum SI_TIMER = 0x10003;
1107 enum SI_ASYNCIO = 0x10004;
1108 enum SI_MESGQ = 0x10005;
1110 else version (NetBSD)
1112 enum SIG_HOLD = cast(sigfn_t2) 3;
1114 struct sigset_t
1116 uint[4] __bits;
1119 enum SA_NOCLDSTOP = 8;
1121 enum SIG_BLOCK = 1;
1122 enum SIG_UNBLOCK = 2;
1123 enum SIG_SETMASK = 3;
1125 union sigval_t
1127 int sival_int;
1128 void* sival_ptr;
1131 struct _ksiginfo
1133 int _signo;
1134 int _code;
1135 int _errno;
1136 version (D_LP64)
1137 int _pad;
1139 union reason_t
1141 struct rt_t
1143 pid_t _pid;
1144 uid_t _uid;
1145 sigval_t _value;
1146 } rt_t _rt;
1147 struct child_t
1149 pid_t _pid;
1150 uid_t _uid;
1151 int _status;
1152 clock_t _utime;
1153 clock_t _stime;
1154 } child_t _child;
1155 struct fault_t
1157 void* _addr;
1158 int _trap;
1159 int _trap2;
1160 int _trap3;
1161 } fault_t fault;
1162 struct poll_t
1164 c_long _band;
1165 int _fd;
1166 } poll_t _poll;
1168 reason_t _reason;
1171 union siginfo_t
1173 ubyte[128] si_pad;
1174 _ksiginfo _info;
1175 @property ref c_long si_band() return { return _info._reason._poll._band; }
1178 enum SI_USER = 0;
1179 enum SI_QUEUE = -1;
1180 enum SI_TIMER = -2;
1181 enum SI_ASYNCIO = -3;
1182 enum SI_MESGQ = -4;
1184 else version (OpenBSD)
1186 enum SIG_CATCH = cast(sigfn_t2) 2;
1187 enum SIG_HOLD = cast(sigfn_t2) 3;
1189 alias sigset_t = uint;
1191 enum SA_NOCLDSTOP = 0x0008;
1193 enum SIG_BLOCK = 1;
1194 enum SIG_UNBLOCK = 2;
1195 enum SIG_SETMASK = 3;
1197 private enum SI_MAXSZ = 128;
1198 private enum SI_PAD = (SI_MAXSZ / int.sizeof) - 3;
1200 struct siginfo_t
1202 int si_signo;
1203 int si_errno;
1204 int si_code;
1205 union _data
1207 int[SI_PAD] _pad;
1208 struct _proc
1210 pid_t _pid;
1211 union _pdata
1213 struct _kill
1215 uid_t _uid;
1216 sigval _value;
1218 struct _cld
1220 clock_t _utime;
1221 clock_t _stime;
1222 int _status;
1226 struct _fault
1228 caddr_t _addr;
1229 int _trapno;
1232 alias si_pid = _data._proc._pid;
1233 alias si_status = _data._proc._pdata._cld._status;
1234 alias si_stime = _data._proc._pdata._cld._stime;
1235 alias si_utime = _data._proc._pdata._cld._utime;
1236 alias si_uid = _data._proc._pdata._kill._uid;
1237 alias si_value = _data._proc._pdata._kill._value;
1238 alias si_addr = _data._fault._addr;
1239 alias si_trapno = _data._fault._trapno;
1242 enum SI_NOINFO = 32767;
1243 enum SI_USER = 0;
1244 enum SI_LWP = -1;
1245 enum SI_QUEUE = -2;
1246 enum SI_TIMER = -3;
1248 else version (DragonFlyBSD)
1250 enum SIG_CATCH = cast(sigfn_t2) 2;
1251 enum SIG_HOLD = cast(sigfn_t2) 3;
1253 struct sigset_t
1255 uint[4] __bits;
1258 enum SA_NOCLDSTOP = 8;
1260 enum SIG_BLOCK = 1;
1261 enum SIG_UNBLOCK = 2;
1262 enum SIG_SETMASK = 3;
1264 struct siginfo_t
1266 int si_signo;
1267 int si_errno;
1268 int si_code;
1269 int si_pid;
1270 uint si_uid;
1271 int si_status;
1272 void* si_addr;
1273 sigval si_value;
1274 c_long si_band;
1275 int[7] __spare;
1278 enum SI_UNDEFINED = 0x00000;
1279 enum SI_USER = 0;
1280 enum SI_QUEUE = -1;
1281 enum SI_TIMER = -2;
1282 enum SI_ASYNCIO = -3;
1283 enum SI_MESGQ = -4;
1285 else version (Solaris)
1287 enum SIG_HOLD = cast(sigfn_t2)2;
1289 struct sigset_t
1291 uint[4] __bits;
1294 enum SIG_BLOCK = 1;
1295 enum SIG_UNBLOCK = 2;
1296 enum SIG_SETMASK = 3;
1298 struct siginfo_t
1300 int si_signo;
1301 int si_code;
1302 int si_errno;
1304 version (D_LP64)
1305 int si_pad;
1307 union ___data
1309 version (D_LP64)
1310 int[(256 / int.sizeof) - 4] si_pad;
1311 else
1312 int[(128 / int.sizeof) - 3] si_pad;
1314 struct ___proc
1316 pid_t __pid;
1318 union ___pdata
1320 struct ___kill
1322 uid_t __uid;
1323 sigval __value;
1326 ___kill __kill;
1328 struct ___cld
1330 clock_t __utime;
1331 int __status;
1332 clock_t __stime;
1335 ___cld __cld;
1338 ___pdata __pdata;
1339 ctid_t __ctid;
1340 zoneid_t __zoneid;
1343 ___proc __proc;
1345 struct ___fault
1347 void* __addr;
1348 int __trapno;
1349 caddr_t __pc;
1352 ___fault __fault;
1354 struct ___file
1356 int __fd;
1357 c_long __band;
1360 ___file __file;
1362 struct ___prof
1364 caddr_t __faddr;
1365 timestruc_t __tstamp;
1366 short __syscall;
1367 char __nsysarg = 0;
1368 char __fault = 0;
1369 c_long[8] __sysarg;
1370 int[10] __mstate;
1373 ___prof __prof;
1375 struct ___rctl
1377 int __entity;
1380 ___rctl __rctl;
1383 ___data __data;
1386 enum SI_NOINFO = 32767;
1387 enum SI_DTRACE = 2050;
1388 enum SI_RCTL = 2049;
1389 enum SI_USER = 0;
1390 enum SI_LWP = -1;
1391 enum SI_QUEUE = -2;
1392 enum SI_TIMER = -3;
1393 enum SI_ASYNCIO = -4;
1394 enum SI_MESGQ = -5;
1396 else
1398 static assert(false, "Unsupported platform");
1402 int kill(pid_t, int);
1403 int sigaction(int, const scope sigaction_t*, sigaction_t*);
1404 int sigaddset(sigset_t*, int);
1405 int sigdelset(sigset_t*, int);
1406 int sigemptyset(sigset_t*);
1407 int sigfillset(sigset_t*);
1408 int sigismember(const scope sigset_t*, int);
1409 int sigpending(sigset_t*);
1410 int sigprocmask(int, const scope sigset_t*, sigset_t*);
1411 int sigsuspend(const scope sigset_t*);
1412 int sigwait(const scope sigset_t*, int*);
1415 version (CRuntime_Glibc)
1417 int kill(pid_t, int);
1418 int sigaction(int, const scope sigaction_t*, sigaction_t*);
1419 int sigaddset(sigset_t*, int);
1420 int sigdelset(sigset_t*, int);
1421 int sigemptyset(sigset_t*);
1422 int sigfillset(sigset_t*);
1423 int sigismember(const scope sigset_t*, int);
1424 int sigpending(sigset_t*);
1425 int sigprocmask(int, const scope sigset_t*, sigset_t*);
1426 int sigsuspend(const scope sigset_t*);
1427 int sigwait(const scope sigset_t*, int*);
1429 else version (Darwin)
1431 int kill(pid_t, int);
1432 int sigaction(int, const scope sigaction_t*, sigaction_t*);
1433 int sigaddset(sigset_t*, int);
1434 int sigdelset(sigset_t*, int);
1435 int sigemptyset(sigset_t*);
1436 int sigfillset(sigset_t*);
1437 int sigismember(const scope sigset_t*, int);
1438 int sigpending(sigset_t*);
1439 int sigprocmask(int, const scope sigset_t*, sigset_t*);
1440 int sigsuspend(const scope sigset_t*);
1441 int sigwait(const scope sigset_t*, int*);
1443 else version (FreeBSD)
1445 int kill(pid_t, int);
1446 int sigaction(int, const scope sigaction_t*, sigaction_t*);
1447 int sigaddset(sigset_t*, int);
1448 int sigdelset(sigset_t*, int);
1449 int sigemptyset(sigset_t *);
1450 int sigfillset(sigset_t *);
1451 int sigismember(const scope sigset_t*, int);
1452 int sigpending(sigset_t *);
1453 int sigprocmask(int, const scope sigset_t*, sigset_t*);
1454 int sigsuspend(const scope sigset_t*);
1455 int sigwait(const scope sigset_t*, int*);
1457 else version (NetBSD)
1459 int kill(pid_t, int);
1460 int __sigaction14(int, const scope sigaction_t*, sigaction_t*);
1461 int __sigaddset14(sigset_t*, int);
1462 int __sigdelset14(sigset_t*, int);
1463 int __sigemptyset14(sigset_t *);
1464 int __sigfillset14(sigset_t *);
1465 int __sigismember14(const scope sigset_t*, int);
1466 int __sigpending14(sigset_t *);
1467 int __sigprocmask14(int, const scope sigset_t*, sigset_t*);
1468 int __sigsuspend14(const scope sigset_t*);
1469 int sigwait(const scope sigset_t*, int*);
1471 alias __sigaction14 sigaction;
1472 alias __sigaddset14 sigaddset;
1473 alias __sigdelset14 sigdelset;
1474 alias __sigemptyset14 sigemptyset;
1475 alias __sigfillset14 sigfillset;
1476 alias __sigismember14 sigismember;
1477 alias __sigpending14 sigpending;
1478 alias __sigprocmask14 sigprocmask;
1479 alias __sigsuspend14 sigsuspend;
1481 else version (OpenBSD)
1483 int kill(pid_t, int);
1484 int sigaction(int, const scope sigaction_t*, sigaction_t*);
1485 int sigaddset(sigset_t*, int);
1486 int sigdelset(sigset_t*, int);
1487 int sigemptyset(sigset_t *);
1488 int sigfillset(sigset_t *);
1489 int sigismember(const scope sigset_t*, int);
1490 int sigpending(sigset_t *);
1491 int sigprocmask(int, const scope sigset_t*, sigset_t*);
1492 int sigsuspend(const scope sigset_t*);
1493 int sigwait(const scope sigset_t*, int*);
1495 else version (DragonFlyBSD)
1497 int kill(pid_t, int);
1498 int sigaction(int, const scope sigaction_t*, sigaction_t*);
1499 int sigaddset(sigset_t*, int);
1500 int sigdelset(sigset_t*, int);
1501 int sigemptyset(sigset_t *);
1502 int sigfillset(sigset_t *);
1503 int sigismember(const scope sigset_t*, int);
1504 int sigpending(sigset_t *);
1505 int sigprocmask(int, const scope sigset_t*, sigset_t*);
1506 int sigsuspend(const scope sigset_t*);
1507 int sigwait(const scope sigset_t*, int*);
1509 else version (Solaris)
1511 int kill(pid_t, int);
1512 int sigaction(int, const scope sigaction_t*, sigaction_t*);
1513 int sigaddset(sigset_t*, int);
1514 int sigdelset(sigset_t*, int);
1515 int sigemptyset(sigset_t*);
1516 int sigfillset(sigset_t*);
1517 int sigismember(const scope sigset_t*, int);
1518 int sigpending(sigset_t*);
1519 int sigprocmask(int, const scope sigset_t*, sigset_t*);
1520 int sigsuspend(const scope sigset_t*);
1521 int sigwait(const scope sigset_t*, int*);
1523 else version (CRuntime_Bionic)
1525 public import core.sys.posix.time: timer_t;
1526 import core.stdc.string : memset;
1528 version (X86)
1529 enum int LONG_BIT = 32;
1530 else version (ARM)
1531 enum int LONG_BIT = 32;
1532 else version (AArch64)
1533 enum int LONG_BIT = 64;
1534 else version (X86_64)
1535 enum int LONG_BIT = 64;
1536 else
1537 static assert(false, "Architecture not supported.");
1539 int kill(pid_t, int);
1540 int sigaction(int, const scope sigaction_t*, sigaction_t*);
1542 // These functions are defined inline in bionic.
1543 int sigaddset(sigset_t* set, int signum)
1545 c_ulong* local_set = cast(c_ulong*) set;
1546 signum--;
1547 local_set[signum/LONG_BIT] |= 1UL << (signum%LONG_BIT);
1548 return 0;
1551 int sigdelset(sigset_t* set, int signum)
1553 c_ulong* local_set = cast(c_ulong*) set;
1554 signum--;
1555 local_set[signum/LONG_BIT] &= ~(1UL << (signum%LONG_BIT));
1556 return 0;
1559 int sigemptyset(sigset_t* set) { memset(set, 0, (*set).sizeof); return 0; }
1561 int sigfillset(sigset_t* set) { memset(set, ~0, (*set).sizeof); return 0; }
1563 int sigismember(sigset_t* set, int signum)
1565 c_ulong* local_set = cast(c_ulong*) set;
1566 signum--;
1567 return cast(int) ((local_set[signum/LONG_BIT] >> (signum%LONG_BIT)) & 1);
1570 int sigpending(sigset_t*);
1571 int sigprocmask(int, const scope sigset_t*, sigset_t*);
1572 int sigsuspend(const scope sigset_t*);
1573 int sigwait(const scope sigset_t*, int*);
1575 else version (CRuntime_Musl)
1577 int kill(pid_t, int);
1578 int sigaction(int, const scope sigaction_t*, sigaction_t*);
1579 int sigaddset(sigset_t*, int);
1580 int sigdelset(sigset_t*, int);
1581 int sigemptyset(sigset_t*);
1582 int sigfillset(sigset_t*);
1583 int sigismember(const scope sigset_t*, int);
1584 int sigpending(sigset_t*);
1585 int sigprocmask(int, const scope sigset_t*, sigset_t*);
1586 int sigsuspend(const scope sigset_t*);
1587 int sigwait(const scope sigset_t*, int*);
1589 else version (CRuntime_UClibc)
1591 int kill(pid_t, int);
1592 int sigaction(int, const scope sigaction_t*, sigaction_t*);
1593 int sigaddset(sigset_t*, int);
1594 int sigdelset(sigset_t*, int);
1595 int sigemptyset(sigset_t*);
1596 int sigfillset(sigset_t*);
1597 int sigismember(const scope sigset_t*, int);
1598 int sigpending(sigset_t*);
1599 int sigprocmask(int, const scope sigset_t*, sigset_t*);
1600 int sigsuspend(const scope sigset_t*);
1601 int sigwait(const scope sigset_t*, int*);
1603 else
1605 static assert(false, "Unsupported platform");
1610 // XOpen (XSI)
1613 SIGPOLL
1614 SIGPROF
1615 SIGSYS
1616 SIGTRAP
1617 SIGVTALRM
1618 SIGXCPU
1619 SIGXFSZ
1621 SA_ONSTACK
1622 SA_RESETHAND
1623 SA_RESTART
1624 SA_SIGINFO
1625 SA_NOCLDWAIT
1626 SA_NODEFER
1628 ILL_ILLOPC
1629 ILL_ILLOPN
1630 ILL_ILLADR
1631 ILL_ILLTRP
1632 ILL_PRVOPC
1633 ILL_PRVREG
1634 ILL_COPROC
1635 ILL_BADSTK
1637 FPE_INTDIV
1638 FPE_INTOVF
1639 FPE_FLTDIV
1640 FPE_FLTOVF
1641 FPE_FLTUND
1642 FPE_FLTRES
1643 FPE_FLTINV
1644 FPE_FLTSUB
1646 SEGV_MAPERR
1647 SEGV_ACCERR
1649 BUS_ADRALN
1650 BUS_ADRERR
1651 BUS_OBJERR
1653 TRAP_BRKPT
1654 TRAP_TRACE
1656 CLD_EXITED
1657 CLD_KILLED
1658 CLD_DUMPED
1659 CLD_TRAPPED
1660 CLD_STOPPED
1661 CLD_CONTINUED
1663 POLL_IN
1664 POLL_OUT
1665 POLL_MSG
1666 POLL_ERR
1667 POLL_PRI
1668 POLL_HUP
1671 version (linux)
1673 version (X86_Any)
1675 enum SIGPOLL = 29;
1676 enum SIGPROF = 27;
1677 enum SIGSYS = 31;
1678 enum SIGTRAP = 5;
1679 enum SIGVTALRM = 26;
1680 enum SIGXCPU = 24;
1681 enum SIGXFSZ = 25;
1683 else version (HPPA_Any)
1685 enum SIGPOLL = 22;
1686 enum SIGPROF = 21;
1687 enum SIGSYS = 31;
1688 enum SIGTRAP = 5;
1689 enum SIGVTALRM = 20;
1690 enum SIGXCPU = 12;
1691 enum SIGXFSZ = 30;
1693 else version (MIPS_Any)
1695 enum SIGPOLL = 22;
1696 enum SIGPROF = 29;
1697 enum SIGSYS = 12;
1698 enum SIGTRAP = 5;
1699 enum SIGVTALRM = 28;
1700 enum SIGXCPU = 30;
1701 enum SIGXFSZ = 31;
1703 else version (PPC_Any)
1705 enum SIGPOLL = 29;
1706 enum SIGPROF = 27;
1707 enum SIGSYS = 31;
1708 enum SIGTRAP = 5;
1709 enum SIGVTALRM = 26;
1710 enum SIGXCPU = 24;
1711 enum SIGXFSZ = 25;
1713 else version (ARM_Any)
1715 enum SIGPOLL = 29;
1716 enum SIGPROF = 27;
1717 enum SIGSYS = 31;
1718 enum SIGTRAP = 5;
1719 enum SIGVTALRM = 26;
1720 enum SIGXCPU = 24;
1721 enum SIGXFSZ = 25;
1723 else version (RISCV_Any)
1725 enum SIGPOLL = 29;
1726 enum SIGPROF = 27;
1727 enum SIGSYS = 31;
1728 enum SIGTRAP = 5;
1729 enum SIGVTALRM = 26;
1730 enum SIGXCPU = 24;
1731 enum SIGXFSZ = 25;
1733 else version (SPARC_Any)
1735 enum SIGPOLL = 23;
1736 enum SIGPROF = 27;
1737 enum SIGSYS = 12;
1738 enum SIGTRAP = 5;
1739 enum SIGVTALRM = 26;
1740 enum SIGXCPU = 24;
1741 enum SIGXFSZ = 25;
1743 else version (IBMZ_Any)
1745 enum SIGPOLL = 29;
1746 enum SIGPROF = 27;
1747 enum SIGSYS = 31;
1748 enum SIGTRAP = 5;
1749 enum SIGVTALRM = 26;
1750 enum SIGXCPU = 24;
1751 enum SIGXFSZ = 25;
1753 else
1754 static assert(0, "unimplemented");
1756 version (MIPS_Any)
1758 enum SA_ONSTACK = 0x08000000;
1759 enum SA_RESETHAND = 0x80000000;
1760 enum SA_RESTART = 0x10000000;
1761 enum SA_SIGINFO = 8;
1762 enum SA_NOCLDWAIT = 0x10000;
1763 enum SA_NODEFER = 0x40000000;
1765 else
1767 enum SA_ONSTACK = 0x08000000;
1768 enum SA_RESETHAND = 0x80000000;
1769 enum SA_RESTART = 0x10000000;
1770 enum SA_SIGINFO = 4;
1771 enum SA_NOCLDWAIT = 2;
1772 enum SA_NODEFER = 0x40000000;
1775 enum SA_NOMASK = SA_NODEFER;
1776 enum SA_ONESHOT = SA_RESETHAND;
1777 enum SA_STACK = SA_ONSTACK;
1779 enum
1781 ILL_ILLOPC = 1,
1782 ILL_ILLOPN,
1783 ILL_ILLADR,
1784 ILL_ILLTRP,
1785 ILL_PRVOPC,
1786 ILL_PRVREG,
1787 ILL_COPROC,
1788 ILL_BADSTK
1791 enum
1793 FPE_INTDIV = 1,
1794 FPE_INTOVF,
1795 FPE_FLTDIV,
1796 FPE_FLTOVF,
1797 FPE_FLTUND,
1798 FPE_FLTRES,
1799 FPE_FLTINV,
1800 FPE_FLTSUB
1803 enum
1805 SEGV_MAPERR = 1,
1806 SEGV_ACCERR
1809 enum
1811 BUS_ADRALN = 1,
1812 BUS_ADRERR,
1813 BUS_OBJERR
1816 enum
1818 TRAP_BRKPT = 1,
1819 TRAP_TRACE
1822 enum
1824 CLD_EXITED = 1,
1825 CLD_KILLED,
1826 CLD_DUMPED,
1827 CLD_TRAPPED,
1828 CLD_STOPPED,
1829 CLD_CONTINUED
1832 enum
1834 POLL_IN = 1,
1835 POLL_OUT,
1836 POLL_MSG,
1837 POLL_ERR,
1838 POLL_PRI,
1839 POLL_HUP
1842 else version (Darwin)
1844 enum SIGPOLL = 7;
1845 enum SIGPROF = 27;
1846 enum SIGSYS = 12;
1847 enum SIGTRAP = 5;
1848 enum SIGVTALRM = 26;
1849 enum SIGXCPU = 24;
1850 enum SIGXFSZ = 25;
1852 enum SA_ONSTACK = 0x0001;
1853 enum SA_RESETHAND = 0x0004;
1854 enum SA_RESTART = 0x0002;
1855 enum SA_SIGINFO = 0x0040;
1856 enum SA_NOCLDWAIT = 0x0020;
1857 enum SA_NODEFER = 0x0010;
1859 enum ILL_ILLOPC = 1;
1860 enum ILL_ILLOPN = 4;
1861 enum ILL_ILLADR = 5;
1862 enum ILL_ILLTRP = 2;
1863 enum ILL_PRVOPC = 3;
1864 enum ILL_PRVREG = 6;
1865 enum ILL_COPROC = 7;
1866 enum ILL_BADSTK = 8;
1868 enum FPE_INTDIV = 7;
1869 enum FPE_INTOVF = 8;
1870 enum FPE_FLTDIV = 1;
1871 enum FPE_FLTOVF = 2;
1872 enum FPE_FLTUND = 3;
1873 enum FPE_FLTRES = 4;
1874 enum FPE_FLTINV = 5;
1875 enum FPE_FLTSUB = 6;
1877 enum
1879 SEGV_MAPERR = 1,
1880 SEGV_ACCERR
1883 enum
1885 BUS_ADRALN = 1,
1886 BUS_ADRERR,
1887 BUS_OBJERR
1890 enum
1892 TRAP_BRKPT = 1,
1893 TRAP_TRACE
1896 enum
1898 CLD_EXITED = 1,
1899 CLD_KILLED,
1900 CLD_DUMPED,
1901 CLD_TRAPPED,
1902 CLD_STOPPED,
1903 CLD_CONTINUED
1906 enum
1908 POLL_IN = 1,
1909 POLL_OUT,
1910 POLL_MSG,
1911 POLL_ERR,
1912 POLL_PRI,
1913 POLL_HUP
1916 else version (FreeBSD)
1918 // No SIGPOLL on *BSD
1919 enum SIGPROF = 27;
1920 enum SIGSYS = 12;
1921 enum SIGTRAP = 5;
1922 enum SIGVTALRM = 26;
1923 enum SIGXCPU = 24;
1924 enum SIGXFSZ = 25;
1926 enum
1928 SA_ONSTACK = 0x0001,
1929 SA_RESTART = 0x0002,
1930 SA_RESETHAND = 0x0004,
1931 SA_NODEFER = 0x0010,
1932 SA_NOCLDWAIT = 0x0020,
1933 SA_SIGINFO = 0x0040,
1936 enum
1938 ILL_ILLOPC = 1,
1939 ILL_ILLOPN,
1940 ILL_ILLADR,
1941 ILL_ILLTRP,
1942 ILL_PRVOPC,
1943 ILL_PRVREG,
1944 ILL_COPROC,
1945 ILL_BADSTK,
1948 enum
1950 BUS_ADRALN = 1,
1951 BUS_ADRERR,
1952 BUS_OBJERR,
1955 enum
1957 SEGV_MAPERR = 1,
1958 SEGV_ACCERR,
1961 enum
1963 FPE_INTOVF = 1,
1964 FPE_INTDIV,
1965 FPE_FLTDIV,
1966 FPE_FLTOVF,
1967 FPE_FLTUND,
1968 FPE_FLTRES,
1969 FPE_FLTINV,
1970 FPE_FLTSUB,
1973 enum
1975 TRAP_BRKPT = 1,
1976 TRAP_TRACE,
1979 enum
1981 CLD_EXITED = 1,
1982 CLD_KILLED,
1983 CLD_DUMPED,
1984 CLD_TRAPPED,
1985 CLD_STOPPED,
1986 CLD_CONTINUED,
1989 enum
1991 POLL_IN = 1,
1992 POLL_OUT,
1993 POLL_MSG,
1994 POLL_ERR,
1995 POLL_PRI,
1996 POLL_HUP,
1999 else version (NetBSD)
2001 // No SIGPOLL on *BSD
2002 enum SIGPROF = 27;
2003 enum SIGSYS = 12;
2004 enum SIGTRAP = 5;
2005 enum SIGVTALRM = 26;
2006 enum SIGXCPU = 24;
2007 enum SIGXFSZ = 25;
2009 enum
2011 SA_ONSTACK = 0x0001,
2012 SA_RESTART = 0x0002,
2013 SA_RESETHAND = 0x0004,
2014 SA_NODEFER = 0x0010,
2015 SA_NOCLDWAIT = 0x0020,
2016 SA_SIGINFO = 0x0040,
2019 enum
2021 ILL_ILLOPC = 1,
2022 ILL_ILLOPN,
2023 ILL_ILLADR,
2024 ILL_ILLTRP,
2025 ILL_PRVOPC,
2026 ILL_PRVREG,
2027 ILL_COPROC,
2028 ILL_BADSTK,
2031 enum
2033 BUS_ADRALN = 1,
2034 BUS_ADRERR,
2035 BUS_OBJERR,
2038 enum
2040 SEGV_MAPERR = 1,
2041 SEGV_ACCERR,
2044 enum
2046 FPE_INTOVF = 1,
2047 FPE_INTDIV,
2048 FPE_FLTDIV,
2049 FPE_FLTOVF,
2050 FPE_FLTUND,
2051 FPE_FLTRES,
2052 FPE_FLTINV,
2053 FPE_FLTSUB,
2056 enum
2058 TRAP_BRKPT = 1,
2059 TRAP_TRACE,
2062 enum
2064 CLD_EXITED = 1,
2065 CLD_KILLED,
2066 CLD_DUMPED,
2067 CLD_TRAPPED,
2068 CLD_STOPPED,
2069 CLD_CONTINUED,
2072 enum
2074 POLL_IN = 1,
2075 POLL_OUT,
2076 POLL_MSG,
2077 POLL_ERR,
2078 POLL_PRI,
2079 POLL_HUP,
2082 else version (OpenBSD)
2084 // No SIGPOLL on *BSD
2085 enum SIGPROF = 27;
2086 enum SIGSYS = 12;
2087 enum SIGTRAP = 5;
2088 enum SIGVTALRM = 26;
2089 enum SIGXCPU = 24;
2090 enum SIGXFSZ = 25;
2092 enum
2094 SA_ONSTACK = 0x0001,
2095 SA_RESTART = 0x0002,
2096 SA_RESETHAND = 0x0004,
2097 SA_NODEFER = 0x0010,
2098 SA_NOCLDWAIT = 0x0020,
2099 SA_SIGINFO = 0x0040,
2102 enum
2104 ILL_ILLOPC = 1,
2105 ILL_ILLOPN,
2106 ILL_ILLADR,
2107 ILL_ILLTRP,
2108 ILL_PRVOPC,
2109 ILL_PRVREG,
2110 ILL_COPROC,
2111 ILL_BADSTK,
2112 NSIGILL = ILL_BADSTK,
2115 enum
2117 BUS_ADRALN = 1,
2118 BUS_ADRERR,
2119 BUS_OBJERR,
2120 NSIGBUS = BUS_OBJERR,
2123 enum
2125 SEGV_MAPERR = 1,
2126 SEGV_ACCERR,
2127 NSIGSEGV = SEGV_ACCERR,
2130 enum
2132 FPE_INTDIV = 1,
2133 FPE_INTOVF,
2134 FPE_FLTDIV,
2135 FPE_FLTOVF,
2136 FPE_FLTUND,
2137 FPE_FLTRES,
2138 FPE_FLTINV,
2139 FPE_FLTSUB,
2140 NSIGFPE = FPE_FLTSUB,
2143 enum
2145 TRAP_BRKPT = 1,
2146 TRAP_TRACE,
2147 NSIGTRAP = TRAP_TRACE,
2150 enum
2152 CLD_EXITED = 1,
2153 CLD_KILLED,
2154 CLD_DUMPED,
2155 CLD_TRAPPED,
2156 CLD_STOPPED,
2157 CLD_CONTINUED,
2158 NSIGCLD = CLD_CONTINUED,
2161 enum
2163 POLL_IN = 1,
2164 POLL_OUT,
2165 POLL_MSG,
2166 POLL_ERR,
2167 POLL_PRI,
2168 POLL_HUP,
2169 NSIGPOLL = POLL_HUP,
2172 else version (DragonFlyBSD)
2174 // No SIGPOLL on *BSD
2175 enum SIGPROF = 27;
2176 enum SIGSYS = 12;
2177 enum SIGTRAP = 5;
2178 enum SIGVTALRM = 26;
2179 enum SIGXCPU = 24;
2180 enum SIGXFSZ = 25;
2182 enum
2184 SA_ONSTACK = 0x0001,
2185 SA_RESTART = 0x0002,
2186 SA_RESETHAND = 0x0004,
2187 SA_NODEFER = 0x0010,
2188 SA_NOCLDWAIT = 0x0020,
2189 SA_SIGINFO = 0x0040,
2192 enum
2194 ILL_ILLOPC = 1,
2195 ILL_ILLOPN,
2196 ILL_ILLADR,
2197 ILL_ILLTRP,
2198 ILL_PRVOPC,
2199 ILL_PRVREG,
2200 ILL_COPROC,
2201 ILL_BADSTK,
2204 enum
2206 BUS_ADRALN = 1,
2207 BUS_ADRERR,
2208 BUS_OBJERR,
2211 enum
2213 SEGV_MAPERR = 1,
2214 SEGV_ACCERR,
2217 enum
2219 FPE_INTOVF = 1,
2220 FPE_INTDIV,
2221 FPE_FLTDIV,
2222 FPE_FLTOVF,
2223 FPE_FLTUND,
2224 FPE_FLTRES,
2225 FPE_FLTINV,
2226 FPE_FLTSUB,
2229 enum
2231 TRAP_BRKPT = 1,
2232 TRAP_TRACE,
2235 enum
2237 CLD_EXITED = 1,
2238 CLD_KILLED,
2239 CLD_DUMPED,
2240 CLD_TRAPPED,
2241 CLD_STOPPED,
2242 CLD_CONTINUED,
2245 enum
2247 POLL_IN = 1,
2248 POLL_OUT,
2249 POLL_MSG,
2250 POLL_ERR,
2251 POLL_PRI,
2252 POLL_HUP,
2255 else version (Solaris)
2257 enum SIGPOLL = 22;
2258 enum SIGIO = SIGPOLL;
2259 enum SIGPROF = 29;
2260 enum SIGSYS = 12;
2261 enum SIGTRAP = 5;
2262 enum SIGVTALRM = 28;
2263 enum SIGXCPU = 30;
2264 enum SIGXFSZ = 31;
2266 enum
2268 SA_ONSTACK = 0x00001,
2269 SA_RESTART = 0x00004,
2270 SA_RESETHAND = 0x00002,
2271 SA_NODEFER = 0x00010,
2272 SA_NOCLDWAIT = 0x10000,
2273 SA_SIGINFO = 0x00008,
2276 enum
2278 ILL_ILLOPC = 1,
2279 ILL_ILLOPN,
2280 ILL_ILLADR,
2281 ILL_ILLTRP,
2282 ILL_PRVOPC,
2283 ILL_PRVREG,
2284 ILL_COPROC,
2285 ILL_BADSTK,
2288 enum
2290 BUS_ADRALN = 1,
2291 BUS_ADRERR,
2292 BUS_OBJERR,
2295 enum
2297 SEGV_MAPERR = 1,
2298 SEGV_ACCERR,
2301 enum
2303 FPE_INTDIV = 1,
2304 FPE_INTOVF,
2305 FPE_FLTDIV,
2306 FPE_FLTOVF,
2307 FPE_FLTUND,
2308 FPE_FLTRES,
2309 FPE_FLTINV,
2310 FPE_FLTSUB,
2311 FPE_FLTDEN,
2314 enum
2316 TRAP_BRKPT = 1,
2317 TRAP_TRACE,
2318 TRAP_RWATCH,
2319 TRAP_WWATCH,
2320 TRAP_XWATCH,
2321 TRAP_DTRACE,
2324 enum
2326 CLD_EXITED = 1,
2327 CLD_KILLED,
2328 CLD_DUMPED,
2329 CLD_TRAPPED,
2330 CLD_STOPPED,
2331 CLD_CONTINUED,
2334 enum
2336 POLL_IN = 1,
2337 POLL_OUT,
2338 POLL_MSG,
2339 POLL_ERR,
2340 POLL_PRI,
2341 POLL_HUP,
2344 else
2346 static assert(false, "Unsupported platform");
2350 SS_ONSTACK
2351 SS_DISABLE
2352 MINSIGSTKSZ
2353 SIGSTKSZ
2355 ucontext_t // from ucontext
2356 mcontext_t // from ucontext
2358 struct stack_t
2360 void* ss_sp;
2361 size_t ss_size;
2362 int ss_flags;
2365 struct sigstack
2367 int ss_onstack;
2368 void* ss_sp;
2371 sigfn_t bsd_signal(int sig, sigfn_t func);
2372 sigfn_t sigset(int sig, sigfn_t func);
2374 int killpg(pid_t, int);
2375 int sigaltstack(const scope stack_t*, stack_t*);
2376 int sighold(int);
2377 int sigignore(int);
2378 int siginterrupt(int, int);
2379 int sigpause(int);
2380 int sigrelse(int);
2383 version (CRuntime_Glibc)
2385 enum SS_ONSTACK = 1;
2386 enum SS_DISABLE = 2;
2387 enum MINSIGSTKSZ = 2048;
2388 enum SIGSTKSZ = 8192;
2390 //ucontext_t (defined in core.sys.posix.ucontext)
2391 //mcontext_t (defined in core.sys.posix.ucontext)
2393 struct stack_t
2395 void* ss_sp;
2396 int ss_flags;
2397 size_t ss_size;
2400 struct sigstack
2402 void* ss_sp;
2403 int ss_onstack;
2406 sigfn_t bsd_signal(int sig, sigfn_t func);
2407 sigfn_t sigset(int sig, sigfn_t func);
2409 nothrow:
2410 @nogc:
2411 sigfn_t2 bsd_signal(int sig, sigfn_t2 func);
2412 sigfn_t2 sigset(int sig, sigfn_t2 func);
2414 int killpg(pid_t, int);
2415 int sigaltstack(const scope stack_t*, stack_t*);
2416 int sighold(int);
2417 int sigignore(int);
2418 int siginterrupt(int, int);
2419 int sigpause(int);
2420 int sigrelse(int);
2422 else version (Darwin)
2424 enum SS_ONSTACK = 0x0001;
2425 enum SS_DISABLE = 0x0004;
2426 enum MINSIGSTKSZ = 32768;
2427 enum SIGSTKSZ = 131072;
2429 //ucontext_t (defined in core.sys.posix.ucontext)
2430 //mcontext_t (defined in core.sys.posix.ucontext)
2432 struct stack_t
2434 void* ss_sp;
2435 size_t ss_size;
2436 int ss_flags;
2439 struct sigstack
2441 void* ss_sp;
2442 int ss_onstack;
2445 sigfn_t bsd_signal(int sig, sigfn_t func);
2446 sigfn_t sigset(int sig, sigfn_t func);
2448 nothrow:
2449 @nogc:
2450 sigfn_t2 bsd_signal(int sig, sigfn_t2 func);
2451 sigfn_t2 sigset(int sig, sigfn_t2 func);
2453 int killpg(pid_t, int);
2454 int sigaltstack(const scope stack_t*, stack_t*);
2455 int sighold(int);
2456 int sigignore(int);
2457 int siginterrupt(int, int);
2458 int sigpause(int);
2459 int sigrelse(int);
2461 else version (FreeBSD)
2463 enum
2465 SS_ONSTACK = 0x0001,
2466 SS_DISABLE = 0x0004,
2469 enum MINSIGSTKSZ = 512 * 4;
2470 enum SIGSTKSZ = (MINSIGSTKSZ + 32768);
2472 //ucontext_t (defined in core.sys.posix.ucontext)
2473 //mcontext_t (defined in core.sys.posix.ucontext)
2475 struct stack_t
2477 void* ss_sp;
2478 size_t ss_size;
2479 int ss_flags;
2482 struct sigstack
2484 void* ss_sp;
2485 int ss_onstack;
2488 //sigfn_t bsd_signal(int sig, sigfn_t func);
2489 sigfn_t sigset(int sig, sigfn_t func);
2491 nothrow:
2492 @nogc:
2493 //sigfn_t2 bsd_signal(int sig, sigfn_t2 func);
2494 sigfn_t2 sigset(int sig, sigfn_t2 func);
2496 int killpg(pid_t, int);
2497 int sigaltstack(const scope stack_t*, stack_t*);
2498 int sighold(int);
2499 int sigignore(int);
2500 int siginterrupt(int, int);
2501 int sigpause(int);
2502 int sigrelse(int);
2504 else version (NetBSD)
2506 enum
2508 SS_ONSTACK = 0x0001,
2509 SS_DISABLE = 0x0004,
2512 enum MINSIGSTKSZ = 8192;
2513 enum SIGSTKSZ = (MINSIGSTKSZ + 32768);
2515 //ucontext_t (defined in core.sys.posix.ucontext)
2516 //mcontext_t (defined in core.sys.posix.ucontext)
2518 struct stack_t
2520 void* ss_sp;
2521 size_t ss_size;
2522 int ss_flags;
2525 struct sigstack
2527 void* ss_sp;
2528 int ss_onstack;
2531 //sigfn_t bsd_signal(int sig, sigfn_t func);
2532 sigfn_t sigset(int sig, sigfn_t func);
2534 nothrow:
2535 @nogc:
2536 //sigfn_t2 bsd_signal(int sig, sigfn_t2 func);
2537 sigfn_t2 sigset(int sig, sigfn_t2 func);
2539 int killpg(pid_t, int);
2540 int sigaltstack(const scope stack_t*, stack_t*);
2541 int sighold(int);
2542 int sigignore(int);
2543 int siginterrupt(int, int);
2544 int sigpause(int);
2545 int sigrelse(int);
2547 else version (OpenBSD)
2549 enum
2551 SS_ONSTACK = 0x0001,
2552 SS_DISABLE = 0x0004,
2555 enum MINSIGSTKSZ = 8192;
2556 enum SIGSTKSZ = (MINSIGSTKSZ + 32768);
2558 //ucontext_t (defined in core.sys.posix.ucontext)
2559 //mcontext_t (defined in core.sys.posix.ucontext)
2561 struct stack_t
2563 void* ss_sp;
2564 size_t ss_size;
2565 int ss_flags;
2568 nothrow:
2569 @nogc:
2570 int killpg(pid_t, int);
2571 int sigaltstack(const scope stack_t*, stack_t*);
2572 int siginterrupt(int, int);
2573 int sigpause(int);
2575 else version (DragonFlyBSD)
2577 enum
2579 SS_ONSTACK = 0x0001,
2580 SS_DISABLE = 0x0004,
2583 enum MINSIGSTKSZ = 8192;
2584 enum SIGSTKSZ = (MINSIGSTKSZ + 32768);
2586 //ucontext_t (defined in core.sys.posix.ucontext)
2587 //mcontext_t (defined in core.sys.posix.ucontext)
2589 struct stack_t
2591 void* ss_sp;
2592 size_t ss_size;
2593 int ss_flags;
2596 struct sigstack
2598 void* ss_sp;
2599 int ss_onstack;
2602 //sigfn_t bsd_signal(int sig, sigfn_t func);
2603 sigfn_t sigset(int sig, sigfn_t func);
2605 nothrow:
2606 @nogc:
2607 //sigfn_t2 bsd_signal(int sig, sigfn_t2 func);
2608 sigfn_t2 sigset(int sig, sigfn_t2 func);
2610 int killpg(pid_t, int);
2611 int sigaltstack(const scope stack_t*, stack_t*);
2612 int sighold(int);
2613 int sigignore(int);
2614 int siginterrupt(int, int);
2615 int sigpause(int);
2616 int sigrelse(int);
2618 else version (Solaris)
2620 enum
2622 SS_ONSTACK = 0x0001,
2623 SS_DISABLE = 0x0002,
2626 enum MINSIGSTKSZ = 2048;
2627 enum SIGSTKSZ = 8192;
2629 struct stack_t
2631 void* ss_sp;
2632 size_t ss_size;
2633 int ss_flags;
2636 struct sigstack
2638 void* ss_sp;
2639 int ss_onstack;
2642 sigfn_t sigset(int sig, sigfn_t func);
2644 nothrow:
2645 @nogc:
2646 sigfn_t2 sigset(int sig, sigfn_t2 func);
2648 int killpg(pid_t, int);
2649 int sigaltstack(const scope stack_t*, stack_t*);
2650 int sighold(int);
2651 int sigignore(int);
2652 int siginterrupt(int, int);
2653 int sigpause(int);
2654 int sigrelse(int);
2656 else version (CRuntime_Bionic)
2658 enum SS_ONSTACK = 1;
2659 enum SS_DISABLE = 2;
2660 enum MINSIGSTKSZ = 2048;
2661 enum SIGSTKSZ = 8192;
2663 struct stack_t
2665 void* ss_sp;
2666 int ss_flags;
2667 size_t ss_size;
2670 sigfn_t bsd_signal(int, sigfn_t);
2672 nothrow:
2673 @nogc:
2674 sigfn_t2 bsd_signal(int, sigfn_t2);
2676 int killpg(int, int);
2677 int sigaltstack(const scope stack_t*, stack_t*);
2678 int siginterrupt(int, int);
2680 else version (CRuntime_Musl)
2682 enum SS_ONSTACK = 1;
2683 enum SS_DISABLE = 2;
2685 version (ARM)
2687 enum MINSIGSTKSZ = 2048;
2688 enum SIGSTKSZ = 8192;
2690 else version (AArch64)
2692 enum MINSIGSTKSZ = 6144;
2693 enum SIGSTKSZ = 12288;
2695 else version (IBMZ_Any)
2697 enum MINSIGSTKSZ = 4096;
2698 enum SIGSTKSZ = 10240;
2700 else version (MIPS_Any)
2702 enum MINSIGSTKSZ = 2048;
2703 enum SIGSTKSZ = 8192;
2705 else version (PPC_Any)
2707 enum MINSIGSTKSZ = 4096;
2708 enum SIGSTKSZ = 10240;
2710 else version (X86_Any)
2712 enum MINSIGSTKSZ = 2048;
2713 enum SIGSTKSZ = 8192;
2715 else
2716 static assert(0, "unimplemented");
2718 //ucontext_t (defined in core.sys.posix.ucontext)
2719 //mcontext_t (defined in core.sys.posix.ucontext)
2721 version (MIPS_Any)
2723 struct stack_t
2725 void* ss_sp;
2726 size_t ss_size;
2727 int ss_flags;
2730 else
2732 struct stack_t
2734 void* ss_sp;
2735 int ss_flags;
2736 size_t ss_size;
2740 sigfn_t bsd_signal(int sig, sigfn_t func);
2741 sigfn_t sigset(int sig, sigfn_t func);
2743 nothrow:
2744 @nogc:
2745 sigfn_t2 bsd_signal(int sig, sigfn_t2 func);
2746 sigfn_t2 sigset(int sig, sigfn_t2 func);
2748 int killpg(pid_t, int);
2749 int sigaltstack(const scope stack_t*, stack_t*);
2750 int sighold(int);
2751 int sigignore(int);
2752 int siginterrupt(int, int);
2753 int sigpause(int);
2754 int sigrelse(int);
2756 else version (CRuntime_UClibc)
2758 enum SS_ONSTACK = 1;
2759 enum SS_DISABLE = 2;
2760 enum MINSIGSTKSZ = 2048;
2761 enum SIGSTKSZ = 8192;
2763 version (MIPS32)
2765 struct stack_t
2767 void *ss_sp;
2768 size_t ss_size;
2769 int ss_flags;
2772 else
2774 struct stack_t
2776 void* ss_sp;
2777 int ss_flags;
2778 size_t ss_size;
2782 struct sigstack
2784 void* ss_sp;
2785 int ss_onstack;
2788 sigfn_t sigset(int sig, sigfn_t func);
2790 nothrow:
2791 @nogc:
2792 sigfn_t2 sigset(int sig, sigfn_t2 func);
2794 int killpg(pid_t, int);
2795 int sigaltstack(const scope stack_t*, stack_t*);
2796 int sighold(int);
2797 int sigignore(int);
2798 int siginterrupt(int, int);
2799 int sigpause(int);
2800 int sigrelse(int);
2802 else
2804 static assert(false, "Unsupported platform");
2808 // Realtime Signals (RTS)
2811 struct sigevent
2813 int sigev_notify;
2814 int sigev_signo;
2815 sigval sigev_value;
2816 void(*)(sigval) sigev_notify_function;
2817 pthread_attr_t* sigev_notify_attributes;
2821 nothrow:
2822 @nogc:
2824 version (linux)
2826 private enum __SIGEV_MAX_SIZE = 64;
2828 static if ( __WORDSIZE == 64 )
2830 private enum __SIGEV_PAD_SIZE = ((__SIGEV_MAX_SIZE / int.sizeof) - 4);
2832 else
2834 private enum __SIGEV_PAD_SIZE = ((__SIGEV_MAX_SIZE / int.sizeof) - 3);
2837 struct sigevent
2839 sigval sigev_value;
2840 int sigev_signo;
2841 int sigev_notify;
2843 union
2845 int[__SIGEV_PAD_SIZE] _pad;
2846 pid_t _tid;
2848 struct
2850 void function(sigval) sigev_notify_function;
2851 void* sigev_notify_attributes;
2856 else version (FreeBSD)
2858 struct sigevent
2860 int sigev_notify;
2861 int sigev_signo;
2862 sigval sigev_value;
2863 union
2865 lwpid_t _threadid;
2866 struct
2868 void function(sigval) sigev_notify_function;
2869 void* sigev_notify_attributes;
2871 c_long[8] __spare__;
2875 else version (NetBSD)
2877 struct sigevent
2879 int sigev_notify;
2880 int sigev_signo;
2881 sigval sigev_value;
2882 void function(sigval) sigev_notify_function;
2883 void /* pthread_attr_t */*sigev_notify_attributes;
2886 else version (OpenBSD)
2888 // OpenBSD does not implement sigevent.
2889 alias sigevent = void;
2891 else version (DragonFlyBSD)
2893 union _sigev_un_t
2895 int sigev_signo;
2896 int sigev_notify_kqueue;
2897 void /*pthread_attr_t*/ * sigev_notify_attributes;
2899 union _sigval_t
2901 int sival_int;
2902 void * sival_ptr;
2903 int sigval_int;
2904 void * sigval_ptr;
2906 struct sigevent
2908 int sigev_notify;
2909 _sigev_un_t sigev_un;
2910 _sigval_t sigev_value;
2911 void function(_sigval_t) sigev_notify_function;
2914 else version (Darwin)
2916 struct sigevent
2918 int sigev_notify;
2919 int sigev_signo;
2920 sigval sigev_value;
2921 void function(sigval) sigev_notify_function;
2922 pthread_attr_t* sigev_notify_attributes;
2925 else version (Solaris)
2927 struct sigevent
2929 int sigev_notify;
2930 int sigev_signo;
2931 sigval sigev_value;
2932 void function(sigval) sigev_notify_function;
2933 pthread_attr_t* sigev_notify_attributes;
2934 int __sigev_pad2;
2937 else
2939 static assert(false, "Unsupported platform");
2943 int sigqueue(pid_t, int, const sigval);
2944 int sigtimedwait(const scope sigset_t*, siginfo_t*, const scope timespec*);
2945 int sigwaitinfo(const scope sigset_t*, siginfo_t*);
2948 nothrow:
2949 @nogc:
2951 version (CRuntime_Glibc)
2953 int sigqueue(pid_t, int, const sigval);
2954 int sigtimedwait(const scope sigset_t*, siginfo_t*, const scope timespec*);
2955 int sigwaitinfo(const scope sigset_t*, siginfo_t*);
2957 else version (FreeBSD)
2959 int sigqueue(pid_t, int, const sigval);
2960 int sigtimedwait(const scope sigset_t*, siginfo_t*, const scope timespec*);
2961 int sigwaitinfo(const scope sigset_t*, siginfo_t*);
2963 else version (NetBSD)
2965 int sigqueue(pid_t, int, const sigval);
2966 int sigtimedwait(const scope sigset_t*, siginfo_t*, const scope timespec*);
2967 int sigwaitinfo(const scope sigset_t*, siginfo_t*);
2969 else version (OpenBSD)
2972 else version (DragonFlyBSD)
2974 int sigqueue(pid_t, int, const sigval);
2975 int sigtimedwait(const scope sigset_t*, siginfo_t*, const scope timespec*);
2976 int sigwaitinfo(const scope sigset_t*, siginfo_t*);
2978 else version (Darwin)
2981 else version (Solaris)
2983 int sigqueue(pid_t, int, const sigval);
2984 int sigtimedwait(const scope sigset_t*, siginfo_t*, const scope timespec*);
2985 int sigwaitinfo(const scope sigset_t*, siginfo_t*);
2987 else version (CRuntime_Bionic)
2990 else version (CRuntime_Musl)
2992 int sigqueue(pid_t, int, const sigval);
2993 pragma(mangle, muslRedirTime64Mangle!("sigtimedwait", "__sigtimedwait_time64"))
2994 int sigtimedwait(const scope sigset_t*, siginfo_t*, const scope timespec*);
2995 int sigwaitinfo(const scope sigset_t*, siginfo_t*);
2997 else version (CRuntime_UClibc)
2999 int sigqueue(pid_t, int, const sigval);
3000 int sigtimedwait(const scope sigset_t*, siginfo_t*, const scope timespec*);
3001 int sigwaitinfo(const scope sigset_t*, siginfo_t*);
3003 else
3005 static assert(false, "Unsupported platform");
3009 // Threads (THR)
3012 int pthread_kill(pthread_t, int);
3013 int pthread_sigmask(int, const scope sigset_t*, sigset_t*);
3016 version (CRuntime_Glibc)
3018 int pthread_kill(pthread_t, int);
3019 int pthread_sigmask(int, const scope sigset_t*, sigset_t*);
3021 else version (Darwin)
3023 int pthread_kill(pthread_t, int);
3024 int pthread_sigmask(int, const scope sigset_t*, sigset_t*);
3026 else version (FreeBSD)
3028 int pthread_kill(pthread_t, int);
3029 int pthread_sigmask(int, const scope sigset_t*, sigset_t*);
3031 else version (NetBSD)
3033 int pthread_kill(pthread_t, int);
3034 int pthread_sigmask(int, const scope sigset_t*, sigset_t*);
3036 else version (OpenBSD)
3038 int pthread_kill(pthread_t, int);
3039 int pthread_sigmask(int, const scope sigset_t*, sigset_t*);
3041 else version (DragonFlyBSD)
3043 int pthread_kill(pthread_t, int);
3044 int pthread_sigmask(int, const scope sigset_t*, sigset_t*);
3046 else version (Solaris)
3048 int pthread_kill(pthread_t, int);
3049 int pthread_sigmask(int, const scope sigset_t*, sigset_t*);
3051 else version (CRuntime_Bionic)
3053 int pthread_kill(pthread_t, int);
3054 int pthread_sigmask(int, const scope sigset_t*, sigset_t*);
3056 else version (CRuntime_Musl)
3058 int pthread_kill(pthread_t, int);
3059 int pthread_sigmask(int, const scope sigset_t*, sigset_t*);
3061 else version (CRuntime_UClibc)
3063 int pthread_kill(pthread_t, int);
3064 int pthread_sigmask(int, const scope sigset_t*, sigset_t*);
3065 int pthread_sigqueue(pthread_t, int, sigval);
3067 else
3069 static assert(false, "Unsupported platform");