Skip to content
Snippets Groups Projects
Commit f20878c5 authored by Tom Almeida's avatar Tom Almeida
Browse files

Added lseek to syscalls

parent aa8b14e1
No related branches found
No related tags found
1 merge request!85Added functions for stdio.h
......@@ -119,6 +119,10 @@ pub fn link(path1: *const c_char, path2: *const c_char) -> c_int {
e(unsafe { syscall!(LINKAT, AT_FDCWD, path1, AT_FDCWD, path2, 0) }) as c_int
}
pub fn lseek(fildes: c_int, offset: off_t, whence: c_int) -> off_t {
e(unsafe { syscall!(LSEEK, fildes, offset, whence) }) as off_t
}
pub fn mkdir(path: *const c_char, mode: mode_t) -> c_int {
e(unsafe { syscall!(MKDIRAT, AT_FDCWD, path, mode) }) as c_int
}
......
......@@ -125,6 +125,10 @@ pub fn link(path1: *const c_char, path2: *const c_char) -> c_int {
e(unsafe { syscall::link(path1.as_ptr(), path2.as_ptr()) }) as c_int
}
pub fn lseek(fd: c_int, offset: isize, whence: usize) -> c_int {
e(syscall::lseek(fd as usize, offset, whence)) as c_int
}
pub fn mkdir(path: *const c_char, mode: mode_t) -> c_int {
let flags = O_CREAT | O_EXCL | O_CLOEXEC | O_DIRECTORY | mode as usize & 0o777;
let path = unsafe { c_str(path) };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment