@@ -863,17 +863,15 @@ test "sigset empty/full" {
863863 if (native_os == .wasi or native_os == .windows )
864864 return error .SkipZigTest ;
865865
866- var set : posix.sigset_t = undefined ;
867-
868- posix .sigemptyset (& set );
866+ var set : posix.sigset_t = posix .sigemptyset ();
869867 for (1.. posix .NSIG ) | i | {
870868 try expectEqual (false , posix .sigismember (& set , @truncate (i )));
871869 }
872870
873871 // The C library can reserve some (unnamed) signals, so can't check the full
874872 // NSIG set is defined, but just test a couple:
875- posix .sigfillset (& set );
876- try expectEqual (true , posix .sigismember (& set , @truncate (posix .SIG .USR1 )));
873+ set = posix .sigfillset ();
874+ try expectEqual (true , posix .sigismember (& set , @truncate (posix .SIG .CHLD )));
877875 try expectEqual (true , posix .sigismember (& set , @truncate (posix .SIG .INT )));
878876}
879877
@@ -887,8 +885,7 @@ test "sigset add/del" {
887885 if (native_os == .wasi or native_os == .windows )
888886 return error .SkipZigTest ;
889887
890- var sigset : posix.sigset_t = undefined ;
891- posix .sigemptyset (& sigset );
888+ var sigset : posix.sigset_t = posix .sigemptyset ();
892889
893890 // See that none are set, then set each one, see that they're all set, then
894891 // remove them all, and then see that none are set.
@@ -924,7 +921,7 @@ test "sigaction" {
924921 return error .SkipZigTest ;
925922 }
926923
927- const test_signo = posix .SIG .USR1 ;
924+ const test_signo = posix .SIG .URG ; // URG only because it is ignored by default in debuggers
928925
929926 const S = struct {
930927 var handler_called_count : u32 = 0 ;
@@ -944,10 +941,10 @@ test "sigaction" {
944941
945942 var sa : posix.Sigaction = .{
946943 .handler = .{ .sigaction = & S .handler },
947- .mask = undefined ,
944+ .mask = posix . sigemptyset () ,
948945 .flags = posix .SA .SIGINFO | posix .SA .RESETHAND ,
949946 };
950- posix . sigemptyset ( & sa . mask );
947+
951948 var old_sa : posix.Sigaction = undefined ;
952949
953950 // Install the new signal handler.
@@ -1009,29 +1006,29 @@ test "sigset_t bits" {
10091006
10101007 const self_pid = posix .system .getpid ();
10111008
1012- // To check that sigset_t mapping matches kernel (think u32/u64
1013- // mismatches on big-endian), try sending a blocked signal to make
1014- // sure the mask matches the signal.
1015- inline for ([_ ]usize { posix .SIG .INT , posix .SIG .USR1 , 62 , 94 , 126 }) | test_signo | {
1009+ // To check that sigset_t mapping matches kernel (think u32/u64 mismatches on
1010+ // big-endian), try sending a blocked signal to make sure the mask matches the
1011+ // signal. (Send URG and CHLD because they're ignored by default in the
1012+ // debugger, vs. USR1 or other named signals)
1013+ inline for ([_ ]usize { posix .SIG .URG , posix .SIG .CHLD , 62 , 94 , 126 }) | test_signo | {
10161014 if (test_signo >= posix .NSIG ) continue ;
10171015
10181016 S .expected_sig = test_signo ;
10191017 S .handler_called_count = 0 ;
10201018
1021- var sa : posix.Sigaction = .{
1019+ const sa : posix.Sigaction = .{
10221020 .handler = .{ .sigaction = & S .handler },
1023- .mask = undefined ,
1021+ .mask = posix . sigemptyset () ,
10241022 .flags = posix .SA .SIGINFO | posix .SA .RESETHAND ,
10251023 };
1026- posix . sigemptyset ( & sa . mask );
1024+
10271025 var old_sa : posix.Sigaction = undefined ;
10281026
10291027 // Install the new signal handler.
10301028 posix .sigaction (test_signo , & sa , & old_sa );
10311029
10321030 // block the signal and see that its delayed until unblocked
1033- var block_one : posix.sigset_t = undefined ;
1034- posix .sigemptyset (& block_one );
1031+ var block_one : posix.sigset_t = posix .sigemptyset ();
10351032 posix .sigaddset (& block_one , test_signo );
10361033 posix .sigprocmask (posix .SIG .BLOCK , & block_one , null );
10371034
0 commit comments