diff options
author | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2008-06-03 08:11:56 +0000 |
---|---|---|
committer | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2008-06-03 08:11:56 +0000 |
commit | 4cc4b30426c5e5a0ecf912791e3f27312438d10e (patch) | |
tree | 81c31f4bde953f135d9e63582b162c17cc173f10 /libc/sysdeps/linux/common | |
parent | 1f124eb0280a5009f1265a9dca49fdb0d95b845e (diff) |
- adds several config-options to allow for turning off certain features
like
o UCLIBC_HAS_GNU_ERROR
o UCLIBC_HAS_BSD_ERR
o UCLIBC_HAS_PTY
o UCLIBC_HAS_GETPT (1)
o UCLIBC_SYSCALL_STUBS
o UCLIBC_SYSCALL_STUB_WARNING
o UCLIBC_LINUX_SPECIFIC (2)
o UCLIBC_BSD_SPECIFIC (3)
o UCLIBC_NTP_LEGACY (4)
o UCLIBC_SV4_DEPRECATED (5)
o UCLIBC_HAVE_REALTIME (6)
o UCLIBC_HAVE_ADVANCED_REALTIME (7)
o UCLIBC_HAVE_EPOLL (8)
o UCLIBC_HAVE_XATTR (9)
o UCLIBC_HAVE_PROFILING (10)
(1) make non-standard getpt optional and implement standard posix_openpt
(2) fstatfs(), inotify_*(), ioperm(), iopl(), madvise(), modify_ldt(),
personality()
ppoll(), setresuid()
(3) mincore(), getdomainname(), setdomainname()
(4) ntp_adjtime(), ntp_gettime() aliases
(5) ustat() [use statfs(2) in your code instead]
(6) All marked as "(REALTIME)" in SUSv3
(7) All marked as "(ADVANCED REALTIME)" in SUSv3
(8) epoll_create(), epoll_ctl(), epoll_wait()
(9) all Extended Attributes
(10) helpers for gcc's -finstrument-functions
- Fixes _dl_exit()
- Implements sleep(3) for !UCLIBC_HAVE_REALTIME
- Implements usleep(3) for !UCLIBC_HAVE_REALTIME
- adds #warning about incorrect posix_fadvise{,64}()
- removes unused and unwanted uselib()
Net outcome is that an allnoconfig with HAVE_SHARED is now about 88k instead
of formerly 130k.
Diffstat (limited to 'libc/sysdeps/linux/common')
43 files changed, 185 insertions, 56 deletions
diff --git a/libc/sysdeps/linux/common/Makefile.in b/libc/sysdeps/linux/common/Makefile.in index 618785d62..d61ae9f4f 100644 --- a/libc/sysdeps/linux/common/Makefile.in +++ b/libc/sysdeps/linux/common/Makefile.in @@ -26,7 +26,54 @@ endif ifneq ($(UCLIBC_LINUX_MODULE_24),y) CSRC := $(filter-out create_module.c delete_module.c init_module.c \ - query_module.c,$(CSRC)) + query_module.c get_kernel_syms.c,$(CSRC)) +endif + +ifneq ($(UCLIBC_LINUX_SPECIFIC),y) +# we need these internally: fstatfs.c statfs.c +CSRC := $(filter-out inotify.c ioperm.c iopl.c madvise.c \ + modify_ldt.c personality.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 swapoff.c swapon.c sysctl.c sysinfo.c \ + uselib.c vhangup.c,$(CSRC)) +endif + +ifneq ($(UCLIBC_BSD_SPECIFIC),y) +# 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) +# 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) +# 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_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 # fails for some reason diff --git a/libc/sysdeps/linux/common/adjtimex.c b/libc/sysdeps/linux/common/adjtimex.c index e1225f46c..280f90e5a 100644 --- a/libc/sysdeps/linux/common/adjtimex.c +++ b/libc/sysdeps/linux/common/adjtimex.c @@ -14,4 +14,6 @@ libc_hidden_proto(adjtimex) _syscall1(int, adjtimex, struct timex *, buf); libc_hidden_def(adjtimex) +#if defined __UCLIBC_NTP_LEGACY__ strong_alias(adjtimex,ntp_adjtime) +#endif diff --git a/libc/sysdeps/linux/common/fstatfs.c b/libc/sysdeps/linux/common/fstatfs.c index 7bcfeb36f..830de8103 100644 --- a/libc/sysdeps/linux/common/fstatfs.c +++ b/libc/sysdeps/linux/common/fstatfs.c @@ -10,7 +10,27 @@ #include <sys/syscall.h> #include <sys/vfs.h> -libc_hidden_proto(fstatfs) +#if !defined __UCLIBC_LINUX_SPECIFIC__ +#ifndef __USE_FILE_OFFSET64 +extern int fstatfs (int __fildes, struct statfs *__buf) + __THROW __nonnull ((2)); +#else +# ifdef __REDIRECT_NTH +extern int __REDIRECT_NTH (fstatfs, (int __fildes, struct statfs *__buf), + fstatfs64) __nonnull ((2)); +# else +# define fstatfs fstatfs64 +# endif +#endif +#endif +extern __typeof(fstatfs) __libc_fstatfs; +libc_hidden_proto(__libc_fstatfs) +#define __NR___libc_fstatfs __NR_fstatfs +_syscall2(int, __libc_fstatfs, int, fd, struct statfs *, buf); +libc_hidden_def(__libc_fstatfs) -_syscall2(int, fstatfs, int, fd, struct statfs *, buf); -libc_hidden_def(fstatfs) +#if defined __UCLIBC_LINUX_SPECIFIC__ +libc_hidden_proto(fstatfs) +weak_alias(__libc_fstatfs,fstatfs) +libc_hidden_weak(fstatfs) +#endif diff --git a/libc/sysdeps/linux/common/getdomainname.c b/libc/sysdeps/linux/common/getdomainname.c index d98651a97..86f6dfd32 100644 --- a/libc/sysdeps/linux/common/getdomainname.c +++ b/libc/sysdeps/linux/common/getdomainname.c @@ -16,8 +16,13 @@ /* Experimentally off - libc_hidden_proto(strcpy) */ libc_hidden_proto(uname) -libc_hidden_proto(getdomainname) -int getdomainname(char *name, size_t len) +#if !defined __UCLIBC_BSD_SPECIFIC__ +extern int getdomainname (char *__name, size_t __len) + __THROW __nonnull ((1)) __wur; +#endif +extern __typeof(getdomainname) __libc_getdomainname; +libc_hidden_proto(__libc_getdomainname) +int __libc_getdomainname(char *name, size_t len) { struct utsname uts; @@ -43,5 +48,10 @@ int getdomainname(char *name, size_t len) #endif return 0; } -libc_hidden_def(getdomainname) +libc_hidden_def(__libc_getdomainname) +#if defined __UCLIBC_BSD_SPECIFIC__ +libc_hidden_proto(getdomainname) +weak_alias(__libc_getdomainname,getdomainname) +libc_hidden_weak(getdomainname) +#endif /* __UCLIBC_BSD_SPECIFIC__ */ #endif diff --git a/libc/sysdeps/linux/common/getdtablesize.c b/libc/sysdeps/linux/common/getdtablesize.c index 4efd8280d..44d21862f 100644 --- a/libc/sysdeps/linux/common/getdtablesize.c +++ b/libc/sysdeps/linux/common/getdtablesize.c @@ -9,6 +9,8 @@ #include <sys/resource.h> #include <limits.h> +/* XXX: _BSD || _XOPEN_SOURCE >= 500 */ +#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED libc_hidden_proto(getdtablesize) libc_hidden_proto(getrlimit) @@ -27,3 +29,4 @@ int getdtablesize (void) return getrlimit (RLIMIT_NOFILE, &ru) < 0 ? __LOCAL_OPEN_MAX : ru.rlim_cur; } libc_hidden_def(getdtablesize) +#endif diff --git a/libc/sysdeps/linux/common/getpgid.c b/libc/sysdeps/linux/common/getpgid.c index 3acd00db6..49f780adf 100644 --- a/libc/sysdeps/linux/common/getpgid.c +++ b/libc/sysdeps/linux/common/getpgid.c @@ -8,6 +8,8 @@ */ #include <sys/syscall.h> + +#if defined __USE_UNIX98 #include <unistd.h> #define __NR___syscall_getpgid __NR_getpgid @@ -17,3 +19,4 @@ pid_t getpgid(pid_t pid) { return (__syscall_getpgid(pid)); } +#endif diff --git a/libc/sysdeps/linux/common/getpgrp.c b/libc/sysdeps/linux/common/getpgrp.c index 704ff5ace..a2fe44560 100644 --- a/libc/sysdeps/linux/common/getpgrp.c +++ b/libc/sysdeps/linux/common/getpgrp.c @@ -11,5 +11,6 @@ #include <unistd.h> #ifdef __NR_getpgrp +/* According to the manpage the POSIX.1 version is favoured */ _syscall0(pid_t, getpgrp); #endif diff --git a/libc/sysdeps/linux/common/getrlimit.c b/libc/sysdeps/linux/common/getrlimit.c index 0684edca2..ecb09d1e2 100644 --- a/libc/sysdeps/linux/common/getrlimit.c +++ b/libc/sysdeps/linux/common/getrlimit.c @@ -17,7 +17,7 @@ libc_hidden_proto(getrlimit) /* Only wrap getrlimit if the new ugetrlimit is not present and getrlimit sucks */ -#if defined(__NR_ugetrlimit) +#if defined __NR_ugetrlimit /* just call ugetrlimit() */ # define __NR___syscall_ugetrlimit __NR_ugetrlimit diff --git a/libc/sysdeps/linux/common/mincore.c b/libc/sysdeps/linux/common/mincore.c index b4e053127..1dc9a9a1a 100644 --- a/libc/sysdeps/linux/common/mincore.c +++ b/libc/sysdeps/linux/common/mincore.c @@ -7,9 +7,9 @@ */ #include <sys/syscall.h> + +#if defined __NR_mincore && (defined __USE_BSD || defined __USE_SVID) #include <unistd.h> #include <sys/mman.h> - -#ifdef __NR_mincore _syscall3(int, mincore, void *, start, size_t, length, unsigned char *, vec); #endif diff --git a/libc/sysdeps/linux/common/mprotect.c b/libc/sysdeps/linux/common/mprotect.c index a5e6920a5..7122f0f2f 100644 --- a/libc/sysdeps/linux/common/mprotect.c +++ b/libc/sysdeps/linux/common/mprotect.c @@ -10,6 +10,6 @@ #include <sys/syscall.h> #include <sys/mman.h> -#ifdef __NR_mprotect +#if defined __ARCH_USE_MMU__ && defined __NR_mprotect _syscall3(int, mprotect, void *, addr, size_t, len, int, prot); #endif diff --git a/libc/sysdeps/linux/common/msync.c b/libc/sysdeps/linux/common/msync.c index 352fb4903..88f021f43 100644 --- a/libc/sysdeps/linux/common/msync.c +++ b/libc/sysdeps/linux/common/msync.c @@ -10,17 +10,13 @@ #include <sys/syscall.h> #include <unistd.h> -#ifdef __NR_msync +#if defined __NR_msync && defined __ARCH_USE_MMU__ #include <sys/mman.h> -#ifdef __ARCH_USE_MMU__ - extern __typeof(msync) __libc_msync; #define __NR___libc_msync __NR_msync _syscall3(int, __libc_msync, void *, addr, size_t, length, int, flags); weak_alias(__libc_msync,msync) #endif - -#endif diff --git a/libc/sysdeps/linux/common/munlockall.c b/libc/sysdeps/linux/common/munlockall.c index 20e8e72ab..39507715a 100644 --- a/libc/sysdeps/linux/common/munlockall.c +++ b/libc/sysdeps/linux/common/munlockall.c @@ -8,7 +8,9 @@ */ #include <sys/syscall.h> + +#if defined __NR_munlockall && defined __ARCH_USE_MMU__ #include <sys/mman.h> -#if defined __ARCH_USE_MMU__ + _syscall0(int, munlockall); #endif diff --git a/libc/sysdeps/linux/common/nanosleep.c b/libc/sysdeps/linux/common/nanosleep.c index b0600251f..c464403c5 100644 --- a/libc/sysdeps/linux/common/nanosleep.c +++ b/libc/sysdeps/linux/common/nanosleep.c @@ -10,6 +10,8 @@ #include <sys/syscall.h> #include <time.h> +#if defined __USE_POSIX199309 && defined __NR_nanosleep + extern __typeof(nanosleep) __libc_nanosleep; #define __NR___libc_nanosleep __NR_nanosleep _syscall2(int, __libc_nanosleep, const struct timespec *, req, @@ -17,3 +19,4 @@ _syscall2(int, __libc_nanosleep, const struct timespec *, req, libc_hidden_proto(nanosleep) weak_alias(__libc_nanosleep,nanosleep) libc_hidden_weak(nanosleep) +#endif diff --git a/libc/sysdeps/linux/common/poll.c b/libc/sysdeps/linux/common/poll.c index 3b0a1fd52..164e08120 100644 --- a/libc/sysdeps/linux/common/poll.c +++ b/libc/sysdeps/linux/common/poll.c @@ -28,7 +28,7 @@ extern __typeof(poll) __libc_poll; _syscall3(int, __libc_poll, struct pollfd *, fds, unsigned long int, nfds, int, timeout); -#elif defined(__NR_ppoll) +#elif defined(__NR_ppoll) && defined __UCLIBC_LINUX_SPECIFIC__ libc_hidden_proto(ppoll) int __libc_poll(struct pollfd *fds, nfds_t nfds, int timeout) diff --git a/libc/sysdeps/linux/common/posix_fadvise.c b/libc/sysdeps/linux/common/posix_fadvise.c index a7ece5aec..45734f9b2 100644 --- a/libc/sysdeps/linux/common/posix_fadvise.c +++ b/libc/sysdeps/linux/common/posix_fadvise.c @@ -46,6 +46,7 @@ strong_alias(posix_fadvise,posix_fadvise64) #else 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 994139c9c..7944c4985 100644 --- a/libc/sysdeps/linux/common/posix_fadvise64.c +++ b/libc/sysdeps/linux/common/posix_fadvise64.c @@ -74,6 +74,7 @@ int posix_fadvise64(int fd, __off64_t offset, __off64_t len, int advice) */ int posix_fadvise64(int fd, __off64_t offset, __off64_t len, int advice) { +#warning This is not correct as far as SUSv3 is concerned. return ENOSYS; } #endif /* __NR_fadvise64_64 */ diff --git a/libc/sysdeps/linux/common/ppoll.c b/libc/sysdeps/linux/common/ppoll.c index ab96e8ba4..90b3517b2 100644 --- a/libc/sysdeps/linux/common/ppoll.c +++ b/libc/sysdeps/linux/common/ppoll.c @@ -20,7 +20,7 @@ #include <sys/syscall.h> #include <sys/poll.h> -#ifdef __NR_ppoll +#if defined __NR_ppoll && defined __UCLIBC_LINUX_SPECIFIC__ libc_hidden_proto(ppoll) diff --git a/libc/sysdeps/linux/common/ptrace.c b/libc/sysdeps/linux/common/ptrace.c index 56a21e5ce..9d6767374 100644 --- a/libc/sysdeps/linux/common/ptrace.c +++ b/libc/sysdeps/linux/common/ptrace.c @@ -4,12 +4,12 @@ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. */ -#include <errno.h> +#include <sys/syscall.h> #include <sys/types.h> #include <sys/ptrace.h> -#include <sys/syscall.h> #include <stdarg.h> +#if defined __NR_ptrace && defined __USE_BSD && defined __USE_MISC #define __NR___syscall_ptrace __NR_ptrace static inline _syscall4(long, __syscall_ptrace, enum __ptrace_request, request, @@ -40,3 +40,4 @@ ptrace (enum __ptrace_request request, ...) return res; } +#endif diff --git a/libc/sysdeps/linux/common/quotactl.c b/libc/sysdeps/linux/common/quotactl.c index 7363c63e0..cb044a4e8 100644 --- a/libc/sysdeps/linux/common/quotactl.c +++ b/libc/sysdeps/linux/common/quotactl.c @@ -8,6 +8,9 @@ */ #include <sys/syscall.h> + +#if defined __USE_BSD #include <sys/quota.h> _syscall4(int, quotactl, int, cmd, const char *, special, int, id, caddr_t, addr); +#endif diff --git a/libc/sysdeps/linux/common/sbrk.c b/libc/sysdeps/linux/common/sbrk.c index 4ac2d2a21..734a4ce01 100644 --- a/libc/sysdeps/linux/common/sbrk.c +++ b/libc/sysdeps/linux/common/sbrk.c @@ -21,7 +21,7 @@ void * sbrk (intptr_t increment) void *oldbrk; if (__curbrk == NULL) - if (brk (0) < 0) /* Initialize the break. */ + if (brk (NULL) < 0) /* Initialize the break. */ return (void *) -1; if (increment == 0) diff --git a/libc/sysdeps/linux/common/select.c b/libc/sysdeps/linux/common/select.c index 03fda35b7..71a4990ab 100644 --- a/libc/sysdeps/linux/common/select.c +++ b/libc/sysdeps/linux/common/select.c @@ -12,8 +12,7 @@ extern __typeof(select) __libc_select; -#if !defined(__NR__newselect) && !defined(__NR_select) - +#if !defined(__NR__newselect) && !defined(__NR_select) && defined __USE_XOPEN2K # define __NR___libc_pselect6 __NR_pselect6 _syscall6(int, __libc_pselect6, int, n, fd_set *, readfds, fd_set *, writefds, fd_set *, exceptfds, const struct timespec *, timeout, diff --git a/libc/sysdeps/linux/common/seteuid.c b/libc/sysdeps/linux/common/seteuid.c index 35a68334d..5a6e9a25a 100644 --- a/libc/sysdeps/linux/common/seteuid.c +++ b/libc/sysdeps/linux/common/seteuid.c @@ -11,6 +11,11 @@ #include <sys/types.h> #include <sys/syscall.h> +#if !defined __UCLIBC_LINUX_SPECIFIC__ +#undef __NR_setresuid +#undef __NR_setresuid32 +#endif + libc_hidden_proto(seteuid) #if (defined __NR_setresuid || defined __NR_setresuid32) && defined __USE_GNU diff --git a/libc/sysdeps/linux/common/setpgid.c b/libc/sysdeps/linux/common/setpgid.c index 144ffa959..3447b999d 100644 --- a/libc/sysdeps/linux/common/setpgid.c +++ b/libc/sysdeps/linux/common/setpgid.c @@ -8,6 +8,8 @@ */ #include <sys/syscall.h> + +#if defined __USE_UNIX98 || defined __USE_SVID #include <unistd.h> libc_hidden_proto(setpgid) @@ -21,3 +23,4 @@ int setpgid(pid_t pid, pid_t pgid) return (__syscall_setpgid(pid, pgid)); } libc_hidden_def(setpgid) +#endif diff --git a/libc/sysdeps/linux/common/setresuid.c b/libc/sysdeps/linux/common/setresuid.c index 883d7a952..54b92465c 100644 --- a/libc/sysdeps/linux/common/setresuid.c +++ b/libc/sysdeps/linux/common/setresuid.c @@ -8,7 +8,7 @@ */ #include <sys/syscall.h> -#ifdef __USE_GNU +#if defined __USE_GNU && defined __UCLIBC_LINUX_SPECIFIC__ #include <unistd.h> #if defined(__NR_setresuid32) diff --git a/libc/sysdeps/linux/common/sigaltstack.c b/libc/sysdeps/linux/common/sigaltstack.c index 624c87792..0c9308408 100644 --- a/libc/sysdeps/linux/common/sigaltstack.c +++ b/libc/sysdeps/linux/common/sigaltstack.c @@ -10,7 +10,8 @@ #include <sys/syscall.h> #include <signal.h> -#ifdef __NR_sigaltstack +#if defined __NR_sigaltstack && (defined __USE_BSD || defined __USE_UNIX98) + _syscall2(int, sigaltstack, const struct sigaltstack *, ss, struct sigaltstack *, oss); #endif diff --git a/libc/sysdeps/linux/common/sigpending.c b/libc/sysdeps/linux/common/sigpending.c index e2928cbe1..fa272c0f5 100644 --- a/libc/sysdeps/linux/common/sigpending.c +++ b/libc/sysdeps/linux/common/sigpending.c @@ -8,6 +8,8 @@ */ #include <sys/syscall.h> + +#if defined __USE_POSIX #include <signal.h> #undef sigpending @@ -22,3 +24,4 @@ int sigpending(sigset_t * set) #else _syscall1(int, sigpending, sigset_t *, set); #endif +#endif diff --git a/libc/sysdeps/linux/common/sigprocmask.c b/libc/sysdeps/linux/common/sigprocmask.c index dd7bd6c3a..d36a5045e 100644 --- a/libc/sysdeps/linux/common/sigprocmask.c +++ b/libc/sysdeps/linux/common/sigprocmask.c @@ -8,6 +8,8 @@ */ #include <sys/syscall.h> + +#if defined __USE_POSIX #include <signal.h> #undef sigprocmask @@ -68,3 +70,4 @@ int sigprocmask(int how, const sigset_t * set, sigset_t * oldset) } #endif libc_hidden_def(sigprocmask) +#endif diff --git a/libc/sysdeps/linux/common/sigqueue.c b/libc/sysdeps/linux/common/sigqueue.c index 9019852f1..5d8e852fe 100644 --- a/libc/sysdeps/linux/common/sigqueue.c +++ b/libc/sysdeps/linux/common/sigqueue.c @@ -22,6 +22,7 @@ #include <string.h> #include <sys/syscall.h> +#if defined __USE_POSIX199309 libc_hidden_proto(getpid) libc_hidden_proto(getuid) @@ -51,3 +52,4 @@ int sigqueue (pid_t pid, int sig, const union sigval val) } #endif +#endif diff --git a/libc/sysdeps/linux/common/sigsuspend.c b/libc/sysdeps/linux/common/sigsuspend.c index 373bd333a..81bbbeec4 100644 --- a/libc/sysdeps/linux/common/sigsuspend.c +++ b/libc/sysdeps/linux/common/sigsuspend.c @@ -8,6 +8,8 @@ */ #include <sys/syscall.h> + +#if defined __USE_POSIX #include <signal.h> extern __typeof(sigsuspend) __libc_sigsuspend; @@ -33,3 +35,4 @@ int __libc_sigsuspend(const sigset_t * set) libc_hidden_proto(sigsuspend) weak_alias(__libc_sigsuspend,sigsuspend) libc_hidden_weak(sigsuspend) +#endif diff --git a/libc/sysdeps/linux/common/statfs.c b/libc/sysdeps/linux/common/statfs.c index eb029a26a..38c277fad 100644 --- a/libc/sysdeps/linux/common/statfs.c +++ b/libc/sysdeps/linux/common/statfs.c @@ -12,6 +12,14 @@ #include <sys/param.h> #include <sys/vfs.h> +extern __typeof(statfs) __libc_statfs; +libc_hidden_proto(__libc_statfs) +#define __NR___libc_statfs __NR_statfs +_syscall2(int, __libc_statfs, const char *, path, struct statfs *, buf); +libc_hidden_def(__libc_statfs) + +#if defined __UCLIBC_LINUX_SPECIFIC__ libc_hidden_proto(statfs) -_syscall2(int, statfs, const char *, path, struct statfs *, buf); -libc_hidden_def(statfs) +weak_alias(__libc_statfs,statfs) +libc_hidden_weak(statfs) +#endif diff --git a/libc/sysdeps/linux/common/symlink.c b/libc/sysdeps/linux/common/symlink.c index 80fb58a28..97f34eb8f 100644 --- a/libc/sysdeps/linux/common/symlink.c +++ b/libc/sysdeps/linux/common/symlink.c @@ -8,5 +8,7 @@ */ #include <sys/syscall.h> +#if defined __USE_BSD || defined __USE_UNIX98 || defined __USE_XOPEN2K #include <unistd.h> _syscall2(int, symlink, const char *, oldpath, const char *, newpath); +#endif diff --git a/libc/sysdeps/linux/common/sync.c b/libc/sysdeps/linux/common/sync.c index 48fac63ea..dd69e335b 100644 --- a/libc/sysdeps/linux/common/sync.c +++ b/libc/sysdeps/linux/common/sync.c @@ -7,10 +7,9 @@ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. */ -#include <features.h> -#include <errno.h> -#include <sys/types.h> #include <sys/syscall.h> +# if defined __USE_BSD || defined __USE_UNIX98 +#include <sys/types.h> #include <unistd.h> #ifndef INLINE_SYSCALL @@ -23,4 +22,4 @@ void sync(void) { INLINE_SYSCALL(sync, 0); } - +#endif diff --git a/libc/sysdeps/linux/common/sysctl.c b/libc/sysdeps/linux/common/sysctl.c index 3cd4f5e41..adee22837 100644 --- a/libc/sysdeps/linux/common/sysctl.c +++ b/libc/sysdeps/linux/common/sysctl.c @@ -8,6 +8,8 @@ */ #include <sys/syscall.h> +#if defined __NR__sysctl && (defined __USE_GNU || defined __USE_BSD) + /* psm: including sys/sysctl.h would depend on kernel headers */ extern int sysctl (int *__name, int __nlen, void *__oldval, size_t *__oldlenp, void *__newval, size_t __newlen) __THROW; @@ -29,13 +31,14 @@ int sysctl(int *name, int nlen, void *oldval, size_t * oldlenp, void *newval, size_t newlen) { struct __sysctl_args args = { - name:name, - nlen:nlen, - oldval:oldval, - oldlenp:oldlenp, - newval:newval, - newlen:newlen + .name = name, + .nlen = nlen, + .oldval = oldval, + .oldlenp = oldlenp, + .newval = newval, + .newlen = newlen }; return _sysctl(&args); } +#endif diff --git a/libc/sysdeps/linux/common/sysfs.c b/libc/sysdeps/linux/common/sysfs.c index 5099d7bb0..a4292f768 100644 --- a/libc/sysdeps/linux/common/sysfs.c +++ b/libc/sysdeps/linux/common/sysfs.c @@ -9,8 +9,9 @@ /* libc isn't really supposed to export this */ #if 0 - #include <sys/syscall.h> -_syscall3(int, sysfs, int, option, unsigned int, index, char, addr); +#if defined __USE_SVID +_syscall3(int, sysfs, int, option, unsigned int, index, char, addr); +#endif #endif diff --git a/libc/sysdeps/linux/common/tee.c b/libc/sysdeps/linux/common/tee.c index 647440815..6725e82bb 100644 --- a/libc/sysdeps/linux/common/tee.c +++ b/libc/sysdeps/linux/common/tee.c @@ -10,19 +10,7 @@ #include <sys/syscall.h> #include <fcntl.h> -libc_hidden_proto(tee) - #ifdef __NR_tee _syscall4(ssize_t, tee, int, __fdin, int, __fdout, size_t, __len, unsigned int, __flags); -#else -ssize_t tee(int __fdin, int __fdout, size_t __len, unsigned int __flags) -{ - __set_errno(ENOSYS); - return -1; -} #endif - -libc_hidden_def(tee) - - diff --git a/libc/sysdeps/linux/common/truncate64.c b/libc/sysdeps/linux/common/truncate64.c index e227900c5..53c46fc56 100644 --- a/libc/sysdeps/linux/common/truncate64.c +++ b/libc/sysdeps/linux/common/truncate64.c @@ -57,7 +57,7 @@ int truncate64 (const char * path, __off64_t length) } #else /* __WORDSIZE */ -#error Your machine is not 64 bit or 32 bit, I am dazed and confused. +#error Your machine is not 64 bit nor 32 bit, I am dazed and confused. #endif /* __WORDSIZE */ #else /* __NR_truncate64 */ diff --git a/libc/sysdeps/linux/common/umount.c b/libc/sysdeps/linux/common/umount.c index f524ea1da..c62f9fb7c 100644 --- a/libc/sysdeps/linux/common/umount.c +++ b/libc/sysdeps/linux/common/umount.c @@ -8,6 +8,8 @@ */ #include <sys/syscall.h> + +#if defined __USE_GNU #include <sys/mount.h> /* arch provides umount() syscall */ @@ -36,3 +38,4 @@ int umount(const char *special_file) } #endif +#endif diff --git a/libc/sysdeps/linux/common/umount2.c b/libc/sysdeps/linux/common/umount2.c index 97ab41e72..25c24d450 100644 --- a/libc/sysdeps/linux/common/umount2.c +++ b/libc/sysdeps/linux/common/umount2.c @@ -8,8 +8,10 @@ */ #include <sys/syscall.h> -#ifdef __NR_umount2 /* Old kernels don't have umount2 */ + +#if defined __USE_GNU #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) @@ -18,3 +20,4 @@ int umount2(const char *special_file, int flags) return -1; } #endif +#endif diff --git a/libc/sysdeps/linux/common/uselib.c b/libc/sysdeps/linux/common/uselib.c index a18f3f463..ffc5d77a1 100644 --- a/libc/sysdeps/linux/common/uselib.c +++ b/libc/sysdeps/linux/common/uselib.c @@ -6,6 +6,8 @@ * * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. */ +#if 0 +linux specific and we do not use it in uClibc. #include <sys/syscall.h> #include <unistd.h> @@ -13,3 +15,4 @@ int uselib (const char *library); _syscall1(int, uselib, const char *, library); #endif +#endif diff --git a/libc/sysdeps/linux/common/utimes.c b/libc/sysdeps/linux/common/utimes.c index 4c7e10a87..83ddb7381 100644 --- a/libc/sysdeps/linux/common/utimes.c +++ b/libc/sysdeps/linux/common/utimes.c @@ -35,4 +35,5 @@ int utimes(const char *file, const struct timeval tvp[2]) return utime(file, times); } #endif +link_warning(utimes, "the use of LEGACY `utimes' is discouraged, use `utime'") libc_hidden_def(utimes) diff --git a/libc/sysdeps/linux/common/wait3.c b/libc/sysdeps/linux/common/wait3.c index 5de975c25..8a2d43f7a 100644 --- a/libc/sysdeps/linux/common/wait3.c +++ b/libc/sysdeps/linux/common/wait3.c @@ -4,11 +4,13 @@ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. */ -#include <syscall.h> +#include <sys/syscall.h> #include <sys/types.h> #include <sys/wait.h> #include <sys/resource.h> +#if defined __USE_BSD + libc_hidden_proto(wait4) /* Wait for a child to exit. When one does, put its status in *STAT_LOC and @@ -20,3 +22,4 @@ pid_t wait3 (__WAIT_STATUS stat_loc, int options, struct rusage * usage) { return wait4 (WAIT_ANY, stat_loc, options, usage); } +#endif diff --git a/libc/sysdeps/linux/common/wait4.c b/libc/sysdeps/linux/common/wait4.c index 4f0f21ddf..ff3b82645 100644 --- a/libc/sysdeps/linux/common/wait4.c +++ b/libc/sysdeps/linux/common/wait4.c @@ -8,6 +8,7 @@ */ #include <sys/syscall.h> +#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED #include <sys/wait.h> #include <sys/resource.h> @@ -22,3 +23,4 @@ pid_t wait4(pid_t pid, int *status, int opts, struct rusage *rusage) return (__syscall_wait4(pid, status, opts, rusage)); } libc_hidden_def(wait4) +#endif diff --git a/libc/sysdeps/linux/common/waitid.c b/libc/sysdeps/linux/common/waitid.c index 0e25acb62..b8d2f70ba 100644 --- a/libc/sysdeps/linux/common/waitid.c +++ b/libc/sysdeps/linux/common/waitid.c @@ -6,10 +6,11 @@ */ #include <sys/syscall.h> + +#if defined __USE_SVID || defined __USE_XOPEN #include <unistd.h> #include <sys/types.h> #include <sys/wait.h> -#ifdef __NR_waitid _syscall4(int, waitid, idtype_t, idtype, id_t, id, siginfo_t*, infop, int, options); #endif |