c++: Fix crash during NRV optimization with invalid input [PR117099, PR117129]
[official-gcc.git] / libphobos / libdruntime / core / sys / posix / signal.d
bloba8b7f7511a92c897ebbc9f0997bd41cd11d9ca1a
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 version (LoongArch64)
395 //SIGABRT (defined in core.stdc.signal)
396 enum SIGALRM = 14;
397 enum SIGBUS = 7;
398 enum SIGCHLD = 17;
399 enum SIGCONT = 18;
400 //SIGFPE (defined in core.stdc.signal)
401 enum SIGHUP = 1;
402 //SIGILL (defined in core.stdc.signal)
403 //SIGINT (defined in core.stdc.signal)
404 enum SIGKILL = 9;
405 enum SIGPIPE = 13;
406 enum SIGQUIT = 3;
407 //SIGSEGV (defined in core.stdc.signal)
408 enum SIGSTOP = 19;
409 //SIGTERM (defined in core.stdc.signal)
410 enum SIGTSTP = 20;
411 enum SIGTTIN = 21;
412 enum SIGTTOU = 22;
413 enum SIGUSR1 = 10;
414 enum SIGUSR2 = 12;
415 enum SIGURG = 23;
417 else
418 static assert(0, "unimplemented");
420 else version (Darwin)
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 (FreeBSD)
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 (NetBSD)
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 (OpenBSD)
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 (DragonFlyBSD)
518 //SIGABRT (defined in core.stdc.signal)
519 enum SIGALRM = 14;
520 enum SIGBUS = 10;
521 enum SIGCHLD = 20;
522 enum SIGCONT = 19;
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 = 17;
532 //SIGTERM (defined in core.stdc.signal)
533 enum SIGTSTP = 18;
534 enum SIGTTIN = 21;
535 enum SIGTTOU = 22;
536 enum SIGUSR1 = 30;
537 enum SIGUSR2 = 31;
538 enum SIGURG = 16;
540 else version (Solaris)
542 //SIGABRT (defined in core.stdc.signal)
543 enum SIGALRM = 14;
544 enum SIGBUS = 10;
545 enum SIGCHLD = 18;
546 enum SIGCONT = 25;
547 //SIGFPE (defined in core.stdc.signal)
548 enum SIGHUP = 1;
549 //SIGILL (defined in core.stdc.signal)
550 //SIGINT (defined in core.stdc.signal)
551 enum SIGKILL = 9;
552 enum SIGPIPE = 13;
553 enum SIGQUIT = 3;
554 //SIGSEGV (defined in core.stdc.signal)
555 enum SIGSTOP = 23;
556 //SIGTERM (defined in core.stdc.signal)
557 enum SIGTSTP = 24;
558 enum SIGTTIN = 26;
559 enum SIGTTOU = 27;
560 enum SIGUSR1 = 16;
561 enum SIGUSR2 = 17;
562 enum SIGURG = 21;
564 else
566 static assert(false, "Unsupported platform");
569 version (linux)
571 version (CRuntime_Musl)
573 struct sigaction_t
575 union
577 sigfn_t sa_handler;
578 sigactfn_t sa_sigaction;
580 sigset_t sa_mask;
581 int sa_flags;
582 void function() sa_restorer;
585 else version (CRuntime_Bionic)
587 version (D_LP64)
589 struct sigaction_t
591 int sa_flags;
592 union
594 sigfn_t sa_handler;
595 sigactfn_t sa_sigaction;
597 sigset_t sa_mask;
598 void function() sa_restorer;
601 else
603 struct sigaction_t
605 union
607 sigfn_t sa_handler;
608 sigactfn_t sa_sigaction;
610 sigset_t sa_mask;
611 int sa_flags;
612 void function() sa_restorer;
616 else version (SystemZ)
618 struct sigaction_t
620 static if ( true /* __USE_POSIX199309 */ )
622 union
624 sigfn_t sa_handler;
625 sigactfn_t sa_sigaction;
628 else
630 sigfn_t sa_handler;
632 version (CRuntime_Glibc)
634 int __glibc_reserved0;
635 int sa_flags;
637 else
639 c_ulong sa_flags;
642 void function() sa_restorer;
644 sigset_t sa_mask;
647 else version (HPPA_Any)
649 struct sigaction_t
651 static if ( true /* __USE_POSIX199309 */ )
653 union
655 sigfn_t sa_handler;
656 sigactfn_t sa_sigaction;
659 else
661 sigfn_t sa_handler;
663 version (CRuntime_Glibc)
665 version (D_LP64)
666 int __glibc_reserved0;
667 int sa_flags;
669 else
671 c_ulong sa_flags;
673 sigset_t sa_mask;
676 else version (MIPS_Any)
678 struct sigaction_t
680 int sa_flags;
682 static if ( true /* __USE_POSIX199309 */ )
684 union
686 sigfn_t sa_handler;
687 sigactfn_t sa_sigaction;
690 else
692 sigfn_t sa_handler;
694 sigset_t sa_mask;
695 void function() sa_restorer;
697 version (CRuntime_Glibc)
699 static if ((void*).sizeof < 8)
700 int[1] sa_resv;
704 else version (SPARC_Any)
706 struct sigaction_t
708 static if ( true /* __USE_POSIX199309 */ )
710 union
712 sigfn_t sa_handler;
713 sigactfn_t sa_sigaction;
716 else
718 sigfn_t sa_handler;
720 version (CRuntime_Glibc)
722 sigset_t sa_mask;
723 version (D_LP64)
724 int __glibc_reserved0;
725 int sa_flags;
726 void function() sa_restorer;
728 else
730 c_ulong sa_flags;
731 void function() sa_restorer;
732 sigset_t sa_mask;
736 else
738 struct sigaction_t
740 static if ( true /* __USE_POSIX199309 */ )
742 union
744 sigfn_t sa_handler;
745 sigactfn_t sa_sigaction;
748 else
750 sigfn_t sa_handler;
752 sigset_t sa_mask;
753 int sa_flags;
755 void function() sa_restorer;
759 else version (FreeBSD)
761 struct sigaction_t
763 union
765 sigfn_t sa_handler;
766 sigactfn_t sa_sigaction;
768 int sa_flags;
769 sigset_t sa_mask;
772 else version (NetBSD)
774 struct sigaction_t
776 union
778 sigfn_t sa_handler;
779 sigactfn_t sa_sigaction;
781 sigset_t sa_mask;
782 int sa_flags;
785 else version (OpenBSD)
787 struct sigaction_t
789 union
791 sigfn_t __sa_handler;
792 alias sa_handler = __sa_handler;
793 sigactfn_t __sa_sigaction;
794 alias sa_sigaction = __sa_sigaction;
796 sigset_t sa_mask;
797 int sa_flags;
800 else version (DragonFlyBSD)
802 struct sigaction_t
804 union
806 sigfn_t sa_handler;
807 sigactfn_t sa_sigaction;
809 int sa_flags;
810 sigset_t sa_mask;
813 else version (Solaris)
815 struct sigaction_t
817 int sa_flags;
819 union
821 sigfn_t sa_handler;
822 sigactfn_t sa_sigaction;
825 sigset_t sa_mask;
826 version (D_LP64) {}
827 else
828 int[2] sa_resv;
831 else version (Darwin)
833 struct sigaction_t
835 static if ( true /* __USE_POSIX199309 */ )
837 union
839 sigfn_t sa_handler;
840 sigactfn_t sa_sigaction;
843 else
845 sigfn_t sa_handler;
847 sigset_t sa_mask;
848 int sa_flags;
851 else
853 static assert(false, "Unsupported platform");
857 // C Extension (CX)
860 SIG_HOLD
862 sigset_t
863 pid_t (defined in core.sys.types)
865 SIGABRT (defined in core.stdc.signal)
866 SIGFPE (defined in core.stdc.signal)
867 SIGILL (defined in core.stdc.signal)
868 SIGINT (defined in core.stdc.signal)
869 SIGSEGV (defined in core.stdc.signal)
870 SIGTERM (defined in core.stdc.signal)
872 SA_NOCLDSTOP (CX|XSI)
873 SIG_BLOCK
874 SIG_UNBLOCK
875 SIG_SETMASK
877 struct siginfo_t
879 int si_signo;
880 int si_code;
882 version (XSI)
884 int si_errno;
885 pid_t si_pid;
886 uid_t si_uid;
887 void* si_addr;
888 int si_status;
889 c_long si_band;
891 version (RTS)
893 sigval si_value;
897 SI_USER
898 SI_QUEUE
899 SI_TIMER
900 SI_ASYNCIO
901 SI_MESGQ
904 nothrow @nogc
907 version (linux)
909 enum SIG_HOLD = cast(sigfn_t2) 2;
911 private enum _SIGSET_NWORDS = 1024 / (8 * c_ulong.sizeof);
913 struct sigset_t
915 c_ulong[_SIGSET_NWORDS] __val;
918 enum SA_NOCLDSTOP = 1; // (CX|XSI)
920 version (MIPS_Any)
922 enum SIG_BLOCK = 1;
923 enum SIG_UNBLOCK = 2;
924 enum SIG_SETMASK = 3;
926 else version (SPARC_Any)
928 enum SIG_BLOCK = 1;
929 enum SIG_UNBLOCK = 2;
930 enum SIG_SETMASK = 4;
932 else
934 enum SIG_BLOCK = 0;
935 enum SIG_UNBLOCK = 1;
936 enum SIG_SETMASK = 2;
939 private enum __SI_MAX_SIZE = 128;
941 static if ( __WORDSIZE == 64 )
943 private enum __SI_PAD_SIZE = ((__SI_MAX_SIZE / int.sizeof) - 4);
945 else
947 private enum __SI_PAD_SIZE = ((__SI_MAX_SIZE / int.sizeof) - 3);
950 struct siginfo_t
952 int si_signo;
953 version (MIPS_Any) // __SI_SWAP_ERRNO_CODE
955 int si_code;
956 int si_errno;
958 else
960 int si_errno;
961 int si_code;
964 union _sifields_t
966 int[__SI_PAD_SIZE] _pad;
968 // kill()
969 struct _kill_t
971 pid_t si_pid;
972 uid_t si_uid;
973 } _kill_t _kill;
974 // POSIX.1b timers.
975 struct _timer_t
977 int si_tid;
978 int si_overrun;
979 sigval si_sigval;
980 } _timer_t _timer;
982 // POSIX.1b signals
983 struct _rt_t
985 pid_t si_pid;
986 uid_t si_uid;
987 sigval si_sigval;
988 } _rt_t _rt;
990 // SIGCHLD
991 struct _sigchild_t
993 pid_t si_pid;
994 uid_t si_uid;
995 int si_status;
996 clock_t si_utime;
997 clock_t si_stime;
998 } _sigchild_t _sigchld;
1000 // SIGILL, SIGFPE, SIGSEGV, SIGBUS
1001 struct _sigfault_t
1003 void* si_addr;
1004 } _sigfault_t _sigfault;
1006 // SIGPOLL
1007 struct _sigpoll_t
1009 c_long si_band;
1010 int si_fd;
1011 } _sigpoll_t _sigpoll;
1012 } _sifields_t _sifields;
1014 nothrow @nogc:
1015 @property ref pid_t si_pid() return { return _sifields._kill.si_pid; }
1016 @property ref uid_t si_uid() return { return _sifields._kill.si_uid; }
1017 @property ref void* si_addr() return { return _sifields._sigfault.si_addr; }
1018 @property ref int si_status() return { return _sifields._sigchld.si_status; }
1019 @property ref c_long si_band() return { return _sifields._sigpoll.si_band; }
1020 @property ref sigval si_value() return { return _sifields._rt.si_sigval; }
1023 enum
1025 SI_ASYNCNL = -60,
1026 SI_TKILL = -6,
1027 SI_SIGIO,
1028 SI_ASYNCIO,
1029 SI_MESGQ,
1030 SI_TIMER,
1031 SI_QUEUE,
1032 SI_USER,
1033 SI_KERNEL = 0x80
1036 else version (Darwin)
1038 enum SIG_HOLD = cast(sigfn_t2) 5;
1040 alias uint sigset_t;
1042 enum SA_NOCLDSTOP = 8; // (CX|XSI)
1044 enum SIG_BLOCK = 1;
1045 enum SIG_UNBLOCK = 2;
1046 enum SIG_SETMASK = 3;
1048 struct siginfo_t
1050 int si_signo;
1051 int si_errno;
1052 int si_code;
1053 pid_t si_pid;
1054 uid_t si_uid;
1055 int si_status;
1056 void* si_addr;
1057 sigval si_value;
1058 int si_band;
1059 uint[7] pad;
1062 enum SI_USER = 0x10001;
1063 enum SI_QUEUE = 0x10002;
1064 enum SI_TIMER = 0x10003;
1065 enum SI_ASYNCIO = 0x10004;
1066 enum SI_MESGQ = 0x10005;
1068 else version (FreeBSD)
1070 enum SIG_HOLD = cast(sigfn_t2) 3;
1072 struct sigset_t
1074 uint[4] __bits;
1077 enum SA_NOCLDSTOP = 8;
1079 enum SIG_BLOCK = 1;
1080 enum SIG_UNBLOCK = 2;
1081 enum SIG_SETMASK = 3;
1083 struct siginfo_t
1085 int si_signo;
1086 int si_errno;
1087 int si_code;
1088 pid_t si_pid;
1089 uid_t si_uid;
1090 int si_status;
1091 void* si_addr;
1092 sigval si_value;
1093 union __reason
1095 struct __fault
1097 int _trapno;
1099 __fault _fault;
1100 struct __timer
1102 int _timerid;
1103 int _overrun;
1105 __timer _timer;
1106 struct __mesgq
1108 int _mqd;
1110 __mesgq _mesgq;
1111 struct __poll
1113 c_long _band;
1115 __poll _poll;
1116 struct ___spare___
1118 c_long __spare1__;
1119 int[7] __spare2__;
1121 ___spare___ __spare__;
1123 __reason _reason;
1125 @property ref c_long si_band() return { return _reason._poll._band; }
1128 enum SI_USER = 0x10001;
1129 enum SI_QUEUE = 0x10002;
1130 enum SI_TIMER = 0x10003;
1131 enum SI_ASYNCIO = 0x10004;
1132 enum SI_MESGQ = 0x10005;
1134 else version (NetBSD)
1136 enum SIG_HOLD = cast(sigfn_t2) 3;
1138 struct sigset_t
1140 uint[4] __bits;
1143 enum SA_NOCLDSTOP = 8;
1145 enum SIG_BLOCK = 1;
1146 enum SIG_UNBLOCK = 2;
1147 enum SIG_SETMASK = 3;
1149 union sigval_t
1151 int sival_int;
1152 void* sival_ptr;
1155 struct _ksiginfo
1157 int _signo;
1158 int _code;
1159 int _errno;
1160 version (D_LP64)
1161 int _pad;
1163 union reason_t
1165 struct rt_t
1167 pid_t _pid;
1168 uid_t _uid;
1169 sigval_t _value;
1170 } rt_t _rt;
1171 struct child_t
1173 pid_t _pid;
1174 uid_t _uid;
1175 int _status;
1176 clock_t _utime;
1177 clock_t _stime;
1178 } child_t _child;
1179 struct fault_t
1181 void* _addr;
1182 int _trap;
1183 int _trap2;
1184 int _trap3;
1185 } fault_t fault;
1186 struct poll_t
1188 c_long _band;
1189 int _fd;
1190 } poll_t _poll;
1192 reason_t _reason;
1195 union siginfo_t
1197 ubyte[128] si_pad;
1198 _ksiginfo _info;
1199 @property ref c_long si_band() return { return _info._reason._poll._band; }
1202 enum SI_USER = 0;
1203 enum SI_QUEUE = -1;
1204 enum SI_TIMER = -2;
1205 enum SI_ASYNCIO = -3;
1206 enum SI_MESGQ = -4;
1208 else version (OpenBSD)
1210 enum SIG_CATCH = cast(sigfn_t2) 2;
1211 enum SIG_HOLD = cast(sigfn_t2) 3;
1213 alias sigset_t = uint;
1215 enum SA_NOCLDSTOP = 0x0008;
1217 enum SIG_BLOCK = 1;
1218 enum SIG_UNBLOCK = 2;
1219 enum SIG_SETMASK = 3;
1221 private enum SI_MAXSZ = 128;
1222 private enum SI_PAD = (SI_MAXSZ / int.sizeof) - 3;
1224 struct siginfo_t
1226 int si_signo;
1227 int si_errno;
1228 int si_code;
1229 union _data
1231 int[SI_PAD] _pad;
1232 struct _proc
1234 pid_t _pid;
1235 union _pdata
1237 struct _kill
1239 uid_t _uid;
1240 sigval _value;
1242 struct _cld
1244 clock_t _utime;
1245 clock_t _stime;
1246 int _status;
1250 struct _fault
1252 caddr_t _addr;
1253 int _trapno;
1256 alias si_pid = _data._proc._pid;
1257 alias si_status = _data._proc._pdata._cld._status;
1258 alias si_stime = _data._proc._pdata._cld._stime;
1259 alias si_utime = _data._proc._pdata._cld._utime;
1260 alias si_uid = _data._proc._pdata._kill._uid;
1261 alias si_value = _data._proc._pdata._kill._value;
1262 alias si_addr = _data._fault._addr;
1263 alias si_trapno = _data._fault._trapno;
1266 enum SI_NOINFO = 32767;
1267 enum SI_USER = 0;
1268 enum SI_LWP = -1;
1269 enum SI_QUEUE = -2;
1270 enum SI_TIMER = -3;
1272 else version (DragonFlyBSD)
1274 enum SIG_CATCH = cast(sigfn_t2) 2;
1275 enum SIG_HOLD = cast(sigfn_t2) 3;
1277 struct sigset_t
1279 uint[4] __bits;
1282 enum SA_NOCLDSTOP = 8;
1284 enum SIG_BLOCK = 1;
1285 enum SIG_UNBLOCK = 2;
1286 enum SIG_SETMASK = 3;
1288 struct siginfo_t
1290 int si_signo;
1291 int si_errno;
1292 int si_code;
1293 int si_pid;
1294 uint si_uid;
1295 int si_status;
1296 void* si_addr;
1297 sigval si_value;
1298 c_long si_band;
1299 int[7] __spare;
1302 enum SI_UNDEFINED = 0x00000;
1303 enum SI_USER = 0;
1304 enum SI_QUEUE = -1;
1305 enum SI_TIMER = -2;
1306 enum SI_ASYNCIO = -3;
1307 enum SI_MESGQ = -4;
1309 else version (Solaris)
1311 enum SIG_HOLD = cast(sigfn_t2)2;
1313 struct sigset_t
1315 uint[4] __bits;
1318 enum SIG_BLOCK = 1;
1319 enum SIG_UNBLOCK = 2;
1320 enum SIG_SETMASK = 3;
1322 struct siginfo_t
1324 int si_signo;
1325 int si_code;
1326 int si_errno;
1328 version (D_LP64)
1329 int si_pad;
1331 union ___data
1333 version (D_LP64)
1334 int[(256 / int.sizeof) - 4] si_pad;
1335 else
1336 int[(128 / int.sizeof) - 3] si_pad;
1338 struct ___proc
1340 pid_t __pid;
1342 union ___pdata
1344 struct ___kill
1346 uid_t __uid;
1347 sigval __value;
1350 ___kill __kill;
1352 struct ___cld
1354 clock_t __utime;
1355 int __status;
1356 clock_t __stime;
1359 ___cld __cld;
1362 ___pdata __pdata;
1363 ctid_t __ctid;
1364 zoneid_t __zoneid;
1367 ___proc __proc;
1369 struct ___fault
1371 void* __addr;
1372 int __trapno;
1373 caddr_t __pc;
1376 ___fault __fault;
1378 struct ___file
1380 int __fd;
1381 c_long __band;
1384 ___file __file;
1386 struct ___prof
1388 caddr_t __faddr;
1389 timestruc_t __tstamp;
1390 short __syscall;
1391 char __nsysarg = 0;
1392 char __fault = 0;
1393 c_long[8] __sysarg;
1394 int[10] __mstate;
1397 ___prof __prof;
1399 struct ___rctl
1401 int __entity;
1404 ___rctl __rctl;
1407 ___data __data;
1410 enum SI_NOINFO = 32767;
1411 enum SI_DTRACE = 2050;
1412 enum SI_RCTL = 2049;
1413 enum SI_USER = 0;
1414 enum SI_LWP = -1;
1415 enum SI_QUEUE = -2;
1416 enum SI_TIMER = -3;
1417 enum SI_ASYNCIO = -4;
1418 enum SI_MESGQ = -5;
1420 else
1422 static assert(false, "Unsupported platform");
1426 int kill(pid_t, int);
1427 int sigaction(int, const scope sigaction_t*, sigaction_t*);
1428 int sigaddset(sigset_t*, int);
1429 int sigdelset(sigset_t*, int);
1430 int sigemptyset(sigset_t*);
1431 int sigfillset(sigset_t*);
1432 int sigismember(const scope sigset_t*, int);
1433 int sigpending(sigset_t*);
1434 int sigprocmask(int, const scope sigset_t*, sigset_t*);
1435 int sigsuspend(const scope sigset_t*);
1436 int sigwait(const scope sigset_t*, int*);
1439 version (CRuntime_Glibc)
1441 int kill(pid_t, int);
1442 int sigaction(int, const scope sigaction_t*, sigaction_t*);
1443 int sigaddset(sigset_t*, int);
1444 int sigdelset(sigset_t*, int);
1445 int sigemptyset(sigset_t*);
1446 int sigfillset(sigset_t*);
1447 int sigismember(const scope sigset_t*, int);
1448 int sigpending(sigset_t*);
1449 int sigprocmask(int, const scope sigset_t*, sigset_t*);
1450 int sigsuspend(const scope sigset_t*);
1451 int sigwait(const scope sigset_t*, int*);
1453 else version (Darwin)
1455 int kill(pid_t, int);
1456 int sigaction(int, const scope sigaction_t*, sigaction_t*);
1457 int sigaddset(sigset_t*, int);
1458 int sigdelset(sigset_t*, int);
1459 int sigemptyset(sigset_t*);
1460 int sigfillset(sigset_t*);
1461 int sigismember(const scope sigset_t*, int);
1462 int sigpending(sigset_t*);
1463 int sigprocmask(int, const scope sigset_t*, sigset_t*);
1464 int sigsuspend(const scope sigset_t*);
1465 int sigwait(const scope sigset_t*, int*);
1467 else version (FreeBSD)
1469 int kill(pid_t, int);
1470 int sigaction(int, const scope sigaction_t*, sigaction_t*);
1471 int sigaddset(sigset_t*, int);
1472 int sigdelset(sigset_t*, int);
1473 int sigemptyset(sigset_t *);
1474 int sigfillset(sigset_t *);
1475 int sigismember(const scope sigset_t*, int);
1476 int sigpending(sigset_t *);
1477 int sigprocmask(int, const scope sigset_t*, sigset_t*);
1478 int sigsuspend(const scope sigset_t*);
1479 int sigwait(const scope sigset_t*, int*);
1481 else version (NetBSD)
1483 int kill(pid_t, int);
1484 int __sigaction14(int, const scope sigaction_t*, sigaction_t*);
1485 int __sigaddset14(sigset_t*, int);
1486 int __sigdelset14(sigset_t*, int);
1487 int __sigemptyset14(sigset_t *);
1488 int __sigfillset14(sigset_t *);
1489 int __sigismember14(const scope sigset_t*, int);
1490 int __sigpending14(sigset_t *);
1491 int __sigprocmask14(int, const scope sigset_t*, sigset_t*);
1492 int __sigsuspend14(const scope sigset_t*);
1493 int sigwait(const scope sigset_t*, int*);
1495 alias __sigaction14 sigaction;
1496 alias __sigaddset14 sigaddset;
1497 alias __sigdelset14 sigdelset;
1498 alias __sigemptyset14 sigemptyset;
1499 alias __sigfillset14 sigfillset;
1500 alias __sigismember14 sigismember;
1501 alias __sigpending14 sigpending;
1502 alias __sigprocmask14 sigprocmask;
1503 alias __sigsuspend14 sigsuspend;
1505 else version (OpenBSD)
1507 int kill(pid_t, int);
1508 int sigaction(int, const scope sigaction_t*, sigaction_t*);
1509 int sigaddset(sigset_t*, int);
1510 int sigdelset(sigset_t*, int);
1511 int sigemptyset(sigset_t *);
1512 int sigfillset(sigset_t *);
1513 int sigismember(const scope sigset_t*, int);
1514 int sigpending(sigset_t *);
1515 int sigprocmask(int, const scope sigset_t*, sigset_t*);
1516 int sigsuspend(const scope sigset_t*);
1517 int sigwait(const scope sigset_t*, int*);
1519 else version (DragonFlyBSD)
1521 int kill(pid_t, int);
1522 int sigaction(int, const scope sigaction_t*, sigaction_t*);
1523 int sigaddset(sigset_t*, int);
1524 int sigdelset(sigset_t*, int);
1525 int sigemptyset(sigset_t *);
1526 int sigfillset(sigset_t *);
1527 int sigismember(const scope sigset_t*, int);
1528 int sigpending(sigset_t *);
1529 int sigprocmask(int, const scope sigset_t*, sigset_t*);
1530 int sigsuspend(const scope sigset_t*);
1531 int sigwait(const scope sigset_t*, int*);
1533 else version (Solaris)
1535 int kill(pid_t, int);
1536 int sigaction(int, const scope sigaction_t*, sigaction_t*);
1537 int sigaddset(sigset_t*, int);
1538 int sigdelset(sigset_t*, int);
1539 int sigemptyset(sigset_t*);
1540 int sigfillset(sigset_t*);
1541 int sigismember(const scope sigset_t*, int);
1542 int sigpending(sigset_t*);
1543 int sigprocmask(int, const scope sigset_t*, sigset_t*);
1544 int sigsuspend(const scope sigset_t*);
1545 int sigwait(const scope sigset_t*, int*);
1547 else version (CRuntime_Bionic)
1549 public import core.sys.posix.time: timer_t;
1550 import core.stdc.string : memset;
1552 version (X86)
1553 enum int LONG_BIT = 32;
1554 else version (ARM)
1555 enum int LONG_BIT = 32;
1556 else version (AArch64)
1557 enum int LONG_BIT = 64;
1558 else version (X86_64)
1559 enum int LONG_BIT = 64;
1560 else
1561 static assert(false, "Architecture not supported.");
1563 int kill(pid_t, int);
1564 int sigaction(int, const scope sigaction_t*, sigaction_t*);
1566 // These functions are defined inline in bionic.
1567 int sigaddset(sigset_t* set, int signum)
1569 c_ulong* local_set = cast(c_ulong*) set;
1570 signum--;
1571 local_set[signum/LONG_BIT] |= 1UL << (signum%LONG_BIT);
1572 return 0;
1575 int sigdelset(sigset_t* set, int signum)
1577 c_ulong* local_set = cast(c_ulong*) set;
1578 signum--;
1579 local_set[signum/LONG_BIT] &= ~(1UL << (signum%LONG_BIT));
1580 return 0;
1583 int sigemptyset(sigset_t* set) { memset(set, 0, (*set).sizeof); return 0; }
1585 int sigfillset(sigset_t* set) { memset(set, ~0, (*set).sizeof); return 0; }
1587 int sigismember(sigset_t* set, int signum)
1589 c_ulong* local_set = cast(c_ulong*) set;
1590 signum--;
1591 return cast(int) ((local_set[signum/LONG_BIT] >> (signum%LONG_BIT)) & 1);
1594 int sigpending(sigset_t*);
1595 int sigprocmask(int, const scope sigset_t*, sigset_t*);
1596 int sigsuspend(const scope sigset_t*);
1597 int sigwait(const scope sigset_t*, int*);
1599 else version (CRuntime_Musl)
1601 int kill(pid_t, int);
1602 int sigaction(int, const scope sigaction_t*, sigaction_t*);
1603 int sigaddset(sigset_t*, int);
1604 int sigdelset(sigset_t*, int);
1605 int sigemptyset(sigset_t*);
1606 int sigfillset(sigset_t*);
1607 int sigismember(const scope sigset_t*, int);
1608 int sigpending(sigset_t*);
1609 int sigprocmask(int, const scope sigset_t*, sigset_t*);
1610 int sigsuspend(const scope sigset_t*);
1611 int sigwait(const scope sigset_t*, int*);
1613 else version (CRuntime_UClibc)
1615 int kill(pid_t, int);
1616 int sigaction(int, const scope sigaction_t*, sigaction_t*);
1617 int sigaddset(sigset_t*, int);
1618 int sigdelset(sigset_t*, int);
1619 int sigemptyset(sigset_t*);
1620 int sigfillset(sigset_t*);
1621 int sigismember(const scope sigset_t*, int);
1622 int sigpending(sigset_t*);
1623 int sigprocmask(int, const scope sigset_t*, sigset_t*);
1624 int sigsuspend(const scope sigset_t*);
1625 int sigwait(const scope sigset_t*, int*);
1627 else
1629 static assert(false, "Unsupported platform");
1634 // XOpen (XSI)
1637 SIGPOLL
1638 SIGPROF
1639 SIGSYS
1640 SIGTRAP
1641 SIGVTALRM
1642 SIGXCPU
1643 SIGXFSZ
1645 SA_ONSTACK
1646 SA_RESETHAND
1647 SA_RESTART
1648 SA_SIGINFO
1649 SA_NOCLDWAIT
1650 SA_NODEFER
1652 ILL_ILLOPC
1653 ILL_ILLOPN
1654 ILL_ILLADR
1655 ILL_ILLTRP
1656 ILL_PRVOPC
1657 ILL_PRVREG
1658 ILL_COPROC
1659 ILL_BADSTK
1661 FPE_INTDIV
1662 FPE_INTOVF
1663 FPE_FLTDIV
1664 FPE_FLTOVF
1665 FPE_FLTUND
1666 FPE_FLTRES
1667 FPE_FLTINV
1668 FPE_FLTSUB
1670 SEGV_MAPERR
1671 SEGV_ACCERR
1673 BUS_ADRALN
1674 BUS_ADRERR
1675 BUS_OBJERR
1677 TRAP_BRKPT
1678 TRAP_TRACE
1680 CLD_EXITED
1681 CLD_KILLED
1682 CLD_DUMPED
1683 CLD_TRAPPED
1684 CLD_STOPPED
1685 CLD_CONTINUED
1687 POLL_IN
1688 POLL_OUT
1689 POLL_MSG
1690 POLL_ERR
1691 POLL_PRI
1692 POLL_HUP
1695 version (linux)
1697 version (X86_Any)
1699 enum SIGPOLL = 29;
1700 enum SIGPROF = 27;
1701 enum SIGSYS = 31;
1702 enum SIGTRAP = 5;
1703 enum SIGVTALRM = 26;
1704 enum SIGXCPU = 24;
1705 enum SIGXFSZ = 25;
1707 else version (HPPA_Any)
1709 enum SIGPOLL = 22;
1710 enum SIGPROF = 21;
1711 enum SIGSYS = 31;
1712 enum SIGTRAP = 5;
1713 enum SIGVTALRM = 20;
1714 enum SIGXCPU = 12;
1715 enum SIGXFSZ = 30;
1717 else version (MIPS_Any)
1719 enum SIGPOLL = 22;
1720 enum SIGPROF = 29;
1721 enum SIGSYS = 12;
1722 enum SIGTRAP = 5;
1723 enum SIGVTALRM = 28;
1724 enum SIGXCPU = 30;
1725 enum SIGXFSZ = 31;
1727 else version (PPC_Any)
1729 enum SIGPOLL = 29;
1730 enum SIGPROF = 27;
1731 enum SIGSYS = 31;
1732 enum SIGTRAP = 5;
1733 enum SIGVTALRM = 26;
1734 enum SIGXCPU = 24;
1735 enum SIGXFSZ = 25;
1737 else version (ARM_Any)
1739 enum SIGPOLL = 29;
1740 enum SIGPROF = 27;
1741 enum SIGSYS = 31;
1742 enum SIGTRAP = 5;
1743 enum SIGVTALRM = 26;
1744 enum SIGXCPU = 24;
1745 enum SIGXFSZ = 25;
1747 else version (RISCV_Any)
1749 enum SIGPOLL = 29;
1750 enum SIGPROF = 27;
1751 enum SIGSYS = 31;
1752 enum SIGTRAP = 5;
1753 enum SIGVTALRM = 26;
1754 enum SIGXCPU = 24;
1755 enum SIGXFSZ = 25;
1757 else version (SPARC_Any)
1759 enum SIGPOLL = 23;
1760 enum SIGPROF = 27;
1761 enum SIGSYS = 12;
1762 enum SIGTRAP = 5;
1763 enum SIGVTALRM = 26;
1764 enum SIGXCPU = 24;
1765 enum SIGXFSZ = 25;
1767 else version (IBMZ_Any)
1769 enum SIGPOLL = 29;
1770 enum SIGPROF = 27;
1771 enum SIGSYS = 31;
1772 enum SIGTRAP = 5;
1773 enum SIGVTALRM = 26;
1774 enum SIGXCPU = 24;
1775 enum SIGXFSZ = 25;
1777 else version (LoongArch64)
1779 enum SIGPOLL = 29;
1780 enum SIGPROF = 27;
1781 enum SIGSYS = 31;
1782 enum SIGTRAP = 5;
1783 enum SIGVTALRM = 26;
1784 enum SIGXCPU = 24;
1785 enum SIGXFSZ = 25;
1787 else
1788 static assert(0, "unimplemented");
1790 version (MIPS_Any)
1792 enum SA_ONSTACK = 0x08000000;
1793 enum SA_RESETHAND = 0x80000000;
1794 enum SA_RESTART = 0x10000000;
1795 enum SA_SIGINFO = 8;
1796 enum SA_NOCLDWAIT = 0x10000;
1797 enum SA_NODEFER = 0x40000000;
1799 else
1801 enum SA_ONSTACK = 0x08000000;
1802 enum SA_RESETHAND = 0x80000000;
1803 enum SA_RESTART = 0x10000000;
1804 enum SA_SIGINFO = 4;
1805 enum SA_NOCLDWAIT = 2;
1806 enum SA_NODEFER = 0x40000000;
1809 enum SA_NOMASK = SA_NODEFER;
1810 enum SA_ONESHOT = SA_RESETHAND;
1811 enum SA_STACK = SA_ONSTACK;
1813 enum
1815 ILL_ILLOPC = 1,
1816 ILL_ILLOPN,
1817 ILL_ILLADR,
1818 ILL_ILLTRP,
1819 ILL_PRVOPC,
1820 ILL_PRVREG,
1821 ILL_COPROC,
1822 ILL_BADSTK
1825 enum
1827 FPE_INTDIV = 1,
1828 FPE_INTOVF,
1829 FPE_FLTDIV,
1830 FPE_FLTOVF,
1831 FPE_FLTUND,
1832 FPE_FLTRES,
1833 FPE_FLTINV,
1834 FPE_FLTSUB
1837 enum
1839 SEGV_MAPERR = 1,
1840 SEGV_ACCERR
1843 enum
1845 BUS_ADRALN = 1,
1846 BUS_ADRERR,
1847 BUS_OBJERR
1850 enum
1852 TRAP_BRKPT = 1,
1853 TRAP_TRACE
1856 enum
1858 CLD_EXITED = 1,
1859 CLD_KILLED,
1860 CLD_DUMPED,
1861 CLD_TRAPPED,
1862 CLD_STOPPED,
1863 CLD_CONTINUED
1866 enum
1868 POLL_IN = 1,
1869 POLL_OUT,
1870 POLL_MSG,
1871 POLL_ERR,
1872 POLL_PRI,
1873 POLL_HUP
1876 else version (Darwin)
1878 enum SIGPOLL = 7;
1879 enum SIGPROF = 27;
1880 enum SIGSYS = 12;
1881 enum SIGTRAP = 5;
1882 enum SIGVTALRM = 26;
1883 enum SIGXCPU = 24;
1884 enum SIGXFSZ = 25;
1886 enum SA_ONSTACK = 0x0001;
1887 enum SA_RESETHAND = 0x0004;
1888 enum SA_RESTART = 0x0002;
1889 enum SA_SIGINFO = 0x0040;
1890 enum SA_NOCLDWAIT = 0x0020;
1891 enum SA_NODEFER = 0x0010;
1893 enum ILL_ILLOPC = 1;
1894 enum ILL_ILLOPN = 4;
1895 enum ILL_ILLADR = 5;
1896 enum ILL_ILLTRP = 2;
1897 enum ILL_PRVOPC = 3;
1898 enum ILL_PRVREG = 6;
1899 enum ILL_COPROC = 7;
1900 enum ILL_BADSTK = 8;
1902 enum FPE_INTDIV = 7;
1903 enum FPE_INTOVF = 8;
1904 enum FPE_FLTDIV = 1;
1905 enum FPE_FLTOVF = 2;
1906 enum FPE_FLTUND = 3;
1907 enum FPE_FLTRES = 4;
1908 enum FPE_FLTINV = 5;
1909 enum FPE_FLTSUB = 6;
1911 enum
1913 SEGV_MAPERR = 1,
1914 SEGV_ACCERR
1917 enum
1919 BUS_ADRALN = 1,
1920 BUS_ADRERR,
1921 BUS_OBJERR
1924 enum
1926 TRAP_BRKPT = 1,
1927 TRAP_TRACE
1930 enum
1932 CLD_EXITED = 1,
1933 CLD_KILLED,
1934 CLD_DUMPED,
1935 CLD_TRAPPED,
1936 CLD_STOPPED,
1937 CLD_CONTINUED
1940 enum
1942 POLL_IN = 1,
1943 POLL_OUT,
1944 POLL_MSG,
1945 POLL_ERR,
1946 POLL_PRI,
1947 POLL_HUP
1950 else version (FreeBSD)
1952 // No SIGPOLL on *BSD
1953 enum SIGPROF = 27;
1954 enum SIGSYS = 12;
1955 enum SIGTRAP = 5;
1956 enum SIGVTALRM = 26;
1957 enum SIGXCPU = 24;
1958 enum SIGXFSZ = 25;
1960 enum
1962 SA_ONSTACK = 0x0001,
1963 SA_RESTART = 0x0002,
1964 SA_RESETHAND = 0x0004,
1965 SA_NODEFER = 0x0010,
1966 SA_NOCLDWAIT = 0x0020,
1967 SA_SIGINFO = 0x0040,
1970 enum
1972 ILL_ILLOPC = 1,
1973 ILL_ILLOPN,
1974 ILL_ILLADR,
1975 ILL_ILLTRP,
1976 ILL_PRVOPC,
1977 ILL_PRVREG,
1978 ILL_COPROC,
1979 ILL_BADSTK,
1982 enum
1984 BUS_ADRALN = 1,
1985 BUS_ADRERR,
1986 BUS_OBJERR,
1989 enum
1991 SEGV_MAPERR = 1,
1992 SEGV_ACCERR,
1995 enum
1997 FPE_INTOVF = 1,
1998 FPE_INTDIV,
1999 FPE_FLTDIV,
2000 FPE_FLTOVF,
2001 FPE_FLTUND,
2002 FPE_FLTRES,
2003 FPE_FLTINV,
2004 FPE_FLTSUB,
2007 enum
2009 TRAP_BRKPT = 1,
2010 TRAP_TRACE,
2013 enum
2015 CLD_EXITED = 1,
2016 CLD_KILLED,
2017 CLD_DUMPED,
2018 CLD_TRAPPED,
2019 CLD_STOPPED,
2020 CLD_CONTINUED,
2023 enum
2025 POLL_IN = 1,
2026 POLL_OUT,
2027 POLL_MSG,
2028 POLL_ERR,
2029 POLL_PRI,
2030 POLL_HUP,
2033 else version (NetBSD)
2035 // No SIGPOLL on *BSD
2036 enum SIGPROF = 27;
2037 enum SIGSYS = 12;
2038 enum SIGTRAP = 5;
2039 enum SIGVTALRM = 26;
2040 enum SIGXCPU = 24;
2041 enum SIGXFSZ = 25;
2043 enum
2045 SA_ONSTACK = 0x0001,
2046 SA_RESTART = 0x0002,
2047 SA_RESETHAND = 0x0004,
2048 SA_NODEFER = 0x0010,
2049 SA_NOCLDWAIT = 0x0020,
2050 SA_SIGINFO = 0x0040,
2053 enum
2055 ILL_ILLOPC = 1,
2056 ILL_ILLOPN,
2057 ILL_ILLADR,
2058 ILL_ILLTRP,
2059 ILL_PRVOPC,
2060 ILL_PRVREG,
2061 ILL_COPROC,
2062 ILL_BADSTK,
2065 enum
2067 BUS_ADRALN = 1,
2068 BUS_ADRERR,
2069 BUS_OBJERR,
2072 enum
2074 SEGV_MAPERR = 1,
2075 SEGV_ACCERR,
2078 enum
2080 FPE_INTOVF = 1,
2081 FPE_INTDIV,
2082 FPE_FLTDIV,
2083 FPE_FLTOVF,
2084 FPE_FLTUND,
2085 FPE_FLTRES,
2086 FPE_FLTINV,
2087 FPE_FLTSUB,
2090 enum
2092 TRAP_BRKPT = 1,
2093 TRAP_TRACE,
2096 enum
2098 CLD_EXITED = 1,
2099 CLD_KILLED,
2100 CLD_DUMPED,
2101 CLD_TRAPPED,
2102 CLD_STOPPED,
2103 CLD_CONTINUED,
2106 enum
2108 POLL_IN = 1,
2109 POLL_OUT,
2110 POLL_MSG,
2111 POLL_ERR,
2112 POLL_PRI,
2113 POLL_HUP,
2116 else version (OpenBSD)
2118 // No SIGPOLL on *BSD
2119 enum SIGPROF = 27;
2120 enum SIGSYS = 12;
2121 enum SIGTRAP = 5;
2122 enum SIGVTALRM = 26;
2123 enum SIGXCPU = 24;
2124 enum SIGXFSZ = 25;
2126 enum
2128 SA_ONSTACK = 0x0001,
2129 SA_RESTART = 0x0002,
2130 SA_RESETHAND = 0x0004,
2131 SA_NODEFER = 0x0010,
2132 SA_NOCLDWAIT = 0x0020,
2133 SA_SIGINFO = 0x0040,
2136 enum
2138 ILL_ILLOPC = 1,
2139 ILL_ILLOPN,
2140 ILL_ILLADR,
2141 ILL_ILLTRP,
2142 ILL_PRVOPC,
2143 ILL_PRVREG,
2144 ILL_COPROC,
2145 ILL_BADSTK,
2146 NSIGILL = ILL_BADSTK,
2149 enum
2151 BUS_ADRALN = 1,
2152 BUS_ADRERR,
2153 BUS_OBJERR,
2154 NSIGBUS = BUS_OBJERR,
2157 enum
2159 SEGV_MAPERR = 1,
2160 SEGV_ACCERR,
2161 NSIGSEGV = SEGV_ACCERR,
2164 enum
2166 FPE_INTDIV = 1,
2167 FPE_INTOVF,
2168 FPE_FLTDIV,
2169 FPE_FLTOVF,
2170 FPE_FLTUND,
2171 FPE_FLTRES,
2172 FPE_FLTINV,
2173 FPE_FLTSUB,
2174 NSIGFPE = FPE_FLTSUB,
2177 enum
2179 TRAP_BRKPT = 1,
2180 TRAP_TRACE,
2181 NSIGTRAP = TRAP_TRACE,
2184 enum
2186 CLD_EXITED = 1,
2187 CLD_KILLED,
2188 CLD_DUMPED,
2189 CLD_TRAPPED,
2190 CLD_STOPPED,
2191 CLD_CONTINUED,
2192 NSIGCLD = CLD_CONTINUED,
2195 enum
2197 POLL_IN = 1,
2198 POLL_OUT,
2199 POLL_MSG,
2200 POLL_ERR,
2201 POLL_PRI,
2202 POLL_HUP,
2203 NSIGPOLL = POLL_HUP,
2206 else version (DragonFlyBSD)
2208 // No SIGPOLL on *BSD
2209 enum SIGPROF = 27;
2210 enum SIGSYS = 12;
2211 enum SIGTRAP = 5;
2212 enum SIGVTALRM = 26;
2213 enum SIGXCPU = 24;
2214 enum SIGXFSZ = 25;
2216 enum
2218 SA_ONSTACK = 0x0001,
2219 SA_RESTART = 0x0002,
2220 SA_RESETHAND = 0x0004,
2221 SA_NODEFER = 0x0010,
2222 SA_NOCLDWAIT = 0x0020,
2223 SA_SIGINFO = 0x0040,
2226 enum
2228 ILL_ILLOPC = 1,
2229 ILL_ILLOPN,
2230 ILL_ILLADR,
2231 ILL_ILLTRP,
2232 ILL_PRVOPC,
2233 ILL_PRVREG,
2234 ILL_COPROC,
2235 ILL_BADSTK,
2238 enum
2240 BUS_ADRALN = 1,
2241 BUS_ADRERR,
2242 BUS_OBJERR,
2245 enum
2247 SEGV_MAPERR = 1,
2248 SEGV_ACCERR,
2251 enum
2253 FPE_INTOVF = 1,
2254 FPE_INTDIV,
2255 FPE_FLTDIV,
2256 FPE_FLTOVF,
2257 FPE_FLTUND,
2258 FPE_FLTRES,
2259 FPE_FLTINV,
2260 FPE_FLTSUB,
2263 enum
2265 TRAP_BRKPT = 1,
2266 TRAP_TRACE,
2269 enum
2271 CLD_EXITED = 1,
2272 CLD_KILLED,
2273 CLD_DUMPED,
2274 CLD_TRAPPED,
2275 CLD_STOPPED,
2276 CLD_CONTINUED,
2279 enum
2281 POLL_IN = 1,
2282 POLL_OUT,
2283 POLL_MSG,
2284 POLL_ERR,
2285 POLL_PRI,
2286 POLL_HUP,
2289 else version (Solaris)
2291 enum SIGPOLL = 22;
2292 enum SIGIO = SIGPOLL;
2293 enum SIGPROF = 29;
2294 enum SIGSYS = 12;
2295 enum SIGTRAP = 5;
2296 enum SIGVTALRM = 28;
2297 enum SIGXCPU = 30;
2298 enum SIGXFSZ = 31;
2300 enum
2302 SA_ONSTACK = 0x00001,
2303 SA_RESTART = 0x00004,
2304 SA_RESETHAND = 0x00002,
2305 SA_NODEFER = 0x00010,
2306 SA_NOCLDWAIT = 0x10000,
2307 SA_SIGINFO = 0x00008,
2310 enum
2312 ILL_ILLOPC = 1,
2313 ILL_ILLOPN,
2314 ILL_ILLADR,
2315 ILL_ILLTRP,
2316 ILL_PRVOPC,
2317 ILL_PRVREG,
2318 ILL_COPROC,
2319 ILL_BADSTK,
2322 enum
2324 BUS_ADRALN = 1,
2325 BUS_ADRERR,
2326 BUS_OBJERR,
2329 enum
2331 SEGV_MAPERR = 1,
2332 SEGV_ACCERR,
2335 enum
2337 FPE_INTDIV = 1,
2338 FPE_INTOVF,
2339 FPE_FLTDIV,
2340 FPE_FLTOVF,
2341 FPE_FLTUND,
2342 FPE_FLTRES,
2343 FPE_FLTINV,
2344 FPE_FLTSUB,
2345 FPE_FLTDEN,
2348 enum
2350 TRAP_BRKPT = 1,
2351 TRAP_TRACE,
2352 TRAP_RWATCH,
2353 TRAP_WWATCH,
2354 TRAP_XWATCH,
2355 TRAP_DTRACE,
2358 enum
2360 CLD_EXITED = 1,
2361 CLD_KILLED,
2362 CLD_DUMPED,
2363 CLD_TRAPPED,
2364 CLD_STOPPED,
2365 CLD_CONTINUED,
2368 enum
2370 POLL_IN = 1,
2371 POLL_OUT,
2372 POLL_MSG,
2373 POLL_ERR,
2374 POLL_PRI,
2375 POLL_HUP,
2378 else
2380 static assert(false, "Unsupported platform");
2384 SS_ONSTACK
2385 SS_DISABLE
2386 MINSIGSTKSZ
2387 SIGSTKSZ
2389 ucontext_t // from ucontext
2390 mcontext_t // from ucontext
2392 struct stack_t
2394 void* ss_sp;
2395 size_t ss_size;
2396 int ss_flags;
2399 struct sigstack
2401 int ss_onstack;
2402 void* ss_sp;
2405 sigfn_t bsd_signal(int sig, sigfn_t func);
2406 sigfn_t sigset(int sig, sigfn_t func);
2408 int killpg(pid_t, int);
2409 int sigaltstack(const scope stack_t*, stack_t*);
2410 int sighold(int);
2411 int sigignore(int);
2412 int siginterrupt(int, int);
2413 int sigpause(int);
2414 int sigrelse(int);
2417 version (CRuntime_Glibc)
2419 enum SS_ONSTACK = 1;
2420 enum SS_DISABLE = 2;
2421 enum MINSIGSTKSZ = 2048;
2422 enum SIGSTKSZ = 8192;
2424 //ucontext_t (defined in core.sys.posix.ucontext)
2425 //mcontext_t (defined in core.sys.posix.ucontext)
2427 version (MIPS_Any)
2429 struct stack_t
2431 void* ss_sp;
2432 size_t ss_size;
2433 int ss_flags;
2436 else
2438 struct stack_t
2440 void* ss_sp;
2441 int ss_flags;
2442 size_t ss_size;
2446 struct sigstack
2448 void* ss_sp;
2449 int ss_onstack;
2452 sigfn_t bsd_signal(int sig, sigfn_t func);
2453 sigfn_t sigset(int sig, sigfn_t func);
2455 nothrow:
2456 @nogc:
2457 sigfn_t2 bsd_signal(int sig, sigfn_t2 func);
2458 sigfn_t2 sigset(int sig, sigfn_t2 func);
2460 int killpg(pid_t, int);
2461 int sigaltstack(const scope stack_t*, stack_t*);
2462 int sighold(int);
2463 int sigignore(int);
2464 int siginterrupt(int, int);
2465 int sigpause(int);
2466 int sigrelse(int);
2468 else version (Darwin)
2470 enum SS_ONSTACK = 0x0001;
2471 enum SS_DISABLE = 0x0004;
2472 enum MINSIGSTKSZ = 32768;
2473 enum SIGSTKSZ = 131072;
2475 //ucontext_t (defined in core.sys.posix.ucontext)
2476 //mcontext_t (defined in core.sys.posix.ucontext)
2478 struct stack_t
2480 void* ss_sp;
2481 size_t ss_size;
2482 int ss_flags;
2485 struct sigstack
2487 void* ss_sp;
2488 int ss_onstack;
2491 sigfn_t bsd_signal(int sig, sigfn_t func);
2492 sigfn_t sigset(int sig, sigfn_t func);
2494 nothrow:
2495 @nogc:
2496 sigfn_t2 bsd_signal(int sig, sigfn_t2 func);
2497 sigfn_t2 sigset(int sig, sigfn_t2 func);
2499 int killpg(pid_t, int);
2500 int sigaltstack(const scope stack_t*, stack_t*);
2501 int sighold(int);
2502 int sigignore(int);
2503 int siginterrupt(int, int);
2504 int sigpause(int);
2505 int sigrelse(int);
2507 else version (FreeBSD)
2509 enum
2511 SS_ONSTACK = 0x0001,
2512 SS_DISABLE = 0x0004,
2515 enum MINSIGSTKSZ = 512 * 4;
2516 enum SIGSTKSZ = (MINSIGSTKSZ + 32768);
2518 //ucontext_t (defined in core.sys.posix.ucontext)
2519 //mcontext_t (defined in core.sys.posix.ucontext)
2521 struct stack_t
2523 void* ss_sp;
2524 size_t ss_size;
2525 int ss_flags;
2528 struct sigstack
2530 void* ss_sp;
2531 int ss_onstack;
2534 //sigfn_t bsd_signal(int sig, sigfn_t func);
2535 sigfn_t sigset(int sig, sigfn_t func);
2537 nothrow:
2538 @nogc:
2539 //sigfn_t2 bsd_signal(int sig, sigfn_t2 func);
2540 sigfn_t2 sigset(int sig, sigfn_t2 func);
2542 int killpg(pid_t, int);
2543 int sigaltstack(const scope stack_t*, stack_t*);
2544 int sighold(int);
2545 int sigignore(int);
2546 int siginterrupt(int, int);
2547 int sigpause(int);
2548 int sigrelse(int);
2550 else version (NetBSD)
2552 enum
2554 SS_ONSTACK = 0x0001,
2555 SS_DISABLE = 0x0004,
2558 enum MINSIGSTKSZ = 8192;
2559 enum SIGSTKSZ = (MINSIGSTKSZ + 32768);
2561 //ucontext_t (defined in core.sys.posix.ucontext)
2562 //mcontext_t (defined in core.sys.posix.ucontext)
2564 struct stack_t
2566 void* ss_sp;
2567 size_t ss_size;
2568 int ss_flags;
2571 struct sigstack
2573 void* ss_sp;
2574 int ss_onstack;
2577 //sigfn_t bsd_signal(int sig, sigfn_t func);
2578 sigfn_t sigset(int sig, sigfn_t func);
2580 nothrow:
2581 @nogc:
2582 //sigfn_t2 bsd_signal(int sig, sigfn_t2 func);
2583 sigfn_t2 sigset(int sig, sigfn_t2 func);
2585 int killpg(pid_t, int);
2586 int sigaltstack(const scope stack_t*, stack_t*);
2587 int sighold(int);
2588 int sigignore(int);
2589 int siginterrupt(int, int);
2590 int sigpause(int);
2591 int sigrelse(int);
2593 else version (OpenBSD)
2595 enum
2597 SS_ONSTACK = 0x0001,
2598 SS_DISABLE = 0x0004,
2601 enum MINSIGSTKSZ = 8192;
2602 enum SIGSTKSZ = (MINSIGSTKSZ + 32768);
2604 //ucontext_t (defined in core.sys.posix.ucontext)
2605 //mcontext_t (defined in core.sys.posix.ucontext)
2607 struct stack_t
2609 void* ss_sp;
2610 size_t ss_size;
2611 int ss_flags;
2614 nothrow:
2615 @nogc:
2616 int killpg(pid_t, int);
2617 int sigaltstack(const scope stack_t*, stack_t*);
2618 int siginterrupt(int, int);
2619 int sigpause(int);
2621 else version (DragonFlyBSD)
2623 enum
2625 SS_ONSTACK = 0x0001,
2626 SS_DISABLE = 0x0004,
2629 enum MINSIGSTKSZ = 8192;
2630 enum SIGSTKSZ = (MINSIGSTKSZ + 32768);
2632 //ucontext_t (defined in core.sys.posix.ucontext)
2633 //mcontext_t (defined in core.sys.posix.ucontext)
2635 struct stack_t
2637 void* ss_sp;
2638 size_t ss_size;
2639 int ss_flags;
2642 struct sigstack
2644 void* ss_sp;
2645 int ss_onstack;
2648 //sigfn_t bsd_signal(int sig, sigfn_t func);
2649 sigfn_t sigset(int sig, sigfn_t func);
2651 nothrow:
2652 @nogc:
2653 //sigfn_t2 bsd_signal(int sig, sigfn_t2 func);
2654 sigfn_t2 sigset(int sig, sigfn_t2 func);
2656 int killpg(pid_t, int);
2657 int sigaltstack(const scope stack_t*, stack_t*);
2658 int sighold(int);
2659 int sigignore(int);
2660 int siginterrupt(int, int);
2661 int sigpause(int);
2662 int sigrelse(int);
2664 else version (Solaris)
2666 enum
2668 SS_ONSTACK = 0x0001,
2669 SS_DISABLE = 0x0002,
2672 enum MINSIGSTKSZ = 2048;
2673 enum SIGSTKSZ = 8192;
2675 struct stack_t
2677 void* ss_sp;
2678 size_t ss_size;
2679 int ss_flags;
2682 struct sigstack
2684 void* ss_sp;
2685 int ss_onstack;
2688 sigfn_t sigset(int sig, sigfn_t func);
2690 nothrow:
2691 @nogc:
2692 sigfn_t2 sigset(int sig, sigfn_t2 func);
2694 int killpg(pid_t, int);
2695 int sigaltstack(const scope stack_t*, stack_t*);
2696 int sighold(int);
2697 int sigignore(int);
2698 int siginterrupt(int, int);
2699 int sigpause(int);
2700 int sigrelse(int);
2702 else version (CRuntime_Bionic)
2704 enum SS_ONSTACK = 1;
2705 enum SS_DISABLE = 2;
2706 enum MINSIGSTKSZ = 2048;
2707 enum SIGSTKSZ = 8192;
2709 struct stack_t
2711 void* ss_sp;
2712 int ss_flags;
2713 size_t ss_size;
2716 sigfn_t bsd_signal(int, sigfn_t);
2718 nothrow:
2719 @nogc:
2720 sigfn_t2 bsd_signal(int, sigfn_t2);
2722 int killpg(int, int);
2723 int sigaltstack(const scope stack_t*, stack_t*);
2724 int siginterrupt(int, int);
2726 else version (CRuntime_Musl)
2728 enum SS_ONSTACK = 1;
2729 enum SS_DISABLE = 2;
2731 version (ARM)
2733 enum MINSIGSTKSZ = 2048;
2734 enum SIGSTKSZ = 8192;
2736 else version (AArch64)
2738 enum MINSIGSTKSZ = 6144;
2739 enum SIGSTKSZ = 12288;
2741 else version (IBMZ_Any)
2743 enum MINSIGSTKSZ = 4096;
2744 enum SIGSTKSZ = 10240;
2746 else version (MIPS_Any)
2748 enum MINSIGSTKSZ = 2048;
2749 enum SIGSTKSZ = 8192;
2751 else version (PPC_Any)
2753 enum MINSIGSTKSZ = 4096;
2754 enum SIGSTKSZ = 10240;
2756 else version (X86_Any)
2758 enum MINSIGSTKSZ = 2048;
2759 enum SIGSTKSZ = 8192;
2761 else
2762 static assert(0, "unimplemented");
2764 //ucontext_t (defined in core.sys.posix.ucontext)
2765 //mcontext_t (defined in core.sys.posix.ucontext)
2767 version (MIPS_Any)
2769 struct stack_t
2771 void* ss_sp;
2772 size_t ss_size;
2773 int ss_flags;
2776 else
2778 struct stack_t
2780 void* ss_sp;
2781 int ss_flags;
2782 size_t ss_size;
2786 sigfn_t bsd_signal(int sig, sigfn_t func);
2787 sigfn_t sigset(int sig, sigfn_t func);
2789 nothrow:
2790 @nogc:
2791 sigfn_t2 bsd_signal(int sig, sigfn_t2 func);
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 version (CRuntime_UClibc)
2804 enum SS_ONSTACK = 1;
2805 enum SS_DISABLE = 2;
2806 enum MINSIGSTKSZ = 2048;
2807 enum SIGSTKSZ = 8192;
2809 version (MIPS_Any)
2811 struct stack_t
2813 void *ss_sp;
2814 size_t ss_size;
2815 int ss_flags;
2818 else
2820 struct stack_t
2822 void* ss_sp;
2823 int ss_flags;
2824 size_t ss_size;
2828 struct sigstack
2830 void* ss_sp;
2831 int ss_onstack;
2834 sigfn_t sigset(int sig, sigfn_t func);
2836 nothrow:
2837 @nogc:
2838 sigfn_t2 sigset(int sig, sigfn_t2 func);
2840 int killpg(pid_t, int);
2841 int sigaltstack(const scope stack_t*, stack_t*);
2842 int sighold(int);
2843 int sigignore(int);
2844 int siginterrupt(int, int);
2845 int sigpause(int);
2846 int sigrelse(int);
2848 else
2850 static assert(false, "Unsupported platform");
2854 // Realtime Signals (RTS)
2857 struct sigevent
2859 int sigev_notify;
2860 int sigev_signo;
2861 sigval sigev_value;
2862 void(*)(sigval) sigev_notify_function;
2863 pthread_attr_t* sigev_notify_attributes;
2867 nothrow:
2868 @nogc:
2870 version (linux)
2872 private enum __SIGEV_MAX_SIZE = 64;
2874 static if ( __WORDSIZE == 64 )
2876 private enum __SIGEV_PAD_SIZE = ((__SIGEV_MAX_SIZE / int.sizeof) - 4);
2878 else
2880 private enum __SIGEV_PAD_SIZE = ((__SIGEV_MAX_SIZE / int.sizeof) - 3);
2883 struct sigevent
2885 sigval sigev_value;
2886 int sigev_signo;
2887 int sigev_notify;
2889 union
2891 int[__SIGEV_PAD_SIZE] _pad;
2892 pid_t _tid;
2894 struct
2896 void function(sigval) sigev_notify_function;
2897 void* sigev_notify_attributes;
2902 else version (FreeBSD)
2904 struct sigevent
2906 int sigev_notify;
2907 int sigev_signo;
2908 sigval sigev_value;
2909 union
2911 lwpid_t _threadid;
2912 struct
2914 void function(sigval) sigev_notify_function;
2915 void* sigev_notify_attributes;
2917 c_long[8] __spare__;
2921 else version (NetBSD)
2923 struct sigevent
2925 int sigev_notify;
2926 int sigev_signo;
2927 sigval sigev_value;
2928 void function(sigval) sigev_notify_function;
2929 void /* pthread_attr_t */*sigev_notify_attributes;
2932 else version (OpenBSD)
2934 // OpenBSD does not implement sigevent.
2935 alias sigevent = void;
2937 else version (DragonFlyBSD)
2939 union _sigev_un_t
2941 int sigev_signo;
2942 int sigev_notify_kqueue;
2943 void /*pthread_attr_t*/ * sigev_notify_attributes;
2945 union _sigval_t
2947 int sival_int;
2948 void * sival_ptr;
2949 int sigval_int;
2950 void * sigval_ptr;
2952 struct sigevent
2954 int sigev_notify;
2955 _sigev_un_t sigev_un;
2956 _sigval_t sigev_value;
2957 void function(_sigval_t) sigev_notify_function;
2960 else version (Darwin)
2962 struct sigevent
2964 int sigev_notify;
2965 int sigev_signo;
2966 sigval sigev_value;
2967 void function(sigval) sigev_notify_function;
2968 pthread_attr_t* sigev_notify_attributes;
2971 else version (Solaris)
2973 struct sigevent
2975 int sigev_notify;
2976 int sigev_signo;
2977 sigval sigev_value;
2978 void function(sigval) sigev_notify_function;
2979 pthread_attr_t* sigev_notify_attributes;
2980 int __sigev_pad2;
2983 else
2985 static assert(false, "Unsupported platform");
2989 int sigqueue(pid_t, int, const sigval);
2990 int sigtimedwait(const scope sigset_t*, siginfo_t*, const scope timespec*);
2991 int sigwaitinfo(const scope sigset_t*, siginfo_t*);
2994 nothrow:
2995 @nogc:
2997 version (CRuntime_Glibc)
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 version (FreeBSD)
3005 int sigqueue(pid_t, int, const sigval);
3006 int sigtimedwait(const scope sigset_t*, siginfo_t*, const scope timespec*);
3007 int sigwaitinfo(const scope sigset_t*, siginfo_t*);
3009 else version (NetBSD)
3011 int sigqueue(pid_t, int, const sigval);
3012 int sigtimedwait(const scope sigset_t*, siginfo_t*, const scope timespec*);
3013 int sigwaitinfo(const scope sigset_t*, siginfo_t*);
3015 else version (OpenBSD)
3018 else version (DragonFlyBSD)
3020 int sigqueue(pid_t, int, const sigval);
3021 int sigtimedwait(const scope sigset_t*, siginfo_t*, const scope timespec*);
3022 int sigwaitinfo(const scope sigset_t*, siginfo_t*);
3024 else version (Darwin)
3027 else version (Solaris)
3029 int sigqueue(pid_t, int, const sigval);
3030 int sigtimedwait(const scope sigset_t*, siginfo_t*, const scope timespec*);
3031 int sigwaitinfo(const scope sigset_t*, siginfo_t*);
3033 else version (CRuntime_Bionic)
3036 else version (CRuntime_Musl)
3038 int sigqueue(pid_t, int, const sigval);
3039 pragma(mangle, muslRedirTime64Mangle!("sigtimedwait", "__sigtimedwait_time64"))
3040 int sigtimedwait(const scope sigset_t*, siginfo_t*, const scope timespec*);
3041 int sigwaitinfo(const scope sigset_t*, siginfo_t*);
3043 else version (CRuntime_UClibc)
3045 int sigqueue(pid_t, int, const sigval);
3046 int sigtimedwait(const scope sigset_t*, siginfo_t*, const scope timespec*);
3047 int sigwaitinfo(const scope sigset_t*, siginfo_t*);
3049 else
3051 static assert(false, "Unsupported platform");
3055 // Threads (THR)
3058 int pthread_kill(pthread_t, int);
3059 int pthread_sigmask(int, const scope sigset_t*, sigset_t*);
3062 version (CRuntime_Glibc)
3064 int pthread_kill(pthread_t, int);
3065 int pthread_sigmask(int, const scope sigset_t*, sigset_t*);
3067 else version (Darwin)
3069 int pthread_kill(pthread_t, int);
3070 int pthread_sigmask(int, const scope sigset_t*, sigset_t*);
3072 else version (FreeBSD)
3074 int pthread_kill(pthread_t, int);
3075 int pthread_sigmask(int, const scope sigset_t*, sigset_t*);
3077 else version (NetBSD)
3079 int pthread_kill(pthread_t, int);
3080 int pthread_sigmask(int, const scope sigset_t*, sigset_t*);
3082 else version (OpenBSD)
3084 int pthread_kill(pthread_t, int);
3085 int pthread_sigmask(int, const scope sigset_t*, sigset_t*);
3087 else version (DragonFlyBSD)
3089 int pthread_kill(pthread_t, int);
3090 int pthread_sigmask(int, const scope sigset_t*, sigset_t*);
3092 else version (Solaris)
3094 int pthread_kill(pthread_t, int);
3095 int pthread_sigmask(int, const scope sigset_t*, sigset_t*);
3097 else version (CRuntime_Bionic)
3099 int pthread_kill(pthread_t, int);
3100 int pthread_sigmask(int, const scope sigset_t*, sigset_t*);
3102 else version (CRuntime_Musl)
3104 int pthread_kill(pthread_t, int);
3105 int pthread_sigmask(int, const scope sigset_t*, sigset_t*);
3107 else version (CRuntime_UClibc)
3109 int pthread_kill(pthread_t, int);
3110 int pthread_sigmask(int, const scope sigset_t*, sigset_t*);
3111 int pthread_sigqueue(pthread_t, int, sigval);
3113 else
3115 static assert(false, "Unsupported platform");