diff options
author | H. Peter Anvin <hpa@zytor.com> | 2004-01-28 01:21:33 +0000 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2004-01-28 01:21:33 +0000 |
commit | 656ea57b2160547c909f7f7b9d63a59100f1c01c (patch) | |
tree | 6d82773a096ca412a2dd2642917ba523d7b556d0 | |
parent | 173d724734f81b3245a41822fc27f7556509d826 (diff) | |
download | klibc-656ea57b2160547c909f7f7b9d63a59100f1c01c.tar.gz |
Add getpagesize() as a real function -- it's a system call on someklibc-0.100
platforms and not others.
-rw-r--r-- | include/unistd.h | 8 | ||||
-rw-r--r-- | klibc/Makefile | 2 | ||||
-rw-r--r-- | klibc/getpagesize.c | 26 | ||||
-rw-r--r-- | klibc/include/unistd.h | 8 | ||||
-rw-r--r-- | klibc/syscommon.h | 2 |
5 files changed, 32 insertions, 14 deletions
diff --git a/include/unistd.h b/include/unistd.h index 03e8e99666cf1..3d5c6881d359f 100644 --- a/include/unistd.h +++ b/include/unistd.h @@ -10,7 +10,6 @@ #include <stddef.h> #include <sys/types.h> #include <sys/select.h> -#include <asm/page.h> __extern char **environ; __extern __noreturn _exit(int); @@ -106,14 +105,11 @@ __extern int optind, opterr, optopt; __extern int isatty(int); +__extern int getpagesize(void); + /* Standard file descriptor numbers. */ #define STDIN_FILENO 0 #define STDOUT_FILENO 1 #define STDERR_FILENO 2 -static inline int getpagesize(void) -{ - return PAGE_SIZE; -} - #endif /* _UNISTD_H */ diff --git a/klibc/Makefile b/klibc/Makefile index 057558c7fa3bc..c5d22279ec1cb 100644 --- a/klibc/Makefile +++ b/klibc/Makefile @@ -24,7 +24,7 @@ LIBOBJS = vsnprintf.o snprintf.o vsprintf.o sprintf.o \ sleep.o usleep.o raise.o abort.o assert.o alarm.o pause.o \ __signal.o signal.o bsd_signal.o siglist.o siglongjmp.o \ sigaction.o sigpending.o sigprocmask.o sigsuspend.o \ - brk.o sbrk.o malloc.o realloc.o calloc.o mmap.o \ + brk.o sbrk.o malloc.o realloc.o calloc.o mmap.o getpagesize.o \ memcpy.o memcmp.o memset.o memccpy.o memmem.o memswap.o \ memmove.o \ strcasecmp.o strncasecmp.o strndup.o strerror.o \ diff --git a/klibc/getpagesize.c b/klibc/getpagesize.c new file mode 100644 index 0000000000000..2d975b1586c78 --- /dev/null +++ b/klibc/getpagesize.c @@ -0,0 +1,26 @@ +/* + * getpagesize.c + */ + +#include <sys/syscall.h> +#include <asm/page.h> + +/* Presumably there is a better way to do this... */ +#ifdef __ia64__ +# define __NR_getpagesize 1171 +#endif + +#ifdef __NR_getpagesize + +_syscall0(int,getpagesize); + +#else + +int getpagesize(void) +{ + return PAGE_SIZE; +} + +#endif + + diff --git a/klibc/include/unistd.h b/klibc/include/unistd.h index 03e8e99666cf1..3d5c6881d359f 100644 --- a/klibc/include/unistd.h +++ b/klibc/include/unistd.h @@ -10,7 +10,6 @@ #include <stddef.h> #include <sys/types.h> #include <sys/select.h> -#include <asm/page.h> __extern char **environ; __extern __noreturn _exit(int); @@ -106,14 +105,11 @@ __extern int optind, opterr, optopt; __extern int isatty(int); +__extern int getpagesize(void); + /* Standard file descriptor numbers. */ #define STDIN_FILENO 0 #define STDOUT_FILENO 1 #define STDERR_FILENO 2 -static inline int getpagesize(void) -{ - return PAGE_SIZE; -} - #endif /* _UNISTD_H */ diff --git a/klibc/syscommon.h b/klibc/syscommon.h index 3093920739107..429025279eb22 100644 --- a/klibc/syscommon.h +++ b/klibc/syscommon.h @@ -28,5 +28,5 @@ #include <unistd.h> #ifdef __i386__ -#include <sys/vm86.h> +# include <sys/vm86.h> #endif |