Commit 682815f6e9
Changed files (2)
std
os
freebsd
std/c/freebsd.zig
@@ -14,9 +14,14 @@ pub extern "c" fn sysctl(name: [*]c_int, namelen: c_uint, oldp: ?*c_void, oldlen
pub extern "c" fn sysctlbyname(name: [*]const u8, oldp: ?*c_void, oldlenp: ?*usize, newp: ?*c_void, newlen: usize) c_int;
pub extern "c" fn sysctlnametomib(name: [*]const u8, mibp: ?*c_int, sizep: ?*usize) c_int;
pub extern "c" fn getdirentries(fd: c_int, buf_ptr: [*]u8, nbytes: usize, basep: *i64) usize;
+pub extern "c" fn getdents(fd: c_int, buf_ptr: [*]u8, nbytes: usize) usize;
pub extern "c" fn pipe2(arg0: *[2]c_int, arg1: u32) c_int;
pub extern "c" fn preadv(fd: c_int, iov: *const c_void, iovcnt: c_int, offset: usize) isize;
pub extern "c" fn pwritev(fd: c_int, iov: *const c_void, iovcnt: c_int, offset: usize) isize;
+pub extern "c" fn openat(fd: c_int, path: ?[*]const u8, flags: c_int) c_int;
+pub extern "c" fn setgid(ruid: c_uint, euid: c_uint) c_int;
+pub extern "c" fn setuid(uid: c_uint) c_int;
+pub extern "c" fn kill(pid: c_int, sig: c_int) c_int;
/// Renamed from `kevent` to `Kevent` to avoid conflict with function name.
pub const Kevent = extern struct {
std/os/freebsd/index.zig
@@ -573,7 +573,7 @@ pub fn getcwd(buf: [*]u8, size: usize) usize {
}
pub fn getdents(fd: i32, dirp: [*]u8, count: usize) usize {
- return arch.syscall3(SYS_getdents, @bitCast(usize, isize(fd)), @ptrToInt(dirp), count);
+ return errnoWrap(@bitCast(isize, c.getdents(fd, drip, count)));
}
pub fn getdirentries(fd: i32, buf_ptr: [*]u8, buf_len: usize, basep: *i64) usize {
@@ -667,7 +667,7 @@ pub fn create(path: [*]const u8, perm: usize) usize {
}
pub fn openat(dirfd: i32, path: [*]const u8, flags: usize, mode: usize) usize {
- return arch.syscall4(SYS_openat, @bitCast(usize, isize(dirfd)), @ptrToInt(path), flags, mode);
+ return errnoWrap(c.openat(@bitCast(usize, isize(dirfd)), @ptrToInt(path), flags, mode));
}
pub fn close(fd: i32) usize {
@@ -683,7 +683,7 @@ pub fn exit(code: i32) noreturn {
}
pub fn kill(pid: i32, sig: i32) usize {
- return arch.syscall2(SYS_kill, @bitCast(usize, isize(pid)), @bitCast(usize, isize(sig)));
+ return errnoWrap(c.kill(pid, sig));
}
pub fn unlink(path: [*]const u8) usize {
@@ -700,11 +700,11 @@ pub fn nanosleep(req: *const timespec, rem: ?*timespec) usize {
}
pub fn setuid(uid: u32) usize {
- return arch.syscall1(SYS_setuid, uid);
+ return errnoWrap(c.setuid(uid));
}
pub fn setgid(gid: u32) usize {
- return arch.syscall1(SYS_setgid, gid);
+ return errnoWrap(c.setgid(gid));
}
pub fn setreuid(ruid: u32, euid: u32) usize {