mirror of
https://github.com/ziglang/zig.git
synced 2026-02-12 20:37:54 +00:00
c.zig: fix waitpid() definition
This commit is contained in:
parent
ba7bfe949e
commit
d8b133d733
@ -103,7 +103,7 @@ pub extern "c" fn linkat(oldfd: fd_t, oldpath: [*:0]const u8, newfd: fd_t, newpa
|
||||
pub extern "c" fn unlink(path: [*:0]const u8) c_int;
|
||||
pub extern "c" fn unlinkat(dirfd: fd_t, path: [*:0]const u8, flags: c_uint) c_int;
|
||||
pub extern "c" fn getcwd(buf: [*]u8, size: usize) ?[*]u8;
|
||||
pub extern "c" fn waitpid(pid: c_int, stat_loc: *c_uint, options: c_uint) c_int;
|
||||
pub extern "c" fn waitpid(pid: pid_t, stat_loc: ?*c_int, options: c_int) pid_t;
|
||||
pub extern "c" fn fork() c_int;
|
||||
pub extern "c" fn access(path: [*:0]const u8, mode: c_uint) c_int;
|
||||
pub extern "c" fn faccessat(dirfd: fd_t, path: [*:0]const u8, mode: c_uint, flags: c_uint) c_int;
|
||||
|
||||
@ -3435,10 +3435,10 @@ pub const WaitPidResult = struct {
|
||||
};
|
||||
|
||||
pub fn waitpid(pid: pid_t, flags: u32) WaitPidResult {
|
||||
const Status = if (builtin.link_libc) c_uint else u32;
|
||||
const Status = if (builtin.link_libc) c_int else u32;
|
||||
var status: Status = undefined;
|
||||
while (true) {
|
||||
const rc = system.waitpid(pid, &status, flags);
|
||||
const rc = system.waitpid(pid, &status, if (builtin.link_libc) @intCast(c_int, flags) else flags);
|
||||
switch (errno(rc)) {
|
||||
0 => return .{
|
||||
.pid = @intCast(pid_t, rc),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user