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)
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
25 else version (WatchOS
)
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
;
46 //nothrow: // this causes http://issues.dlang.org/show_bug.cgi?id=12738 (which has been fixed)
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)
72 SIGABRT (defined in core.stdc.signal)
77 SIGFPE (defined in core.stdc.signal)
79 SIGILL (defined in core.stdc.signal)
80 SIGINT (defined in core.stdc.signal)
84 SIGSEGV (defined in core.stdc.signal)
86 SIGTERM (defined in core.stdc.signal)
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
;
117 private alias void function(int) sigfn_t2
;
118 private alias void function(int, siginfo_t
*, void*) sigactfn_t2
;
136 import core
.sys
.posix
.unistd
;
138 @property int SIGRTMIN() nothrow @nogc {
139 __gshared
static int sig
= -1;
141 sig
= cast(int)sysconf(_SC_SIGRT_MIN
);
146 @property int SIGRTMAX() nothrow @nogc {
147 __gshared
static int sig
= -1;
149 sig
= cast(int)sysconf(_SC_SIGRT_MAX
);
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
161 else version (DragonFlyBSD
)
166 else version (NetBSD
)
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;
185 sig
= __libc_current_sigrtmin();
190 @property int SIGRTMAX() nothrow @nogc {
191 __gshared
static int sig
= -1;
193 sig
= __libc_current_sigrtmax();
203 //SIGABRT (defined in core.stdc.signal)
208 //SIGFPE (defined in core.stdc.signal)
210 //SIGILL (defined in core.stdc.signal)
211 //SIGINT (defined in core.stdc.signal)
215 //SIGSEGV (defined in core.stdc.signal)
217 //SIGTERM (defined in core.stdc.signal)
225 else version (HPPA_Any
)
227 //SIGABRT (defined in core.stdc.signal)
232 //SIGFPE (defined in core.stdc.signal)
234 //SIGILL (defined in core.stdc.signal)
235 //SIGINT (defined in core.stdc.signal)
239 //SIGSEGV (defined in core.stdc.signal)
241 //SIGTERM (defined in core.stdc.signal)
249 else version (MIPS_Any
)
251 //SIGABRT (defined in core.stdc.signal)
256 //SIGFPE (defined in core.stdc.signal)
258 //SIGILL (defined in core.stdc.signal)
259 //SIGINT (defined in core.stdc.signal)
263 //SIGSEGV (defined in core.stdc.signal)
265 //SIGTERM (defined in core.stdc.signal)
273 else version (PPC_Any
)
275 //SIGABRT (defined in core.stdc.signal)
280 //SIGFPE (defined in core.stdc.signal)
282 //SIGILL (defined in core.stdc.signal)
283 //SIGINT (defined in core.stdc.signal)
287 //SIGSEGV (defined in core.stdc.signal)
289 //SIGTERM (defined in core.stdc.signal)
297 else version (ARM_Any
)
299 //SIGABRT (defined in core.stdc.signal)
304 //SIGFPE (defined in core.stdc.signal)
306 //SIGILL (defined in core.stdc.signal)
307 //SIGINT (defined in core.stdc.signal)
311 //SIGSEGV (defined in core.stdc.signal)
313 //SIGTERM (defined in core.stdc.signal)
321 else version (RISCV_Any
)
323 //SIGABRT (defined in core.stdc.signal)
328 //SIGFPE (defined in core.stdc.signal)
330 //SIGILL (defined in core.stdc.signal)
331 //SIGINT (defined in core.stdc.signal)
335 //SIGSEGV (defined in core.stdc.signal)
337 //SIGTERM (defined in core.stdc.signal)
345 else version (SPARC_Any
)
347 //SIGABRT (defined in core.stdc.signal)
352 //SIGFPE (defined in core.stdc.signal)
354 //SIGILL (defined in core.stdc.signal)
355 //SIGINT (defined in core.stdc.signal)
359 //SIGSEGV (defined in core.stdc.signal)
361 //SIGTERM (defined in core.stdc.signal)
369 else version (IBMZ_Any
)
371 //SIGABRT (defined in core.stdc.signal)
376 //SIGFPE (defined in core.stdc.signal)
378 //SIGILL (defined in core.stdc.signal)
379 //SIGINT (defined in core.stdc.signal)
383 //SIGSEGV (defined in core.stdc.signal)
385 //SIGTERM (defined in core.stdc.signal)
394 static assert(0, "unimplemented");
396 else version (Darwin
)
398 //SIGABRT (defined in core.stdc.signal)
403 //SIGFPE (defined in core.stdc.signal)
405 //SIGILL (defined in core.stdc.signal)
406 //SIGINT (defined in core.stdc.signal)
410 //SIGSEGV (defined in core.stdc.signal)
412 //SIGTERM (defined in core.stdc.signal)
420 else version (FreeBSD
)
422 //SIGABRT (defined in core.stdc.signal)
427 //SIGFPE (defined in core.stdc.signal)
429 //SIGILL (defined in core.stdc.signal)
430 //SIGINT (defined in core.stdc.signal)
434 //SIGSEGV (defined in core.stdc.signal)
436 //SIGTERM (defined in core.stdc.signal)
444 else version (NetBSD
)
446 //SIGABRT (defined in core.stdc.signal)
451 //SIGFPE (defined in core.stdc.signal)
453 //SIGILL (defined in core.stdc.signal)
454 //SIGINT (defined in core.stdc.signal)
458 //SIGSEGV (defined in core.stdc.signal)
460 //SIGTERM (defined in core.stdc.signal)
468 else version (OpenBSD
)
470 //SIGABRT (defined in core.stdc.signal)
475 //SIGFPE (defined in core.stdc.signal)
477 //SIGILL (defined in core.stdc.signal)
478 //SIGINT (defined in core.stdc.signal)
482 //SIGSEGV (defined in core.stdc.signal)
484 //SIGTERM (defined in core.stdc.signal)
492 else version (DragonFlyBSD
)
494 //SIGABRT (defined in core.stdc.signal)
499 //SIGFPE (defined in core.stdc.signal)
501 //SIGILL (defined in core.stdc.signal)
502 //SIGINT (defined in core.stdc.signal)
506 //SIGSEGV (defined in core.stdc.signal)
508 //SIGTERM (defined in core.stdc.signal)
516 else version (Solaris
)
518 //SIGABRT (defined in core.stdc.signal)
523 //SIGFPE (defined in core.stdc.signal)
525 //SIGILL (defined in core.stdc.signal)
526 //SIGINT (defined in core.stdc.signal)
530 //SIGSEGV (defined in core.stdc.signal)
532 //SIGTERM (defined in core.stdc.signal)
542 static assert(false, "Unsupported platform");
547 version (CRuntime_Musl
)
554 sigactfn_t sa_sigaction
;
558 void function() sa_restorer
;
561 else version (CRuntime_Bionic
)
571 sigactfn_t sa_sigaction
;
574 void function() sa_restorer
;
584 sigactfn_t sa_sigaction
;
588 void function() sa_restorer
;
592 else version (SystemZ
)
596 static if ( true /* __USE_POSIX199309 */ )
601 sigactfn_t sa_sigaction
;
608 version (CRuntime_Glibc
)
610 int __glibc_reserved0
;
618 void function() sa_restorer
;
623 else version (HPPA_Any
)
627 static if ( true /* __USE_POSIX199309 */ )
632 sigactfn_t sa_sigaction
;
639 version (CRuntime_Glibc
)
642 int __glibc_reserved0
;
652 else version (MIPS_Any
)
658 static if ( true /* __USE_POSIX199309 */ )
663 sigactfn_t sa_sigaction
;
671 void function() sa_restorer
;
673 version (CRuntime_Glibc
)
675 static if ((void*).sizeof
< 8)
680 else version (SPARC_Any
)
684 static if ( true /* __USE_POSIX199309 */ )
689 sigactfn_t sa_sigaction
;
696 version (CRuntime_Glibc
)
700 int __glibc_reserved0
;
702 void function() sa_restorer
;
707 void function() sa_restorer
;
716 static if ( true /* __USE_POSIX199309 */ )
721 sigactfn_t sa_sigaction
;
731 void function() sa_restorer
;
735 else version (FreeBSD
)
742 sigactfn_t sa_sigaction
;
748 else version (NetBSD
)
755 sigactfn_t sa_sigaction
;
761 else version (OpenBSD
)
767 sigfn_t __sa_handler
;
768 alias sa_handler
= __sa_handler
;
769 sigactfn_t __sa_sigaction
;
770 alias sa_sigaction
= __sa_sigaction
;
776 else version (DragonFlyBSD
)
783 sigactfn_t sa_sigaction
;
789 else version (Solaris
)
798 sigactfn_t sa_sigaction
;
807 else version (Darwin
)
811 static if ( true /* __USE_POSIX199309 */ )
816 sigactfn_t sa_sigaction
;
829 static assert(false, "Unsupported platform");
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)
885 enum SIG_HOLD
= cast(sigfn_t2
) 2;
887 private enum _SIGSET_NWORDS
= 1024 / (8 * c_ulong
.sizeof
);
891 c_ulong
[_SIGSET_NWORDS
] __val
;
894 enum SA_NOCLDSTOP
= 1; // (CX|XSI)
899 enum SIG_UNBLOCK
= 2;
900 enum SIG_SETMASK
= 3;
902 else version (SPARC_Any
)
905 enum SIG_UNBLOCK
= 2;
906 enum SIG_SETMASK
= 4;
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);
923 private enum __SI_PAD_SIZE
= ((__SI_MAX_SIZE
/ int.sizeof
) - 3);
929 version (MIPS_Any
) // __SI_SWAP_ERRNO_CODE
942 int[__SI_PAD_SIZE
] _pad
;
974 } _sigchild_t _sigchld
;
976 // SIGILL, SIGFPE, SIGSEGV, SIGBUS
980 } _sigfault_t _sigfault
;
987 } _sigpoll_t _sigpoll
;
988 } _sifields_t _sifields
;
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
; }
1012 else version (Darwin
)
1014 enum SIG_HOLD
= cast(sigfn_t2
) 5;
1016 alias uint sigset_t
;
1018 enum SA_NOCLDSTOP
= 8; // (CX|XSI)
1021 enum SIG_UNBLOCK
= 2;
1022 enum SIG_SETMASK
= 3;
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;
1053 enum SA_NOCLDSTOP
= 8;
1056 enum SIG_UNBLOCK
= 2;
1057 enum SIG_SETMASK
= 3;
1097 ___spare___ __spare__
;
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;
1119 enum SA_NOCLDSTOP
= 8;
1122 enum SIG_UNBLOCK
= 2;
1123 enum SIG_SETMASK
= 3;
1175 @property ref c_long
si_band() return { return _info
._reason
._poll
._band
; }
1181 enum SI_ASYNCIO
= -3;
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;
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;
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;
1248 else version (DragonFlyBSD
)
1250 enum SIG_CATCH
= cast(sigfn_t2
) 2;
1251 enum SIG_HOLD
= cast(sigfn_t2
) 3;
1258 enum SA_NOCLDSTOP
= 8;
1261 enum SIG_UNBLOCK
= 2;
1262 enum SIG_SETMASK
= 3;
1278 enum SI_UNDEFINED
= 0x00000;
1282 enum SI_ASYNCIO
= -3;
1285 else version (Solaris
)
1287 enum SIG_HOLD
= cast(sigfn_t2
)2;
1295 enum SIG_UNBLOCK
= 2;
1296 enum SIG_SETMASK
= 3;
1310 int[(256 / int.sizeof
) - 4] si_pad
;
1312 int[(128 / int.sizeof
) - 3] si_pad
;
1365 timestruc_t __tstamp
;
1386 enum SI_NOINFO
= 32767;
1387 enum SI_DTRACE
= 2050;
1388 enum SI_RCTL
= 2049;
1393 enum SI_ASYNCIO
= -4;
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
;
1529 enum int LONG_BIT
= 32;
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;
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
;
1547 local_set
[signum
/LONG_BIT
] |
= 1UL << (signum
%LONG_BIT
);
1551 int sigdelset(sigset_t
* set
, int signum
)
1553 c_ulong
* local_set
= cast(c_ulong
*) set
;
1555 local_set
[signum
/LONG_BIT
] &= ~(1UL << (signum
%LONG_BIT
));
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
;
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*);
1605 static assert(false, "Unsupported platform");
1679 enum SIGVTALRM
= 26;
1683 else version (HPPA_Any
)
1689 enum SIGVTALRM
= 20;
1693 else version (MIPS_Any
)
1699 enum SIGVTALRM
= 28;
1703 else version (PPC_Any
)
1709 enum SIGVTALRM
= 26;
1713 else version (ARM_Any
)
1719 enum SIGVTALRM
= 26;
1723 else version (RISCV_Any
)
1729 enum SIGVTALRM
= 26;
1733 else version (SPARC_Any
)
1739 enum SIGVTALRM
= 26;
1743 else version (IBMZ_Any
)
1749 enum SIGVTALRM
= 26;
1754 static assert(0, "unimplemented");
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;
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
;
1842 else version (Darwin
)
1848 enum SIGVTALRM
= 26;
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;
1916 else version (FreeBSD
)
1918 // No SIGPOLL on *BSD
1922 enum SIGVTALRM
= 26;
1928 SA_ONSTACK
= 0x0001,
1929 SA_RESTART
= 0x0002,
1930 SA_RESETHAND
= 0x0004,
1931 SA_NODEFER
= 0x0010,
1932 SA_NOCLDWAIT
= 0x0020,
1933 SA_SIGINFO
= 0x0040,
1999 else version (NetBSD
)
2001 // No SIGPOLL on *BSD
2005 enum SIGVTALRM
= 26;
2011 SA_ONSTACK
= 0x0001,
2012 SA_RESTART
= 0x0002,
2013 SA_RESETHAND
= 0x0004,
2014 SA_NODEFER
= 0x0010,
2015 SA_NOCLDWAIT
= 0x0020,
2016 SA_SIGINFO
= 0x0040,
2082 else version (OpenBSD
)
2084 // No SIGPOLL on *BSD
2088 enum SIGVTALRM
= 26;
2094 SA_ONSTACK
= 0x0001,
2095 SA_RESTART
= 0x0002,
2096 SA_RESETHAND
= 0x0004,
2097 SA_NODEFER
= 0x0010,
2098 SA_NOCLDWAIT
= 0x0020,
2099 SA_SIGINFO
= 0x0040,
2112 NSIGILL
= ILL_BADSTK
,
2120 NSIGBUS
= BUS_OBJERR
,
2127 NSIGSEGV
= SEGV_ACCERR
,
2140 NSIGFPE
= FPE_FLTSUB
,
2147 NSIGTRAP
= TRAP_TRACE
,
2158 NSIGCLD
= CLD_CONTINUED
,
2169 NSIGPOLL
= POLL_HUP
,
2172 else version (DragonFlyBSD
)
2174 // No SIGPOLL on *BSD
2178 enum SIGVTALRM
= 26;
2184 SA_ONSTACK
= 0x0001,
2185 SA_RESTART
= 0x0002,
2186 SA_RESETHAND
= 0x0004,
2187 SA_NODEFER
= 0x0010,
2188 SA_NOCLDWAIT
= 0x0020,
2189 SA_SIGINFO
= 0x0040,
2255 else version (Solaris
)
2258 enum SIGIO
= SIGPOLL
;
2262 enum SIGVTALRM
= 28;
2268 SA_ONSTACK
= 0x00001,
2269 SA_RESTART
= 0x00004,
2270 SA_RESETHAND
= 0x00002,
2271 SA_NODEFER
= 0x00010,
2272 SA_NOCLDWAIT
= 0x10000,
2273 SA_SIGINFO
= 0x00008,
2346 static assert(false, "Unsupported platform");
2355 ucontext_t // from ucontext
2356 mcontext_t // from ucontext
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*);
2378 int siginterrupt(int, 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)
2406 sigfn_t
bsd_signal(int sig
, sigfn_t func
);
2407 sigfn_t
sigset(int sig
, sigfn_t func
);
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
*);
2418 int siginterrupt(int, 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)
2445 sigfn_t
bsd_signal(int sig
, sigfn_t func
);
2446 sigfn_t
sigset(int sig
, sigfn_t func
);
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
*);
2457 int siginterrupt(int, int);
2461 else version (FreeBSD
)
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)
2488 //sigfn_t bsd_signal(int sig, sigfn_t func);
2489 sigfn_t
sigset(int sig
, sigfn_t func
);
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
*);
2500 int siginterrupt(int, int);
2504 else version (NetBSD
)
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)
2531 //sigfn_t bsd_signal(int sig, sigfn_t func);
2532 sigfn_t
sigset(int sig
, sigfn_t func
);
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
*);
2543 int siginterrupt(int, int);
2547 else version (OpenBSD
)
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)
2570 int killpg(pid_t
, int);
2571 int sigaltstack(const scope stack_t
*, stack_t
*);
2572 int siginterrupt(int, int);
2575 else version (DragonFlyBSD
)
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)
2602 //sigfn_t bsd_signal(int sig, sigfn_t func);
2603 sigfn_t
sigset(int sig
, sigfn_t func
);
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
*);
2614 int siginterrupt(int, int);
2618 else version (Solaris
)
2622 SS_ONSTACK
= 0x0001,
2623 SS_DISABLE
= 0x0002,
2626 enum MINSIGSTKSZ
= 2048;
2627 enum SIGSTKSZ
= 8192;
2642 sigfn_t
sigset(int sig
, sigfn_t func
);
2646 sigfn_t2
sigset(int sig
, sigfn_t2 func
);
2648 int killpg(pid_t
, int);
2649 int sigaltstack(const scope stack_t
*, stack_t
*);
2652 int siginterrupt(int, int);
2656 else version (CRuntime_Bionic
)
2658 enum SS_ONSTACK
= 1;
2659 enum SS_DISABLE
= 2;
2660 enum MINSIGSTKSZ
= 2048;
2661 enum SIGSTKSZ
= 8192;
2670 sigfn_t
bsd_signal(int, sigfn_t
);
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;
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;
2716 static assert(0, "unimplemented");
2718 //ucontext_t (defined in core.sys.posix.ucontext)
2719 //mcontext_t (defined in core.sys.posix.ucontext)
2740 sigfn_t
bsd_signal(int sig
, sigfn_t func
);
2741 sigfn_t
sigset(int sig
, sigfn_t func
);
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
*);
2752 int siginterrupt(int, int);
2756 else version (CRuntime_UClibc
)
2758 enum SS_ONSTACK
= 1;
2759 enum SS_DISABLE
= 2;
2760 enum MINSIGSTKSZ
= 2048;
2761 enum SIGSTKSZ
= 8192;
2788 sigfn_t
sigset(int sig
, sigfn_t 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
*);
2798 int siginterrupt(int, int);
2804 static assert(false, "Unsupported platform");
2808 // Realtime Signals (RTS)
2816 void(*)(sigval) sigev_notify_function;
2817 pthread_attr_t* sigev_notify_attributes;
2826 private enum __SIGEV_MAX_SIZE
= 64;
2828 static if ( __WORDSIZE
== 64 )
2830 private enum __SIGEV_PAD_SIZE
= ((__SIGEV_MAX_SIZE
/ int.sizeof
) - 4);
2834 private enum __SIGEV_PAD_SIZE
= ((__SIGEV_MAX_SIZE
/ int.sizeof
) - 3);
2845 int[__SIGEV_PAD_SIZE
] _pad
;
2850 void function(sigval
) sigev_notify_function
;
2851 void* sigev_notify_attributes
;
2856 else version (FreeBSD
)
2868 void function(sigval
) sigev_notify_function
;
2869 void* sigev_notify_attributes
;
2871 c_long
[8] __spare__
;
2875 else version (NetBSD
)
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
)
2896 int sigev_notify_kqueue
;
2897 void /*pthread_attr_t*/ * sigev_notify_attributes
;
2909 _sigev_un_t sigev_un
;
2910 _sigval_t sigev_value
;
2911 void function(_sigval_t
) sigev_notify_function
;
2914 else version (Darwin
)
2921 void function(sigval
) sigev_notify_function
;
2922 pthread_attr_t
* sigev_notify_attributes
;
2925 else version (Solaris
)
2932 void function(sigval
) sigev_notify_function
;
2933 pthread_attr_t
* sigev_notify_attributes
;
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*);
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
*);
3005 static assert(false, "Unsupported platform");
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
);
3069 static assert(false, "Unsupported platform");