diff options
Diffstat (limited to 'userland/libc')
-rw-r--r-- | userland/libc/include/syscall.h | 1 | ||||
-rw-r--r-- | userland/libc/include/unistd.h | 1 | ||||
-rw-r--r-- | userland/libc/unistd/dup.c | 6 |
3 files changed, 8 insertions, 0 deletions
diff --git a/userland/libc/include/syscall.h b/userland/libc/include/syscall.h index a0303f4..95ab817 100644 --- a/userland/libc/include/syscall.h +++ b/userland/libc/include/syscall.h @@ -53,6 +53,7 @@ #define SYS_QUEUE_WAIT 45 #define SYS_SENDFILE 46 #define SYS_SHM_UNLINK 47 +#define SYS_DUP 48 int syscall(uint32_t eax, uint32_t ebx, uint32_t ecx, uint32_t edx, uint32_t esi, uint32_t edi); diff --git a/userland/libc/include/unistd.h b/userland/libc/include/unistd.h index b44ca3e..3f17df4 100644 --- a/userland/libc/include/unistd.h +++ b/userland/libc/include/unistd.h @@ -15,6 +15,7 @@ int close(int fildes); int ftruncate(int fildes, size_t length); int execv(char *path, char **argv); int pipe(int fd[2]); +int dup(int fildes); int dup2(int org_fd, int new_fd); int getopt(int argc, char *const argv[], const char *optstring); pid_t getpid(void); diff --git a/userland/libc/unistd/dup.c b/userland/libc/unistd/dup.c new file mode 100644 index 0000000..176659b --- /dev/null +++ b/userland/libc/unistd/dup.c @@ -0,0 +1,6 @@ +#include <syscall.h> +#include <unistd.h> + +int dup(int fildes) { + RC_ERRNO(syscall(SYS_DUP, (u32)fildes, 0, 0, 0, 0)); +} |