authorgravatar for 48339289+codic12@users.noreply.github.comcodic12 <48339289+codic12@users.noreply.github.com> 2021-05-04 09:21:23-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-06-11 14:50:48-07:00
log54229fec337f61cad2243f416966892136285683
treee308f42a9d13907ae268d1690cff6431b3bd7cdc
parent264969a8c3f84212a71fc43f9239b0dc7684994c

c.zig: fix waitpid() definition


2 files changed, 3 insertions(+), 3 deletions(-)

lib/std/c.zig+1-1
...@@ -103,7 +103,7 @@ pub extern "c" fn linkat(oldfd: fd_t, oldpath: [*:0]const u8, newfd: fd_t, newpa...@@ -103,7 +103,7 @@ pub extern "c" fn linkat(oldfd: fd_t, oldpath: [*:0]const u8, newfd: fd_t, newpa
103pub extern "c" fn unlink(path: [*:0]const u8) c_int;103pub extern "c" fn unlink(path: [*:0]const u8) c_int;
104pub extern "c" fn unlinkat(dirfd: fd_t, path: [*:0]const u8, flags: c_uint) c_int;104pub extern "c" fn unlinkat(dirfd: fd_t, path: [*:0]const u8, flags: c_uint) c_int;
105pub extern "c" fn getcwd(buf: [*]u8, size: usize) ?[*]u8;105pub extern "c" fn getcwd(buf: [*]u8, size: usize) ?[*]u8;
106pub extern "c" fn waitpid(pid: c_int, stat_loc: *c_uint, options: c_uint) c_int;106pub extern "c" fn waitpid(pid: pid_t, stat_loc: ?*c_int, options: c_int) pid_t;
107pub extern "c" fn fork() c_int;107pub extern "c" fn fork() c_int;
108pub extern "c" fn access(path: [*:0]const u8, mode: c_uint) c_int;108pub extern "c" fn access(path: [*:0]const u8, mode: c_uint) c_int;
109pub extern "c" fn faccessat(dirfd: fd_t, path: [*:0]const u8, mode: c_uint, flags: c_uint) c_int;109pub extern "c" fn faccessat(dirfd: fd_t, path: [*:0]const u8, mode: c_uint, flags: c_uint) c_int;
lib/std/os.zig+2-2
...@@ -3435,10 +3435,10 @@ pub const WaitPidResult = struct {...@@ -3435,10 +3435,10 @@ pub const WaitPidResult = struct {
3435};3435};
34363436
3437pub fn waitpid(pid: pid_t, flags: u32) WaitPidResult {3437pub fn waitpid(pid: pid_t, flags: u32) WaitPidResult {
3438 const Status = if (builtin.link_libc) c_uint else u32;3438 const Status = if (builtin.link_libc) c_int else u32;
3439 var status: Status = undefined;3439 var status: Status = undefined;
3440 while (true) {3440 while (true) {
3441 const rc = system.waitpid(pid, &status, flags);3441 const rc = system.waitpid(pid, &status, if (builtin.link_libc) @intCast(c_int, flags) else flags);
3442 switch (errno(rc)) {3442 switch (errno(rc)) {
3443 0 => return .{3443 0 => return .{
3444 .pid = @intCast(pid_t, rc),3444 .pid = @intCast(pid_t, rc),