diff options
Diffstat (limited to 'libc/sysdeps/linux')
33 files changed, 138 insertions, 110 deletions
diff --git a/libc/sysdeps/linux/arm/ioperm.c b/libc/sysdeps/linux/arm/ioperm.c index 357d987f8..f887d54f1 100644 --- a/libc/sysdeps/linux/arm/ioperm.c +++ b/libc/sysdeps/linux/arm/ioperm.c @@ -157,7 +157,7 @@ init_iosys (void) /* translate systype name into i/o system: */ for (i = 0; i < sizeof (platform) / sizeof (platform[0]); ++i) { - if (strcmp (platform[i].name, systype) == 0) { + if (__strcmp (platform[i].name, systype) == 0) { io.shift = platform[i].shift; io.io_base = platform[i].io_base; io.initdone = 1; @@ -185,14 +185,14 @@ int ioperm (unsigned long int from, unsigned long int num, int turn_on) if (! io.base) { int fd; - fd = open ("/dev/mem", O_RDWR); + fd = __open ("/dev/mem", O_RDWR); if (fd < 0) return -1; io.base = (unsigned long int) mmap (0, MAX_PORT << io.shift, PROT_READ | PROT_WRITE, MAP_SHARED, fd, io.io_base); - close (fd); + __close (fd); if ((long) io.base == -1) return -1; } diff --git a/libc/sysdeps/linux/arm/sigaction.c b/libc/sysdeps/linux/arm/sigaction.c index 5fbb7fbf1..822fd0d97 100644 --- a/libc/sysdeps/linux/arm/sigaction.c +++ b/libc/sysdeps/linux/arm/sigaction.c @@ -58,7 +58,7 @@ int __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oa if (act) { kact.k_sa_handler = act->sa_handler; - memcpy (&kact.sa_mask, &act->sa_mask, sizeof (sigset_t)); + __memcpy (&kact.sa_mask, &act->sa_mask, sizeof (sigset_t)); kact.sa_flags = act->sa_flags; # ifdef HAVE_SA_RESTORER /* If the user specified SA_ONSTACK this means she is trying to @@ -83,7 +83,7 @@ int __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oa oact ? __ptrvalue (&koact) : NULL, _NSIG / 8); if (oact && result >= 0) { oact->sa_handler = koact.k_sa_handler; - memcpy (&oact->sa_mask, &koact.sa_mask, sizeof (sigset_t)); + __memcpy (&oact->sa_mask, &koact.sa_mask, sizeof (sigset_t)); oact->sa_flags = koact.sa_flags; # ifdef HAVE_SA_RESTORER oact->sa_restorer = koact.sa_restorer; 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/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 ee7b4daef..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 -attribute_hidden _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. */ -attribute_hidden _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..6913798a8 100644 --- a/libc/sysdeps/linux/common/getdents.c +++ b/libc/sysdeps/linux/common/getdents.c @@ -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..37ecc1339 100644 --- a/libc/sysdeps/linux/common/getdents64.c +++ b/libc/sysdeps/linux/common/getdents64.c @@ -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/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/getrlimit.c b/libc/sysdeps/linux/common/getrlimit.c index c84330b03..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 -attribute_hidden _syscall2(int, __ugetrlimit, enum __rlimit_resource, resource, +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/gettimeofday.c b/libc/sysdeps/linux/common/gettimeofday.c index 0165acfc1..88f7f9999 100644 --- a/libc/sysdeps/linux/common/gettimeofday.c +++ b/libc/sysdeps/linux/common/gettimeofday.c @@ -9,4 +9,8 @@ #include "syscalls.h" #include <sys/time.h> -_syscall2(int, gettimeofday, struct timeval *, tv, struct timezone *, tz); +#undef gettimeofday +#define __NR___gettimeofday __NR_gettimeofday +attribute_hidden _syscall2(int, __gettimeofday, struct timeval *, tv, struct timezone *, tz); +strong_alias(__gettimeofday,gettimeofday) +weak_alias(__gettimeofday,__libc_gettimeofday) 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/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/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/sigprocmask.c b/libc/sysdeps/linux/common/sigprocmask.c index c15ba2485..7a18648e8 100644 --- a/libc/sysdeps/linux/common/sigprocmask.c +++ b/libc/sysdeps/linux/common/sigprocmask.c @@ -19,7 +19,7 @@ static inline _syscall4(int, __rt_sigprocmask, int, how, const sigset_t *, set, sigset_t *, oldset, size_t, size); -int sigprocmask(int how, const sigset_t * set, sigset_t * oldset) +int attribute_hidden __sigprocmask(int how, const sigset_t * set, sigset_t * oldset) { if (set && #if (SIG_BLOCK == 0) && (SIG_UNBLOCK == 1) && (SIG_SETMASK == 2) @@ -44,7 +44,7 @@ static inline _syscall3(int, __syscall_sigprocmask, int, how, const sigset_t *, set, sigset_t *, oldset); -int sigprocmask(int how, const sigset_t * set, sigset_t * oldset) +int attribute_hidden __sigprocmask(int how, const sigset_t * set, sigset_t * oldset) { if (set && #if (SIG_BLOCK == 0) && (SIG_UNBLOCK == 1) && (SIG_SETMASK == 2) @@ -61,3 +61,5 @@ int sigprocmask(int how, const sigset_t * set, sigset_t * oldset) return (__syscall_sigprocmask(how, set, oldset)); } #endif + +strong_alias(__sigprocmask,sigprocmask) 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/ulimit.c b/libc/sysdeps/linux/common/ulimit.c index 5bbed45a7..b8e09fc8f 100644 --- a/libc/sysdeps/linux/common/ulimit.c +++ b/libc/sysdeps/linux/common/ulimit.c @@ -19,6 +19,8 @@ */ #define sysconf __sysconf +#define getrlimit __getrlimit +#define setrlimit __setrlimit #define _GNU_SOURCE #define _LARGEFILE64_SOURCE 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 diff --git a/libc/sysdeps/linux/e1/longjmp.c b/libc/sysdeps/linux/e1/longjmp.c index 5770d4997..89d6b76d9 100644 --- a/libc/sysdeps/linux/e1/longjmp.c +++ b/libc/sysdeps/linux/e1/longjmp.c @@ -43,7 +43,7 @@ void longjmp(jmp_buf state, int value ) void siglongjmp(sigjmp_buf state, int value ) { if( state->__mask_was_saved ) - sigprocmask(SIG_SETMASK, &state->__saved_mask, NULL); + __sigprocmask(SIG_SETMASK, &state->__saved_mask, NULL); if(!value) state->__jmpbuf->ReturnValue = 1; diff --git a/libc/sysdeps/linux/e1/setjmp.c b/libc/sysdeps/linux/e1/setjmp.c index 2942cb193..502e89b22 100644 --- a/libc/sysdeps/linux/e1/setjmp.c +++ b/libc/sysdeps/linux/e1/setjmp.c @@ -32,7 +32,7 @@ int sigsetjmp( sigjmp_buf state , int savesigs) if(savesigs) { state->__mask_was_saved = 1; /* how arg in <sigprocmask> is not significant */ - sigprocmask(SIG_SETMASK, NULL, &state->__saved_mask); + __sigprocmask(SIG_SETMASK, NULL, &state->__saved_mask); } else state->__mask_was_saved = 0; diff --git a/libc/sysdeps/linux/i386/sigaction.c b/libc/sysdeps/linux/i386/sigaction.c index 640e51f21..0875796cf 100644 --- a/libc/sysdeps/linux/i386/sigaction.c +++ b/libc/sysdeps/linux/i386/sigaction.c @@ -48,7 +48,7 @@ int __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oa if (act) { kact.k_sa_handler = act->sa_handler; - memcpy (&kact.sa_mask, &act->sa_mask, sizeof (kact.sa_mask)); + __memcpy (&kact.sa_mask, &act->sa_mask, sizeof (kact.sa_mask)); kact.sa_flags = act->sa_flags; kact.sa_flags = act->sa_flags | SA_RESTORER; @@ -63,7 +63,7 @@ int __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oa if (oact && result >= 0) { oact->sa_handler = koact.k_sa_handler; - memcpy (&oact->sa_mask, &koact.sa_mask, sizeof (oact->sa_mask)); + __memcpy (&oact->sa_mask, &koact.sa_mask, sizeof (oact->sa_mask)); oact->sa_flags = koact.sa_flags; oact->sa_restorer = koact.sa_restorer; } diff --git a/libc/sysdeps/linux/mips/sigaction.c b/libc/sysdeps/linux/mips/sigaction.c index de35edf40..245886dbd 100644 --- a/libc/sysdeps/linux/mips/sigaction.c +++ b/libc/sysdeps/linux/mips/sigaction.c @@ -46,7 +46,7 @@ int __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oa if (act) { kact.k_sa_handler = act->sa_handler; - memcpy (&kact.sa_mask, &act->sa_mask, sizeof (kact.sa_mask)); + __memcpy (&kact.sa_mask, &act->sa_mask, sizeof (kact.sa_mask)); kact.sa_flags = act->sa_flags; kact.sa_flags = act->sa_flags | SA_RESTORER; @@ -62,7 +62,7 @@ int __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oa if (oact && result >= 0) { oact->sa_handler = koact.k_sa_handler; - memcpy (&oact->sa_mask, &koact.sa_mask, sizeof (oact->sa_mask)); + __memcpy (&oact->sa_mask, &koact.sa_mask, sizeof (oact->sa_mask)); oact->sa_flags = koact.sa_flags; #ifdef HAVE_SA_RESTORER oact->sa_restorer = koact.sa_restorer; diff --git a/libc/sysdeps/linux/sh/longjmp.c b/libc/sysdeps/linux/sh/longjmp.c index c36344cd1..ee3afcd74 100644 --- a/libc/sysdeps/linux/sh/longjmp.c +++ b/libc/sysdeps/linux/sh/longjmp.c @@ -33,7 +33,7 @@ void __libc_siglongjmp (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/x86_64/sigaction.c b/libc/sysdeps/linux/x86_64/sigaction.c index f701d5047..ac10bc5aa 100644 --- a/libc/sysdeps/linux/x86_64/sigaction.c +++ b/libc/sysdeps/linux/x86_64/sigaction.c @@ -52,7 +52,7 @@ __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oact) if (act) { kact.k_sa_handler = act->sa_handler; - memcpy (&kact.sa_mask, &act->sa_mask, sizeof (sigset_t)); + __memcpy (&kact.sa_mask, &act->sa_mask, sizeof (sigset_t)); kact.sa_flags = act->sa_flags | SA_RESTORER; kact.sa_restorer = &restore_rt; @@ -65,7 +65,7 @@ __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oact) oact ? __ptrvalue (&koact) : NULL, _NSIG / 8); if (oact && result >= 0) { oact->sa_handler = koact.k_sa_handler; - memcpy (&oact->sa_mask, &koact.sa_mask, sizeof (sigset_t)); + __memcpy (&oact->sa_mask, &koact.sa_mask, sizeof (sigset_t)); oact->sa_flags = koact.sa_flags; oact->sa_restorer = koact.sa_restorer; } |