authorgravatar for i@mgxm.meMarcio Giaxa <i@mgxm.me> 2018-12-17 22:07:21-02:00
committergravatar for i@mgxm.meMarcio Giaxa <i@mgxm.me> 2018-12-19 18:42:00-02:00
log0273fbf710f98854f3331c0810cd2f31f20d2fb5
treef2682961b31c2def724710418de3b34d25df3a4e
parent5ea37f6e8c9226ec02fbc95cc5c6d06a8e9ee6f7

freebsd: add access


1 files changed, 11 insertions(+), 0 deletions(-)

std/os/freebsd/index.zig+11
...@@ -95,6 +95,13 @@ pub const SIGLIBRT = 33;...@@ -95,6 +95,13 @@ pub const SIGLIBRT = 33;
95pub const SIGRTMIN = 65;95pub const SIGRTMIN = 65;
96pub const SIGRTMAX = 126;96pub const SIGRTMAX = 126;
9797
98// access function
99pub const F_OK = 0; // test for existence of file
100pub const X_OK = 1; // test for execute or search permission
101pub const W_OK = 2; // test for write permission
102pub const R_OK = 4; // test for read permission
103
104
98pub const O_RDONLY = 0o0;105pub const O_RDONLY = 0o0;
99pub const O_WRONLY = 0o1;106pub const O_WRONLY = 0o1;
100pub const O_RDWR = 0o2;107pub const O_RDWR = 0o2;
...@@ -554,6 +561,10 @@ pub fn fork() usize {...@@ -554,6 +561,10 @@ pub fn fork() usize {
554 return arch.syscall0(SYS_fork);561 return arch.syscall0(SYS_fork);
555}562}
556563
564pub fn access(path: [*]const u8, mode: u32) usize {
565 return errnoWrap(c.access(path, mode));
566}
567
557pub fn getcwd(buf: [*]u8, size: usize) usize {568pub fn getcwd(buf: [*]u8, size: usize) usize {
558 return arch.syscall2(SYS___getcwd, @ptrToInt(buf), size);569 return arch.syscall2(SYS___getcwd, @ptrToInt(buf), size);
559}570}