| author | |
| committer | |
| log | e8a4e47d384ab059c856fc99755f5e176bab67d2 |
| tree | ee895edaa679a6e37928966568ae69f2c0e4270b |
| parent | c6a18e9534025bb84f2707b3d2bd7437f2168a7e |
The interface and errors for this seem to be very universal and
generic. Note Linux already has this defined as a syscall as well.2 files changed, 15 insertions(+), 0 deletions(-)
lib/std/c.zig+1| ... | @@ -10808,6 +10808,7 @@ pub extern "c" fn if_nametoindex([*:0]const u8) c_int; | ... | @@ -10808,6 +10808,7 @@ pub extern "c" fn if_nametoindex([*:0]const u8) c_int; |
| 10808 | 10808 | ||
| 10809 | pub extern "c" fn getpid() pid_t; | 10809 | pub extern "c" fn getpid() pid_t; |
| 10810 | pub extern "c" fn getppid() pid_t; | 10810 | pub extern "c" fn getppid() pid_t; |
| 10811 | pub extern "c" fn setsid() pid_t; | ||
| 10811 | 10812 | ||
| 10812 | /// These are implementation defined but share identical values in at least musl and glibc: | 10813 | /// These are implementation defined but share identical values in at least musl and glibc: |
| 10813 | /// - https://git.musl-libc.org/cgit/musl/tree/include/locale.h?id=ab31e9d6a0fa7c5c408856c89df2dfb12c344039#n18 | 10814 | /// - https://git.musl-libc.org/cgit/musl/tree/include/locale.h?id=ab31e9d6a0fa7c5c408856c89df2dfb12c344039#n18 |
lib/std/posix.zig+14| ... | @@ -7089,6 +7089,20 @@ pub fn tcsetpgrp(handle: fd_t, pgrp: pid_t) TermioSetPgrpError!void { | ... | @@ -7089,6 +7089,20 @@ pub fn tcsetpgrp(handle: fd_t, pgrp: pid_t) TermioSetPgrpError!void { |
| 7089 | } | 7089 | } |
| 7090 | } | 7090 | } |
| 7091 | 7091 | ||
| 7092 | pub const SetSidError = error{ | ||
| 7093 | /// The calling process is already a process group leader, or the process group ID of a process other than the calling process matches the process ID of the calling process. | ||
| 7094 | PermissionDenied, | ||
| 7095 | } || UnexpectedError; | ||
| 7096 | |||
| 7097 | pub fn setsid() SetSidError!pid_t { | ||
| 7098 | const rc = system.setsid(); | ||
| 7099 | switch (errno(rc)) { | ||
| 7100 | .SUCCESS => return rc, | ||
| 7101 | .PERM => return error.PermissionDenied, | ||
| 7102 | else => |err| return unexpectedErrno(err), | ||
| 7103 | } | ||
| 7104 | } | ||
| 7105 | |||
| 7092 | pub fn signalfd(fd: fd_t, mask: *const sigset_t, flags: u32) !fd_t { | 7106 | pub fn signalfd(fd: fd_t, mask: *const sigset_t, flags: u32) !fd_t { |
| 7093 | const rc = system.signalfd(fd, mask, flags); | 7107 | const rc = system.signalfd(fd, mask, flags); |
| 7094 | switch (errno(rc)) { | 7108 | switch (errno(rc)) { |