Kernel/LibC: Add basic pipe() syscall and command

You can now create pipes :)
This commit is contained in:
Bananymous
2023-07-06 22:16:26 +03:00
parent cdcb395640
commit 4cd72992c8
9 changed files with 220 additions and 1 deletions

View File

@@ -39,6 +39,7 @@ __BEGIN_DECLS
#define SYS_GET_PWD 32
#define SYS_SET_PWD 33
#define SYS_CLOCK_GETTIME 34
#define SYS_PIPE 35
__END_DECLS

View File

@@ -251,6 +251,12 @@ long syscall(long syscall, ...)
ret = Kernel::syscall(SYS_CLOCK_GETTIME, clock_id, (uintptr_t)tp);
break;
}
case SYS_PIPE:
{
int* fildes = va_arg(args, int*);
ret = Kernel::syscall(SYS_PIPE, (uintptr_t)fildes);
break;
}
default:
puts("LibC: Unhandeled syscall");
ret = -ENOSYS;
@@ -365,6 +371,11 @@ pid_t fork(void)
return syscall(SYS_FORK);
}
int pipe(int fildes[2])
{
return syscall(SYS_PIPE, fildes);
}
unsigned int sleep(unsigned int seconds)
{
return syscall(SYS_SLEEP, seconds);