summaryrefslogtreecommitdiffstats
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/__socketcall.c2
-rw-r--r--libc/sysdeps/linux/common/bits/mman.h12
-rw-r--r--libc/sysdeps/linux/common/bits/utmp.h21
-rw-r--r--libc/sysdeps/linux/common/bits/utmpx.h16
-rw-r--r--libc/sysdeps/linux/common/clock_getres.c2
-rw-r--r--libc/sysdeps/linux/common/close.c7
-rw-r--r--libc/sysdeps/linux/common/cmsg_nxthdr.c5
-rw-r--r--libc/sysdeps/linux/common/creat64.c2
-rw-r--r--libc/sysdeps/linux/common/create_module.c4
-rw-r--r--libc/sysdeps/linux/common/dl-osinfo.h51
-rw-r--r--libc/sysdeps/linux/common/getcwd.c18
-rw-r--r--libc/sysdeps/linux/common/getdents.c4
-rw-r--r--libc/sysdeps/linux/common/getdents64.c4
-rw-r--r--libc/sysdeps/linux/common/getdirname.c2
-rw-r--r--libc/sysdeps/linux/common/getdnnm.c4
-rw-r--r--libc/sysdeps/linux/common/getdtablesize.c2
-rw-r--r--libc/sysdeps/linux/common/getgroups.c2
-rw-r--r--libc/sysdeps/linux/common/gethstnm.c4
-rw-r--r--libc/sysdeps/linux/common/getpagesize.c5
-rw-r--r--libc/sysdeps/linux/common/getrlimit.c13
-rw-r--r--libc/sysdeps/linux/common/getrlimit64.c2
-rw-r--r--libc/sysdeps/linux/common/longjmp.c2
-rw-r--r--libc/sysdeps/linux/common/open.c7
-rw-r--r--libc/sysdeps/linux/common/open64.c9
-rw-r--r--libc/sysdeps/linux/common/poll.c30
-rw-r--r--libc/sysdeps/linux/common/posix_fadvise.c18
-rw-r--r--libc/sysdeps/linux/common/posix_fadvise64.c18
-rw-r--r--libc/sysdeps/linux/common/read.c7
-rw-r--r--libc/sysdeps/linux/common/setgroups.c2
-rw-r--r--libc/sysdeps/linux/common/setrlimit.c14
-rw-r--r--libc/sysdeps/linux/common/setrlimit64.c1
-rw-r--r--libc/sysdeps/linux/common/ssp.c12
-rw-r--r--libc/sysdeps/linux/common/syscalls.h6
-rw-r--r--libc/sysdeps/linux/common/ulimit.c4
-rw-r--r--libc/sysdeps/linux/common/write.c9
35 files changed, 194 insertions, 127 deletions
diff --git a/libc/sysdeps/linux/common/__socketcall.c b/libc/sysdeps/linux/common/__socketcall.c
index 8e9fbf7f3..48a083c3a 100644
--- a/libc/sysdeps/linux/common/__socketcall.c
+++ b/libc/sysdeps/linux/common/__socketcall.c
@@ -10,5 +10,5 @@
#include "syscalls.h"
#ifdef __NR_socketcall
#define __NR___socketcall __NR_socketcall
-_syscall2(int, __socketcall, int, call, unsigned long *, args);
+attribute_hidden _syscall2(int, __socketcall, int, call, unsigned long *, args);
#endif
diff --git a/libc/sysdeps/linux/common/bits/mman.h b/libc/sysdeps/linux/common/bits/mman.h
index f567b9baa..0c1590270 100644
--- a/libc/sysdeps/linux/common/bits/mman.h
+++ b/libc/sysdeps/linux/common/bits/mman.h
@@ -1,5 +1,5 @@
/* Definitions for BSD-style memory management.
- Copyright (C) 1994-1998,2000,01 Free Software Foundation, Inc.
+ Copyright (C) 1994-1998,2000,01,02,05 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -80,6 +80,16 @@
# define POSIX_MADV_DONTNEED 4 /* Don't need these pages. */
#endif
+/* Flags to `msync'. */
+#define MS_ASYNC 1 /* Sync memory asynchronously. */
+#define MS_SYNC 0 /* Synchronous memory sync. */
+#define MS_INVALIDATE 2 /* Invalidate the caches. */
+
+/* Flags for `mremap'. */
+#ifdef __USE_GNU
+# define MREMAP_MAYMOVE 1 /* Mapping address may change. */
+# define MREMAP_FIXED 2 /* Fifth argument sets new address. */
+#endif
/* Flags for `mlockall' (can be OR'd together). */
#define MCL_CURRENT 1 /* Lock all currently mapped pages. */
diff --git a/libc/sysdeps/linux/common/bits/utmp.h b/libc/sysdeps/linux/common/bits/utmp.h
index 2ed29bbb4..e855ad73f 100644
--- a/libc/sysdeps/linux/common/bits/utmp.h
+++ b/libc/sysdeps/linux/common/bits/utmp.h
@@ -1,5 +1,6 @@
/* The `struct utmp' type, describing entries in the utmp file. GNU version.
- Copyright (C) 1993, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+ Copyright (C) 1993, 1996, 1997, 1998, 1999, 2002
+ Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -24,6 +25,7 @@
#include <paths.h>
#include <sys/time.h>
#include <sys/types.h>
+#include <bits/wordsize.h>
#define UT_LINESIZE 32
@@ -35,7 +37,11 @@
previous logins. */
struct lastlog
{
+#if __WORDSIZE == 64 && defined __WORDSIZE_COMPAT32
+ int32_t ll_time;
+#else
__time_t ll_time;
+#endif
char ll_line[UT_LINESIZE];
char ll_host[UT_HOSTSIZE];
};
@@ -61,8 +67,21 @@ struct utmp
char ut_host[UT_HOSTSIZE]; /* Hostname for remote login. */
struct exit_status ut_exit; /* Exit status of a process marked
as DEAD_PROCESS. */
+/* The ut_session and ut_tv fields must be the same size when compiled
+ 32- and 64-bit. This allows data files and shared memory to be
+ shared between 32- and 64-bit applications. */
+#if __WORDSIZE == 64 && defined __WORDSIZE_COMPAT32
+ int32_t ut_session; /* Session ID, used for windowing. */
+ struct
+ {
+ int32_t tv_sec; /* Seconds. */
+ int32_t tv_usec; /* Microseconds. */
+ } ut_tv; /* Time entry was made. */
+#else
long int ut_session; /* Session ID, used for windowing. */
struct timeval ut_tv; /* Time entry was made. */
+#endif
+
int32_t ut_addr_v6[4]; /* Internet address of remote host. */
char __unused[20]; /* Reserved for future use. */
};
diff --git a/libc/sysdeps/linux/common/bits/utmpx.h b/libc/sysdeps/linux/common/bits/utmpx.h
index 99735370b..c84cda6fe 100644
--- a/libc/sysdeps/linux/common/bits/utmpx.h
+++ b/libc/sysdeps/linux/common/bits/utmpx.h
@@ -1,5 +1,5 @@
/* Structures and definitions for the user accounting database. GNU version.
- Copyright (C) 1997, 1998, 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1998, 2000, 2001, 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -23,6 +23,7 @@
#include <bits/types.h>
#include <sys/time.h>
+#include <bits/wordsize.h>
#ifdef __USE_GNU
@@ -62,8 +63,21 @@ struct utmpx
char ut_host[__UT_HOSTSIZE]; /* Hostname for remote login. */
struct __exit_status ut_exit; /* Exit status of a process marked
as DEAD_PROCESS. */
+
+/* The fields ut_session and ut_tv must be the same size when compiled
+ 32- and 64-bit. This allows files and shared memory to be shared
+ between 32- and 64-bit applications. */
+#if __WORDSIZE == 64 && defined __WORDSIZE_COMPAT32
+ __int32_t ut_session; /* Session ID, used for windowing. */
+ struct
+ {
+ __int32_t tv_sec; /* Seconds. */
+ __int32_t tv_usec; /* Microseconds. */
+ } ut_tv; /* Time entry was made. */
+#else
long int ut_session; /* Session ID, used for windowing. */
struct timeval ut_tv; /* Time entry was made. */
+#endif
__int32_t ut_addr_v6[4]; /* Internet address of remote host. */
char __unused[20]; /* Reserved for future use. */
};
diff --git a/libc/sysdeps/linux/common/clock_getres.c b/libc/sysdeps/linux/common/clock_getres.c
index 0ae2bb07d..7aff495d0 100644
--- a/libc/sysdeps/linux/common/clock_getres.c
+++ b/libc/sysdeps/linux/common/clock_getres.c
@@ -19,6 +19,8 @@
*
*/
+#define sysconf __sysconf
+
#define _GNU_SOURCE
#include "syscalls.h"
#include <time.h>
diff --git a/libc/sysdeps/linux/common/close.c b/libc/sysdeps/linux/common/close.c
index 1e03b091e..2e9c2073d 100644
--- a/libc/sysdeps/linux/common/close.c
+++ b/libc/sysdeps/linux/common/close.c
@@ -10,6 +10,7 @@
#include "syscalls.h"
#include <unistd.h>
-#define __NR___libc_close __NR_close
-_syscall1(int, __libc_close, int, fd);
-weak_alias(__libc_close, close);
+#define __NR___close __NR_close
+attribute_hidden _syscall1(int, __close, int, fd);
+strong_alias(__close,close)
+weak_alias(__close,__libc_close)
diff --git a/libc/sysdeps/linux/common/cmsg_nxthdr.c b/libc/sysdeps/linux/common/cmsg_nxthdr.c
index 20c490dcc..cc17c28f5 100644
--- a/libc/sysdeps/linux/common/cmsg_nxthdr.c
+++ b/libc/sysdeps/linux/common/cmsg_nxthdr.c
@@ -22,8 +22,8 @@
#include <sys/socket.h>
-struct cmsghdr *
-__cmsg_nxthdr (struct msghdr *mhdr, struct cmsghdr *cmsg)
+struct cmsghdr attribute_hidden *
+__libc_cmsg_nxthdr (struct msghdr *mhdr, struct cmsghdr *cmsg)
{
if ((size_t) cmsg->cmsg_len < sizeof (struct cmsghdr))
/* The kernel header does this so there may be a reason. */
@@ -39,3 +39,4 @@ __cmsg_nxthdr (struct msghdr *mhdr, struct cmsghdr *cmsg)
return NULL;
return cmsg;
}
+strong_alias(__libc_cmsg_nxthdr,__cmsg_nxthdr)
diff --git a/libc/sysdeps/linux/common/creat64.c b/libc/sysdeps/linux/common/creat64.c
index deeda3892..759f5bed8 100644
--- a/libc/sysdeps/linux/common/creat64.c
+++ b/libc/sysdeps/linux/common/creat64.c
@@ -16,6 +16,8 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#define open64 __open64
+
#include <features.h>
#include <fcntl.h>
#include <sys/types.h>
diff --git a/libc/sysdeps/linux/common/create_module.c b/libc/sysdeps/linux/common/create_module.c
index 0c8f50999..a54f13be5 100644
--- a/libc/sysdeps/linux/common/create_module.c
+++ b/libc/sysdeps/linux/common/create_module.c
@@ -34,7 +34,7 @@
# ifdef __STR_NR_create_module
# define __STR_NR___create_module __STR_NR_create_module
# endif
-_syscall2(long, __create_module, const char *, name, size_t, size);
+static inline _syscall2(long, __create_module, const char *, name, size_t, size);
/* By checking the value of errno, we know if we have been fooled
* by the syscall2 macro making a very high address look like a
* negative, so we we fix it up here. */
@@ -53,7 +53,7 @@ unsigned long create_module(const char *name, size_t size)
# define __NR___create_module __NR_create_module
/* Alpha doesn't have the same problem, exactly, but a bug in older
kernels fails to clear the error flag. Clear it here explicitly. */
-_syscall4(unsigned long, __create_module, const char *, name,
+static inline _syscall4(unsigned long, __create_module, const char *, name,
size_t, size, size_t, dummy, size_t, err);
unsigned long create_module(const char *name, size_t size)
{
diff --git a/libc/sysdeps/linux/common/dl-osinfo.h b/libc/sysdeps/linux/common/dl-osinfo.h
index 4976b2b46..7998b08a4 100644
--- a/libc/sysdeps/linux/common/dl-osinfo.h
+++ b/libc/sysdeps/linux/common/dl-osinfo.h
@@ -10,35 +10,35 @@
#include <features.h>
#ifdef __UCLIBC_HAS_SSP__
-#include <stdint.h>
-#include <sys/time.h>
+# if defined IS_IN_libc || defined IS_IN_rtld
-#ifdef IS_IN_libc
-#include <ssp-internal.h>
-#if 0
-#ifndef __SSP_QUICK_CANARY__
-#define OPEN __libc_open
-#define READ __libc_read
-#define CLOSE __libc_close
-#endif
-#define GETTIMEOFDAY gettimeofday
-#endif
-#else
-#ifdef __SSP__
-#error "file must not be compiled with stack protection enabled on it. Use -fno-stack-protector"
-#endif
-#ifndef __SSP_QUICK_CANARY__
-#define OPEN _dl_open
-#define READ _dl_read
-#define CLOSE _dl_close
-#endif
-#define GETTIMEOFDAY _dl_gettimeofday
-#endif
+# if defined __SSP__ || defined __SSP_ALL__
+# error "file must not be compiled with stack protection enabled on it. Use -fno-stack-protector"
+# endif
+
+# include <stdint.h>
+# include <sys/time.h>
+
+# ifdef IS_IN_libc
+# ifndef __SSP_QUICK_CANARY__
+# define OPEN __open
+# define READ __read
+# define CLOSE __close
+# endif
+# define GETTIMEOFDAY gettimeofday
+# else
+# ifndef __SSP_QUICK_CANARY__
+# define OPEN _dl_open
+# define READ _dl_read
+# define CLOSE _dl_close
+# endif
+# define GETTIMEOFDAY _dl_gettimeofday
+# endif
static __always_inline uintptr_t _dl_setup_stack_chk_guard(void)
{
uintptr_t ret;
-#ifndef __SSP_QUICK_CANARY__
+# ifndef __SSP_QUICK_CANARY__
{
int fd = OPEN("/dev/urandom", O_RDONLY, 0);
if (fd >= 0) {
@@ -48,7 +48,7 @@ static __always_inline uintptr_t _dl_setup_stack_chk_guard(void)
return ret;
}
}
-#endif /* !__SSP_QUICK_CANARY__ */
+# endif /* !__SSP_QUICK_CANARY__ */
/* Start with the "terminator canary". */
ret = 0xFF0A0D00UL;
@@ -62,6 +62,7 @@ static __always_inline uintptr_t _dl_setup_stack_chk_guard(void)
}
return ret;
}
+# endif /* libc || rtld */
#endif /* __UCLIBC_HAS_SSP__ */
#endif /* _DL_OSINFO_H */
diff --git a/libc/sysdeps/linux/common/getcwd.c b/libc/sysdeps/linux/common/getcwd.c
index c6a2fc005..d007993eb 100644
--- a/libc/sysdeps/linux/common/getcwd.c
+++ b/libc/sysdeps/linux/common/getcwd.c
@@ -47,13 +47,13 @@ static char *search_dir(dev_t this_dev, ino_t this_ino, char *path_buf, int path
slow_search = 1;
#endif
- slen = strlen(path_buf);
+ slen = __strlen(path_buf);
ptr = path_buf + slen - 1;
if (*ptr != '/') {
if (slen + 2 > path_size) {
goto oops;
}
- strcpy(++ptr, "/");
+ __strcpy(++ptr, "/");
slen++;
}
slen++;
@@ -67,10 +67,10 @@ static char *search_dir(dev_t this_dev, ino_t this_ino, char *path_buf, int path
#ifdef FAST_DIR_SEARCH_POSSIBLE
if (slow_search || this_ino == d->d_ino) {
#endif
- if (slen + strlen(d->d_name) > path_size) {
+ if (slen + __strlen(d->d_name) > path_size) {
goto oops;
}
- strcpy(ptr + 1, d->d_name);
+ __strcpy(ptr + 1, d->d_name);
if (stat(path_buf, &st) < 0)
continue;
if (st.st_ino == this_ino && st.st_dev == this_dev) {
@@ -108,13 +108,13 @@ static char *recurser(char *path_buf, int path_size, dev_t root_dev, ino_t root_
if (path_size < 2) {
goto oops;
}
- strcpy(path_buf, "/");
+ __strcpy(path_buf, "/");
return path_buf;
}
- if (strlen(path_buf) + 4 > path_size) {
+ if (__strlen(path_buf) + 4 > path_size) {
goto oops;
}
- strcat(path_buf, "/..");
+ __strcat(path_buf, "/..");
if (recurser(path_buf, path_size, root_dev, root_ino) == 0)
return 0;
@@ -141,11 +141,11 @@ int __syscall_getcwd(char * buf, unsigned long size)
return -1;
}
/* start with actual dir */
- if (buf) strncpy(buf, ".", size);
+ if (buf) __strncpy(buf, ".", size);
cwd = recurser(buf, size, st.st_dev, st.st_ino);
if (cwd) {
- len = strlen(buf);
+ len = __strlen(buf);
__set_errno(olderrno);
}
return len;
diff --git a/libc/sysdeps/linux/common/getdents.c b/libc/sysdeps/linux/common/getdents.c
index 876420664..24ce2c8ba 100644
--- a/libc/sysdeps/linux/common/getdents.c
+++ b/libc/sysdeps/linux/common/getdents.c
@@ -28,7 +28,7 @@
#include <sys/types.h>
#include <sys/syscall.h>
-
+#undef offsetof
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
struct kernel_dirent
@@ -90,7 +90,7 @@ ssize_t attribute_hidden __getdents (int fd, char *buf, size_t nbytes)
dp->d_off = kdp->d_off;
dp->d_reclen = new_reclen;
dp->d_type = DT_UNKNOWN;
- memcpy (dp->d_name, kdp->d_name,
+ __memcpy (dp->d_name, kdp->d_name,
kdp->d_reclen - offsetof (struct kernel_dirent, d_name));
dp = (struct dirent *) ((char *) dp + new_reclen);
kdp = (struct kernel_dirent *) (((char *) kdp) + kdp->d_reclen);
diff --git a/libc/sysdeps/linux/common/getdents64.c b/libc/sysdeps/linux/common/getdents64.c
index e45d9d364..a475c948a 100644
--- a/libc/sysdeps/linux/common/getdents64.c
+++ b/libc/sysdeps/linux/common/getdents64.c
@@ -31,7 +31,7 @@
#if defined __UCLIBC_HAS_LFS__ && defined __NR_getdents64
-
+#undef offsetof
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
struct kernel_dirent64
@@ -95,7 +95,7 @@ ssize_t attribute_hidden __getdents64 (int fd, char *buf, size_t nbytes)
dp->d_off = kdp->d_off;
dp->d_reclen = new_reclen;
dp->d_type = DT_UNKNOWN;
- memcpy (dp->d_name, kdp->d_name,
+ __memcpy (dp->d_name, kdp->d_name,
kdp->d_reclen - offsetof (struct kernel_dirent64, d_name));
dp = (struct dirent64 *) ((char *) dp + new_reclen);
kdp = (struct kernel_dirent64 *) (((char *) kdp) + kdp->d_reclen);
diff --git a/libc/sysdeps/linux/common/getdirname.c b/libc/sysdeps/linux/common/getdirname.c
index 4cc528fc7..d0865fba5 100644
--- a/libc/sysdeps/linux/common/getdirname.c
+++ b/libc/sysdeps/linux/common/getdirname.c
@@ -49,7 +49,7 @@ get_current_dir_name (void)
&& pwdstat.st_dev == dotstat.st_dev
&& pwdstat.st_ino == dotstat.st_ino)
/* The PWD value is correct. Use it. */
- return strdup (pwd);
+ return __strdup (pwd);
return getcwd ((char *) NULL, 0);
}
diff --git a/libc/sysdeps/linux/common/getdnnm.c b/libc/sysdeps/linux/common/getdnnm.c
index aa5a7d756..3c48b4ca0 100644
--- a/libc/sysdeps/linux/common/getdnnm.c
+++ b/libc/sysdeps/linux/common/getdnnm.c
@@ -18,10 +18,10 @@ getdomainname(char *name, size_t len)
if (uname(&uts) == -1) return -1;
- if (strlen(uts.domainname)+1 > len) {
+ if (__strlen(uts.domainname)+1 > len) {
__set_errno(EINVAL);
return -1;
}
- strcpy(name, uts.domainname);
+ __strcpy(name, uts.domainname);
return 0;
}
diff --git a/libc/sysdeps/linux/common/getdtablesize.c b/libc/sysdeps/linux/common/getdtablesize.c
index 016e6f62e..8cbcebdce 100644
--- a/libc/sysdeps/linux/common/getdtablesize.c
+++ b/libc/sysdeps/linux/common/getdtablesize.c
@@ -16,6 +16,8 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
+#define getrlimit __getrlimit
+
#include <stdlib.h>
#include <unistd.h>
#include <sys/resource.h>
diff --git a/libc/sysdeps/linux/common/getgroups.c b/libc/sysdeps/linux/common/getgroups.c
index 17a7b51c7..402d87e66 100644
--- a/libc/sysdeps/linux/common/getgroups.c
+++ b/libc/sysdeps/linux/common/getgroups.c
@@ -7,6 +7,8 @@
* GNU Library General Public License (LGPL) version 2 or later.
*/
+#define sysconf __sysconf
+
#include "syscalls.h"
#include <unistd.h>
diff --git a/libc/sysdeps/linux/common/gethstnm.c b/libc/sysdeps/linux/common/gethstnm.c
index 0f7a04681..8a23e9516 100644
--- a/libc/sysdeps/linux/common/gethstnm.c
+++ b/libc/sysdeps/linux/common/gethstnm.c
@@ -15,10 +15,10 @@ gethostname(char *name, size_t len)
if (uname(&uts) == -1) return -1;
- if (strlen(uts.nodename)+1 > len) {
+ if (__strlen(uts.nodename)+1 > len) {
__set_errno(EINVAL);
return -1;
}
- strcpy(name, uts.nodename);
+ __strcpy(name, uts.nodename);
return 0;
}
diff --git a/libc/sysdeps/linux/common/getpagesize.c b/libc/sysdeps/linux/common/getpagesize.c
index 0844d5b79..8469cbb76 100644
--- a/libc/sysdeps/linux/common/getpagesize.c
+++ b/libc/sysdeps/linux/common/getpagesize.c
@@ -22,7 +22,7 @@
extern size_t __pagesize;
/* Return the system page size. */
-int __getpagesize(void)
+int attribute_hidden __libc_getpagesize(void)
{
if (__pagesize != 0)
return __pagesize;
@@ -40,5 +40,6 @@ int __getpagesize(void)
#endif /* NBPG. */
#endif /* EXEC_PAGESIZE. */
}
-weak_alias(__getpagesize, getpagesize);
+strong_alias(__libc_getpagesize, __getpagesize)
+weak_alias(__getpagesize, getpagesize)
diff --git a/libc/sysdeps/linux/common/getrlimit.c b/libc/sysdeps/linux/common/getrlimit.c
index faeba92f4..fef907a03 100644
--- a/libc/sysdeps/linux/common/getrlimit.c
+++ b/libc/sysdeps/linux/common/getrlimit.c
@@ -13,9 +13,10 @@
#ifdef __NR_ugetrlimit
#define __NR___ugetrlimit __NR_ugetrlimit
+static inline
_syscall2(int, __ugetrlimit, enum __rlimit_resource, resource,
struct rlimit *, rlim);
-int getrlimit(__rlimit_resource_t resource, struct rlimit *rlimits)
+int attribute_hidden __getrlimit(__rlimit_resource_t resource, struct rlimit *rlimits)
{
return (__ugetrlimit(resource, rlimits));
}
@@ -23,15 +24,15 @@ int getrlimit(__rlimit_resource_t resource, struct rlimit *rlimits)
#else /* __NR_ugetrlimit */
/* Only include the old getrlimit if the new one (ugetrlimit) is not around */
-#define __NR___getrlimit __NR_getrlimit
+#define __NR___syscall_getrlimit __NR_getrlimit
static inline
-_syscall2(int, __getrlimit, int, resource, struct rlimit *, rlim);
+_syscall2(int, __syscall_getrlimit, int, resource, struct rlimit *, rlim);
-int getrlimit(__rlimit_resource_t resource, struct rlimit *rlimits)
+int attribute_hidden __getrlimit(__rlimit_resource_t resource, struct rlimit *rlimits)
{
int result;
- result = __getrlimit(resource, rlimits);
+ result = __syscall_getrlimit(resource, rlimits);
if (result == -1)
return result;
@@ -45,3 +46,5 @@ int getrlimit(__rlimit_resource_t resource, struct rlimit *rlimits)
return result;
}
#endif
+
+strong_alias(__getrlimit,getrlimit)
diff --git a/libc/sysdeps/linux/common/getrlimit64.c b/libc/sysdeps/linux/common/getrlimit64.c
index 1af7870af..76c3196ad 100644
--- a/libc/sysdeps/linux/common/getrlimit64.c
+++ b/libc/sysdeps/linux/common/getrlimit64.c
@@ -16,6 +16,8 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#define getrlimit __getrlimit
+
#include <features.h>
#if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS != 64
diff --git a/libc/sysdeps/linux/common/longjmp.c b/libc/sysdeps/linux/common/longjmp.c
index 1a4201922..5b4eff5f5 100644
--- a/libc/sysdeps/linux/common/longjmp.c
+++ b/libc/sysdeps/linux/common/longjmp.c
@@ -36,7 +36,7 @@ void __libc_longjmp (sigjmp_buf env, int val)
if (env[0].__mask_was_saved)
/* Restore the saved signal mask. */
- (void) sigprocmask (SIG_SETMASK, &env[0].__saved_mask,
+ (void) __sigprocmask (SIG_SETMASK, &env[0].__saved_mask,
(sigset_t *) NULL);
/* Call the machine-dependent function to restore machine state. */
diff --git a/libc/sysdeps/linux/common/open.c b/libc/sysdeps/linux/common/open.c
index 332d6a402..90e990a4f 100644
--- a/libc/sysdeps/linux/common/open.c
+++ b/libc/sysdeps/linux/common/open.c
@@ -18,7 +18,7 @@
static inline _syscall3(int, __syscall_open, const char *, file,
int, flags, __kernel_mode_t, mode);
-int __libc_open(const char *file, int flags, ...)
+int attribute_hidden __open(const char *file, int flags, ...)
{
/* gcc may warn about mode being uninitialized.
* Just ignore that, since gcc is wrong. */
@@ -33,9 +33,10 @@ int __libc_open(const char *file, int flags, ...)
}
return __syscall_open(file, flags, mode);
}
-weak_alias(__libc_open, open);
+strong_alias(__open,open)
+weak_alias(__open,__libc_open)
int creat(const char *file, mode_t mode)
{
- return __libc_open(file, O_WRONLY | O_CREAT | O_TRUNC, mode);
+ return __open(file, O_WRONLY | O_CREAT | O_TRUNC, mode);
}
diff --git a/libc/sysdeps/linux/common/open64.c b/libc/sysdeps/linux/common/open64.c
index d9a27a7bc..c1cd47141 100644
--- a/libc/sysdeps/linux/common/open64.c
+++ b/libc/sysdeps/linux/common/open64.c
@@ -26,11 +26,9 @@
#endif
#ifdef __UCLIBC_HAS_LFS__
-extern int __libc_open (__const char *file, int oflag, ...);
-
/* Open FILE with access OFLAG. If OFLAG includes O_CREAT,
a third argument is the file protection. */
-int __libc_open64 (const char *file, int oflag, ...)
+int attribute_hidden __open64 (const char *file, int oflag, ...)
{
int mode = 0;
@@ -42,7 +40,8 @@ int __libc_open64 (const char *file, int oflag, ...)
va_end (arg);
}
- return __libc_open(file, oflag | O_LARGEFILE, mode);
+ return __open(file, oflag | O_LARGEFILE, mode);
}
-weak_alias (__libc_open64, open64);
+strong_alias(__open64,open64)
+weak_alias(__open64,__libc_open64)
#endif /* __UCLIBC_HAS_LFS__ */
diff --git a/libc/sysdeps/linux/common/poll.c b/libc/sysdeps/linux/common/poll.c
index 06c857c43..87d0dbb27 100644
--- a/libc/sysdeps/linux/common/poll.c
+++ b/libc/sysdeps/linux/common/poll.c
@@ -62,9 +62,9 @@ int poll(struct pollfd *fds, nfds_t nfds, int timeout)
/* We can't call FD_ZERO, since FD_ZERO only works with sets
of exactly __FD_SETSIZE size. */
- memset (rset, 0, bytes);
- memset (wset, 0, bytes);
- memset (xset, 0, bytes);
+ __memset (rset, 0, bytes);
+ __memset (wset, 0, bytes);
+ __memset (xset, 0, bytes);
for (f = fds; f < &fds[nfds]; ++f)
{
@@ -86,13 +86,13 @@ int poll(struct pollfd *fds, nfds_t nfds, int timeout)
nwset = alloca (nbytes);
nxset = alloca (nbytes);
- memset ((char *) nrset + bytes, 0, nbytes - bytes);
- memset ((char *) nwset + bytes, 0, nbytes - bytes);
- memset ((char *) nxset + bytes, 0, nbytes - bytes);
+ __memset ((char *) nrset + bytes, 0, nbytes - bytes);
+ __memset ((char *) nwset + bytes, 0, nbytes - bytes);
+ __memset ((char *) nxset + bytes, 0, nbytes - bytes);
- rset = memcpy (nrset, rset, bytes);
- wset = memcpy (nwset, wset, bytes);
- xset = memcpy (nxset, xset, bytes);
+ rset = __memcpy (nrset, rset, bytes);
+ wset = __memcpy (nwset, wset, bytes);
+ xset = __memcpy (nxset, xset, bytes);
bytes = nbytes;
}
@@ -126,9 +126,9 @@ int poll(struct pollfd *fds, nfds_t nfds, int timeout)
struct timeval sngl_tv;
/* Clear the original set. */
- memset (rset, 0, bytes);
- memset (wset, 0, bytes);
- memset (xset, 0, bytes);
+ __memset (rset, 0, bytes);
+ __memset (wset, 0, bytes);
+ __memset (xset, 0, bytes);
/* This means we don't wait for input. */
sngl_tv.tv_sec = 0;
@@ -145,9 +145,9 @@ int poll(struct pollfd *fds, nfds_t nfds, int timeout)
{
int n;
- memset (sngl_rset, 0, bytes);
- memset (sngl_wset, 0, bytes);
- memset (sngl_xset, 0, bytes);
+ __memset (sngl_rset, 0, bytes);
+ __memset (sngl_wset, 0, bytes);
+ __memset (sngl_xset, 0, bytes);
if (f->events & POLLIN)
FD_SET (f->fd, sngl_rset);
diff --git a/libc/sysdeps/linux/common/posix_fadvise.c b/libc/sysdeps/linux/common/posix_fadvise.c
index a1888134b..52fc35700 100644
--- a/libc/sysdeps/linux/common/posix_fadvise.c
+++ b/libc/sysdeps/linux/common/posix_fadvise.c
@@ -8,22 +8,20 @@
* GNU Library General Public License (LGPL) version 2 or later.
*/
+/* need to hide the posix_fadvise64 prototype or the weak_alias()
+ * will fail when __NR_fadvise64_64 doesnt exist */
+#define posix_fadvise64 __hide_posix_fadvise64
#include "syscalls.h"
#include <fcntl.h>
+#undef posix_fadvise64
#ifdef __NR_fadvise64
-#define __NR___syscall_fadvise64 __NR_fadvise64
-_syscall4(int, __syscall_fadvise64, int, fd, off_t, offset,
+#define __NR_posix_fadvise __NR_fadvise64
+_syscall4(int, posix_fadvise, int, fd, off_t, offset,
off_t, len, int, advice);
-int __libc_posix_fadvise(int fd, off_t offset, off_t len, int advice)
-{
- return (__syscall_fadvise64(fd, offset, len, advice));
-}
-weak_alias(__libc_posix_fadvise, posix_fadvise);
-#if defined __UCLIBC_HAS_LFS__ && !defined __NR_fadvise64_64 && \
- !defined __USE_LARGEFILE64
-weak_alias(__libc_posix_fadvise, posix_fadvise64);
+#if defined __UCLIBC_HAS_LFS__ && !defined __NR_fadvise64_64
+weak_alias(posix_fadvise, posix_fadvise64);
#endif
#else
diff --git a/libc/sysdeps/linux/common/posix_fadvise64.c b/libc/sysdeps/linux/common/posix_fadvise64.c
index a5dbe8de2..5c5cf9906 100644
--- a/libc/sysdeps/linux/common/posix_fadvise64.c
+++ b/libc/sysdeps/linux/common/posix_fadvise64.c
@@ -19,34 +19,30 @@
#ifdef __UCLIBC_HAS_LFS__
#ifdef __NR_fadvise64_64
-#define __NR___syscall_fadvise64_64 __NR_fadvise64_64
/* 64 bit implementation is cake ... or more like pie ... */
#if __WORDSIZE == 64
-_syscall4(int, __syscall_fadvise64_64, int, fd, __off64_t, offset,
+
+#define __NR_posix_fadvise64 __NR_fadvise64_64
+_syscall4(int, posix_fadvise64, int, fd, __off64_t, offset,
__off64_t, len, int, advice);
-int __libc_posix_fadvise64(int fd, __off64_t offset, __off64_t len, int advice)
-{
- return (__syscall_fadvise64_64(fd, offset, len, advice));
-}
-weak_alias(__libc_posix_fadvise64, posix_fadvise64);
/* 32 bit implementation is kind of a pita */
#elif __WORDSIZE == 32
#ifdef _syscall6 /* workaround until everyone has _syscall6() */
-_syscall6(int, __syscall_fadvise64_64, int, fd,
+#define __NR___syscall_fadvise64_64 __NR_fadvise64_64
+static inline _syscall6(int, __syscall_fadvise64_64, int, fd,
unsigned long, high_offset, unsigned long, low_offset,
unsigned long, high_len, unsigned long, low_len,
int, advice);
-int __libc_posix_fadvise64(int fd, __off64_t offset, __off64_t len, int advice)
+int posix_fadvise64(int fd, __off64_t offset, __off64_t len, int advice)
{
return (__syscall_fadvise64_64(fd,
__LONG_LONG_PAIR(offset >> 32, offset & 0xffffffff),
__LONG_LONG_PAIR(len >> 32, len & 0xffffffff),
advice));
}
-weak_alias(__libc_posix_fadvise64, posix_fadvise64);
#else
#warning _syscall6 has not been defined for your machine :(
#endif /* _syscall6 */
@@ -56,7 +52,7 @@ weak_alias(__libc_posix_fadvise64, posix_fadvise64);
#endif
#elif !defined __NR_fadvise64
-/* This is declared as a weak alias in posix_fadvice.c if __NR_fadvise64
+/* This is declared as a weak alias in posix_fadvise.c if __NR_fadvise64
* is defined.
*/
int posix_fadvise64(int fd, __off64_t offset, __off64_t len, int advice)
diff --git a/libc/sysdeps/linux/common/read.c b/libc/sysdeps/linux/common/read.c
index 9b9ea5bc9..6490bccbc 100644
--- a/libc/sysdeps/linux/common/read.c
+++ b/libc/sysdeps/linux/common/read.c
@@ -10,6 +10,7 @@
#include "syscalls.h"
#include <unistd.h>
-#define __NR___libc_read __NR_read
-_syscall3(ssize_t, __libc_read, int, fd, __ptr_t, buf, size_t, count);
-weak_alias(__libc_read, read);
+#define __NR___read __NR_read
+attribute_hidden _syscall3(ssize_t, __read, int, fd, __ptr_t, buf, size_t, count);
+strong_alias(__read,read)
+weak_alias(__read,__libc_read)
diff --git a/libc/sysdeps/linux/common/setgroups.c b/libc/sysdeps/linux/common/setgroups.c
index 4b4a1ddec..d92840370 100644
--- a/libc/sysdeps/linux/common/setgroups.c
+++ b/libc/sysdeps/linux/common/setgroups.c
@@ -7,6 +7,8 @@
* GNU Library General Public License (LGPL) version 2 or later.
*/
+#define sysconf __sysconf
+
#include "syscalls.h"
#include <unistd.h>
#include <grp.h>
diff --git a/libc/sysdeps/linux/common/setrlimit.c b/libc/sysdeps/linux/common/setrlimit.c
index c7ebe6c98..9c5466a09 100644
--- a/libc/sysdeps/linux/common/setrlimit.c
+++ b/libc/sysdeps/linux/common/setrlimit.c
@@ -12,12 +12,13 @@
#ifndef __NR_ugetrlimit
/* Only wrap setrlimit if the new ugetrlimit is not present */
-#define __NR___setrlimit __NR_setrlimit
+#define __NR___syscall_setrlimit __NR_setrlimit
#include <unistd.h>
#include <sys/resource.h>
#define RMIN(x, y) ((x) < (y) ? (x) : (y))
-_syscall2(int, __setrlimit, int, resource, const struct rlimit *, rlim);
-int setrlimit(__rlimit_resource_t resource, const struct rlimit *rlimits)
+static inline
+_syscall2(int, __syscall_setrlimit, int, resource, const struct rlimit *, rlim);
+int attribute_hidden __setrlimit(__rlimit_resource_t resource, const struct rlimit *rlimits)
{
struct rlimit rlimits_small;
@@ -27,7 +28,7 @@ int setrlimit(__rlimit_resource_t resource, const struct rlimit *rlimits)
RLIM_INFINITY >> 1);
rlimits_small.rlim_max = RMIN((unsigned long int) rlimits->rlim_max,
RLIM_INFINITY >> 1);
- return (__setrlimit(resource, &rlimits_small));
+ return (__syscall_setrlimit(resource, &rlimits_small));
}
#undef RMIN
@@ -36,6 +37,9 @@ int setrlimit(__rlimit_resource_t resource, const struct rlimit *rlimits)
#include <unistd.h>
struct rlimit;
-_syscall2(int, setrlimit, unsigned int, resource,
+#define __NR___setrlimit __NR_setrlimit
+attribute_hidden _syscall2(int, __setrlimit, unsigned int, resource,
const struct rlimit *, rlim);
#endif
+
+strong_alias(__setrlimit,setrlimit)
diff --git a/libc/sysdeps/linux/common/setrlimit64.c b/libc/sysdeps/linux/common/setrlimit64.c
index 8d190f573..d59057c90 100644
--- a/libc/sysdeps/linux/common/setrlimit64.c
+++ b/libc/sysdeps/linux/common/setrlimit64.c
@@ -16,6 +16,7 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#define setrlimit __setrlimit
#include <features.h>
diff --git a/libc/sysdeps/linux/common/ssp.c b/libc/sysdeps/linux/common/ssp.c
index 43708fe61..4c52d070f 100644
--- a/libc/sysdeps/linux/common/ssp.c
+++ b/libc/sysdeps/linux/common/ssp.c
@@ -30,10 +30,10 @@ static __always_inline void block_signals(void)
sigfillset(&mask);
sigdelset(&mask, SSP_SIGTYPE); /* Block all signal handlers */
- SIGPROCMASK(SIG_BLOCK, &mask, NULL); /* except SSP_SIGTYPE */
+ __sigprocmask(SIG_BLOCK, &mask, NULL); /* except SSP_SIGTYPE */
/* Make the default handler associated with the signal handler */
- memset(&sa, 0, sizeof(struct sigaction));
+ __memset(&sa, 0, sizeof(struct sigaction));
sigfillset(&sa.sa_mask); /* Block all signals */
sa.sa_flags = 0;
sa.sa_handler = SIG_DFL;
@@ -42,10 +42,10 @@ static __always_inline void block_signals(void)
static __always_inline void ssp_write(int fd, const char *msg1, const char *msg2, const char *msg3)
{
- WRITE(fd, msg1, strlen(msg1));
- WRITE(fd, msg2, strlen(msg2));
- WRITE(fd, msg3, strlen(msg3));
- WRITE(fd, "()\n", 3);
+ __write(fd, msg1, __strlen(msg1));
+ __write(fd, msg2, __strlen(msg2));
+ __write(fd, msg3, __strlen(msg3));
+ __write(fd, "()\n", 3);
openlog("ssp", LOG_CONS | LOG_PID, LOG_USER);
syslog(LOG_INFO, "%s%s%s()", msg1, msg2, msg3);
closelog();
diff --git a/libc/sysdeps/linux/common/syscalls.h b/libc/sysdeps/linux/common/syscalls.h
index b42f82100..743ac8a74 100644
--- a/libc/sysdeps/linux/common/syscalls.h
+++ b/libc/sysdeps/linux/common/syscalls.h
@@ -29,10 +29,8 @@
#include <endian.h>
#undef __OPTIMIZE__
-/*
- * We absolutely do _NOT_ want interfaces silently
- * renamed under us or very bad things will happen...
- */
+/* We absolutely do _NOT_ want interfaces silently
+ * * * renamed under us or very bad things will happen... */
#ifdef __USE_FILE_OFFSET64
# undef __USE_FILE_OFFSET64
#endif
diff --git a/libc/sysdeps/linux/common/ulimit.c b/libc/sysdeps/linux/common/ulimit.c
index 2394edaae..b8e09fc8f 100644
--- a/libc/sysdeps/linux/common/ulimit.c
+++ b/libc/sysdeps/linux/common/ulimit.c
@@ -18,6 +18,10 @@
*
*/
+#define sysconf __sysconf
+#define getrlimit __getrlimit
+#define setrlimit __setrlimit
+
#define _GNU_SOURCE
#define _LARGEFILE64_SOURCE
#include <features.h>
diff --git a/libc/sysdeps/linux/common/write.c b/libc/sysdeps/linux/common/write.c
index b7e34f81c..d3b5fab93 100644
--- a/libc/sysdeps/linux/common/write.c
+++ b/libc/sysdeps/linux/common/write.c
@@ -10,9 +10,12 @@
#include "syscalls.h"
#include <unistd.h>
-#define __NR___libc_write __NR_write
-_syscall3(ssize_t, __libc_write, int, fd, const __ptr_t, buf, size_t, count);
-weak_alias(__libc_write, write);
+#define __NR___write __NR_write
+attribute_hidden _syscall3(ssize_t, __write, int, fd, const __ptr_t, buf, size_t, count);
+strong_alias(__write,write)
+weak_alias(__write,__libc_write)
+#if 0
/* Stupid libgcc.a from gcc 2.95.x uses __write in pure.o
* which is a blatent GNU libc-ism... */
weak_alias(__libc_write, __write);
+#endif