summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/common
diff options
context:
space:
mode:
Diffstat (limited to 'libc/sysdeps/linux/common')
-rw-r--r--libc/sysdeps/linux/common/errno.c4
-rw-r--r--libc/sysdeps/linux/common/getdnnm.c3
-rw-r--r--libc/sysdeps/linux/common/getdtablesize.c7
-rw-r--r--libc/sysdeps/linux/common/getpagesize.c4
-rw-r--r--libc/sysdeps/linux/common/setegid.c1
-rw-r--r--libc/sysdeps/linux/common/seteuid.c1
-rw-r--r--libc/sysdeps/linux/common/statfix.c6
-rw-r--r--libc/sysdeps/linux/common/statfix.h2
-rw-r--r--libc/sysdeps/linux/common/syscalls.c31
-rw-r--r--libc/sysdeps/linux/common/wait.c1
-rw-r--r--libc/sysdeps/linux/common/waitpid.c3
11 files changed, 36 insertions, 27 deletions
diff --git a/libc/sysdeps/linux/common/errno.c b/libc/sysdeps/linux/common/errno.c
index e6a8ae875..0d500dc8f 100644
--- a/libc/sysdeps/linux/common/errno.c
+++ b/libc/sysdeps/linux/common/errno.c
@@ -1,8 +1,8 @@
-#include <errno.h>
+//#include <errno.h>
int errno = 0;
-int * __errno_location ( void )
+int * __attribute__ ((__weak__)) __errno_location ( void )
{
return &errno;
}
diff --git a/libc/sysdeps/linux/common/getdnnm.c b/libc/sysdeps/linux/common/getdnnm.c
index 46751b1e7..5e1f97b95 100644
--- a/libc/sysdeps/linux/common/getdnnm.c
+++ b/libc/sysdeps/linux/common/getdnnm.c
@@ -1,7 +1,8 @@
#include <string.h>
#include <unistd.h>
-#include <sys/utsname.h>
#include <errno.h>
+#define __USE_GNU
+#include <sys/utsname.h>
int
getdomainname(char *name, size_t len)
diff --git a/libc/sysdeps/linux/common/getdtablesize.c b/libc/sysdeps/linux/common/getdtablesize.c
index 664881f2a..016e6f62e 100644
--- a/libc/sysdeps/linux/common/getdtablesize.c
+++ b/libc/sysdeps/linux/common/getdtablesize.c
@@ -16,9 +16,12 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-#include <limits.h>
+#include <stdlib.h>
#include <unistd.h>
#include <sys/resource.h>
+#include <limits.h>
+
+#define __LOCAL_OPEN_MAX 256
/* Return the maximum number of file descriptors
the current process could possibly have. */
@@ -29,6 +32,6 @@ int getdtablesize (void)
/* This should even work if `getrlimit' is not implemented. POSIX.1
does not define this function but we will generate a stub which
returns -1. */
- return getrlimit (RLIMIT_NOFILE, &ru) < 0 ? OPEN_MAX : ru.rlim_cur;
+ return getrlimit (RLIMIT_NOFILE, &ru) < 0 ? __LOCAL_OPEN_MAX : ru.rlim_cur;
}
diff --git a/libc/sysdeps/linux/common/getpagesize.c b/libc/sysdeps/linux/common/getpagesize.c
index 708fdd06e..362dd7b2b 100644
--- a/libc/sysdeps/linux/common/getpagesize.c
+++ b/libc/sysdeps/linux/common/getpagesize.c
@@ -17,10 +17,11 @@
Boston, MA 02111-1307, USA. */
#include <unistd.h>
+#include <features.h>
#include <sys/param.h>
/* Return the system page size. */
-int getpagesize ()
+int __getpagesize()
{
#ifdef EXEC_PAGESIZE
return EXEC_PAGESIZE;
@@ -36,3 +37,4 @@ int getpagesize ()
#endif /* EXEC_PAGESIZE. */
}
+weak_alias(__getpagesize, getpagesize);
diff --git a/libc/sysdeps/linux/common/setegid.c b/libc/sysdeps/linux/common/setegid.c
index 19d8e3f9c..0869119e7 100644
--- a/libc/sysdeps/linux/common/setegid.c
+++ b/libc/sysdeps/linux/common/setegid.c
@@ -1,4 +1,5 @@
#include <unistd.h>
+#include <sys/types.h>
int setegid(gid_t gid)
{
diff --git a/libc/sysdeps/linux/common/seteuid.c b/libc/sysdeps/linux/common/seteuid.c
index cbb43ce85..fbf60909d 100644
--- a/libc/sysdeps/linux/common/seteuid.c
+++ b/libc/sysdeps/linux/common/seteuid.c
@@ -1,6 +1,7 @@
#include <unistd.h>
#include <stdio.h>
#include <errno.h>
+#include <sys/types.h>
int seteuid(uid_t uid)
{
diff --git a/libc/sysdeps/linux/common/statfix.c b/libc/sysdeps/linux/common/statfix.c
index 07facd0c7..d06b9448e 100644
--- a/libc/sysdeps/linux/common/statfix.c
+++ b/libc/sysdeps/linux/common/statfix.c
@@ -2,8 +2,8 @@
/*
* Convert from the kernel's version of struct stat to libc's version
*
- * Copyright (C) 2000 by Lineo, inc. Written by Erik Andersen
- * <andersen@lineo.com>, <andersee@debian.org>
+ * Copyright (C) 2000, 2001 by Lineo, inc.
+ * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Library General Public License as published by
@@ -22,7 +22,7 @@
*/
/* Pull in whatever this particular arch's kernel thinks the kernel version of
- * struct stat should look like. It turn out that each arch has a different
+ * struct stat should look like. It turns out that each arch has a different
* opinion on the subject. Then pull in libc's version of struct stat... */
#include "statfix.h"
diff --git a/libc/sysdeps/linux/common/statfix.h b/libc/sysdeps/linux/common/statfix.h
index eaf623b0e..0d1dbfa89 100644
--- a/libc/sysdeps/linux/common/statfix.h
+++ b/libc/sysdeps/linux/common/statfix.h
@@ -18,7 +18,7 @@
#undef stat
extern void statfix(struct libc_stat *libcstat, struct kernel_stat *kstat);
-extern int _fxstat(int version, int fd, struct libc_stat * statbuf);
+extern int __fxstat(int version, int fd, struct libc_stat * statbuf);
#endif
diff --git a/libc/sysdeps/linux/common/syscalls.c b/libc/sysdeps/linux/common/syscalls.c
index 1ecb2e64f..613374688 100644
--- a/libc/sysdeps/linux/common/syscalls.c
+++ b/libc/sysdeps/linux/common/syscalls.c
@@ -143,7 +143,7 @@ _syscall1(time_t, time, time_t *, t);
extern int mknod(const char *pathname, mode_t mode, dev_t dev);
_syscall3(int, mknod, const char *, pathname, mode_t, mode, dev_t, dev);
-int _xmknod (int version, const char * path, mode_t mode, dev_t *dev)
+int __xmknod (int version, const char * path, mode_t mode, dev_t *dev)
{
switch(version)
{
@@ -221,7 +221,7 @@ _syscall0(gid_t, getuid);
//#define __NR_stime 25
#ifdef L_stime
#include <time.h>
-_syscall1(int, stime, time_t *, t);
+_syscall1(int, stime, const time_t *, t);
#endif
//#define __NR_ptrace 26
@@ -253,7 +253,7 @@ _syscall0(int, pause);
//#define __NR_utime 30
#ifdef L_utime
#include <utime.h>
-_syscall2(int, utime, const char *, filename, struct utimbuf *, buf);
+_syscall2(int, utime, const char *, filename, const struct utimbuf *, buf);
#endif
//#define __NR_stty 31
@@ -277,7 +277,7 @@ _syscall1(int, nice, int, inc);
//#define __NR_sync 36
#ifdef L_sync
#include <unistd.h>
-_syscall0(int, sync);
+_syscall0(void, sync);
#endif
//#define __NR_kill 37
@@ -560,13 +560,13 @@ _syscall2(int, getrusage, int, who, struct rusage *, usage);
//#define __NR_gettimeofday 78
#ifdef L_gettimeofday
-#include <unistd.h>
+#include <sys/time.h>
_syscall2(int, gettimeofday, struct timeval *, tv, struct timezone *, tz);
#endif
//#define __NR_settimeofday 79
#ifdef L_settimeofday
-#include <unistd.h>
+#include <sys/time.h>
_syscall2(int, settimeofday, const struct timeval *, tv,
const struct timezone *, tz);
#endif
@@ -754,14 +754,14 @@ int klogctl(int type, char *buf, int len)
//#define __NR_setitimer 104
#ifdef L_setitimer
#include <sys/time.h>
-_syscall3(int, setitimer, enum __itimer_which, which,
+_syscall3(int, setitimer, __itimer_which_t, which,
const struct itimerval *, new, struct itimerval *, old);
#endif
//#define __NR_getitimer 105
#ifdef L_getitimer
#include <sys/time.h>
-_syscall2(int, getitimer, enum __itimer_which, which, struct itimerval *, value);
+_syscall2(int, getitimer, __itimer_which_t, which, struct itimerval *, value);
#endif
//#define __NR_stat 106
@@ -775,7 +775,7 @@ _syscall2(int, getitimer, enum __itimer_which, which, struct itimerval *, value)
extern int __stat(const char *file_name, struct kernel_stat *buf);
_syscall2(int, __stat, const char *, file_name, struct kernel_stat *, buf);
-int _xstat(int version, const char * file_name, struct libc_stat * cstat)
+int __xstat(int version, const char * file_name, struct libc_stat * cstat)
{
struct kernel_stat kstat;
int result = __stat(file_name, &kstat);
@@ -788,7 +788,7 @@ int _xstat(int version, const char * file_name, struct libc_stat * cstat)
int stat(const char *file_name, struct libc_stat *buf)
{
- return(_xstat(0, file_name, buf));
+ return(__xstat(0, file_name, buf));
}
#endif
@@ -803,7 +803,7 @@ int stat(const char *file_name, struct libc_stat *buf)
extern int __lstat(const char *file_name, struct kernel_stat *buf);
_syscall2(int, __lstat, const char *, file_name, struct kernel_stat *, buf);
-int _lxstat(int version, const char * file_name, struct libc_stat * cstat)
+int __lxstat(int version, const char * file_name, struct libc_stat * cstat)
{
struct kernel_stat kstat;
int result = __lstat(file_name, &kstat);
@@ -816,7 +816,7 @@ int _lxstat(int version, const char * file_name, struct libc_stat * cstat)
int lstat(const char *file_name, struct libc_stat *buf)
{
- return(_lxstat(0, file_name, buf));
+ return(__lxstat(0, file_name, buf));
}
#endif
@@ -831,7 +831,7 @@ int lstat(const char *file_name, struct libc_stat *buf)
extern int __fstat(int filedes, struct kernel_stat *buf);
_syscall2(int, __fstat, int, filedes, struct kernel_stat *, buf);
-int _fxstat(int version, int fd, struct libc_stat * cstat)
+int __fxstat(int version, int fd, struct libc_stat * cstat)
{
struct kernel_stat kstat;
int result = __fstat(fd, &kstat);
@@ -844,7 +844,7 @@ int _fxstat(int version, int fd, struct libc_stat * cstat)
int fstat(int filedes, struct libc_stat *buf)
{
- return(_fxstat(0, filedes, buf));
+ return(__fxstat(0, filedes, buf));
}
#endif
@@ -936,14 +936,13 @@ _syscall1(int, adjtimex, struct timex *, buf);
//#define __NR_mprotect 125
#ifdef L_mprotect
#include <sys/mman.h>
-_syscall3(int, mprotect, const void *, addr, size_t, len, int, prot);
+_syscall3(int, mprotect, void *, addr, size_t, len, int, prot);
#endif
//#define __NR_sigprocmask 126
#ifdef L_sigprocmask
#include <signal.h>
_syscall3(int, sigprocmask, int, how, const sigset_t *, set, sigset_t *,
-
oldset);
#endif
diff --git a/libc/sysdeps/linux/common/wait.c b/libc/sysdeps/linux/common/wait.c
index 6520013f0..13f9e148e 100644
--- a/libc/sysdeps/linux/common/wait.c
+++ b/libc/sysdeps/linux/common/wait.c
@@ -1,3 +1,4 @@
+#include <stdlib.h>
#include <syscall.h>
#include <sys/types.h>
#include <sys/wait.h>
diff --git a/libc/sysdeps/linux/common/waitpid.c b/libc/sysdeps/linux/common/waitpid.c
index 255a3c84e..a912e5179 100644
--- a/libc/sysdeps/linux/common/waitpid.c
+++ b/libc/sysdeps/linux/common/waitpid.c
@@ -1,4 +1,5 @@
-#include <syscall.h>
+#include <stdlib.h>
+#include <sys/types.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/resource.h>