From dba41a3719dce32c2375b30da7759aec0a45defc Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Fri, 19 Jan 2024 15:36:12 +0100 Subject: [PATCH] fix usage of pid_t instead of gid_t --- libc/inc/sys/unistd.h | 6 +++--- mentos/inc/system/syscall.h | 6 +++--- mentos/src/process/scheduler.c | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/libc/inc/sys/unistd.h b/libc/inc/sys/unistd.h index 768ff87..18f5abe 100644 --- a/libc/inc/sys/unistd.h +++ b/libc/inc/sys/unistd.h @@ -108,17 +108,17 @@ int setpgid(pid_t pid, pid_t pgid); ///@brief returns the real group ID of the calling process. ///@return GID of the current process -extern pid_t getgid(void); +extern gid_t getgid(void); ///@brief returns the effective group ID of the calling process. ///@return GID of the current process extern gid_t getegid(void); ///@brief sets the group IDs of the calling process. -///@param pid process identifier to +///@param gid the Group ID to set ///@return On success, zero is returned. /// Otherwise returns -1 with errno set to :EINVAL or EPERM -extern int setgid(pid_t pid); +extern int setgid(gid_t gid); ///@brief sets the real and effective group IDs of the calling process. ///@param rgid the new real Group ID. diff --git a/mentos/inc/system/syscall.h b/mentos/inc/system/syscall.h index b95108b..b055583 100644 --- a/mentos/inc/system/syscall.h +++ b/mentos/inc/system/syscall.h @@ -133,13 +133,13 @@ int sys_setpgid(pid_t pid, pid_t pgid); ///@brief returns the real group ID of the calling process. ///@return GID of the current process -pid_t sys_getgid(void); +gid_t sys_getgid(void); ///@brief sets the group ID of the calling process. -///@param pid process identifier to +///@param gid group id ///@return On success, zero is returned. /// Otherwise returns -1 with errno set to :EINVAL or EPERM. -int sys_setgid(pid_t pid); +int sys_setgid(gid_t gid); ///@brief returns the effective group ID of the calling process. ///@return GID of the current process diff --git a/mentos/src/process/scheduler.c b/mentos/src/process/scheduler.c index 852bcc9..0b2320b 100644 --- a/mentos/src/process/scheduler.c +++ b/mentos/src/process/scheduler.c @@ -383,7 +383,7 @@ int sys_setpgid(pid_t pid, pid_t pgid) uid_t sys_getuid(void) { RETURN_PROCESS_ATTR_OR_EPERM(ruid); } uid_t sys_geteuid(void) { RETURN_PROCESS_ATTR_OR_EPERM(uid); } -pid_t sys_getgid(void) { RETURN_PROCESS_ATTR_OR_EPERM(rgid); } +gid_t sys_getgid(void) { RETURN_PROCESS_ATTR_OR_EPERM(rgid); } gid_t sys_getegid(void) { RETURN_PROCESS_ATTR_OR_EPERM(gid); } #define FAIL_ON_INV_ID(id) \ @@ -418,7 +418,7 @@ int sys_setuid(uid_t uid) return -EPERM; } -int sys_setgid(pid_t gid) +int sys_setgid(gid_t gid) { FAIL_ON_INV_ID_OR_PROC(gid); IF_PRIVILEGED_SET_ALL_AND_RETURN(gid);