mirror of
https://github.com/EnderIce2/Fennix.git
synced 2025-05-28 15:34:31 +00:00
feat(kernel/syscalls): add fcntl() syscall
Signed-off-by: EnderIce2 <enderice2@protonmail.com>
This commit is contained in:
parent
b05a6a14e8
commit
2080d1f2b7
@ -830,6 +830,25 @@ typedef enum
|
||||
* - #EINVAL if the request is invalid
|
||||
*/
|
||||
SYS_IOCTL,
|
||||
/**
|
||||
* @brief Function control
|
||||
*
|
||||
* @code
|
||||
* int fcntl(int fd, int cmd, void *arg);
|
||||
* @endcode
|
||||
*
|
||||
* @details Manipulates the underlying parameters of a device.
|
||||
*
|
||||
* @param fd File descriptor referring to the device
|
||||
* @param cmd Device-specific request code
|
||||
* @param arg Argument for the request
|
||||
*
|
||||
* @return
|
||||
* - #EOK on success
|
||||
* - #EBADF if `fd` is not valid
|
||||
* - #EINVAL if the request is invalid
|
||||
*/
|
||||
SYS_FCNTL,
|
||||
|
||||
/* File Status */
|
||||
|
||||
@ -1678,6 +1697,9 @@ typedef enum
|
||||
/** @copydoc SYS_IOCTL */
|
||||
#define call_ioctl(fd, request, argp) syscall3(SYS_IOCTL, (scarg)fd, (scarg)request, (scarg)argp)
|
||||
|
||||
/** @copydoc SYS_FCNTL */
|
||||
#define call_fcntl(fd, cmd, arg) syscall3(SYS_FCNTL, (scarg)fd, (scarg)cmd, (scarg)arg)
|
||||
|
||||
/* File Status */
|
||||
|
||||
/** @copydoc SYS_STAT */
|
||||
|
@ -135,6 +135,7 @@ static int sys_close(SysFrm *Frame, int fd)
|
||||
}
|
||||
|
||||
static int sys_ioctl(SysFrm *Frame, int fd, unsigned long request, void *argp) { return -ENOSYS; }
|
||||
static int sys_fcntl(SysFrm *Frame, int fd, int cmd, void *arg) { return -ENOSYS; }
|
||||
static int sys_stat(SysFrm *Frame, const char *pathname, struct stat *statbuf) { return -ENOSYS; }
|
||||
static int sys_fstat(SysFrm *Frame, int fd, struct stat *statbuf) { return -ENOSYS; }
|
||||
static int sys_lstat(SysFrm *Frame, const char *pathname, struct stat *statbuf) { return -ENOSYS; }
|
||||
@ -275,6 +276,7 @@ __constructor void __init_native_syscalls(void)
|
||||
scTbl[SYS_OPEN] = {"SYS_OPEN", (void *)sys_open};
|
||||
scTbl[SYS_CLOSE] = {"SYS_CLOSE", (void *)sys_close};
|
||||
scTbl[SYS_IOCTL] = {"SYS_IOCTL", (void *)sys_ioctl};
|
||||
scTbl[SYS_FCNTL] = {"SYS_FCNTL", (void *)sys_fcntl};
|
||||
|
||||
/* File Status */
|
||||
scTbl[SYS_STAT] = {"SYS_STAT", (void *)sys_stat};
|
||||
|
Loading…
x
Reference in New Issue
Block a user