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/Makefile.in130
-rw-r--r--libc/sysdeps/linux/common/__rt_sigtimedwait.c12
-rw-r--r--libc/sysdeps/linux/common/__rt_sigwaitinfo.c11
-rw-r--r--libc/sysdeps/linux/common/__syscall_fcntl.c1
-rw-r--r--libc/sysdeps/linux/common/bdflush.c6
-rw-r--r--libc/sysdeps/linux/common/bits/sigstack.h2
-rw-r--r--libc/sysdeps/linux/common/bits/sigthread.h8
-rw-r--r--libc/sysdeps/linux/common/bits/socket.h22
-rw-r--r--libc/sysdeps/linux/common/bits/statvfs.h6
-rw-r--r--libc/sysdeps/linux/common/bits/syscalls-common.h1
-rw-r--r--libc/sysdeps/linux/common/bits/types.h5
-rw-r--r--libc/sysdeps/linux/common/bits/uClibc_ctype.h2
-rw-r--r--libc/sysdeps/linux/common/bits/uClibc_errno.h43
-rw-r--r--libc/sysdeps/linux/common/capget.c6
-rw-r--r--libc/sysdeps/linux/common/capset.c7
-rw-r--r--libc/sysdeps/linux/common/create_module.c7
-rw-r--r--libc/sysdeps/linux/common/delete_module.c6
-rw-r--r--libc/sysdeps/linux/common/epoll.c18
-rw-r--r--libc/sysdeps/linux/common/fdatasync.c7
-rw-r--r--libc/sysdeps/linux/common/fork.c12
-rw-r--r--libc/sysdeps/linux/common/get_kernel_syms.c6
-rw-r--r--libc/sysdeps/linux/common/getegid.c22
-rw-r--r--libc/sysdeps/linux/common/geteuid.c21
-rw-r--r--libc/sysdeps/linux/common/getgid.c8
-rw-r--r--libc/sysdeps/linux/common/getpgrp.c8
-rw-r--r--libc/sysdeps/linux/common/getpid.c12
-rw-r--r--libc/sysdeps/linux/common/getppid.c8
-rw-r--r--libc/sysdeps/linux/common/getuid.c8
-rw-r--r--libc/sysdeps/linux/common/init_module.c6
-rw-r--r--libc/sysdeps/linux/common/longjmp.c4
-rw-r--r--libc/sysdeps/linux/common/lutimes.c2
-rw-r--r--libc/sysdeps/linux/common/nanosleep.c1
-rw-r--r--libc/sysdeps/linux/common/pivot_root.c6
-rw-r--r--libc/sysdeps/linux/common/posix_fadvise.c3
-rw-r--r--libc/sysdeps/linux/common/posix_fadvise64.c3
-rw-r--r--libc/sysdeps/linux/common/query_module.c7
-rw-r--r--libc/sysdeps/linux/common/sched_getaffinity.c6
-rw-r--r--libc/sysdeps/linux/common/sched_setaffinity.c11
-rw-r--r--libc/sysdeps/linux/common/signalfd.c6
-rw-r--r--libc/sysdeps/linux/common/sigsuspend.c2
-rw-r--r--libc/sysdeps/linux/common/splice.c7
-rw-r--r--libc/sysdeps/linux/common/ssp.c9
-rw-r--r--libc/sysdeps/linux/common/stubs.c187
-rw-r--r--libc/sysdeps/linux/common/sync_file_range.c6
-rw-r--r--libc/sysdeps/linux/common/sysdep.h5
-rw-r--r--libc/sysdeps/linux/common/umask.c2
-rw-r--r--libc/sysdeps/linux/common/umount.c9
-rw-r--r--libc/sysdeps/linux/common/umount2.c6
-rw-r--r--libc/sysdeps/linux/common/vmsplice.c7
-rw-r--r--libc/sysdeps/linux/common/xattr.c78
50 files changed, 318 insertions, 460 deletions
diff --git a/libc/sysdeps/linux/common/Makefile.in b/libc/sysdeps/linux/common/Makefile.in
index cf4cf8708..3f9791104 100644
--- a/libc/sysdeps/linux/common/Makefile.in
+++ b/libc/sysdeps/linux/common/Makefile.in
@@ -8,123 +8,69 @@
COMMON_DIR := $(top_srcdir)libc/sysdeps/linux/common
COMMON_OUT := $(top_builddir)libc/sysdeps/linux/common
-CSRC := $(notdir $(wildcard $(COMMON_DIR)/*.c))
+CSRC-y := $(notdir $(wildcard $(COMMON_DIR)/*.c))
+CSRC- := ssp-local.c
-ifneq ($(UCLIBC_HAS_LFS),y)
CSRC_LFS := $(notdir $(wildcard $(COMMON_DIR)/*64.c))
-CSRC := $(filter-out llseek.c $(CSRC_LFS),$(CSRC))
-endif
-
-CSRC := $(filter-out ssp-local.c,$(CSRC))
-ifneq ($(UCLIBC_HAS_SSP),y)
-CSRC := $(filter-out ssp.c,$(CSRC))
-endif
-
-ifneq ($(UCLIBC_LINUX_MODULE_24),y)
-CSRC := $(filter-out create_module.c query_module.c get_kernel_syms.c,$(CSRC))
-endif
+CSRC-y := $(filter-out llseek.c $(CSRC_LFS),$(CSRC-y))
+CSRC-$(UCLIBC_HAS_LFS) += llseek.c $(CSRC_LFS)
-ifneq ($(UCLIBC_LINUX_SPECIFIC),y)
+CSRC-$(if $(or $(UCLIBC_HAS_SSP),$(UCLIBC_HAS_FORTIFY)),y) += ssp.c
+CSRC-$(UCLIBC_LINUX_MODULE_24) += create_module.c query_module.c \
+ get_kernel_syms.c
# we need these internally: fstatfs.c statfs.c
-CSRC := $(filter-out capget.c capset.c inotify.c ioperm.c iopl.c \
+CSRC-$(UCLIBC_LINUX_SPECIFIC) += capget.c capset.c inotify.c ioperm.c iopl.c \
modify_ldt.c personality.c ppoll.c prctl.c readahead.c reboot.c \
remap_file_pages.c sched_getaffinity.c sched_setaffinity.c \
sendfile64.c sendfile.c setfsgid.c setfsuid.c setresuid.c \
splice.c vmsplice.c tee.c signalfd.c swapoff.c swapon.c \
- sync_file_range.c sysctl.c sysinfo.c timerfd.c uselib.c vhangup.c,$(CSRC))
-ifneq ($(UCLIBC_HAS_THREADS_NATIVE),y)
-# we need madvise.c in NPTL
-CSRC := $(filter-pout madvise.c,$(CSRC))
-endif
-endif
-
+ sync_file_range.c sysctl.c sysinfo.c timerfd.c uselib.c vhangup.c
+CSRC-$(if $(and $(UCLIBC_LINUX_SPECIFIC),$(UCLIBC_HAS_THREADS_NATIVE)),y) += madvise.c
ifeq ($(UCLIBC_HAS_THREADS_NATIVE),y)
-CSRC := $(filter-out fork.c getpid.c raise.c open.c close.c read.c write.c, $(CSRC))
-ifeq ($(TARGET_ARCH),arm)
-CSRC := $(filter-out vfork.c, $(CSRC))
-else ifeq ($(TARGET_ARCH),x86_64)
-CSRC := $(filter-out vfork.c, $(CSRC))
-else ifeq ($(TARGET_ARCH),mips)
-ifeq ($(CONFIG_MIPS_O32_ABI),y)
-CSRC := $(filter-out waitpid.c, $(CSRC))
-endif
-else
-CSRC := $(filter-out waitpid.c, $(CSRC))
-endif
+CSRC- += fork.c getpid.c raise.c open.c close.c read.c write.c
+CSRC- += $(if $(findstring =arm=,=$(TARGET_ARCH)=),vfork.c)
+CSRC- += $(if $(findstring =x86_64=,=$(TARGET_ARCH)=),vfork.c)
+CSRC- += $(if $(findstring =mips=y=,=$(TARGET_ARCH)=$(CONFIG_MIPS_O32_ABI)=),waitpid.c)
endif
-
-ifneq ($(ARCH_USE_MMU),y)
# stubbed out in mman.h
-CSRC := $(filter-out msync.c, $(CSRC))
-endif
-
-ifneq ($(UCLIBC_BSD_SPECIFIC),y)
+CSRC-$(ARCH_USE_MMU) += msync.c
# we need these internally: getdomainname.c
-CSRC := $(filter-out mincore.c setdomainname.c,$(CSRC))
-endif
-
-ifneq ($(UCLIBC_NTP_LEGACY),y)
-CSRC := $(filter-out ntp_gettime.c,$(CSRC))
-endif
-
-
-ifneq ($(UCLIBC_HAS_REALTIME),y)
+CSRC-$(UCLIBC_BSD_SPECIFIC) += mincore.c setdomainname.c
+CSRC-$(UCLIBC_NTP_LEGACY) += ntp_gettime.c
# aio_cancel|aio_error|aio_fsync|aio_read|aio_return|aio_suspend|aio_write|clock_getres|clock_gettime|clock_settime|clock_settime|fdatasync|lio_listio|mlockall|munlockall|mlock|munlock|mq_close|mq_getattr|mq_notify|mq_open|mq_receive|mq_timedreceive|mq_send|mq_timedsend|mq_setattr|mq_unlink|nanosleep|sched_getparam|sched_get_priority_max|sched_get_priority_min|sched_getscheduler|sched_rr_get_interval|sched_setparam|sched_setscheduler|sem_close|sem_destroy|sem_getvalue|sem_init|sem_open|sem_post|sem_trywait|sem_wait|sem_unlink|sem_wait|shm_open|shm_unlink|sigqueue|sigtimedwait|sigwaitinfo|sigwaitinfo|timer_create|timer_delete|timer_getoverrun|timer_gettime|timer_settime
-CSRC := $(filter-out clock_getres.c clock_gettime.c clock_settime.c fdatasync.c Makefile.in mlockall.c mlock.c munlockall.c munlock.c nanosleep.c __rt_sigtimedwait.c sched_getparam.c sched_get_priority_max.c sched_get_priority_min.c sched_getscheduler.c sched_rr_get_interval.c sched_setparam.c sched_setscheduler.c sigqueue.c,$(CSRC))
-endif
-
-
-ifneq ($(UCLIBC_HAS_ADVANCED_REALTIME),y)
+CSRC-$(UCLIBC_HAS_REALTIME) += clock_getres.c clock_gettime.c clock_settime.c \
+ fdatasync.c mlockall.c mlock.c munlockall.c munlock.c \
+ nanosleep.c __rt_sigtimedwait.c sched_getparam.c \
+ sched_get_priority_max.c sched_get_priority_min.c sched_getscheduler.c \
+ sched_rr_get_interval.c sched_setparam.c sched_setscheduler.c sigqueue.c
# clock_getcpuclockid|clock_nanosleep|mq_timedreceive|mq_timedsend|posix_fadvise|posix_fallocate|posix_madvise|posix_memalign|posix_mem_offset|posix_spawnattr_destroy|posix_spawnattr_init|posix_spawnattr_getflags|posix_spawnattr_setflags|posix_spawnattr_getpgroup|posix_spawnattr_setpgroup|posix_spawnattr_getschedparam|posix_spawnattr_setschedparam|posix_spawnattr_getschedpolicy|posix_spawnattr_setschedpolicy|posix_spawnattr_getsigdefault|posix_spawnattr_setsigdefault|posix_spawnattr_getsigmask|posix_spawnattr_setsigmask|posix_spawnattr_init|posix_spawnattr_setflags|posix_spawnattr_setpgroup|posix_spawnattr_setschedparam|posix_spawnattr_setschedpolicy|posix_spawnattr_setsigdefault|posix_spawnattr_setsigmask|posix_spawn_file_actions_addclose|posix_spawn_file_actions_addopen|posix_spawn_file_actions_adddup2|posix_spawn_file_actions_addopen|posix_spawn_file_actions_destroy|posix_spawn_file_actions_init|posix_spawn_file_actions_init|posix_spawn|posix_spawnp|posix_spawnp|posix_typed_mem_get_info|pthread_mutex_timedlock|sem_timedwait
-CSRC := $(filter-out posix_fadvise64.c posix_fadvise.c,$(CSRC))
-endif
-
-ifneq ($(UCLIBC_SUSV4_LEGACY),y)
-CSRC := $(filter-out utime.c,$(CSRC))
-endif
-
-ifneq ($(UCLIBC_HAS_EPOLL),y)
-CSRC := $(filter-out epoll.c,$(CSRC))
-endif
-
-ifneq ($(UCLIBC_HAS_XATTR),y)
-CSRC := $(filter-out xattr.c,$(CSRC))
-endif
-
-ifneq ($(UCLIBC_HAS_PROFILING),y)
-CSRC := $(filter-out noophooks.c pcprofile.c,$(CSRC))
-endif
-
-ifneq ($(UCLIBC_SV4_DEPRECATED),y)
-CSRC := $(filter-out ustat.c,$(CSRC))
-endif
-
-ifeq ($(TARGET_ARCH),sh)
-CSRC := $(filter-out longjmp.c vfork.c,$(CSRC))
-endif
-
-ifeq ($(TARGET_ARCH),sparc)
-CSRC := $(filter-out vfork.c,$(CSRC))
-endif
-
-ifeq ($(TARGET_ARCH),i386)
-CSRC := $(filter-out vfork.c,$(CSRC))
-endif
+CSRC-$(UCLIBC_HAS_ADVANCED_REALTIME) += posix_fadvise64.c posix_fadvise.c
+CSRC-$(UCLIBC_SUSV4_LEGACY) += utime.c
+CSRC-$(UCLIBC_HAS_EPOLL) += epoll.c
+CSRC-$(UCLIBC_HAS_XATTR) += xattr.c
+CSRC-$(UCLIBC_HAS_PROFILING) += noophooks.c #pcprofile.c
+CSRC-$(UCLIBC_SV4_DEPRECATED) += ustat.c
+CSRC- += $(if $(findstring =c6x=,=$(TARGET_ARCH)=),vfork.c)
+CSRC- += $(if $(findstring =sh=,=$(TARGET_ARCH)=),longjmp.c vfork.c)
+CSRC- += $(if $(findstring =sparc=,=$(TARGET_ARCH)=),vfork.c)
+CSRC- += $(if $(findstring =i386=,=$(TARGET_ARCH)=),vfork.c)
+
+CSRC-y := $(filter-out $(CSRC-),$(CSRC-y))
# provided via pthreads builddir
-CSRC := $(filter-out $(libc_a_CSRC) $(notdir $(libpthread_libc_OBJS:.o=.c)),$(CSRC))
+CSRC-y := $(filter-out $(libc_a_CSRC) $(notdir $(libpthread_libc_OBJS:.o=.c)),$(CSRC-y))
SSRC := $(filter-out $(libc_a_SSRC) $(notdir $(libpthread_libc_OBJS:.o=.S)),$(SSRC))
# fails for some reason
ifneq ($(strip $(ARCH_OBJS)),)
-CSRC := $(filter-out $(notdir $(ARCH_OBJS:.o=.c)) $(ARCH_OBJ_FILTEROUT),$(CSRC))
+CSRC-y := $(filter-out $(notdir $(ARCH_OBJS:.o=.c)) $(ARCH_OBJ_FILTEROUT),$(CSRC-y))
endif
CFLAGS-ssp.c := $(SSP_DISABLE_FLAGS)
CFLAGS-ssp-local.c := $(SSP_DISABLE_FLAGS)
-COMMON_SRC := $(patsubst %.c,$(COMMON_DIR)/%.c,$(CSRC))
-COMMON_OBJ := $(patsubst %.c,$(COMMON_OUT)/%.o,$(CSRC))
+COMMON_SRC := $(patsubst %.c,$(COMMON_DIR)/%.c,$(CSRC-y))
+COMMON_OBJ := $(patsubst %.c,$(COMMON_OUT)/%.o,$(CSRC-y))
libc-y += $(COMMON_OBJ)
libc-static-$(UCLIBC_HAS_SSP) += $(COMMON_OUT)/ssp-local.o
diff --git a/libc/sysdeps/linux/common/__rt_sigtimedwait.c b/libc/sysdeps/linux/common/__rt_sigtimedwait.c
index a7ab8fb61..26860d2d2 100644
--- a/libc/sysdeps/linux/common/__rt_sigtimedwait.c
+++ b/libc/sysdeps/linux/common/__rt_sigtimedwait.c
@@ -86,16 +86,6 @@ int attribute_hidden __sigtimedwait(const sigset_t * set, siginfo_t * info,
return __rt_sigtimedwait(set, info, timeout, _NSIG / 8);
}
# endif /* !__UCLIBC_HAS_THREADS_NATIVE__ */
-#else
-int attribute_hidden __sigtimedwait(const sigset_t * set, siginfo_t * info,
- const struct timespec *timeout)
-{
- if (set == NULL)
- __set_errno(EINVAL);
- else
- __set_errno(ENOSYS);
- return -1;
-}
-#endif
weak_alias(__sigtimedwait,sigtimedwait)
libc_hidden_weak(sigtimedwait)
+#endif
diff --git a/libc/sysdeps/linux/common/__rt_sigwaitinfo.c b/libc/sysdeps/linux/common/__rt_sigwaitinfo.c
index 92a11c9b6..6b4332715 100644
--- a/libc/sysdeps/linux/common/__rt_sigwaitinfo.c
+++ b/libc/sysdeps/linux/common/__rt_sigwaitinfo.c
@@ -83,16 +83,7 @@ int attribute_hidden __sigwaitinfo(const sigset_t * set, siginfo_t * info)
return __rt_sigwaitinfo(set, info, NULL, _NSIG / 8);
}
# endif
-#else
-int attribute_hidden __sigwaitinfo(const sigset_t * set, siginfo_t * info)
-{
- if (set == NULL)
- __set_errno(EINVAL);
- else
- __set_errno(ENOSYS);
- return -1;
-}
-#endif
libc_hidden_proto(sigwaitinfo)
weak_alias (__sigwaitinfo, sigwaitinfo)
libc_hidden_weak(sigwaitinfo)
+#endif
diff --git a/libc/sysdeps/linux/common/__syscall_fcntl.c b/libc/sysdeps/linux/common/__syscall_fcntl.c
index 5da3c5f32..6d4c339ab 100644
--- a/libc/sysdeps/linux/common/__syscall_fcntl.c
+++ b/libc/sysdeps/linux/common/__syscall_fcntl.c
@@ -40,6 +40,7 @@ int __fcntl_nocancel (int fd, int cmd, ...)
# endif
return INLINE_SYSCALL (fcntl, 3, fd, cmd, arg);
}
+libc_hidden_def(__fcntl_nocancel)
int __libc_fcntl (int fd, int cmd, ...)
{
diff --git a/libc/sysdeps/linux/common/bdflush.c b/libc/sysdeps/linux/common/bdflush.c
index 687a8f9a7..c2a05ed88 100644
--- a/libc/sysdeps/linux/common/bdflush.c
+++ b/libc/sysdeps/linux/common/bdflush.c
@@ -12,10 +12,4 @@
#ifdef __NR_bdflush
_syscall2(int, bdflush, int, __func, long int, __data)
-#else
-int bdflush(int __func, long int __data)
-{
- __set_errno(ENOSYS);
- return -1;
-}
#endif
diff --git a/libc/sysdeps/linux/common/bits/sigstack.h b/libc/sysdeps/linux/common/bits/sigstack.h
index 7f260367b..2b3b321bd 100644
--- a/libc/sysdeps/linux/common/bits/sigstack.h
+++ b/libc/sysdeps/linux/common/bits/sigstack.h
@@ -22,12 +22,14 @@
#endif
+#if defined __UCLIBC_SUSV4_LEGACY__ || !defined __UCLIBC_STRICT_HEADERS__
/* Structure describing a signal stack (obsolete). */
struct sigstack
{
void *ss_sp; /* Signal stack pointer. */
int ss_onstack; /* Nonzero if executing on this stack. */
};
+#endif
/* Possible values for `ss_flags.'. */
diff --git a/libc/sysdeps/linux/common/bits/sigthread.h b/libc/sysdeps/linux/common/bits/sigthread.h
index 960bde18a..4f14b9f45 100644
--- a/libc/sysdeps/linux/common/bits/sigthread.h
+++ b/libc/sysdeps/linux/common/bits/sigthread.h
@@ -1,5 +1,5 @@
/* Signal handling function for threaded programs.
- Copyright (C) 1998, 1999, 2000, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000, 2002, 2009 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
@@ -35,4 +35,10 @@ extern int pthread_sigmask (int __how,
/* Send signal SIGNO to the given thread. */
extern int pthread_kill (pthread_t __threadid, int __signo) __THROW;
+#if defined __USE_GNU && defined __UCLIBC_HAS_THREADS_NATIVE__
+/* Queue signal and data to a thread. */
+extern int pthread_sigqueue (pthread_t __threadid, int __signo,
+ const union sigval __value) __THROW;
+#endif
+
#endif /* bits/sigthread.h */
diff --git a/libc/sysdeps/linux/common/bits/socket.h b/libc/sysdeps/linux/common/bits/socket.h
index 11f6e9715..7e12733ae 100644
--- a/libc/sysdeps/linux/common/bits/socket.h
+++ b/libc/sysdeps/linux/common/bits/socket.h
@@ -98,8 +98,18 @@ enum __socket_type
#define PF_IRDA 23 /* IRDA sockets. */
#define PF_PPPOX 24 /* PPPoX sockets. */
#define PF_WANPIPE 25 /* Wanpipe API sockets. */
+#define PF_LLC 26 /* Linux LLC. */
+#define PF_CAN 29 /* Controller Area Network. */
+#define PF_TIPC 30 /* TIPC sockets. */
#define PF_BLUETOOTH 31 /* Bluetooth sockets. */
-#define PF_MAX 32 /* For now.. */
+#define PF_IUCV 32 /* IUCV sockets. */
+#define PF_RXRPC 33 /* RxRPC sockets. */
+#define PF_ISDN 34 /* mISDN sockets. */
+#define PF_PHONET 35 /* Phonet sockets. */
+#define PF_IEEE802154 36 /* IEEE 802.15.4 sockets. */
+#define PF_CAIF 37 /* CAIF sockets. */
+#define PF_ALG 38 /* Algorithm sockets. */
+#define PF_MAX 39 /* For now.. */
/* Address families. */
#define AF_UNSPEC PF_UNSPEC
@@ -130,7 +140,17 @@ enum __socket_type
#define AF_IRDA PF_IRDA
#define AF_PPPOX PF_PPPOX
#define AF_WANPIPE PF_WANPIPE
+#define AF_LLC PF_LLC
+#define AF_CAN PF_CAN
+#define AF_TIPC PF_TIPC
#define AF_BLUETOOTH PF_BLUETOOTH
+#define AF_IUCV PF_IUCV
+#define AF_RXRPC PF_RXRPC
+#define AF_ISDN PF_ISDN
+#define AF_PHONET PF_PHONET
+#define AF_IEEE802154 PF_IEEE802154
+#define AF_CAIF PF_CAIF
+#define AF_ALG PF_ALG
#define AF_MAX PF_MAX
/* Socket level values. Others are defined in the appropriate headers.
diff --git a/libc/sysdeps/linux/common/bits/statvfs.h b/libc/sysdeps/linux/common/bits/statvfs.h
index cca0871ac..84717c3d9 100644
--- a/libc/sysdeps/linux/common/bits/statvfs.h
+++ b/libc/sysdeps/linux/common/bits/statvfs.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 1998, 2000, 2001, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1997,1998,2000,2001,2002,2006 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
@@ -101,7 +101,9 @@ enum
# define ST_IMMUTABLE ST_IMMUTABLE
ST_NOATIME = 1024, /* Do not update access times. */
# define ST_NOATIME ST_NOATIME
- ST_NODIRATIME = 2048 /* Do not update directory access times. */
+ ST_NODIRATIME = 2048, /* Do not update directory access times. */
# define ST_NODIRATIME ST_NODIRATIME
+ ST_RELATIME = 4096 /* Update atime relative to mtime/ctime. */
+# define ST_RELATIME ST_RELATIME
#endif /* Use GNU. */
};
diff --git a/libc/sysdeps/linux/common/bits/syscalls-common.h b/libc/sysdeps/linux/common/bits/syscalls-common.h
index 5e4e350c5..1b84d9e2b 100644
--- a/libc/sysdeps/linux/common/bits/syscalls-common.h
+++ b/libc/sysdeps/linux/common/bits/syscalls-common.h
@@ -97,6 +97,7 @@ type name(C_DECL_ARGS_##nargs(args)) { \
}
#define _syscall0(args...) SYSCALL_FUNC(0, args)
+#define _syscall_noerr0(args...) SYSCALL_NOERR_FUNC(0, args)
#define _syscall1(args...) SYSCALL_FUNC(1, args)
#define _syscall_noerr1(args...) SYSCALL_NOERR_FUNC(1, args)
#define _syscall2(args...) SYSCALL_FUNC(2, args)
diff --git a/libc/sysdeps/linux/common/bits/types.h b/libc/sysdeps/linux/common/bits/types.h
index 24d0056fb..c4c10e2ff 100644
--- a/libc/sysdeps/linux/common/bits/types.h
+++ b/libc/sysdeps/linux/common/bits/types.h
@@ -200,11 +200,6 @@ __STD_TYPE __U32_TYPE __socklen_t;
#undef __STD_TYPE
-#ifdef _LIBC
-/* Used in `struct shmid_ds'. */
-typedef __kernel_ipc_pid_t __ipc_pid_t;
-#endif
-
/* Now add the thread types. */
#if defined __UCLIBC_HAS_THREADS__ && (defined __USE_POSIX199506 || defined __USE_UNIX98)
# include <bits/pthreadtypes.h>
diff --git a/libc/sysdeps/linux/common/bits/uClibc_ctype.h b/libc/sysdeps/linux/common/bits/uClibc_ctype.h
index 3bf4e1b28..5ff281d8e 100644
--- a/libc/sysdeps/linux/common/bits/uClibc_ctype.h
+++ b/libc/sysdeps/linux/common/bits/uClibc_ctype.h
@@ -95,7 +95,7 @@
/**********************************************************************/
__BEGIN_DECLS
-#if defined _LIBC && (defined NOT_IN_libc || defined IS_IN_libc)
+#ifdef _LIBC
/* These are uClibc-specific. */
# define __isdigit_char(c) ((unsigned char)((c) - '0') <= 9)
# define __isdigit_int(c) ((unsigned int)((c) - '0') <= 9)
diff --git a/libc/sysdeps/linux/common/bits/uClibc_errno.h b/libc/sysdeps/linux/common/bits/uClibc_errno.h
deleted file mode 100644
index 9c1561841..000000000
--- a/libc/sysdeps/linux/common/bits/uClibc_errno.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
- *
- * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
- */
-#ifndef _BITS_UCLIBC_ERRNO_H
-#define _BITS_UCLIBC_ERRNO_H 1
-
-#ifdef IS_IN_rtld
-# undef errno
-# define errno _dl_errno
-extern int _dl_errno; /* attribute_hidden; */
-#elif defined __UCLIBC_HAS_THREADS__
-# include <tls.h>
-# if defined USE___THREAD && USE___THREAD
-# undef errno
-# ifndef NOT_IN_libc
-# define errno __libc_errno
-# else
-# define errno errno
-# endif
-extern __thread int errno attribute_tls_model_ie;
-# endif /* USE___THREAD */
-#endif /* IS_IN_rtld */
-
-#define __set_errno(val) (errno = (val))
-
-#ifndef __ASSEMBLER__
-extern int *__errno_location (void) __THROW __attribute__ ((__const__))
-# ifdef IS_IN_rtld
- attribute_hidden
-# endif
-;
-# if defined __UCLIBC_HAS_THREADS__
-# include <tls.h>
-# if defined USE___THREAD && USE___THREAD
-libc_hidden_proto(__errno_location)
-# endif
-# endif
-
-#endif /* !__ASSEMBLER__ */
-
-#endif
diff --git a/libc/sysdeps/linux/common/capget.c b/libc/sysdeps/linux/common/capget.c
index 361de845d..c3e8c5771 100644
--- a/libc/sysdeps/linux/common/capget.c
+++ b/libc/sysdeps/linux/common/capget.c
@@ -11,10 +11,4 @@
int capget(void *header, void *data);
#ifdef __NR_capget
_syscall2(int, capget, void *, header, void *, data)
-#else
-int capget(void *header, void *data)
-{
- __set_errno(ENOSYS);
- return -1;
-}
#endif
diff --git a/libc/sysdeps/linux/common/capset.c b/libc/sysdeps/linux/common/capset.c
index 0a77e05f4..c0cf5deb0 100644
--- a/libc/sysdeps/linux/common/capset.c
+++ b/libc/sysdeps/linux/common/capset.c
@@ -8,13 +8,8 @@
*/
#include <sys/syscall.h>
+
int capset(void *header, const void *data);
#ifdef __NR_capset
_syscall2(int, capset, void *, header, const void *, data)
-#elif defined __UCLIBC_HAS_STUBS__
-int capset(void *header, const void *data)
-{
- __set_errno(ENOSYS);
- return -1;
-}
#endif
diff --git a/libc/sysdeps/linux/common/create_module.c b/libc/sysdeps/linux/common/create_module.c
index d8f24466d..ddd7c4cff 100644
--- a/libc/sysdeps/linux/common/create_module.c
+++ b/libc/sysdeps/linux/common/create_module.c
@@ -49,11 +49,4 @@ unsigned long create_module(const char *name, size_t size)
_syscall2(unsigned long, create_module, const char *, name, size_t, size)
#endif
-#else /* !__NR_create_module */
-caddr_t create_module(const char *name attribute_unused, size_t size attribute_unused);
-caddr_t create_module(const char *name attribute_unused, size_t size attribute_unused)
-{
- __set_errno(ENOSYS);
- return (caddr_t)-1;
-}
#endif
diff --git a/libc/sysdeps/linux/common/delete_module.c b/libc/sysdeps/linux/common/delete_module.c
index 44f9b30ae..8ac6e559e 100644
--- a/libc/sysdeps/linux/common/delete_module.c
+++ b/libc/sysdeps/linux/common/delete_module.c
@@ -10,10 +10,4 @@
int delete_module(const char *name, unsigned int flags);
#ifdef __NR_delete_module
_syscall2(int, delete_module, const char *, name, unsigned int, flags)
-#elif defined __UCLIBC_HAS_STUBS__
-int delete_module(const char *name, unsigned int flags)
-{
- __set_errno(ENOSYS);
- return -1;
-}
#endif
diff --git a/libc/sysdeps/linux/common/epoll.c b/libc/sysdeps/linux/common/epoll.c
index 86272d9aa..dda92282e 100644
--- a/libc/sysdeps/linux/common/epoll.c
+++ b/libc/sysdeps/linux/common/epoll.c
@@ -15,12 +15,6 @@
*/
#ifdef __NR_epoll_create
_syscall1(int, epoll_create, int, size)
-#else
-int epoll_create(int size)
-{
- __set_errno(ENOSYS);
- return -1;
-}
#endif
/*
@@ -28,12 +22,6 @@ int epoll_create(int size)
*/
#ifdef __NR_epoll_ctl
_syscall4(int,epoll_ctl, int, epfd, int, op, int, fd, struct epoll_event *, event)
-#else
-int epoll_ctl(int epfd, int op, int fd, struct epoll_event *event)
-{
- __set_errno(ENOSYS);
- return -1;
-}
#endif
/*
@@ -41,10 +29,4 @@ int epoll_ctl(int epfd, int op, int fd, struct epoll_event *event)
*/
#ifdef __NR_epoll_wait
_syscall4(int, epoll_wait, int, epfd, struct epoll_event *, events, int, maxevents, int, timeout)
-#else
-int epoll_wait(int epfd, struct epoll_event *events, int maxevents, int timeout)
-{
- __set_errno(ENOSYS);
- return -1;
-}
#endif
diff --git a/libc/sysdeps/linux/common/fdatasync.c b/libc/sysdeps/linux/common/fdatasync.c
index 19d37b6e0..e51c72365 100644
--- a/libc/sysdeps/linux/common/fdatasync.c
+++ b/libc/sysdeps/linux/common/fdatasync.c
@@ -40,11 +40,4 @@ int fdatasync(int fd)
# endif
}
-#elif defined __UCLIBC_HAS_STUBS__
-/* no syscall available, so provide a stub */
-int fdatasync(int fd)
-{
- __set_errno(ENOSYS);
- return -1;
-}
#endif
diff --git a/libc/sysdeps/linux/common/fork.c b/libc/sysdeps/linux/common/fork.c
index f21ec35b8..14e00a2cd 100644
--- a/libc/sysdeps/linux/common/fork.c
+++ b/libc/sysdeps/linux/common/fork.c
@@ -20,16 +20,4 @@ weak_alias(__libc_fork,fork)
libc_hidden_weak(fork)
#endif
-#elif defined __UCLIBC_HAS_STUBS__
-
-extern __typeof(fork) __libc_fork;
-pid_t __libc_fork(void)
-{
- __set_errno(ENOSYS);
- return -1;
-}
-weak_alias(__libc_fork,fork)
-libc_hidden_weak(fork)
-link_warning(fork, "fork: this function is not implemented on no-mmu systems")
-
#endif
diff --git a/libc/sysdeps/linux/common/get_kernel_syms.c b/libc/sysdeps/linux/common/get_kernel_syms.c
index d6595eaf5..6124a81d4 100644
--- a/libc/sysdeps/linux/common/get_kernel_syms.c
+++ b/libc/sysdeps/linux/common/get_kernel_syms.c
@@ -13,10 +13,4 @@ struct kernel_sym;
int get_kernel_syms(struct kernel_sym *table attribute_unused);
#ifdef __NR_get_kernel_syms
_syscall1(int, get_kernel_syms, struct kernel_sym *, table)
-#else
-int get_kernel_syms(struct kernel_sym *table attribute_unused)
-{
- __set_errno(ENOSYS);
- return -1;
-}
#endif
diff --git a/libc/sysdeps/linux/common/getegid.c b/libc/sysdeps/linux/common/getegid.c
index f2b6401cf..80a8ac9bb 100644
--- a/libc/sysdeps/linux/common/getegid.c
+++ b/libc/sysdeps/linux/common/getegid.c
@@ -10,24 +10,12 @@
#include <sys/syscall.h>
#include <unistd.h>
-
-#if defined(__NR_getegid32)
+#ifdef __NR_getegid32
# undef __NR_getegid
# define __NR_getegid __NR_getegid32
-_syscall0(gid_t, getegid)
-
-#elif defined(__NR_getegid)
-# define __NR___syscall_getegid __NR_getegid
-static __inline__ _syscall0(int, __syscall_getegid)
-gid_t getegid(void)
-{
- return (__syscall_getegid());
-}
-#else
-
-gid_t getegid(void)
-{
- return (getgid());
-}
#endif
+
+#ifdef __NR_getegid
+_syscall_noerr0(gid_t, getegid)
libc_hidden_def(getegid)
+#endif
diff --git a/libc/sysdeps/linux/common/geteuid.c b/libc/sysdeps/linux/common/geteuid.c
index 6111e5d1b..610fbc170 100644
--- a/libc/sysdeps/linux/common/geteuid.c
+++ b/libc/sysdeps/linux/common/geteuid.c
@@ -10,25 +10,12 @@
#include <sys/syscall.h>
#include <unistd.h>
-
-#if defined(__NR_geteuid32)
+#ifdef __NR_geteuid32
# undef __NR_geteuid
# define __NR_geteuid __NR_geteuid32
-_syscall0(uid_t, geteuid)
-
-#elif defined(__NR_geteuid)
-# define __NR___syscall_geteuid __NR_geteuid
-static __inline__ _syscall0(int, __syscall_geteuid)
-uid_t geteuid(void)
-{
- return (__syscall_geteuid());
-}
-
-#else
-uid_t geteuid(void)
-{
- return (getuid());
-}
#endif
+#ifdef __NR_geteuid
+_syscall_noerr0(uid_t, geteuid)
libc_hidden_def(geteuid)
+#endif
diff --git a/libc/sysdeps/linux/common/getgid.c b/libc/sysdeps/linux/common/getgid.c
index 80c60034e..ccfbfc067 100644
--- a/libc/sysdeps/linux/common/getgid.c
+++ b/libc/sysdeps/linux/common/getgid.c
@@ -10,7 +10,7 @@
#include <sys/syscall.h>
#include <unistd.h>
-#if defined __NR_getxgid
+#ifdef __NR_getxgid
# undef __NR_getgid
# define __NR_getgid __NR_getxgid
#endif
@@ -19,5 +19,9 @@
# define __NR_getgid __NR_getgid32
#endif
-_syscall0(gid_t, getgid)
+_syscall_noerr0(gid_t, getgid)
libc_hidden_def(getgid)
+#if !defined __NR_getegid32 && !defined __NR_getegid
+strong_alias(getgid,getegid)
+libc_hidden_def(getegid)
+#endif
diff --git a/libc/sysdeps/linux/common/getpgrp.c b/libc/sysdeps/linux/common/getpgrp.c
index 5d36ba155..0af9dc499 100644
--- a/libc/sysdeps/linux/common/getpgrp.c
+++ b/libc/sysdeps/linux/common/getpgrp.c
@@ -12,17 +12,11 @@
#ifdef __NR_getpgrp
/* According to the manpage the POSIX.1 version is favoured */
-_syscall0(pid_t, getpgrp)
+_syscall_noerr0(pid_t, getpgrp)
#elif defined __NR_getpgid && (defined __NR_getpid || defined __NR_getxpid)
/* IA64 doesn't have a getpgrp syscall */
pid_t getpgrp(void)
{
return getpgid(getpid());
}
-#elif defined __UCLIBC_HAS_STUBS__
-pid_t getpgrp(void)
-{
- __set_errno(ENOSYS);
- return -1;
-}
#endif
diff --git a/libc/sysdeps/linux/common/getpid.c b/libc/sysdeps/linux/common/getpid.c
index 8041022e7..d9a69084f 100644
--- a/libc/sysdeps/linux/common/getpid.c
+++ b/libc/sysdeps/linux/common/getpid.c
@@ -10,11 +10,13 @@
#include <sys/syscall.h>
#include <unistd.h>
-extern __typeof(getpid) __libc_getpid;
-#if defined __NR_getxpid
+#ifdef __NR_getxpid
+# undef __NR_getpid
# define __NR_getpid __NR_getxpid
#endif
-#define __NR___libc_getpid __NR_getpid
-_syscall0(pid_t, __libc_getpid)
-weak_alias(__libc_getpid, getpid)
+
+_syscall_noerr0(pid_t, getpid)
libc_hidden_weak(getpid)
+#ifndef __NR_getppid
+strong_alias(getpid,getppid)
+#endif
diff --git a/libc/sysdeps/linux/common/getppid.c b/libc/sysdeps/linux/common/getppid.c
index 4f2b0e933..9d85661d9 100644
--- a/libc/sysdeps/linux/common/getppid.c
+++ b/libc/sysdeps/linux/common/getppid.c
@@ -9,11 +9,7 @@
#include <sys/syscall.h>
#include <unistd.h>
+
#ifdef __NR_getppid
-_syscall0(pid_t, getppid)
-#else
-pid_t getppid(void)
-{
- return getpid();
-}
+_syscall_noerr0(pid_t, getppid)
#endif
diff --git a/libc/sysdeps/linux/common/getuid.c b/libc/sysdeps/linux/common/getuid.c
index b6f813a06..f921acb2e 100644
--- a/libc/sysdeps/linux/common/getuid.c
+++ b/libc/sysdeps/linux/common/getuid.c
@@ -10,7 +10,7 @@
#include <sys/syscall.h>
#include <unistd.h>
-#if defined __NR_getxuid
+#ifdef __NR_getxuid
# undef __NR_getuid
# define __NR_getuid __NR_getxuid
#endif
@@ -19,5 +19,9 @@
# define __NR_getuid __NR_getuid32
#endif
-_syscall0(uid_t, getuid)
+_syscall_noerr0(uid_t, getuid)
libc_hidden_def(getuid)
+#if !defined __NR_geteuid32 && !defined __NR_geteuid
+strong_alias(getuid,geteuid)
+libc_hidden_def(geteuid)
+#endif
diff --git a/libc/sysdeps/linux/common/init_module.c b/libc/sysdeps/linux/common/init_module.c
index 8a6e94199..cf6d74721 100644
--- a/libc/sysdeps/linux/common/init_module.c
+++ b/libc/sysdeps/linux/common/init_module.c
@@ -15,11 +15,5 @@ int init_module(void *first, void *second, void *third, void *fourth, void *fift
* and let the kernel cope with whatever it gets. It's good at that. */
_syscall5(int, init_module, void *, first, void *, second, void *, third,
void *, fourth, void *, fifth)
-#else
-int init_module(void *first, void *second, void *third, void *fourth, void *fifth)
-{
- __set_errno(ENOSYS);
- return -1;
-}
#endif
diff --git a/libc/sysdeps/linux/common/longjmp.c b/libc/sysdeps/linux/common/longjmp.c
index 4d1442414..b07eced6a 100644
--- a/libc/sysdeps/linux/common/longjmp.c
+++ b/libc/sysdeps/linux/common/longjmp.c
@@ -24,6 +24,10 @@
extern void __longjmp (__jmp_buf __env, int __val) attribute_noreturn;
libc_hidden_proto(__longjmp)
+#if 0
+extern void _longjmp_unwind (jmp_buf env, int val);
+#endif
+
extern __typeof(longjmp) __libc_longjmp attribute_noreturn;
/* Set the signal mask to the one specified in ENV, and jump
to the position specified in ENV, causing the setjmp
diff --git a/libc/sysdeps/linux/common/lutimes.c b/libc/sysdeps/linux/common/lutimes.c
index 0b4a8ea45..e01d40efd 100644
--- a/libc/sysdeps/linux/common/lutimes.c
+++ b/libc/sysdeps/linux/common/lutimes.c
@@ -12,7 +12,7 @@
#ifdef __NR_lutimes
_syscall2(int, lutimes, const char *, file, const struct timeval *, tvp)
-#else
+#elif defined __NR_utimensat
#include <sys/time.h>
#include <fcntl.h>
diff --git a/libc/sysdeps/linux/common/nanosleep.c b/libc/sysdeps/linux/common/nanosleep.c
index 0be59c511..26ce4a6c5 100644
--- a/libc/sysdeps/linux/common/nanosleep.c
+++ b/libc/sysdeps/linux/common/nanosleep.c
@@ -36,6 +36,5 @@ int __libc_nanosleep(const struct timespec *req, struct timespec *rem)
#endif
}
-libc_hidden_proto(nanosleep)
weak_alias(__libc_nanosleep,nanosleep)
libc_hidden_weak(nanosleep)
diff --git a/libc/sysdeps/linux/common/pivot_root.c b/libc/sysdeps/linux/common/pivot_root.c
index 3e9705903..0e738d53f 100644
--- a/libc/sysdeps/linux/common/pivot_root.c
+++ b/libc/sysdeps/linux/common/pivot_root.c
@@ -12,10 +12,4 @@
int pivot_root(const char *new_root, const char *put_old);
#ifdef __NR_pivot_root
_syscall2(int, pivot_root, const char *, new_root, const char *, put_old)
-#else
-int pivot_root(const char *new_root, const char *put_old)
-{
- __set_errno(ENOSYS);
- return -1;
-}
#endif
diff --git a/libc/sysdeps/linux/common/posix_fadvise.c b/libc/sysdeps/linux/common/posix_fadvise.c
index 7c43be959..17831c201 100644
--- a/libc/sysdeps/linux/common/posix_fadvise.c
+++ b/libc/sysdeps/linux/common/posix_fadvise.c
@@ -27,10 +27,9 @@ int posix_fadvise(int fd, off_t offset, off_t len, int advice)
strong_alias(posix_fadvise,posix_fadvise64)
#endif
-#else
+#elif defined __UCLIBC_HAS_STUBS__
int posix_fadvise(int fd attribute_unused, off_t offset attribute_unused, off_t len attribute_unused, int advice attribute_unused)
{
-#warning This is not correct as far as SUSv3 is concerned.
return ENOSYS;
}
#endif
diff --git a/libc/sysdeps/linux/common/posix_fadvise64.c b/libc/sysdeps/linux/common/posix_fadvise64.c
index b53e64321..e8a530fdf 100644
--- a/libc/sysdeps/linux/common/posix_fadvise64.c
+++ b/libc/sysdeps/linux/common/posix_fadvise64.c
@@ -58,13 +58,12 @@ int posix_fadvise64(int fd, __off64_t offset, __off64_t len, int advice)
#error your machine is neither 32 bit or 64 bit ... it must be magical
#endif
-#elif !defined __NR_fadvise64
+#elif !defined __NR_fadvise64 && defined __UCLIBC_HAS_STUBS__
/* This is declared as a strong alias in posix_fadvise.c if __NR_fadvise64
* is defined.
*/
int posix_fadvise64(int fd, __off64_t offset, __off64_t len, int advice)
{
-#warning This is not correct as far as SUSv3 is concerned.
return ENOSYS;
}
#endif /* __NR_fadvise64_64 */
diff --git a/libc/sysdeps/linux/common/query_module.c b/libc/sysdeps/linux/common/query_module.c
index 0f3d4700c..7c168df45 100644
--- a/libc/sysdeps/linux/common/query_module.c
+++ b/libc/sysdeps/linux/common/query_module.c
@@ -13,11 +13,4 @@ int query_module(const char *name attribute_unused, int which attribute_unused,
#ifdef __NR_query_module
_syscall5(int, query_module, const char *, name, int, which,
void *, buf, size_t, bufsize, size_t *, ret)
-#elif defined __UCLIBC_HAS_STUBS__
-int query_module(const char *name attribute_unused, int which attribute_unused,
- void *buf attribute_unused, size_t bufsize attribute_unused, size_t * ret attribute_unused)
-{
- __set_errno(ENOSYS);
- return -1;
-}
#endif
diff --git a/libc/sysdeps/linux/common/sched_getaffinity.c b/libc/sysdeps/linux/common/sched_getaffinity.c
index 5d5e5b2c4..8982582cc 100644
--- a/libc/sysdeps/linux/common/sched_getaffinity.c
+++ b/libc/sysdeps/linux/common/sched_getaffinity.c
@@ -44,11 +44,5 @@ int sched_getaffinity(pid_t pid, size_t cpusetsize, cpu_set_t *cpuset)
}
return res;
}
-#elif defined __UCLIBC_HAS_STUBS__
-int sched_getaffinity(pid_t pid, size_t cpusetsize, cpu_set_t *cpuset)
-{
- __set_errno(ENOSYS);
- return -1;
-}
#endif
#endif
diff --git a/libc/sysdeps/linux/common/sched_setaffinity.c b/libc/sysdeps/linux/common/sched_setaffinity.c
index 1a0f55f75..980c44199 100644
--- a/libc/sysdeps/linux/common/sched_setaffinity.c
+++ b/libc/sysdeps/linux/common/sched_setaffinity.c
@@ -70,16 +70,5 @@ int sched_setaffinity(pid_t pid, size_t cpusetsize, const cpu_set_t *cpuset)
return INLINE_SYSCALL (sched_setaffinity, 3, pid, cpusetsize, cpuset);
}
-#else
-#define ___HAVE_NO_sched_setaffinity
#endif
-
-#if defined ___HAVE_NO_sched_setaffinity && defined __UCLIBC_HAS_STUBS__
-int sched_setaffinity(pid_t pid, size_t cpusetsize, const cpu_set_t *cpuset)
-{
- __set_errno(ENOSYS);
- return -1;
-}
-#endif
-
#endif /* __USE_GNU */
diff --git a/libc/sysdeps/linux/common/signalfd.c b/libc/sysdeps/linux/common/signalfd.c
index 3d76e04c4..a0c995a89 100644
--- a/libc/sysdeps/linux/common/signalfd.c
+++ b/libc/sysdeps/linux/common/signalfd.c
@@ -21,8 +21,7 @@ static __inline__ _syscall3(int, __syscall_signalfd, int, fd,
const sigset_t *, mask, size_t, sizemask)
#endif
-#if defined __NR_signalfd4 || defined __NR_signalfd \
- || defined __UCLIBC_HAS_STUBS__
+#if defined __NR_signalfd4 || defined __NR_signalfd
int signalfd (int fd, const sigset_t *mask, int flags)
{
#if defined __NR___syscall_signalfd4
@@ -33,9 +32,6 @@ int signalfd (int fd, const sigset_t *mask, int flags)
return -1;
}
return __syscall_signalfd(fd, mask, _NSIG / 8);
-#elif defined __UCLIBC_HAS_STUBS__
- __set_errno(ENOSYS);
- return -1;
#endif
}
#endif
diff --git a/libc/sysdeps/linux/common/sigsuspend.c b/libc/sysdeps/linux/common/sigsuspend.c
index 789eeda89..ded2aad5b 100644
--- a/libc/sysdeps/linux/common/sigsuspend.c
+++ b/libc/sysdeps/linux/common/sigsuspend.c
@@ -38,7 +38,7 @@ int sigsuspend (const sigset_t *set)
return result;
}
# else
-static inline _syscall2(int, __rt_sigsuspend, const sigset_t *, mask, size_t, size);
+static inline _syscall2(int, __rt_sigsuspend, const sigset_t *, mask, size_t, size)
int sigsuspend(const sigset_t * mask)
{
diff --git a/libc/sysdeps/linux/common/splice.c b/libc/sysdeps/linux/common/splice.c
index b21d10336..83f348a48 100644
--- a/libc/sysdeps/linux/common/splice.c
+++ b/libc/sysdeps/linux/common/splice.c
@@ -13,11 +13,4 @@
#ifdef __NR_splice
_syscall6(ssize_t, splice, int, __fdin, __off64_t *, __offin, int, __fdout,
__off64_t *, __offout, size_t, __len, unsigned int, __flags)
-#else
-ssize_t splice(int __fdin, __off64_t *__offin, int __fdout,
- __off64_t *__offout, size_t __len, unsigned int __flags)
-{
- __set_errno(ENOSYS);
- return -1;
-}
#endif
diff --git a/libc/sysdeps/linux/common/ssp.c b/libc/sysdeps/linux/common/ssp.c
index a2d7ff2ca..df242cc69 100644
--- a/libc/sysdeps/linux/common/ssp.c
+++ b/libc/sysdeps/linux/common/ssp.c
@@ -71,6 +71,7 @@ static attribute_noreturn void terminate(void)
_exit(127);
}
+#ifdef __UCLIBC_HAS_SSP_COMPAT__
void __stack_smash_handler(char func[], int damaged __attribute__ ((unused))) attribute_noreturn __cold;
void __stack_smash_handler(char func[], int damaged)
{
@@ -84,7 +85,9 @@ void __stack_smash_handler(char func[], int damaged)
while(1)
terminate();
}
+#endif
+#ifdef __UCLIBC_HAS_SSP__
void __stack_chk_fail(void) attribute_noreturn __cold;
void __stack_chk_fail(void)
{
@@ -99,8 +102,9 @@ void __stack_chk_fail(void)
while(1)
terminate();
}
+#endif
-void __chk_fail(void) attribute_noreturn;
+#ifdef __UCLIBC_HAS_FORTIFY__
void __chk_fail(void)
{
static const char msg1[] = "buffer overflow detected: ";
@@ -114,4 +118,5 @@ void __chk_fail(void)
while(1)
terminate();
}
-
+libc_hidden_def(__chk_fail)
+#endif
diff --git a/libc/sysdeps/linux/common/stubs.c b/libc/sysdeps/linux/common/stubs.c
new file mode 100644
index 000000000..655c64001
--- /dev/null
+++ b/libc/sysdeps/linux/common/stubs.c
@@ -0,0 +1,187 @@
+/*
+ * system call not available stub
+ *
+ * Copyright (C) 2009 Analog Devices Inc.
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include <errno.h>
+#include <sys/syscall.h>
+
+#ifdef __UCLIBC_HAS_STUBS__
+
+static int enosys_stub(void)
+{
+ __set_errno(ENOSYS);
+ return -1;
+}
+
+#define make_stub(stub) \
+ link_warning(stub, #stub ": this function is not implemented") \
+ strong_alias(enosys_stub, stub)
+
+#ifndef __ARCH_USE_MMU__
+# undef __NR_fork
+#endif
+
+#ifndef __UCLIBC_HAS_LFS__
+# undef __NR_fadvise64
+# undef __NR_fadvise64_64
+# undef __NR_sync_file_range
+#endif
+
+#ifndef __NR_bdflush
+make_stub(bdflush)
+#endif
+
+#ifndef __NR_capget
+make_stub(capget)
+#endif
+
+#ifndef __NR_capset
+make_stub(capset)
+#endif
+
+#ifndef __NR_create_module
+make_stub(create_module)
+#endif
+
+#ifndef __NR_delete_module
+make_stub(delete_module)
+#endif
+
+#ifndef __NR_epoll_create
+make_stub(epoll_create)
+#endif
+
+#ifndef __NR_epoll_ctl
+make_stub(epoll_ctl)
+#endif
+
+#ifndef __NR_epoll_wait
+make_stub(epoll_wait)
+#endif
+
+#ifndef __NR_fdatasync
+make_stub(fdatasync)
+#endif
+
+#ifndef __NR_flistxattr
+make_stub(flistxattr)
+#endif
+
+#ifndef __NR_fork
+make_stub(fork)
+#endif
+
+#ifndef __NR_fgetxattr
+make_stub(fgetxattr)
+#endif
+
+#ifndef __NR_fremovexattr
+make_stub(fremovexattr)
+#endif
+
+#ifndef __NR_fsetxattr
+make_stub(fsetxattr)
+#endif
+
+#ifndef __NR_get_kernel_syms
+make_stub(get_kernel_syms)
+#endif
+
+#if !defined(__NR_getpgrp) && (defined(__NR_getpgid) && (defined(__NR_getpid) || defined(__NR_getxpid)))
+make_stub(getpgrp)
+#endif
+
+#ifndef __NR_getxattr
+make_stub(getxattr)
+#endif
+
+#ifndef __NR_init_module
+make_stub(init_module)
+#endif
+
+#ifndef __NR_lgetxattr
+make_stub(lgetxattr)
+#endif
+
+#ifndef __NR_listxattr
+make_stub(listxattr)
+#endif
+
+#ifndef __NR_llistxattr
+make_stub(llistxattr)
+#endif
+
+#ifndef __NR_lremovexattr
+make_stub(lremovexattr)
+#endif
+
+#ifndef __NR_lsetxattr
+make_stub(lsetxattr)
+#endif
+
+#ifndef __NR_pivot_root
+make_stub(pivot_root)
+#endif
+
+#ifndef __NR_query_module
+make_stub(query_module)
+#endif
+
+#ifndef __NR_removexattr
+make_stub(removexattr)
+#endif
+
+#ifndef __NR_sched_getaffinity
+make_stub(sched_getaffinity)
+#endif
+
+#ifndef __NR_sched_setaffinity
+make_stub(sched_setaffinity)
+#endif
+
+#ifndef __NR_setxattr
+make_stub(setxattr)
+#endif
+
+#if !defined(__NR_signalfd4) && !defined(__NR_signalfd)
+make_stub(signalfd)
+#endif
+
+#ifndef __NR_rt_sigtimedwait
+make_stub(sigtimedwait)
+make_stub(sigwaitinfo)
+#endif
+
+#ifndef __NR_splice
+make_stub(splice)
+#endif
+
+#ifndef __NR_sync_file_range
+make_stub(sync_file_range)
+#endif
+
+#if !defined(__NR_umount) && !defined(__NR_umount2)
+make_stub(umount)
+#endif
+
+#ifndef __NR_umount2
+make_stub(umount2)
+#endif
+
+#ifndef __NR_utimensat
+make_stub(futimens)
+make_stub(utimensat)
+# ifndef __NR_lutimes
+make_stub(lutimes)
+# endif
+#endif
+
+#ifndef __NR_vmsplice
+make_stub(vmsplice)
+#endif
+
+#endif
diff --git a/libc/sysdeps/linux/common/sync_file_range.c b/libc/sysdeps/linux/common/sync_file_range.c
index 7e2deff41..d24403e1b 100644
--- a/libc/sysdeps/linux/common/sync_file_range.c
+++ b/libc/sysdeps/linux/common/sync_file_range.c
@@ -23,11 +23,5 @@ int sync_file_range(int fd, off64_t offset, off64_t nbytes, unsigned int flags)
__LONG_LONG_PAIR((long)(nbytes >> 32), (long)(nbytes & 0xffffffff)),
flags);
}
-#elif defined __UCLIBC_HAS_STUBS__
-int sync_file_range(int fd, __off64_t offset, __off64_t nbytes, unsigned int flags)
-{
- __set_errno(ENOSYS);
- return -1;
-}
#endif
#endif
diff --git a/libc/sysdeps/linux/common/sysdep.h b/libc/sysdeps/linux/common/sysdep.h
index a7ec95480..156e5711a 100644
--- a/libc/sysdeps/linux/common/sysdep.h
+++ b/libc/sysdeps/linux/common/sysdep.h
@@ -51,6 +51,7 @@
/* Macros to generate eh_frame unwind information. */
# ifdef HAVE_ASM_CFI_DIRECTIVES
+# define cfi_sections(sect...) .cfi_sections sect
# define cfi_startproc .cfi_startproc
# define cfi_endproc .cfi_endproc
# define cfi_def_cfa(reg, off) .cfi_def_cfa reg, off
@@ -71,6 +72,7 @@
# define cfi_lsda(enc, exp) .cfi_lsda enc, exp
# else
+# define cfi_sections(sect...)
# define cfi_startproc
# define cfi_endproc
# define cfi_def_cfa(reg, off)
@@ -95,6 +97,8 @@
# ifdef HAVE_ASM_CFI_DIRECTIVES
# define CFI_STRINGIFY(Name) CFI_STRINGIFY2 (Name)
# define CFI_STRINGIFY2(Name) #Name
+# define CFI_SECTIONS(sect...) \
+ ".cfi_sections " CFI_STRINGIFY(sect)
# define CFI_STARTPROC ".cfi_startproc"
# define CFI_ENDPROC ".cfi_endproc"
# define CFI_DEF_CFA(reg, off) \
@@ -128,6 +132,7 @@
# define CFI_LSDA(enc, exp) \
".cfi_lsda " CFI_STRINGIFY(enc) "," CFI_STRINGIFY(exp)
# else
+# define CFI_SECTIONS(sect...)
# define CFI_STARTPROC
# define CFI_ENDPROC
# define CFI_DEF_CFA(reg, off)
diff --git a/libc/sysdeps/linux/common/umask.c b/libc/sysdeps/linux/common/umask.c
index ef9860e31..b838e1731 100644
--- a/libc/sysdeps/linux/common/umask.c
+++ b/libc/sysdeps/linux/common/umask.c
@@ -15,5 +15,5 @@ static __inline__ _syscall1(__kernel_mode_t, __syscall_umask, __kernel_mode_t, m
mode_t umask(mode_t mode)
{
- return (__syscall_umask(mode));
+ return __syscall_umask(mode);
}
diff --git a/libc/sysdeps/linux/common/umount.c b/libc/sysdeps/linux/common/umount.c
index 453ecd27b..a084d29bd 100644
--- a/libc/sysdeps/linux/common/umount.c
+++ b/libc/sysdeps/linux/common/umount.c
@@ -28,14 +28,5 @@ int umount(const char *special_file)
return (__syscall_umount2(special_file, 0));
}
-/* arch doesn't provide any umount syscall !? */
-#else
-
-int umount(const char *special_file)
-{
- __set_errno(ENOSYS);
- return -1;
-}
-
#endif
#endif
diff --git a/libc/sysdeps/linux/common/umount2.c b/libc/sysdeps/linux/common/umount2.c
index bd44717d4..2cc4a2338 100644
--- a/libc/sysdeps/linux/common/umount2.c
+++ b/libc/sysdeps/linux/common/umount2.c
@@ -13,11 +13,5 @@
#include <sys/mount.h>
#ifdef __NR_umount2 /* Old kernels don't have umount2 */
_syscall2(int, umount2, const char *, special_file, int, flags)
-#else
-int umount2(const char *special_file, int flags)
-{
- __set_errno(ENOSYS);
- return -1;
-}
#endif
#endif
diff --git a/libc/sysdeps/linux/common/vmsplice.c b/libc/sysdeps/linux/common/vmsplice.c
index c5fd6c7ed..dd0640e1e 100644
--- a/libc/sysdeps/linux/common/vmsplice.c
+++ b/libc/sysdeps/linux/common/vmsplice.c
@@ -13,11 +13,4 @@
#ifdef __NR_vmsplice
_syscall4(ssize_t, vmsplice, int, __fdout, const struct iovec *, __iov,
size_t, __count, unsigned int, __flags)
-#else
-ssize_t vmsplice(int __fdout, const struct iovec *__iov, size_t __count,
- unsigned int __flags)
-{
- __set_errno(ENOSYS);
- return -1;
-}
#endif
diff --git a/libc/sysdeps/linux/common/xattr.c b/libc/sysdeps/linux/common/xattr.c
index 8a4e3be29..dea471ad6 100644
--- a/libc/sysdeps/linux/common/xattr.c
+++ b/libc/sysdeps/linux/common/xattr.c
@@ -29,136 +29,58 @@
#ifdef __NR_setxattr
_syscall5(int, setxattr, const char *, path, const char *, name,
const void *, value, size_t, size, int, flags)
-#else
-int setxattr(__const char *__path, __const char *__name,
- __const void *__value, size_t __size, int __flags)
-{
- __set_errno(ENOSYS);
- return -1;
-}
#endif
#ifdef __NR_lsetxattr
_syscall5(int, lsetxattr, const char *, path, const char *, name,
const void *, value, size_t, size, int, flags)
-#else
-int lsetxattr(__const char *__path, __const char *__name,
- __const void *__value, size_t __size, int __flags)
-{
- __set_errno(ENOSYS);
- return -1;
-}
#endif
#ifdef __NR_fsetxattr
_syscall5(int, fsetxattr, int, filedes, const char *, name, const void *,
value, size_t, size, int, flags)
-#else
-int fsetxattr(int __fd, __const char *__name, __const void *__value,
- size_t __size, int __flags)
-{
- __set_errno(ENOSYS);
- return -1;
-}
#endif
/* gets */
#ifdef __NR_getxattr
_syscall4(ssize_t, getxattr, const char *, path, const char *, name,
void *, value, size_t, size)
-#else
-ssize_t getxattr(__const char *__path, __const char *__name, void *__value,
- size_t __size)
-{
- __set_errno(ENOSYS);
- return -1;
-}
#endif
#ifdef __NR_lgetxattr
_syscall4(ssize_t, lgetxattr, const char *, path, const char *, name,
void *, value, size_t, size)
-#else
-ssize_t lgetxattr(__const char *__path, __const char *__name,
- void *__value, size_t __size)
-{
- __set_errno(ENOSYS);
- return -1;
-}
#endif
#ifdef __NR_fgetxattr
_syscall4(ssize_t, fgetxattr, int, filedes, const char *, name, void *,
value, size_t, size)
-#else
-ssize_t fgetxattr(int __fd, __const char *__name, void *__value,
- size_t __size)
-{
- __set_errno(ENOSYS);
- return -1;
-}
#endif
/* list */
#ifdef __NR_listxattr
_syscall3(ssize_t, listxattr, const char *, path, char *, list, size_t,
size)
-#else
-ssize_t listxattr(__const char *__path, char *__list, size_t __size)
-{
- __set_errno(ENOSYS);
- return -1;
-}
#endif
#ifdef __NR_llistxattr
_syscall3(ssize_t, llistxattr, const char *, path, char *, list, size_t,
size)
-#else
-ssize_t llistxattr(__const char *__path, char *__list, size_t __size)
-{
- __set_errno(ENOSYS);
- return -1;
-}
#endif
#ifdef __NR_flistxattr
_syscall3(ssize_t, flistxattr, int, filedes, char *, list, size_t, size)
-#else
-ssize_t flistxattr(int __fd, char *__list, size_t __size)
-{
- __set_errno(ENOSYS);
- return -1;
-}
#endif
/* remove */
#ifdef __NR_removexattr
_syscall2(int, removexattr, const char *, path, const char *, name)
-#else
-int removexattr(__const char *__path, __const char *__name)
-{
- __set_errno(ENOSYS);
- return -1;
-}
#endif
#ifdef __NR_lremovexattr
_syscall2(int, lremovexattr, const char *, path, const char *, name)
-#else
-int lremovexattr(__const char *__path, __const char *__name)
-{
- __set_errno(ENOSYS);
- return -1;
-}
#endif
#ifdef __NR_fremovexattr
_syscall2(int, fremovexattr, int, filedes, const char *, name)
-#else
-int fremovexattr(int __fd, __const char *__name)
-{
- __set_errno(ENOSYS);
- return -1;
-}
#endif