fcntl: open should use a va_list
The current implementation of open requires the user to pass all three args to the function. It should use a va_list and allow a user to provide only the filename and flags.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
sys_includes = ["sys/types.h"]
|
||||
sys_includes = ["stdarg.h", "sys/types.h"]
|
||||
include_guard = "_FCNTL_H"
|
||||
trailer = "#include <bits/fcntl.h>"
|
||||
language = "C"
|
||||
|
||||
[enum]
|
||||
|
||||
@@ -33,7 +33,7 @@ pub const F_UNLCK: c_int = 2;
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn creat(path: *const c_char, mode: mode_t) -> c_int {
|
||||
open(path, O_WRONLY | O_CREAT | O_TRUNC, mode)
|
||||
sys_open(path, O_WRONLY | O_CREAT | O_TRUNC, mode)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
@@ -42,7 +42,7 @@ pub extern "C" fn fcntl(fildes: c_int, cmd: c_int, arg: c_int) -> c_int {
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn open(path: *const c_char, oflag: c_int, mode: mode_t) -> c_int {
|
||||
pub extern "C" fn sys_open(path: *const c_char, oflag: c_int, mode: mode_t) -> c_int {
|
||||
platform::open(path, oflag, mode)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user