| ... | @@ -1391,6 +1391,10 @@ pub fn faccessat(dirfd: i32, path: [*:0]const u8, mode: u32, flags: u32) usize { | ... | @@ -1391,6 +1391,10 @@ pub fn faccessat(dirfd: i32, path: [*:0]const u8, mode: u32, flags: u32) usize { |
| 1391 | return syscall4(.faccessat2, @as(usize, @bitCast(@as(isize, dirfd))), @intFromPtr(path), mode, flags); | 1391 | return syscall4(.faccessat2, @as(usize, @bitCast(@as(isize, dirfd))), @intFromPtr(path), mode, flags); |
| 1392 | } | 1392 | } |
| 1393 | | 1393 | |
| | 1394 | pub fn acct(path: [*:0]const u8) usize { |
| | 1395 | return syscall1(.acct, @intFromPtr(path)); |
| | 1396 | } |
| | 1397 | |
| 1394 | pub fn pipe(fd: *[2]i32) usize { | 1398 | pub fn pipe(fd: *[2]i32) usize { |
| 1395 | if (comptime (native_arch.isMIPS() or native_arch.isSPARC())) { | 1399 | if (comptime (native_arch.isMIPS() or native_arch.isSPARC())) { |
| 1396 | return syscall_pipe(fd); | 1400 | return syscall_pipe(fd); |
| ... | @@ -1601,11 +1605,27 @@ pub fn fchown(fd: i32, owner: uid_t, group: gid_t) usize { | ... | @@ -1601,11 +1605,27 @@ pub fn fchown(fd: i32, owner: uid_t, group: gid_t) usize { |
| 1601 | } | 1605 | } |
| 1602 | } | 1606 | } |
| 1603 | | 1607 | |
| | 1608 | pub fn fchownat(fd: i32, path: [*:0]const u8, owner: uid_t, group: gid_t, flags: u32) usize { |
| | 1609 | return syscall5(.fchownat, @as(usize, @bitCast(@as(isize, fd))), @intFromPtr(path), owner, group, flags); |
| | 1610 | } |
| | 1611 | |
| 1604 | pub fn chown(path: [*:0]const u8, owner: uid_t, group: gid_t) usize { | 1612 | pub fn chown(path: [*:0]const u8, owner: uid_t, group: gid_t) usize { |
| 1605 | if (@hasField(SYS, "chown32")) { | 1613 | if (@hasField(SYS, "chown32")) { |
| 1606 | return syscall3(.chown32, @intFromPtr(path), owner, group); | 1614 | return syscall3(.chown32, @intFromPtr(path), owner, group); |
| 1607 | } else { | 1615 | } else if (@hasField(SYS, "chown")) { |
| 1608 | return syscall3(.chown, @intFromPtr(path), owner, group); | 1616 | return syscall3(.chown, @intFromPtr(path), owner, group); |
| | 1617 | } else { |
| | 1618 | return fchownat(AT.FDCWD, path, owner, group, 0); |
| | 1619 | } |
| | 1620 | } |
| | 1621 | |
| | 1622 | pub fn lchown(path: [*:0]const u8, owner: uid_t, group: gid_t) usize { |
| | 1623 | if (@hasField(SYS, "lchown32")) { |
| | 1624 | return syscall3(.lchown32, @intFromPtr(path), owner, group); |
| | 1625 | } else if (@hasField(SYS, "lchown")) { |
| | 1626 | return syscall3(.lchown, @intFromPtr(path), owner, group); |
| | 1627 | } else { |
| | 1628 | return fchownat(AT.FDCWD, path, owner, group, AT.SYMLINK_NOFOLLOW); |
| 1609 | } | 1629 | } |
| 1610 | } | 1630 | } |
| 1611 | | 1631 | |
| ... | @@ -2064,7 +2084,11 @@ pub fn setpgid(pid: pid_t, pgid: pid_t) usize { | ... | @@ -2064,7 +2084,11 @@ pub fn setpgid(pid: pid_t, pgid: pid_t) usize { |
| 2064 | return syscall2(.setpgid, @intCast(pid), @intCast(pgid)); | 2084 | return syscall2(.setpgid, @intCast(pid), @intCast(pgid)); |
| 2065 | } | 2085 | } |
| 2066 | | 2086 | |
| 2067 | pub fn getgroups(size: usize, list: ?*gid_t) usize { | 2087 | pub fn getpgid(pid: pid_t) usize { |
| | 2088 | return syscall1(.getpgid, @intCast(pid)); |
| | 2089 | } |
| | 2090 | |
| | 2091 | pub fn getgroups(size: usize, list: ?[*]gid_t) usize { |
| 2068 | if (@hasField(SYS, "getgroups32")) { | 2092 | if (@hasField(SYS, "getgroups32")) { |
| 2069 | return syscall2(.getgroups32, size, @intFromPtr(list)); | 2093 | return syscall2(.getgroups32, size, @intFromPtr(list)); |
| 2070 | } else { | 2094 | } else { |
| ... | @@ -2084,6 +2108,10 @@ pub fn setsid() usize { | ... | @@ -2084,6 +2108,10 @@ pub fn setsid() usize { |
| 2084 | return syscall0(.setsid); | 2108 | return syscall0(.setsid); |
| 2085 | } | 2109 | } |
| 2086 | | 2110 | |
| | 2111 | pub fn getsid(pid: pid_t) usize { |
| | 2112 | return syscall1(.getsid, @intCast(pid)); |
| | 2113 | } |
| | 2114 | |
| 2087 | pub fn getpid() pid_t { | 2115 | pub fn getpid() pid_t { |
| 2088 | // Casts result to a pid_t, safety-checking >= 0, because getpid() cannot fail | 2116 | // Casts result to a pid_t, safety-checking >= 0, because getpid() cannot fail |
| 2089 | return @intCast(@as(u32, @truncate(syscall0(.getpid)))); | 2117 | return @intCast(@as(u32, @truncate(syscall0(.getpid)))); |