diff options
author | Eric Andersen <andersen@codepoet.org> | 2001-06-27 19:54:48 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2001-06-27 19:54:48 +0000 |
commit | 20ade83c2dde545ee1cb1687a2a593a227994726 (patch) | |
tree | c4e1454bdcb1d5d5d8433eef05f031766df917c1 /ldso | |
parent | 389c0e545e26507afd1a394904574ddd8b35cb79 (diff) |
Cleanup to not use kernel headers at all.
-Erik
Diffstat (limited to 'ldso')
-rw-r--r-- | ldso/ldso/boot1.c | 2 | ||||
-rw-r--r-- | ldso/ldso/dl-elf.c | 2 | ||||
-rw-r--r-- | ldso/ldso/i386/dl-syscalls.h | 93 | ||||
-rw-r--r-- | ldso/ldso/i386/ld_syscalls.h | 93 | ||||
-rw-r--r-- | ldso/ldso/i386/syscalls.h | 93 | ||||
-rw-r--r-- | ldso/ldso/ld-uClibc.c | 2 | ||||
-rw-r--r-- | ldso/ldso/ld_syscall.h | 14 | ||||
-rw-r--r-- | ldso/ldso/ldso.c | 2 | ||||
-rw-r--r-- | ldso/ldso/m68k/dl-syscalls.h | 28 | ||||
-rw-r--r-- | ldso/ldso/m68k/ld_syscalls.h | 28 | ||||
-rw-r--r-- | ldso/ldso/m68k/syscalls.h | 28 | ||||
-rw-r--r-- | ldso/ldso/readelflib1.c | 2 | ||||
-rw-r--r-- | ldso/ldso/sparc/dl-syscalls.h | 21 | ||||
-rw-r--r-- | ldso/ldso/sparc/ld_syscalls.h | 21 | ||||
-rw-r--r-- | ldso/ldso/sparc/syscalls.h | 21 | ||||
-rw-r--r-- | ldso/ldso/syscall.h | 14 |
16 files changed, 391 insertions, 73 deletions
diff --git a/ldso/ldso/boot1.c b/ldso/ldso/boot1.c index c6dc5f628..a96562f19 100644 --- a/ldso/ldso/boot1.c +++ b/ldso/ldso/boot1.c @@ -648,7 +648,7 @@ found_got: { int fd; - struct kernel_stat st; + struct stat st; char *preload; if (!_dl_stat(LDSO_PRELOAD, &st)) { diff --git a/ldso/ldso/dl-elf.c b/ldso/ldso/dl-elf.c index ae7a86a37..c1a4a41ee 100644 --- a/ldso/ldso/dl-elf.c +++ b/ldso/ldso/dl-elf.c @@ -321,7 +321,7 @@ struct elf_resolve *_dl_load_elf_shared_library(int secure, we don't load the library if it isn't setuid. */ if (secure) { - struct kernel_stat st; + struct stat st; if (_dl_stat(libname, &st) || !(st.st_mode & S_ISUID)) return NULL; diff --git a/ldso/ldso/i386/dl-syscalls.h b/ldso/ldso/i386/dl-syscalls.h index 30544290f..b06c3238d 100644 --- a/ldso/ldso/i386/dl-syscalls.h +++ b/ldso/ldso/i386/dl-syscalls.h @@ -1,4 +1,23 @@ -#include <asm/unistd.h> +#include <sys/types.h> + +/* + * This file contains the system call macros and syscall + * numbers used by the shared library loader. + */ + +#define __NR_exit 1 +#define __NR_read 3 +#define __NR_write 4 +#define __NR_open 5 +#define __NR_close 6 +#define __NR_getuid 24 +#define __NR_geteuid 49 +#define __NR_getgid 47 +#define __NR_getegid 50 +#define __NR_mmap 90 +#define __NR_munmap 91 +#define __NR_stat 106 +#define __NR_mprotect 125 /* Here are the macros which define how this platform makes * system calls. This particular variant does _not_ set @@ -6,7 +25,6 @@ * these will get called before the errno symbol is dynamicly * linked. */ -#undef __syscall_return #define __syscall_return(type, res) \ do { \ if ((unsigned long)(res) >= (unsigned long)(-125)) { \ @@ -16,6 +34,15 @@ do { \ return (type) (res); \ } while (0) +#define _syscall0(type,name) \ +type name(void) \ +{ \ +long __res; \ +__asm__ volatile ("int $0x80" \ + : "=a" (__res) \ + : "0" (__NR_##name)); \ +__syscall_return(type,__res); \ +} #if defined(__PIC__) @@ -23,7 +50,6 @@ do { \ * PIC uses %ebx, so we need to save it during system calls */ -#undef _syscall1 #define _syscall1(type,name,type1,arg1) \ type name(type1 arg1) \ { \ @@ -34,7 +60,6 @@ __asm__ volatile ("push %%ebx; movl %2,%%ebx; int $0x80; pop %%ebx" \ __syscall_return(type,__res); \ } -#undef _syscall2 #define _syscall2(type,name,type1,arg1,type2,arg2) \ type name(type1 arg1,type2 arg2) \ { \ @@ -45,7 +70,6 @@ __asm__ volatile ("push %%ebx; movl %2,%%ebx; int $0x80; pop %%ebx" \ __syscall_return(type,__res); \ } -#undef _syscall3 #define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \ type name(type1 arg1,type2 arg2,type3 arg3) \ { \ @@ -57,7 +81,6 @@ __asm__ volatile ("push %%ebx; movl %2,%%ebx; int $0x80; pop %%ebx" \ __syscall_return(type,__res); \ } -#undef _syscall4 #define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \ type name (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \ { \ @@ -69,7 +92,6 @@ __asm__ volatile ("push %%ebx; movl %2,%%ebx; int $0x80; pop %%ebx" \ __syscall_return(type,__res); \ } -#undef _syscall5 #define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \ type5,arg5) \ type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \ @@ -82,6 +104,63 @@ __asm__ volatile ("push %%ebx; movl %2,%%ebx; int $0x80; pop %%ebx" \ __syscall_return(type,__res); \ } +#else /* not doing __PIC__ */ + +#define _syscall1(type,name,type1,arg1) \ +type name(type1 arg1) \ +{ \ +long __res; \ +__asm__ volatile ("int $0x80" \ + : "=a" (__res) \ + : "0" (__NR_##name),"b" ((long)(arg1))); \ +__syscall_return(type,__res); \ +} + +#define _syscall2(type,name,type1,arg1,type2,arg2) \ +type name(type1 arg1,type2 arg2) \ +{ \ +long __res; \ +__asm__ volatile ("int $0x80" \ + : "=a" (__res) \ + : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2))); \ +__syscall_return(type,__res); \ +} + +#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \ +type name(type1 arg1,type2 arg2,type3 arg3) \ +{ \ +long __res; \ +__asm__ volatile ("int $0x80" \ + : "=a" (__res) \ + : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \ + "d" ((long)(arg3))); \ +__syscall_return(type,__res); \ +} + +#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \ +type name (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \ +{ \ +long __res; \ +__asm__ volatile ("int $0x80" \ + : "=a" (__res) \ + : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \ + "d" ((long)(arg3)),"S" ((long)(arg4))); \ +__syscall_return(type,__res); \ +} + +#define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \ + type5,arg5) \ +type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \ +{ \ +long __res; \ +__asm__ volatile ("int $0x80" \ + : "=a" (__res) \ + : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \ + "d" ((long)(arg3)),"S" ((long)(arg4)),"D" ((long)(arg5))); \ +__syscall_return(type,__res); \ +} + + #endif /* __PIC__ */ diff --git a/ldso/ldso/i386/ld_syscalls.h b/ldso/ldso/i386/ld_syscalls.h index 30544290f..b06c3238d 100644 --- a/ldso/ldso/i386/ld_syscalls.h +++ b/ldso/ldso/i386/ld_syscalls.h @@ -1,4 +1,23 @@ -#include <asm/unistd.h> +#include <sys/types.h> + +/* + * This file contains the system call macros and syscall + * numbers used by the shared library loader. + */ + +#define __NR_exit 1 +#define __NR_read 3 +#define __NR_write 4 +#define __NR_open 5 +#define __NR_close 6 +#define __NR_getuid 24 +#define __NR_geteuid 49 +#define __NR_getgid 47 +#define __NR_getegid 50 +#define __NR_mmap 90 +#define __NR_munmap 91 +#define __NR_stat 106 +#define __NR_mprotect 125 /* Here are the macros which define how this platform makes * system calls. This particular variant does _not_ set @@ -6,7 +25,6 @@ * these will get called before the errno symbol is dynamicly * linked. */ -#undef __syscall_return #define __syscall_return(type, res) \ do { \ if ((unsigned long)(res) >= (unsigned long)(-125)) { \ @@ -16,6 +34,15 @@ do { \ return (type) (res); \ } while (0) +#define _syscall0(type,name) \ +type name(void) \ +{ \ +long __res; \ +__asm__ volatile ("int $0x80" \ + : "=a" (__res) \ + : "0" (__NR_##name)); \ +__syscall_return(type,__res); \ +} #if defined(__PIC__) @@ -23,7 +50,6 @@ do { \ * PIC uses %ebx, so we need to save it during system calls */ -#undef _syscall1 #define _syscall1(type,name,type1,arg1) \ type name(type1 arg1) \ { \ @@ -34,7 +60,6 @@ __asm__ volatile ("push %%ebx; movl %2,%%ebx; int $0x80; pop %%ebx" \ __syscall_return(type,__res); \ } -#undef _syscall2 #define _syscall2(type,name,type1,arg1,type2,arg2) \ type name(type1 arg1,type2 arg2) \ { \ @@ -45,7 +70,6 @@ __asm__ volatile ("push %%ebx; movl %2,%%ebx; int $0x80; pop %%ebx" \ __syscall_return(type,__res); \ } -#undef _syscall3 #define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \ type name(type1 arg1,type2 arg2,type3 arg3) \ { \ @@ -57,7 +81,6 @@ __asm__ volatile ("push %%ebx; movl %2,%%ebx; int $0x80; pop %%ebx" \ __syscall_return(type,__res); \ } -#undef _syscall4 #define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \ type name (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \ { \ @@ -69,7 +92,6 @@ __asm__ volatile ("push %%ebx; movl %2,%%ebx; int $0x80; pop %%ebx" \ __syscall_return(type,__res); \ } -#undef _syscall5 #define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \ type5,arg5) \ type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \ @@ -82,6 +104,63 @@ __asm__ volatile ("push %%ebx; movl %2,%%ebx; int $0x80; pop %%ebx" \ __syscall_return(type,__res); \ } +#else /* not doing __PIC__ */ + +#define _syscall1(type,name,type1,arg1) \ +type name(type1 arg1) \ +{ \ +long __res; \ +__asm__ volatile ("int $0x80" \ + : "=a" (__res) \ + : "0" (__NR_##name),"b" ((long)(arg1))); \ +__syscall_return(type,__res); \ +} + +#define _syscall2(type,name,type1,arg1,type2,arg2) \ +type name(type1 arg1,type2 arg2) \ +{ \ +long __res; \ +__asm__ volatile ("int $0x80" \ + : "=a" (__res) \ + : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2))); \ +__syscall_return(type,__res); \ +} + +#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \ +type name(type1 arg1,type2 arg2,type3 arg3) \ +{ \ +long __res; \ +__asm__ volatile ("int $0x80" \ + : "=a" (__res) \ + : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \ + "d" ((long)(arg3))); \ +__syscall_return(type,__res); \ +} + +#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \ +type name (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \ +{ \ +long __res; \ +__asm__ volatile ("int $0x80" \ + : "=a" (__res) \ + : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \ + "d" ((long)(arg3)),"S" ((long)(arg4))); \ +__syscall_return(type,__res); \ +} + +#define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \ + type5,arg5) \ +type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \ +{ \ +long __res; \ +__asm__ volatile ("int $0x80" \ + : "=a" (__res) \ + : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \ + "d" ((long)(arg3)),"S" ((long)(arg4)),"D" ((long)(arg5))); \ +__syscall_return(type,__res); \ +} + + #endif /* __PIC__ */ diff --git a/ldso/ldso/i386/syscalls.h b/ldso/ldso/i386/syscalls.h index 30544290f..b06c3238d 100644 --- a/ldso/ldso/i386/syscalls.h +++ b/ldso/ldso/i386/syscalls.h @@ -1,4 +1,23 @@ -#include <asm/unistd.h> +#include <sys/types.h> + +/* + * This file contains the system call macros and syscall + * numbers used by the shared library loader. + */ + +#define __NR_exit 1 +#define __NR_read 3 +#define __NR_write 4 +#define __NR_open 5 +#define __NR_close 6 +#define __NR_getuid 24 +#define __NR_geteuid 49 +#define __NR_getgid 47 +#define __NR_getegid 50 +#define __NR_mmap 90 +#define __NR_munmap 91 +#define __NR_stat 106 +#define __NR_mprotect 125 /* Here are the macros which define how this platform makes * system calls. This particular variant does _not_ set @@ -6,7 +25,6 @@ * these will get called before the errno symbol is dynamicly * linked. */ -#undef __syscall_return #define __syscall_return(type, res) \ do { \ if ((unsigned long)(res) >= (unsigned long)(-125)) { \ @@ -16,6 +34,15 @@ do { \ return (type) (res); \ } while (0) +#define _syscall0(type,name) \ +type name(void) \ +{ \ +long __res; \ +__asm__ volatile ("int $0x80" \ + : "=a" (__res) \ + : "0" (__NR_##name)); \ +__syscall_return(type,__res); \ +} #if defined(__PIC__) @@ -23,7 +50,6 @@ do { \ * PIC uses %ebx, so we need to save it during system calls */ -#undef _syscall1 #define _syscall1(type,name,type1,arg1) \ type name(type1 arg1) \ { \ @@ -34,7 +60,6 @@ __asm__ volatile ("push %%ebx; movl %2,%%ebx; int $0x80; pop %%ebx" \ __syscall_return(type,__res); \ } -#undef _syscall2 #define _syscall2(type,name,type1,arg1,type2,arg2) \ type name(type1 arg1,type2 arg2) \ { \ @@ -45,7 +70,6 @@ __asm__ volatile ("push %%ebx; movl %2,%%ebx; int $0x80; pop %%ebx" \ __syscall_return(type,__res); \ } -#undef _syscall3 #define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \ type name(type1 arg1,type2 arg2,type3 arg3) \ { \ @@ -57,7 +81,6 @@ __asm__ volatile ("push %%ebx; movl %2,%%ebx; int $0x80; pop %%ebx" \ __syscall_return(type,__res); \ } -#undef _syscall4 #define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \ type name (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \ { \ @@ -69,7 +92,6 @@ __asm__ volatile ("push %%ebx; movl %2,%%ebx; int $0x80; pop %%ebx" \ __syscall_return(type,__res); \ } -#undef _syscall5 #define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \ type5,arg5) \ type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \ @@ -82,6 +104,63 @@ __asm__ volatile ("push %%ebx; movl %2,%%ebx; int $0x80; pop %%ebx" \ __syscall_return(type,__res); \ } +#else /* not doing __PIC__ */ + +#define _syscall1(type,name,type1,arg1) \ +type name(type1 arg1) \ +{ \ +long __res; \ +__asm__ volatile ("int $0x80" \ + : "=a" (__res) \ + : "0" (__NR_##name),"b" ((long)(arg1))); \ +__syscall_return(type,__res); \ +} + +#define _syscall2(type,name,type1,arg1,type2,arg2) \ +type name(type1 arg1,type2 arg2) \ +{ \ +long __res; \ +__asm__ volatile ("int $0x80" \ + : "=a" (__res) \ + : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2))); \ +__syscall_return(type,__res); \ +} + +#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \ +type name(type1 arg1,type2 arg2,type3 arg3) \ +{ \ +long __res; \ +__asm__ volatile ("int $0x80" \ + : "=a" (__res) \ + : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \ + "d" ((long)(arg3))); \ +__syscall_return(type,__res); \ +} + +#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \ +type name (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \ +{ \ +long __res; \ +__asm__ volatile ("int $0x80" \ + : "=a" (__res) \ + : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \ + "d" ((long)(arg3)),"S" ((long)(arg4))); \ +__syscall_return(type,__res); \ +} + +#define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \ + type5,arg5) \ +type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \ +{ \ +long __res; \ +__asm__ volatile ("int $0x80" \ + : "=a" (__res) \ + : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \ + "d" ((long)(arg3)),"S" ((long)(arg4)),"D" ((long)(arg5))); \ +__syscall_return(type,__res); \ +} + + #endif /* __PIC__ */ diff --git a/ldso/ldso/ld-uClibc.c b/ldso/ldso/ld-uClibc.c index c6dc5f628..a96562f19 100644 --- a/ldso/ldso/ld-uClibc.c +++ b/ldso/ldso/ld-uClibc.c @@ -648,7 +648,7 @@ found_got: { int fd; - struct kernel_stat st; + struct stat st; char *preload; if (!_dl_stat(LDSO_PRELOAD, &st)) { diff --git a/ldso/ldso/ld_syscall.h b/ldso/ldso/ld_syscall.h index 28c002cbf..013cc6fb7 100644 --- a/ldso/ldso/ld_syscall.h +++ b/ldso/ldso/ld_syscall.h @@ -1,4 +1,3 @@ -#include <sys/types.h> #include "syscalls.h" @@ -70,21 +69,16 @@ static inline _syscall3(int, _dl_mprotect, const void *, addr, unsigned long, le /* Pull in whatever this particular arch's kernel thinks the kernel version of * struct stat should look like. It turns out that each arch has a different * opinion on the subject, and different kernel revs use different names... */ -#define __NR__dl_stat __NR_stat -#define stat kernel_stat -#define new_stat kernel_stat -#include <asm/stat.h> -#undef new_stat -#undef stat -#define S_ISUID 04000 /* Set user ID on execution. */ -static inline _syscall2(int, _dl_stat, const char *, file_name, struct kernel_stat *, buf); +#include <sys/stat.h> +#define __NR__dl_stat __NR_stat +static inline _syscall2(int, _dl_stat, const char *, file_name, struct stat *, buf); #define __NR__dl_munmap __NR_munmap static inline _syscall2(int, _dl_munmap, void *, start, unsigned long, length); #define __NR__dl_getuid __NR_getuid -static inline _syscall0(gid_t, _dl_getuid); +static inline _syscall0(uid_t, _dl_getuid); #define __NR__dl_geteuid __NR_geteuid static inline _syscall0(uid_t, _dl_geteuid); diff --git a/ldso/ldso/ldso.c b/ldso/ldso/ldso.c index c6dc5f628..a96562f19 100644 --- a/ldso/ldso/ldso.c +++ b/ldso/ldso/ldso.c @@ -648,7 +648,7 @@ found_got: { int fd; - struct kernel_stat st; + struct stat st; char *preload; if (!_dl_stat(LDSO_PRELOAD, &st)) { diff --git a/ldso/ldso/m68k/dl-syscalls.h b/ldso/ldso/m68k/dl-syscalls.h index 7d76c5422..5ffb61bac 100644 --- a/ldso/ldso/m68k/dl-syscalls.h +++ b/ldso/ldso/m68k/dl-syscalls.h @@ -1,12 +1,24 @@ -#include <asm/unistd.h> +#include <sys/types.h> + +/* + * This file contains the system call macros and syscall + * numbers used by the shared library loader. + */ + +#define __NR_exit 1 +#define __NR_read 3 +#define __NR_write 4 +#define __NR_open 5 +#define __NR_close 6 +#define __NR_getuid 24 +#define __NR_geteuid 49 +#define __NR_getgid 47 +#define __NR_getegid 50 +#define __NR_mmap 90 +#define __NR_munmap 91 +#define __NR_stat 106 +#define __NR_mprotect 125 -#undef __syscall_return -#undef _syscall0 -#undef _syscall1 -#undef _syscall2 -#undef _syscall3 -#undef _syscall4 -#undef _syscall5 /* Here are the macros which define how this platform makes * system calls. This particular variant does _not_ set diff --git a/ldso/ldso/m68k/ld_syscalls.h b/ldso/ldso/m68k/ld_syscalls.h index 7d76c5422..5ffb61bac 100644 --- a/ldso/ldso/m68k/ld_syscalls.h +++ b/ldso/ldso/m68k/ld_syscalls.h @@ -1,12 +1,24 @@ -#include <asm/unistd.h> +#include <sys/types.h> + +/* + * This file contains the system call macros and syscall + * numbers used by the shared library loader. + */ + +#define __NR_exit 1 +#define __NR_read 3 +#define __NR_write 4 +#define __NR_open 5 +#define __NR_close 6 +#define __NR_getuid 24 +#define __NR_geteuid 49 +#define __NR_getgid 47 +#define __NR_getegid 50 +#define __NR_mmap 90 +#define __NR_munmap 91 +#define __NR_stat 106 +#define __NR_mprotect 125 -#undef __syscall_return -#undef _syscall0 -#undef _syscall1 -#undef _syscall2 -#undef _syscall3 -#undef _syscall4 -#undef _syscall5 /* Here are the macros which define how this platform makes * system calls. This particular variant does _not_ set diff --git a/ldso/ldso/m68k/syscalls.h b/ldso/ldso/m68k/syscalls.h index 7d76c5422..5ffb61bac 100644 --- a/ldso/ldso/m68k/syscalls.h +++ b/ldso/ldso/m68k/syscalls.h @@ -1,12 +1,24 @@ -#include <asm/unistd.h> +#include <sys/types.h> + +/* + * This file contains the system call macros and syscall + * numbers used by the shared library loader. + */ + +#define __NR_exit 1 +#define __NR_read 3 +#define __NR_write 4 +#define __NR_open 5 +#define __NR_close 6 +#define __NR_getuid 24 +#define __NR_geteuid 49 +#define __NR_getgid 47 +#define __NR_getegid 50 +#define __NR_mmap 90 +#define __NR_munmap 91 +#define __NR_stat 106 +#define __NR_mprotect 125 -#undef __syscall_return -#undef _syscall0 -#undef _syscall1 -#undef _syscall2 -#undef _syscall3 -#undef _syscall4 -#undef _syscall5 /* Here are the macros which define how this platform makes * system calls. This particular variant does _not_ set diff --git a/ldso/ldso/readelflib1.c b/ldso/ldso/readelflib1.c index ae7a86a37..c1a4a41ee 100644 --- a/ldso/ldso/readelflib1.c +++ b/ldso/ldso/readelflib1.c @@ -321,7 +321,7 @@ struct elf_resolve *_dl_load_elf_shared_library(int secure, we don't load the library if it isn't setuid. */ if (secure) { - struct kernel_stat st; + struct stat st; if (_dl_stat(libname, &st) || !(st.st_mode & S_ISUID)) return NULL; diff --git a/ldso/ldso/sparc/dl-syscalls.h b/ldso/ldso/sparc/dl-syscalls.h index 0fe431809..d7cd3734b 100644 --- a/ldso/ldso/sparc/dl-syscalls.h +++ b/ldso/ldso/sparc/dl-syscalls.h @@ -1,4 +1,23 @@ -#include <asm/unistd.h> +#include <sys/types.h> + +/* + * This file contains the system call macros and syscall + * numbers used by the shared library loader. + */ + +#define __NR_exit 1 +#define __NR_read 3 +#define __NR_write 4 +#define __NR_open 5 +#define __NR_close 6 +#define __NR_getuid 24 +#define __NR_getgid 47 +#define __NR_geteuid 49 +#define __NR_getegid 50 +#define __NR_mmap 71 +#define __NR_munmap 73 +#define __NR_stat 38 +#define __NR_mprotect 74 /* Here are the macros which define how this platform makes * system calls. This particular variant does _not_ set diff --git a/ldso/ldso/sparc/ld_syscalls.h b/ldso/ldso/sparc/ld_syscalls.h index 0fe431809..d7cd3734b 100644 --- a/ldso/ldso/sparc/ld_syscalls.h +++ b/ldso/ldso/sparc/ld_syscalls.h @@ -1,4 +1,23 @@ -#include <asm/unistd.h> +#include <sys/types.h> + +/* + * This file contains the system call macros and syscall + * numbers used by the shared library loader. + */ + +#define __NR_exit 1 +#define __NR_read 3 +#define __NR_write 4 +#define __NR_open 5 +#define __NR_close 6 +#define __NR_getuid 24 +#define __NR_getgid 47 +#define __NR_geteuid 49 +#define __NR_getegid 50 +#define __NR_mmap 71 +#define __NR_munmap 73 +#define __NR_stat 38 +#define __NR_mprotect 74 /* Here are the macros which define how this platform makes * system calls. This particular variant does _not_ set diff --git a/ldso/ldso/sparc/syscalls.h b/ldso/ldso/sparc/syscalls.h index 0fe431809..d7cd3734b 100644 --- a/ldso/ldso/sparc/syscalls.h +++ b/ldso/ldso/sparc/syscalls.h @@ -1,4 +1,23 @@ -#include <asm/unistd.h> +#include <sys/types.h> + +/* + * This file contains the system call macros and syscall + * numbers used by the shared library loader. + */ + +#define __NR_exit 1 +#define __NR_read 3 +#define __NR_write 4 +#define __NR_open 5 +#define __NR_close 6 +#define __NR_getuid 24 +#define __NR_getgid 47 +#define __NR_geteuid 49 +#define __NR_getegid 50 +#define __NR_mmap 71 +#define __NR_munmap 73 +#define __NR_stat 38 +#define __NR_mprotect 74 /* Here are the macros which define how this platform makes * system calls. This particular variant does _not_ set diff --git a/ldso/ldso/syscall.h b/ldso/ldso/syscall.h index 28c002cbf..013cc6fb7 100644 --- a/ldso/ldso/syscall.h +++ b/ldso/ldso/syscall.h @@ -1,4 +1,3 @@ -#include <sys/types.h> #include "syscalls.h" @@ -70,21 +69,16 @@ static inline _syscall3(int, _dl_mprotect, const void *, addr, unsigned long, le /* Pull in whatever this particular arch's kernel thinks the kernel version of * struct stat should look like. It turns out that each arch has a different * opinion on the subject, and different kernel revs use different names... */ -#define __NR__dl_stat __NR_stat -#define stat kernel_stat -#define new_stat kernel_stat -#include <asm/stat.h> -#undef new_stat -#undef stat -#define S_ISUID 04000 /* Set user ID on execution. */ -static inline _syscall2(int, _dl_stat, const char *, file_name, struct kernel_stat *, buf); +#include <sys/stat.h> +#define __NR__dl_stat __NR_stat +static inline _syscall2(int, _dl_stat, const char *, file_name, struct stat *, buf); #define __NR__dl_munmap __NR_munmap static inline _syscall2(int, _dl_munmap, void *, start, unsigned long, length); #define __NR__dl_getuid __NR_getuid -static inline _syscall0(gid_t, _dl_getuid); +static inline _syscall0(uid_t, _dl_getuid); #define __NR__dl_geteuid __NR_geteuid static inline _syscall0(uid_t, _dl_geteuid); |