| ... | @@ -1895,6 +1895,10 @@ pub const libc = struct { | ... | @@ -1895,6 +1895,10 @@ pub const libc = struct { |
| 1895 | /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/jn.html | 1895 | /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/jn.html |
| 1896 | pub extern fn jn(n: c_int, x: f64) f64; | 1896 | pub extern fn jn(n: c_int, x: f64) f64; |
| 1897 | | 1897 | |
| | 1898 | /// int kill(pid_t pid, int sig); |
| | 1899 | /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/kill.html |
| | 1900 | pub extern fn kill(pid: pid_t, sig: c_int) c_int; |
| | 1901 | |
| 1898 | /// long labs(long i); | 1902 | /// long labs(long i); |
| 1899 | /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/labs.html | 1903 | /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/labs.html |
| 1900 | pub extern fn labs(i: c_long) c_long; | 1904 | pub extern fn labs(i: c_long) c_long; |
| ... | @@ -3205,6 +3209,43 @@ pub const LOCK = struct { | ... | @@ -3205,6 +3209,43 @@ pub const LOCK = struct { |
| 3205 | pub const UN = 8; | 3209 | pub const UN = 8; |
| 3206 | }; | 3210 | }; |
| 3207 | | 3211 | |
| | 3212 | pub const SIG = struct { |
| | 3213 | pub const HUP = 1; |
| | 3214 | pub const INT = 2; |
| | 3215 | pub const QUIT = 3; |
| | 3216 | pub const ILL = 4; |
| | 3217 | pub const TRAP = 5; |
| | 3218 | pub const ABRT = 6; |
| | 3219 | pub const IOT = ABRT; |
| | 3220 | pub const BUS = 7; |
| | 3221 | pub const FPE = 8; |
| | 3222 | pub const KILL = 9; |
| | 3223 | pub const USR1 = 10; |
| | 3224 | pub const SEGV = 11; |
| | 3225 | pub const USR2 = 12; |
| | 3226 | pub const PIPE = 13; |
| | 3227 | pub const ALRM = 14; |
| | 3228 | pub const TERM = 15; |
| | 3229 | pub const STKFLT = 16; |
| | 3230 | pub const CHLD = 17; |
| | 3231 | pub const CONT = 18; |
| | 3232 | pub const STOP = 19; |
| | 3233 | pub const TSTP = 20; |
| | 3234 | pub const TTIN = 21; |
| | 3235 | pub const TTOU = 22; |
| | 3236 | pub const URG = 23; |
| | 3237 | pub const XCPU = 24; |
| | 3238 | pub const XFSZ = 25; |
| | 3239 | pub const VTALRM = 26; |
| | 3240 | pub const PROF = 27; |
| | 3241 | pub const WINCH = 28; |
| | 3242 | pub const IO = 29; |
| | 3243 | pub const POLL = 29; |
| | 3244 | pub const PWR = 30; |
| | 3245 | pub const SYS = 31; |
| | 3246 | pub const UNUSED = SYS; |
| | 3247 | }; |
| | 3248 | |
| 3208 | pub fn getpid() pid_t { | 3249 | pub fn getpid() pid_t { |
| 3209 | return libc.getpid(); | 3250 | return libc.getpid(); |
| 3210 | } | 3251 | } |
| ... | @@ -3548,3 +3589,8 @@ pub fn pipe2(flag: c_int) ![2]c_int { | ... | @@ -3548,3 +3589,8 @@ pub fn pipe2(flag: c_int) ![2]c_int { |
| 3548 | std.debug.assert(rc == 0); | 3589 | std.debug.assert(rc == 0); |
| 3549 | return fildes; | 3590 | return fildes; |
| 3550 | } | 3591 | } |
| | 3592 | pub fn kill(pid: pid_t, sig: c_int) !void { |
| | 3593 | const rc = libc.kill(pid, sig); |
| | 3594 | if (rc == -1) return errno.fromInt(errno.fromLibC()); |
| | 3595 | std.debug.assert(rc == 0); |
| | 3596 | } |