From b7c35dad69fd34ba8dbcecae3edc0c4883f98bce Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Thu, 7 Jun 2018 07:19:01 +0200 Subject: [PATCH] mescc: Support gcc-3.2: Implement getuid, getgid. * lib/linux+gnu.c (getuid, getdid): New function. * lib/binutils.c (getuid, getdid): Remove stub. --- lib/binutils.c | 14 -------------- lib/linux+gnu.c | 15 +++++++++++++++ lib/linux-gcc.c | 8 ++++---- lib/linux-mes.c | 8 ++++---- 4 files changed, 23 insertions(+), 22 deletions(-) diff --git a/lib/binutils.c b/lib/binutils.c index 3f525c2c..909af6f6 100644 --- a/lib/binutils.c +++ b/lib/binutils.c @@ -91,20 +91,6 @@ frexp (int x) return 0; } -int -getgid (int x) -{ - eputs ("getgid stub\n"); - return 0; -} - -int -getuid (int x) -{ - eputs ("getuid stub\n"); - return 0; -} - void perror (char const *message) { diff --git a/lib/linux+gnu.c b/lib/linux+gnu.c index 601efa17..ca2c293c 100644 --- a/lib/linux+gnu.c +++ b/lib/linux+gnu.c @@ -20,16 +20,19 @@ #define SYS_link 0x09 #define SYS_getpid 0x14 +#define SYS_getuid 0x18 #define SYS_kill 0x25 #define SYS_rename 0x26 #define SYS_mkdir 0x27 #define SYS_dup 0x29 #define SYS_pipe 0x2a +#define SYS_getgid 0x2f #define SYS_signal 0x30 #define SYS_lstat 0x6b #define SYS_fstat 0x6c #define SYS_nanosleep 0xa2 + int link (char const *old_name, char const *new_name) { @@ -42,6 +45,12 @@ getpid () return _sys_call (SYS_getpid); } +uid_t +getuid () +{ + return _sys_call (SYS_getuid); +} + int kill (pid_t pid, int signum) { @@ -66,6 +75,12 @@ dup (int old) return _sys_call1 (SYS_dup, (int)old); } +gid_t +getgid () +{ + return _sys_call (SYS_getgid); +} + #if __MESC__ void * signal (int signum, void * action) diff --git a/lib/linux-gcc.c b/lib/linux-gcc.c index 9e6048c5..f92dcc68 100644 --- a/lib/linux-gcc.c +++ b/lib/linux-gcc.c @@ -36,7 +36,7 @@ _sys_call (int sys_call) if (r < 0) errno = -r; else - errno = 0 + errno = 0; return r; #endif } @@ -58,7 +58,7 @@ _sys_call1 (int sys_call, int one) if (r < 0) errno = -r; else - errno = 0 + errno = 0; return r; #endif } @@ -81,7 +81,7 @@ _sys_call2 (int sys_call, int one, int two) if (r < 0) errno = -r; else - errno = 0 + errno = 0; return r; #endif } @@ -105,7 +105,7 @@ _sys_call3 (int sys_call, int one, int two, int three) if (r < 0) errno = -r; else - errno = 0 + errno = 0; return r; #endif } diff --git a/lib/linux-mes.c b/lib/linux-mes.c index 6f1a8534..1c4521ed 100644 --- a/lib/linux-mes.c +++ b/lib/linux-mes.c @@ -61,7 +61,7 @@ _sys_call (int sys_call) if (r < 0) errno = -r; else - errno = 0 + errno = 0; return r; } @@ -72,7 +72,7 @@ _sys_call1 (int sys_call, int one) if (r < 0) errno = -r; else - errno = 0 + errno = 0; return r; } @@ -83,7 +83,7 @@ _sys_call2 (int sys_call, int one, int two) if (r < 0) errno = -r; else - errno = 0 + errno = 0; return r; } @@ -94,6 +94,6 @@ _sys_call3 (int sys_call, int one, int two, int three) if (r < 0) errno = -r; else - errno = 0 + errno = 0; return r; }