Kernel/LibC: Add basic pipe() syscall and command
You can now create pipes :)
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user