aboutsummaryrefslogtreecommitdiff
path: root/std
diff options
context:
space:
mode:
authorMarcio Giaxa <i@mgxm.me>2018-12-17 22:07:21 -0200
committerMarcio Giaxa <i@mgxm.me>2018-12-19 18:42:00 -0200
commit0273fbf710f98854f3331c0810cd2f31f20d2fb5 (patch)
treef2682961b31c2def724710418de3b34d25df3a4e /std
parent5ea37f6e8c9226ec02fbc95cc5c6d06a8e9ee6f7 (diff)
downloadzig-0273fbf710f98854f3331c0810cd2f31f20d2fb5.tar.gz
zig-0273fbf710f98854f3331c0810cd2f31f20d2fb5.zip
freebsd: add access
Diffstat (limited to 'std')
-rw-r--r--std/os/freebsd/index.zig11
1 files changed, 11 insertions, 0 deletions
diff --git a/std/os/freebsd/index.zig b/std/os/freebsd/index.zig
index 880a49b4a8..73573d1d21 100644
--- a/std/os/freebsd/index.zig
+++ b/std/os/freebsd/index.zig
@@ -95,6 +95,13 @@ pub const SIGLIBRT = 33;
pub const SIGRTMIN = 65;
pub const SIGRTMAX = 126;
+// access function
+pub const F_OK = 0; // test for existence of file
+pub const X_OK = 1; // test for execute or search permission
+pub const W_OK = 2; // test for write permission
+pub const R_OK = 4; // test for read permission
+
+
pub const O_RDONLY = 0o0;
pub const O_WRONLY = 0o1;
pub const O_RDWR = 0o2;
@@ -554,6 +561,10 @@ pub fn fork() usize {
return arch.syscall0(SYS_fork);
}
+pub fn access(path: [*]const u8, mode: u32) usize {
+ return errnoWrap(c.access(path, mode));
+}
+
pub fn getcwd(buf: [*]u8, size: usize) usize {
return arch.syscall2(SYS___getcwd, @ptrToInt(buf), size);
}