Kernel: Implement SYS_GET_PID and SYS_TCSETPGID

we don't have consept of process groups yet
This commit is contained in:
Bananymous
2023-07-24 22:27:11 +03:00
parent 1ef0534b69
commit f6ee4b3496
5 changed files with 56 additions and 3 deletions

View File

@@ -45,6 +45,8 @@ __BEGIN_DECLS
#define SYS_KILL 38
#define SYS_SIGNAL 39
#define SYS_SIGNAL_DONE 40
#define SYS_TCSETPGRP 41
#define SYS_GET_PID 42
__END_DECLS

View File

@@ -286,6 +286,18 @@ long syscall(long syscall, ...)
ret = Kernel::syscall(SYS_SIGNAL, signal, (uintptr_t)handler);
break;
}
case SYS_TCSETPGRP:
{
int fd = va_arg(args, int);
pid_t pgrp = va_arg(args, pid_t);
ret = Kernel::syscall(SYS_TCSETPGRP, fd, pgrp);
break;
}
case SYS_GET_PID:
{
ret = Kernel::syscall(SYS_GET_PID);
break;
}
case SYS_SIGNAL_DONE:
// Should not be called by an user
// fall through
@@ -438,6 +450,11 @@ int chdir(const char* path)
return syscall(SYS_SET_PWD, path);
}
pid_t getpid(void)
{
return syscall(SYS_GET_PID);
}
uid_t getuid(void)
{
return syscall(SYS_GET_UID);
@@ -487,3 +504,8 @@ int setregid(gid_t rgid, gid_t egid)
{
return syscall(SYS_SET_REGID, rgid, egid);
}
int tcsetpgrp(int fildes, pid_t pgid_id)
{
return syscall(SYS_TCSETPGRP, fildes, pgid_id);
}