Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.

Commit 8c3de4f

Browse files
committed
Issue 22689: core.sys.posix.signal: Separate OS-specific sigset types from C runtime functions
1 parent a311c6e commit 8c3de4f

1 file changed

Lines changed: 36 additions & 89 deletions

File tree

src/core/sys/posix/signal.d

Lines changed: 36 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -833,6 +833,8 @@ else
833833
// C Extension (CX)
834834
//
835835
/*
836+
SIG_HOLD
837+
836838
sigset_t
837839
pid_t (defined in core.sys.types)
838840
@@ -842,95 +844,6 @@ SIGILL (defined in core.stdc.signal)
842844
SIGINT (defined in core.stdc.signal)
843845
SIGSEGV (defined in core.stdc.signal)
844846
SIGTERM (defined in core.stdc.signal)
845-
*/
846-
847-
nothrow @nogc
848-
{
849-
850-
version (CRuntime_Glibc)
851-
{
852-
private enum _SIGSET_NWORDS = 1024 / (8 * c_ulong.sizeof);
853-
854-
struct sigset_t
855-
{
856-
c_ulong[_SIGSET_NWORDS] __val;
857-
}
858-
}
859-
else version (Darwin)
860-
{
861-
alias uint sigset_t;
862-
}
863-
else version (FreeBSD)
864-
{
865-
struct sigset_t
866-
{
867-
uint[4] __bits;
868-
}
869-
}
870-
else version (NetBSD)
871-
{
872-
struct sigset_t
873-
{
874-
uint[4] __bits;
875-
}
876-
}
877-
else version (OpenBSD)
878-
{
879-
alias sigset_t = uint;
880-
}
881-
else version (DragonFlyBSD)
882-
{
883-
struct sigset_t
884-
{
885-
uint[4] __bits;
886-
}
887-
}
888-
else version (Solaris)
889-
{
890-
struct sigset_t
891-
{
892-
uint[4] __bits;
893-
}
894-
}
895-
else version (CRuntime_Bionic)
896-
{
897-
version (X86)
898-
alias uint sigset_t;
899-
else version (ARM)
900-
alias uint sigset_t;
901-
else version (AArch64)
902-
struct sigset_t { ulong[1] sig; }
903-
else version (X86_64)
904-
alias ulong sigset_t;
905-
else
906-
static assert(false, "Architecture not supported.");
907-
}
908-
else version (CRuntime_Musl)
909-
{
910-
struct sigset_t
911-
{
912-
c_ulong[128/c_long.sizeof] __bits;
913-
}
914-
}
915-
else version (CRuntime_UClibc)
916-
{
917-
version (MIPS32)
918-
private enum _SIGSET_NWORDS = 128 / (8 * c_ulong.sizeof);
919-
else
920-
private enum _SIGSET_NWORDS = 64 / (8 * c_ulong.sizeof);
921-
922-
struct sigset_t
923-
{
924-
c_ulong[_SIGSET_NWORDS] __val;
925-
}
926-
}
927-
else
928-
{
929-
static assert(false, "Unsupported platform");
930-
}
931-
932-
/*
933-
SIG_HOLD
934847
935848
SA_NOCLDSTOP (CX|XSI)
936849
SIG_BLOCK
@@ -964,10 +877,20 @@ SI_ASYNCIO
964877
SI_MESGQ
965878
*/
966879

880+
nothrow @nogc
881+
{
882+
967883
version (linux)
968884
{
969885
enum SIG_HOLD = cast(sigfn_t2) 2;
970886

887+
private enum _SIGSET_NWORDS = 1024 / (8 * c_ulong.sizeof);
888+
889+
struct sigset_t
890+
{
891+
c_ulong[_SIGSET_NWORDS] __val;
892+
}
893+
971894
enum SA_NOCLDSTOP = 1; // (CX|XSI)
972895

973896
version (MIPS_Any)
@@ -1090,6 +1013,8 @@ else version (Darwin)
10901013
{
10911014
enum SIG_HOLD = cast(sigfn_t2) 5;
10921015

1016+
alias uint sigset_t;
1017+
10931018
enum SA_NOCLDSTOP = 8; // (CX|XSI)
10941019

10951020
enum SIG_BLOCK = 1;
@@ -1120,6 +1045,11 @@ else version (FreeBSD)
11201045
{
11211046
enum SIG_HOLD = cast(sigfn_t2) 3;
11221047

1048+
struct sigset_t
1049+
{
1050+
uint[4] __bits;
1051+
}
1052+
11231053
enum SA_NOCLDSTOP = 8;
11241054

11251055
enum SIG_BLOCK = 1;
@@ -1181,6 +1111,11 @@ else version (NetBSD)
11811111
{
11821112
enum SIG_HOLD = cast(sigfn_t2) 3;
11831113

1114+
struct sigset_t
1115+
{
1116+
uint[4] __bits;
1117+
}
1118+
11841119
enum SA_NOCLDSTOP = 8;
11851120

11861121
enum SIG_BLOCK = 1;
@@ -1251,6 +1186,8 @@ else version (OpenBSD)
12511186
enum SIG_CATCH = cast(sigfn_t2) 2;
12521187
enum SIG_HOLD = cast(sigfn_t2) 3;
12531188

1189+
alias sigset_t = uint;
1190+
12541191
enum SA_NOCLDSTOP = 0x0008;
12551192

12561193
enum SIG_BLOCK = 1;
@@ -1313,6 +1250,11 @@ else version (DragonFlyBSD)
13131250
enum SIG_CATCH = cast(sigfn_t2) 2;
13141251
enum SIG_HOLD = cast(sigfn_t2) 3;
13151252

1253+
struct sigset_t
1254+
{
1255+
uint[4] __bits;
1256+
}
1257+
13161258
enum SA_NOCLDSTOP = 8;
13171259

13181260
enum SIG_BLOCK = 1;
@@ -1344,6 +1286,11 @@ else version (Solaris)
13441286
{
13451287
enum SIG_HOLD = cast(sigfn_t2)2;
13461288

1289+
struct sigset_t
1290+
{
1291+
uint[4] __bits;
1292+
}
1293+
13471294
enum SIG_BLOCK = 1;
13481295
enum SIG_UNBLOCK = 2;
13491296
enum SIG_SETMASK = 3;

0 commit comments

Comments
 (0)