freebsd: add access

master
Marcio Giaxa 2018-12-17 22:07:21 -02:00
parent 5ea37f6e8c
commit 0273fbf710
1 changed files with 11 additions and 0 deletions

View File

@ -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);
}