diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2020-10-16 18:14:39 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2020-10-16 18:14:39 -0700 |
| commit | 5c16022c81effc2d684aaf21217dce0f7708946a (patch) | |
| tree | f8287a9f1e07269c5ebd2d3e0a86483c23270e25 /lib/std | |
| parent | 3921cb0d8d46c59411b6c8f35f5d271c26fba14f (diff) | |
| download | zig-5c16022c81effc2d684aaf21217dce0f7708946a.tar.gz zig-5c16022c81effc2d684aaf21217dce0f7708946a.zip | |
rename WaitpidRet to WaitPidResult
Diffstat (limited to 'lib/std')
| -rw-r--r-- | lib/std/child_process.zig | 4 | ||||
| -rw-r--r-- | lib/std/os.zig | 19 |
2 files changed, 12 insertions, 11 deletions
diff --git a/lib/std/child_process.zig b/lib/std/child_process.zig index 10241b8eb2..3b8913af50 100644 --- a/lib/std/child_process.zig +++ b/lib/std/child_process.zig @@ -269,9 +269,9 @@ pub const ChildProcess = struct { } fn waitUnwrapped(self: *ChildProcess) void { - const ret = os.waitpid(self.pid, 0); + const status = os.waitpid(self.pid, 0).status; self.cleanupStreams(); - self.handleWaitResult(ret.status); + self.handleWaitResult(status); } fn handleWaitResult(self: *ChildProcess, status: u32) void { diff --git a/lib/std/os.zig b/lib/std/os.zig index 48c1cee6fd..4a06d3c0bb 100644 --- a/lib/std/os.zig +++ b/lib/std/os.zig @@ -3121,21 +3121,24 @@ pub fn getsockoptError(sockfd: fd_t) ConnectError!void { } } -pub const WaitpidRet = struct { - pid: pid_t, status: u32 +pub const WaitPidResult = struct { + pid: pid_t, + status: u32, }; -pub fn waitpid(pid: pid_t, flags: u32) WaitpidRet { - // TODO allow implicit pointer cast from *u32 to *c_uint ? +pub fn waitpid(pid: pid_t, flags: u32) WaitPidResult { const Status = if (builtin.link_libc) c_uint else u32; var status: Status = undefined; while (true) { const rc = system.waitpid(pid, &status, flags); switch (errno(rc)) { - 0 => return WaitpidRet{ .pid = @intCast(pid_t, rc), .status = @bitCast(u32, status) }, + 0 => return .{ + .pid = @intCast(pid_t, rc), + .status = @bitCast(u32, status), + }, EINTR => continue, ECHILD => unreachable, // The process specified does not exist. It would be a race condition to handle this error. - EINVAL => unreachable, // The options argument was invalid + EINVAL => unreachable, // Invalid flags. else => unreachable, } } @@ -5439,9 +5442,7 @@ pub fn getrlimit(resource: rlimit_resource) GetrlimitError!rlimit { } } -pub const SetrlimitError = error{ - PermissionDenied, -} || UnexpectedError; +pub const SetrlimitError = error{PermissionDenied} || UnexpectedError; pub fn setrlimit(resource: rlimit_resource, limits: rlimit) SetrlimitError!void { // TODO implement for systems other than linux and enable test |
