authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-05-26 17:59:07 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-05-26 17:59:07 -07:00
logf340bdfff52c148a94fcb844b80d9048bd419e79
tree55573dfd624080fa0e5e1d84dbd7cdc061e05a67
parentf2fb41162f712ebc5992e88d74f15fa351de1bf4
signaturebadge-check Signed by SSH key SHA256:4hHJbtBRU58AYXwjL7fkz2fnQHdiye8x1QpTCQ0sHNw

add pipe2


2 files changed, 12 insertions(+), 0 deletions(-)

mod.zig+11
......@@ -2155,6 +2155,10 @@ pub const libc = struct {
21552155 /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pause.html
21562156 pub extern fn pause() c_int;
21572157
2158 /// int pipe2(int fildes[2], int flag);
2159 /// https://pubs.opengroup.org/onlinepubs/9799919799/functions/pipe.html
2160 pub extern fn pipe2(pipefd: *[2]c_int, flag: c_int) c_int;
2161
21582162 /// double pow(double x, double y);
21592163 /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/pow.html
21602164 pub extern fn pow(x: f64, y: f64) f64;
......@@ -3537,3 +3541,10 @@ pub fn pthread_rwlock_unlock(rwlock: *pthread_rwlock_t) !void {
35373541 const rc = libc.pthread_rwlock_unlock(rwlock);
35383542 if (rc != 0) return errno.fromInt(rc);
35393543}
3544pub fn pipe2(flag: c_int) ![2]c_int {
3545 var fildes: [2]c_int = @splat(-1);
3546 const rc = libc.pipe2(&fildes, flag);
3547 if (rc == -1) return errno.fromInt(errno.fromLibC());
3548 std.debug.assert(rc == 0);
3549 return fildes;
3550}
test.zig+1
......@@ -70,4 +70,5 @@ test {
7070 _ = &linux.pthread_rwlock_wrlock;
7171 _ = &linux.pthread_rwlock_trywrlock;
7272 _ = &linux.pthread_rwlock_unlock;
73 _ = &linux.pipe2;
7374}