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/__rt_sigtimedwait.c2
-rw-r--r--libc/sysdeps/linux/common/__syscall_rt_sigaction.c2
-rw-r--r--libc/sysdeps/linux/common/__syscall_sigaction.c2
-rw-r--r--libc/sysdeps/linux/common/adjtimex.c8
-rw-r--r--libc/sysdeps/linux/common/alarm.c2
-rw-r--r--libc/sysdeps/linux/common/clock_settime.c2
-rw-r--r--libc/sysdeps/linux/common/getdirname.c2
-rw-r--r--libc/sysdeps/linux/common/getdtablesize.c4
-rw-r--r--libc/sysdeps/linux/common/getpagesize.c7
-rw-r--r--libc/sysdeps/linux/common/getpid.c11
-rw-r--r--libc/sysdeps/linux/common/getppid.c2
-rw-r--r--libc/sysdeps/linux/common/kill.c3
-rw-r--r--libc/sysdeps/linux/common/ntp_gettime.c2
-rw-r--r--libc/sysdeps/linux/common/poll.c2
-rw-r--r--libc/sysdeps/linux/common/setitimer.c4
-rw-r--r--libc/sysdeps/linux/common/settimeofday.c4
-rw-r--r--libc/sysdeps/linux/common/ssp.c35
-rw-r--r--libc/sysdeps/linux/common/stime.c2
-rw-r--r--libc/sysdeps/linux/common/time.c6
-rw-r--r--libc/sysdeps/linux/common/times.c4
-rw-r--r--libc/sysdeps/linux/common/utime.c8
-rw-r--r--libc/sysdeps/linux/common/utimes.c8
-rw-r--r--libc/sysdeps/linux/common/wait.c8
-rw-r--r--libc/sysdeps/linux/common/wait3.c2
-rw-r--r--libc/sysdeps/linux/common/wait4.c3
-rw-r--r--libc/sysdeps/linux/common/waitpid.c9
26 files changed, 100 insertions, 44 deletions
diff --git a/libc/sysdeps/linux/common/__rt_sigtimedwait.c b/libc/sysdeps/linux/common/__rt_sigtimedwait.c
index c50eadbbe..3c3d99c2a 100644
--- a/libc/sysdeps/linux/common/__rt_sigtimedwait.c
+++ b/libc/sysdeps/linux/common/__rt_sigtimedwait.c
@@ -13,7 +13,7 @@
#include <stddef.h>
#ifdef __NR_rt_sigtimedwait
#define __NR___rt_sigtimedwait __NR_rt_sigtimedwait
-_syscall4(int, __rt_sigtimedwait, const sigset_t *, set, siginfo_t *, info,
+static _syscall4(int, __rt_sigtimedwait, const sigset_t *, set, siginfo_t *, info,
const struct timespec *, timeout, size_t, setsize);
int sigwaitinfo(const sigset_t * set, siginfo_t * info)
diff --git a/libc/sysdeps/linux/common/__syscall_rt_sigaction.c b/libc/sysdeps/linux/common/__syscall_rt_sigaction.c
index 9d4916618..be7709040 100644
--- a/libc/sysdeps/linux/common/__syscall_rt_sigaction.c
+++ b/libc/sysdeps/linux/common/__syscall_rt_sigaction.c
@@ -14,7 +14,7 @@
#define __NR___syscall_rt_sigaction __NR_rt_sigaction
#undef sigaction
-_syscall4(int, __syscall_rt_sigaction, int, signum,
+attribute_hidden _syscall4(int, __syscall_rt_sigaction, int, signum,
const struct sigaction *, act, struct sigaction *, oldact,
size_t, size);
diff --git a/libc/sysdeps/linux/common/__syscall_sigaction.c b/libc/sysdeps/linux/common/__syscall_sigaction.c
index 6c33b2802..4333a6a1a 100644
--- a/libc/sysdeps/linux/common/__syscall_sigaction.c
+++ b/libc/sysdeps/linux/common/__syscall_sigaction.c
@@ -13,7 +13,7 @@
#define __NR___syscall_sigaction __NR_sigaction
#include <signal.h>
#undef sigaction
-_syscall3(int, __syscall_sigaction, int, signum, const struct sigaction *,
+attribute_hidden _syscall3(int, __syscall_sigaction, int, signum, const struct sigaction *,
act, struct sigaction *, oldact);
#endif
diff --git a/libc/sysdeps/linux/common/adjtimex.c b/libc/sysdeps/linux/common/adjtimex.c
index 28ad442e8..ef33051e8 100644
--- a/libc/sysdeps/linux/common/adjtimex.c
+++ b/libc/sysdeps/linux/common/adjtimex.c
@@ -9,7 +9,9 @@
#include "syscalls.h"
#include <sys/timex.h>
-_syscall1(int, adjtimex, struct timex *, buf);
-weak_alias(adjtimex, __adjtimex);
-weak_alias(adjtimex, ntp_adjtime);
+#define __NR___adjtimex __NR_adjtimex
+attribute_hidden _syscall1(int, __adjtimex, struct timex *, buf);
+
+strong_alias(__adjtimex, adjtimex)
+weak_alias(__adjtimex, ntp_adjtime)
diff --git a/libc/sysdeps/linux/common/alarm.c b/libc/sysdeps/linux/common/alarm.c
index 7e554fcbf..eec941d07 100644
--- a/libc/sysdeps/linux/common/alarm.c
+++ b/libc/sysdeps/linux/common/alarm.c
@@ -7,6 +7,8 @@
* GNU Library General Public License (LGPL) version 2 or later.
*/
+#define setitimer __setitimer
+
#include "syscalls.h"
#include <unistd.h>
#ifdef __NR_alarm
diff --git a/libc/sysdeps/linux/common/clock_settime.c b/libc/sysdeps/linux/common/clock_settime.c
index 40dadc78d..e2ec03f78 100644
--- a/libc/sysdeps/linux/common/clock_settime.c
+++ b/libc/sysdeps/linux/common/clock_settime.c
@@ -19,6 +19,8 @@
*
*/
+#define settimeofday __settimeofday
+
#define _GNU_SOURCE
#include "syscalls.h"
#include <time.h>
diff --git a/libc/sysdeps/linux/common/getdirname.c b/libc/sysdeps/linux/common/getdirname.c
index d0865fba5..486ee9335 100644
--- a/libc/sysdeps/linux/common/getdirname.c
+++ b/libc/sysdeps/linux/common/getdirname.c
@@ -37,7 +37,7 @@ get_current_dir_name (void)
struct stat dotstat, pwdstat;
#endif
- pwd = getenv ("PWD");
+ pwd = __getenv ("PWD");
if (pwd != NULL
#if defined __UCLIBC_HAS_LFS__
&& stat64 (".", &dotstat) == 0
diff --git a/libc/sysdeps/linux/common/getdtablesize.c b/libc/sysdeps/linux/common/getdtablesize.c
index 8cbcebdce..de3af63d7 100644
--- a/libc/sysdeps/linux/common/getdtablesize.c
+++ b/libc/sysdeps/linux/common/getdtablesize.c
@@ -27,7 +27,7 @@
/* Return the maximum number of file descriptors
the current process could possibly have. */
-int getdtablesize (void)
+int attribute_hidden __getdtablesize (void)
{
struct rlimit ru;
@@ -36,4 +36,4 @@ int getdtablesize (void)
returns -1. */
return getrlimit (RLIMIT_NOFILE, &ru) < 0 ? __LOCAL_OPEN_MAX : ru.rlim_cur;
}
-
+strong_alias(__getdtablesize,getdtablesize)
diff --git a/libc/sysdeps/linux/common/getpagesize.c b/libc/sysdeps/linux/common/getpagesize.c
index 8469cbb76..669cdb075 100644
--- a/libc/sysdeps/linux/common/getpagesize.c
+++ b/libc/sysdeps/linux/common/getpagesize.c
@@ -22,7 +22,8 @@
extern size_t __pagesize;
/* Return the system page size. */
-int attribute_hidden __libc_getpagesize(void)
+/* couldn't make __getpagesize hidden, because shm.h uses it in a macro */
+int attribute_hidden __getpagesize_internal(void)
{
if (__pagesize != 0)
return __pagesize;
@@ -40,6 +41,6 @@ int attribute_hidden __libc_getpagesize(void)
#endif /* NBPG. */
#endif /* EXEC_PAGESIZE. */
}
-strong_alias(__libc_getpagesize, __getpagesize)
-weak_alias(__getpagesize, getpagesize)
+strong_alias(__getpagesize_internal, __getpagesize)
+weak_alias(__getpagesize_internal, getpagesize)
diff --git a/libc/sysdeps/linux/common/getpid.c b/libc/sysdeps/linux/common/getpid.c
index a4e07d97c..6a6a9e129 100644
--- a/libc/sysdeps/linux/common/getpid.c
+++ b/libc/sysdeps/linux/common/getpid.c
@@ -11,9 +11,10 @@
#include <unistd.h>
#if defined (__alpha__)
-#define __NR_getpid __NR_getxpid
+#define __NR___getpid __NR_getxpid
#endif
-#define __NR___libc_getpid __NR_getpid
-_syscall0(pid_t, __libc_getpid);
-weak_alias(__libc_getpid, getpid);
-weak_alias(__libc_getpid, __getpid);
+#define __NR___getpid __NR_getpid
+attribute_hidden _syscall0(pid_t, __getpid);
+strong_alias(__getpid, getpid)
+/* not used in libpthread */
+/* weak_alias(__getpid, __libc_getpid) */
diff --git a/libc/sysdeps/linux/common/getppid.c b/libc/sysdeps/linux/common/getppid.c
index efd542863..b2944e5e0 100644
--- a/libc/sysdeps/linux/common/getppid.c
+++ b/libc/sysdeps/linux/common/getppid.c
@@ -14,6 +14,6 @@ _syscall0(pid_t, getppid);
# else
pid_t getppid(void)
{
- return (getpid());
+ return (__getpid());
}
# endif
diff --git a/libc/sysdeps/linux/common/kill.c b/libc/sysdeps/linux/common/kill.c
index d8033fabc..2d1d9ae8a 100644
--- a/libc/sysdeps/linux/common/kill.c
+++ b/libc/sysdeps/linux/common/kill.c
@@ -14,7 +14,8 @@
#define __NR___syscall_kill __NR_kill
static inline _syscall2(int, __syscall_kill, __kernel_pid_t, pid, int, sig);
-int kill(pid_t pid, int sig)
+int attribute_hidden __kill(pid_t pid, int sig)
{
return (__syscall_kill(pid, sig));
}
+strong_alias(__kill,kill)
diff --git a/libc/sysdeps/linux/common/ntp_gettime.c b/libc/sysdeps/linux/common/ntp_gettime.c
index 07f380402..0c4d1549f 100644
--- a/libc/sysdeps/linux/common/ntp_gettime.c
+++ b/libc/sysdeps/linux/common/ntp_gettime.c
@@ -16,6 +16,8 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#define adjtimex __adjtimex
+
#include <sys/timex.h>
int ntp_gettime(struct ntptimeval *ntv)
diff --git a/libc/sysdeps/linux/common/poll.c b/libc/sysdeps/linux/common/poll.c
index 87d0dbb27..f021e0269 100644
--- a/libc/sysdeps/linux/common/poll.c
+++ b/libc/sysdeps/linux/common/poll.c
@@ -17,6 +17,8 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#define getdtablesize __getdtablesize
+
#include "syscalls.h"
#include <sys/poll.h>
diff --git a/libc/sysdeps/linux/common/setitimer.c b/libc/sysdeps/linux/common/setitimer.c
index 981f1a158..be51cb5c5 100644
--- a/libc/sysdeps/linux/common/setitimer.c
+++ b/libc/sysdeps/linux/common/setitimer.c
@@ -9,5 +9,7 @@
#include "syscalls.h"
#include <sys/time.h>
-_syscall3(int, setitimer, __itimer_which_t, which,
+#define __NR___setitimer __NR_setitimer
+attribute_hidden _syscall3(int, __setitimer, __itimer_which_t, which,
const struct itimerval *, new, struct itimerval *, old);
+strong_alias(__setitimer,setitimer)
diff --git a/libc/sysdeps/linux/common/settimeofday.c b/libc/sysdeps/linux/common/settimeofday.c
index b63c421c7..4e88b3edb 100644
--- a/libc/sysdeps/linux/common/settimeofday.c
+++ b/libc/sysdeps/linux/common/settimeofday.c
@@ -9,5 +9,7 @@
#include "syscalls.h"
#include <sys/time.h>
-_syscall2(int, settimeofday, const struct timeval *, tv,
+#define __NR___settimeofday __NR_settimeofday
+attribute_hidden _syscall2(int, __settimeofday, const struct timeval *, tv,
const struct timezone *, tz);
+strong_alias(__settimeofday,settimeofday)
diff --git a/libc/sysdeps/linux/common/ssp.c b/libc/sysdeps/linux/common/ssp.c
index 4c52d070f..7a977f56a 100644
--- a/libc/sysdeps/linux/common/ssp.c
+++ b/libc/sysdeps/linux/common/ssp.c
@@ -16,12 +16,29 @@
* Mike Frysinger <vapier[@]gentoo.org>
*/
+#if defined __SSP__ || defined __SSP_ALL__
+#error "file must not be compiled with stack protection enabled on it. Use -fno-stack-protector"
+#endif
+
+#ifdef __PROPOLICE_BLOCK_SEGV__
+# define SSP_SIGTYPE SIGSEGV
+#else
+# define SSP_SIGTYPE SIGABRT
+#endif
+
+#define openlog __openlog
+#define syslog __syslog
+#define closelog __closelog
+#define sigfillset __sigfillset_internal
+#define sigdelset __sigdelset_internal
+#define sigaction __sigaction_internal
+#define kill __kill
+
#include <string.h>
#include <unistd.h>
+#include <signal.h>
#include <sys/syslog.h>
-#include <ssp-internal.h>
-
static __always_inline void block_signals(void)
{
struct sigaction sa;
@@ -37,7 +54,7 @@ static __always_inline void block_signals(void)
sigfillset(&sa.sa_mask); /* Block all signals */
sa.sa_flags = 0;
sa.sa_handler = SIG_DFL;
- SIGACTION(SSP_SIGTYPE, &sa, NULL);
+ sigaction(SSP_SIGTYPE, &sa, NULL);
}
static __always_inline void ssp_write(int fd, const char *msg1, const char *msg2, const char *msg3)
@@ -46,15 +63,15 @@ static __always_inline void ssp_write(int fd, const char *msg1, const char *msg2
__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();
+ __openlog("ssp", LOG_CONS | LOG_PID, LOG_USER);
+ __syslog(LOG_INFO, "%s%s%s()", msg1, msg2, msg3);
+ __closelog();
}
-static __always_inline void terminate(void)
+static __always_inline attribute_noreturn void terminate(void)
{
- (void) KILL(GETPID(), SSP_SIGTYPE);
- EXIT(127);
+ (void) kill(__getpid(), SSP_SIGTYPE);
+ _exit(127);
}
void attribute_noreturn __stack_smash_handler(char func[], int damaged __attribute__ ((unused)));
diff --git a/libc/sysdeps/linux/common/stime.c b/libc/sysdeps/linux/common/stime.c
index 586088695..bfb7682d0 100644
--- a/libc/sysdeps/linux/common/stime.c
+++ b/libc/sysdeps/linux/common/stime.c
@@ -7,6 +7,8 @@
* GNU Library General Public License (LGPL) version 2 or later.
*/
+#define settimeofday __settimeofday
+
#include "syscalls.h"
#include <time.h>
#include <sys/time.h>
diff --git a/libc/sysdeps/linux/common/time.c b/libc/sysdeps/linux/common/time.c
index 0c37c375c..506850ff9 100644
--- a/libc/sysdeps/linux/common/time.c
+++ b/libc/sysdeps/linux/common/time.c
@@ -11,9 +11,10 @@
#include <time.h>
#include <sys/time.h>
#ifdef __NR_time
-_syscall1(time_t, time, time_t *, t);
+#define __NR___time __NR_time
+attribute_hidden _syscall1(time_t, __time, time_t *, t);
#else
-time_t time(time_t * t)
+time_t attribute_hidden __time(time_t * t)
{
time_t result;
struct timeval tv;
@@ -29,3 +30,4 @@ time_t time(time_t * t)
return result;
}
#endif
+strong_alias(__time,time)
diff --git a/libc/sysdeps/linux/common/times.c b/libc/sysdeps/linux/common/times.c
index beb07fb35..0fefdca10 100644
--- a/libc/sysdeps/linux/common/times.c
+++ b/libc/sysdeps/linux/common/times.c
@@ -9,4 +9,6 @@
#include "syscalls.h"
#include <sys/times.h>
-_syscall1(clock_t, times, struct tms *, buf);
+#define __NR___times __NR_times
+attribute_hidden _syscall1(clock_t, __times, struct tms *, buf);
+strong_alias(__times,times)
diff --git a/libc/sysdeps/linux/common/utime.c b/libc/sysdeps/linux/common/utime.c
index d7a71d690..5515488cd 100644
--- a/libc/sysdeps/linux/common/utime.c
+++ b/libc/sysdeps/linux/common/utime.c
@@ -7,14 +7,17 @@
* GNU Library General Public License (LGPL) version 2 or later.
*/
+#define utimes __utimes
+
#include "syscalls.h"
#include <utime.h>
#ifdef __NR_utime
-_syscall2(int, utime, const char *, file, const struct utimbuf *, times);
+#define __NR___utime __NR_utime
+attribute_hidden _syscall2(int, __utime, const char *, file, const struct utimbuf *, times);
#else
#include <stdlib.h>
#include <sys/time.h>
-int utime(const char *file, const struct utimbuf *times)
+int attribute_hidden __utime(const char *file, const struct utimbuf *times)
{
struct timeval timevals[2];
@@ -32,3 +35,4 @@ int utime(const char *file, const struct utimbuf *times)
return utimes(file, timevals);
}
#endif
+strong_alias(__utime,utime)
diff --git a/libc/sysdeps/linux/common/utimes.c b/libc/sysdeps/linux/common/utimes.c
index ef0fffe11..ca45204c7 100644
--- a/libc/sysdeps/linux/common/utimes.c
+++ b/libc/sysdeps/linux/common/utimes.c
@@ -7,14 +7,17 @@
* GNU Library General Public License (LGPL) version 2 or later.
*/
+#define utime __utime
+
#include "syscalls.h"
#include <utime.h>
#ifdef __NR_utimes
-_syscall2(int, utimes, const char *, file, const struct timeval *, tvp);
+#define __NR___utimes __NR_utimes
+attribute_hidden _syscall2(int, __utimes, const char *, file, const struct timeval *, tvp);
#else
#include <stdlib.h>
#include <sys/time.h>
-int utimes(const char *file, const struct timeval tvp[2])
+int attribute_hidden __utimes(const char *file, const struct timeval tvp[2])
{
struct utimbuf buf, *times;
@@ -28,3 +31,4 @@ int utimes(const char *file, const struct timeval tvp[2])
return utime(file, times);
}
#endif
+strong_alias(__utimes,utimes)
diff --git a/libc/sysdeps/linux/common/wait.c b/libc/sysdeps/linux/common/wait.c
index 6c46d0caa..b2a6d2295 100644
--- a/libc/sysdeps/linux/common/wait.c
+++ b/libc/sysdeps/linux/common/wait.c
@@ -1,3 +1,5 @@
+#define wait4 __wait4
+
#include <stdlib.h>
#include <syscall.h>
#include <sys/types.h>
@@ -6,8 +8,8 @@
/* Wait for a child to die. When one does, put its status in *STAT_LOC
* and return its process ID. For errors, return (pid_t) -1. */
-__pid_t __libc_wait (__WAIT_STATUS_DEFN stat_loc)
+__pid_t wait (__WAIT_STATUS_DEFN stat_loc)
{
- return wait4 (WAIT_ANY, stat_loc, 0, (struct rusage *) NULL);
+ return __wait4 (WAIT_ANY, stat_loc, 0, (struct rusage *) NULL);
}
-weak_alias(__libc_wait, wait)
+weak_alias(wait,__libc_wait)
diff --git a/libc/sysdeps/linux/common/wait3.c b/libc/sysdeps/linux/common/wait3.c
index 6a8bc77fc..4b4d6aef1 100644
--- a/libc/sysdeps/linux/common/wait3.c
+++ b/libc/sysdeps/linux/common/wait3.c
@@ -1,3 +1,5 @@
+#define wait4 __wait4
+
#include <syscall.h>
#include <sys/types.h>
#include <sys/wait.h>
diff --git a/libc/sysdeps/linux/common/wait4.c b/libc/sysdeps/linux/common/wait4.c
index 5434a009e..b5a2c5933 100644
--- a/libc/sysdeps/linux/common/wait4.c
+++ b/libc/sysdeps/linux/common/wait4.c
@@ -14,7 +14,8 @@
static inline _syscall4(int, __syscall_wait4, __kernel_pid_t, pid,
int *, status, int, opts, struct rusage *, rusage);
-pid_t wait4(pid_t pid, int *status, int opts, struct rusage *rusage)
+pid_t attribute_hidden __wait4(pid_t pid, int *status, int opts, struct rusage *rusage)
{
return (__syscall_wait4(pid, status, opts, rusage));
}
+strong_alias(__wait4,wait4)
diff --git a/libc/sysdeps/linux/common/waitpid.c b/libc/sysdeps/linux/common/waitpid.c
index fef93173b..612917fcf 100644
--- a/libc/sysdeps/linux/common/waitpid.c
+++ b/libc/sysdeps/linux/common/waitpid.c
@@ -1,11 +1,14 @@
+#define wait4 __wait4
+
#include <stdlib.h>
#include <sys/types.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/resource.h>
-__pid_t __libc_waitpid(__pid_t pid, int *wait_stat, int options)
+__pid_t attribute_hidden __waitpid(__pid_t pid, int *wait_stat, int options)
{
- return wait4(pid, wait_stat, options, NULL);
+ return __wait4(pid, wait_stat, options, NULL);
}
-weak_alias(__libc_waitpid, waitpid)
+strong_alias(__waitpid,waitpid)
+weak_alias(__waitpid,__libc_waitpid)