Add getpagesize() as a real function -- it's a system call on some
platforms and not others.
diff --git a/include/unistd.h b/include/unistd.h
index 03e8e99..3d5c688 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 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 057558c..c5d2227 100644
--- a/klibc/Makefile
+++ b/klibc/Makefile
@@ -24,7 +24,7 @@
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 0000000..2d975b1
--- /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 03e8e99..3d5c688 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 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 3093920..4290252 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