This commit is contained in:
Paul Sajna
2018-03-04 08:32:23 -08:00
parent aa4f7ed3a5
commit c96040187f
3 changed files with 11 additions and 1 deletions
+6
View File
@@ -8,6 +8,12 @@ pub fn chdir(path: *const c_char) -> c_int {
}
}
pub fn chown(path: *const c_char, owner: usize, group: usize) -> c_int {
unsafe {
syscall!(CHOWN, owner as u32, group as u32) as c_int
}
}
pub fn close(fildes: c_int) -> c_int {
unsafe {
syscall!(CLOSE, fildes) as c_int
+4
View File
@@ -11,6 +11,10 @@ pub fn chdir(path: *const c_char) -> c_int {
syscall::chdir(cstr_to_slice(path))? as c_int
}
pub fn chown(path: *const c_char, owner: usize, group: usize) -> c_int {
let fd = syscall::open(cstr_to_slice(path));
syscall::fchown(fd, owner as u32, group as u32)? as c_int
pub fn close(fd: c_int) -> c_int {
syscall::close(fd as usize);
0
+1 -1
View File
@@ -56,7 +56,7 @@ pub extern "C" fn chroot(path: *const c_char) -> c_int {
#[no_mangle]
pub extern "C" fn chown(path: *const c_char, owner: uid_t, group: gid_t) -> c_int {
unimplemented!();
platform::chown(path, owner, group)
}
#[no_mangle]