| author | |
| committer | |
| log | 979fd12be96d5f8eda3e02ba676aecea78e6c0db |
| tree | d60b8162448bfaab3e0ef57d7eb0f47b94e54e26 |
| parent | 87e8fc1ade38e764041166dc14cc7cee9382357b |
The std lib is missing getppid, this patch adds it.3 files changed, 9 insertions(+), 0 deletions(-)
lib/std/c.zig+1| ... | ... | @@ -9351,6 +9351,7 @@ pub extern "c" fn setlogmask(maskpri: c_int) c_int; |
| 9351 | 9351 | pub extern "c" fn if_nametoindex([*:0]const u8) c_int; |
| 9352 | 9352 | |
| 9353 | 9353 | pub extern "c" fn getpid() pid_t; |
| 9354 | pub extern "c" fn getppid() pid_t; | |
| 9354 | 9355 | |
| 9355 | 9356 | /// These are implementation defined but share identical values in at least musl and glibc: |
| 9356 | 9357 | /// - https://git.musl-libc.org/cgit/musl/tree/include/locale.h?id=ab31e9d6a0fa7c5c408856c89df2dfb12c344039#n18 |
lib/std/os/linux.zig+4| ... | ... | @@ -1614,6 +1614,10 @@ pub fn getpid() pid_t { |
| 1614 | 1614 | return @bitCast(@as(u32, @truncate(syscall0(.getpid)))); |
| 1615 | 1615 | } |
| 1616 | 1616 | |
| 1617 | pub fn getppid() pid_t { | |
| 1618 | return @bitCast(@as(u32, @truncate(syscall0(.getppid)))); | |
| 1619 | } | |
| 1620 | ||
| 1617 | 1621 | pub fn gettid() pid_t { |
| 1618 | 1622 | return @bitCast(@as(u32, @truncate(syscall0(.gettid)))); |
| 1619 | 1623 | } |
lib/std/os/linux/test.zig+4| ... | ... | @@ -32,6 +32,10 @@ test "getpid" { |
| 32 | 32 | try expect(linux.getpid() != 0); |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | test "getppid" { | |
| 36 | try expect(linux.getppid() != 0); | |
| 37 | } | |
| 38 | ||
| 35 | 39 | test "timer" { |
| 36 | 40 | const epoll_fd = linux.epoll_create(); |
| 37 | 41 | var err: linux.E = linux.E.init(epoll_fd); |