implement dup syscall
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
# Add the library.
|
||||
add_library(
|
||||
libc
|
||||
${CMAKE_SOURCE_DIR}/libc/src/unistd/dup.c
|
||||
${CMAKE_SOURCE_DIR}/libc/src/stdio.c
|
||||
${CMAKE_SOURCE_DIR}/libc/src/ctype.c
|
||||
${CMAKE_SOURCE_DIR}/libc/src/string.c
|
||||
|
||||
@@ -253,6 +253,12 @@ int fchdir(int fd);
|
||||
/// appropriately.
|
||||
ssize_t getdents(int fd, dirent_t *dirp, unsigned int count);
|
||||
|
||||
/// @brief Return a new file descriptor
|
||||
/// @param fd The fd pointing to the opened file.
|
||||
/// @return On success, a new file descriptor is returned.
|
||||
/// On error, -1 is returned, and errno is set appropriately.
|
||||
int dup(int fd);
|
||||
|
||||
/// @brief Send signal to calling thread after desired seconds.
|
||||
/// @param seconds the amount of seconds.
|
||||
/// @return If there is a previous alarm() request with time remaining, alarm()
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
/// @file dup.c
|
||||
/// @brief
|
||||
/// @copyright (c) 2024 This file is distributed under the MIT License.
|
||||
/// See LICENSE.md for details.
|
||||
|
||||
#include "sys/unistd.h"
|
||||
#include "system/syscall_types.h"
|
||||
#include "sys/errno.h"
|
||||
|
||||
_syscall1(int, dup, int, fd)
|
||||
Reference in New Issue
Block a user