From 6349a663038dbe7b59467c5bd06cd5f5dc91c867 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Sun, 6 Feb 2011 23:51:23 +0100 Subject: fix a problem with hidden getutent in non-threaded builds Signed-off-by: Denys Vlasenko --- libc/misc/utmp/utent.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libc') diff --git a/libc/misc/utmp/utent.c b/libc/misc/utmp/utent.c index bf265c2a3..11d615437 100644 --- a/libc/misc/utmp/utent.c +++ b/libc/misc/utmp/utent.c @@ -98,8 +98,8 @@ struct utmp *getutent(void) __UCLIBC_MUTEX_UNLOCK(utmplock); return ret; } -libc_hidden_def(getutent) #endif +libc_hidden_def(getutent) void endutent(void) { -- cgit v1.2.3 From 6a0aa4add30eecf76b9d14ad3f204e4017f9f22c Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Wed, 9 Feb 2011 20:08:20 +0100 Subject: arm: mv nptl specific atomic impl to common place Thanks to Nitin Garg for notincing! Signed-off-by: Bernhard Reutner-Fischer --- libc/sysdeps/linux/arm/bits/atomic.h | 122 +++++++++++++++++++++++++++++++++++ 1 file changed, 122 insertions(+) create mode 100644 libc/sysdeps/linux/arm/bits/atomic.h (limited to 'libc') diff --git a/libc/sysdeps/linux/arm/bits/atomic.h b/libc/sysdeps/linux/arm/bits/atomic.h new file mode 100644 index 000000000..8f63e2510 --- /dev/null +++ b/libc/sysdeps/linux/arm/bits/atomic.h @@ -0,0 +1,122 @@ +/* Copyright (C) 2002, 2003, 2004, 2005 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include + + +typedef int8_t atomic8_t; +typedef uint8_t uatomic8_t; +typedef int_fast8_t atomic_fast8_t; +typedef uint_fast8_t uatomic_fast8_t; + +typedef int32_t atomic32_t; +typedef uint32_t uatomic32_t; +typedef int_fast32_t atomic_fast32_t; +typedef uint_fast32_t uatomic_fast32_t; + +typedef intptr_t atomicptr_t; +typedef uintptr_t uatomicptr_t; +typedef intmax_t atomic_max_t; +typedef uintmax_t uatomic_max_t; + +void __arm_link_error (void); + +#ifdef __thumb2__ +#define atomic_full_barrier() \ + __asm__ __volatile__ \ + ("movw\tip, #0x0fa0\n\t" \ + "movt\tip, #0xffff\n\t" \ + "blx\tip" \ + : : : "ip", "lr", "cc", "memory"); +#else +#define atomic_full_barrier() \ + __asm__ __volatile__ \ + ("mov\tip, #0xffff0fff\n\t" \ + "mov\tlr, pc\n\t" \ + "add\tpc, ip, #(0xffff0fa0 - 0xffff0fff)" \ + : : : "ip", "lr", "cc", "memory"); +#endif + +/* Atomic compare and exchange. This sequence relies on the kernel to + provide a compare and exchange operation which is atomic on the + current architecture, either via cleverness on pre-ARMv6 or via + ldrex / strex on ARMv6. */ + +#define __arch_compare_and_exchange_val_8_acq(mem, newval, oldval) \ + ({ __arm_link_error (); oldval; }) + +#define __arch_compare_and_exchange_val_16_acq(mem, newval, oldval) \ + ({ __arm_link_error (); oldval; }) + +/* It doesn't matter what register is used for a_oldval2, but we must + specify one to work around GCC PR rtl-optimization/21223. Otherwise + it may cause a_oldval or a_tmp to be moved to a different register. */ + +#ifdef __thumb2__ +/* Thumb-2 has ldrex/strex. However it does not have barrier instructions, + so we still need to use the kernel helper. */ +#define __arch_compare_and_exchange_val_32_acq(mem, newval, oldval) \ + ({ register __typeof (oldval) a_oldval __asm__ ("r0"); \ + register __typeof (oldval) a_newval __asm__ ("r1") = (newval); \ + register __typeof (mem) a_ptr __asm__ ("r2") = (mem); \ + register __typeof (oldval) a_tmp __asm__ ("r3"); \ + register __typeof (oldval) a_oldval2 __asm__ ("r4") = (oldval); \ + __asm__ __volatile__ \ + ("0:\tldr\t%[tmp],[%[ptr]]\n\t" \ + "cmp\t%[tmp], %[old2]\n\t" \ + "bne\t1f\n\t" \ + "mov\t%[old], %[old2]\n\t" \ + "movw\t%[tmp], #0x0fc0\n\t" \ + "movt\t%[tmp], #0xffff\n\t" \ + "blx\t%[tmp]\n\t" \ + "bcc\t0b\n\t" \ + "mov\t%[tmp], %[old2]\n\t" \ + "1:" \ + : [old] "=&r" (a_oldval), [tmp] "=&r" (a_tmp) \ + : [new] "r" (a_newval), [ptr] "r" (a_ptr), \ + [old2] "r" (a_oldval2) \ + : "ip", "lr", "cc", "memory"); \ + a_tmp; }) +#else +#define __arch_compare_and_exchange_val_32_acq(mem, newval, oldval) \ + ({ register __typeof (oldval) a_oldval __asm__ ("r0"); \ + register __typeof (oldval) a_newval __asm__ ("r1") = (newval); \ + register __typeof (mem) a_ptr __asm__ ("r2") = (mem); \ + register __typeof (oldval) a_tmp __asm__ ("r3"); \ + register __typeof (oldval) a_oldval2 __asm__ ("r4") = (oldval); \ + __asm__ __volatile__ \ + ("0:\tldr\t%[tmp],[%[ptr]]\n\t" \ + "cmp\t%[tmp], %[old2]\n\t" \ + "bne\t1f\n\t" \ + "mov\t%[old], %[old2]\n\t" \ + "mov\t%[tmp], #0xffff0fff\n\t" \ + "mov\tlr, pc\n\t" \ + "add\tpc, %[tmp], #(0xffff0fc0 - 0xffff0fff)\n\t" \ + "bcc\t0b\n\t" \ + "mov\t%[tmp], %[old2]\n\t" \ + "1:" \ + : [old] "=&r" (a_oldval), [tmp] "=&r" (a_tmp) \ + : [new] "r" (a_newval), [ptr] "r" (a_ptr), \ + [old2] "r" (a_oldval2) \ + : "ip", "lr", "cc", "memory"); \ + a_tmp; }) +#endif + +#define __arch_compare_and_exchange_val_64_acq(mem, newval, oldval) \ + ({ __arm_link_error (); oldval; }) -- cgit v1.2.3 From 6f810c757e5b14a97f05652972e91f95e321a404 Mon Sep 17 00:00:00 2001 From: Peter Korsgaard Date: Wed, 2 Feb 2011 17:58:38 +0100 Subject: sync bits/socket.h PF_* / AF_* values with 2.6.38-rc3 A number of new address / protocol families have been added over the years, so sync with Linux 2.6.38-rc3, adding CAN, ISDN, Phonet, Zigbee, .. which are starting to be used by applications. Signed-off-by: Peter Korsgaard Signed-off-by: Bernhard Reutner-Fischer --- libc/sysdeps/linux/common/bits/socket.h | 22 +++++++++++++++++++++- libc/sysdeps/linux/mips/bits/socket.h | 22 +++++++++++++++++++++- libc/sysdeps/linux/sparc/bits/socket.h | 22 +++++++++++++++++++++- 3 files changed, 63 insertions(+), 3 deletions(-) (limited to 'libc') 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/mips/bits/socket.h b/libc/sysdeps/linux/mips/bits/socket.h index b46e7be28..27ceafafe 100644 --- a/libc/sysdeps/linux/mips/bits/socket.h +++ b/libc/sysdeps/linux/mips/bits/socket.h @@ -100,8 +100,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 @@ -132,7 +142,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/sparc/bits/socket.h b/libc/sysdeps/linux/sparc/bits/socket.h index e41527fd3..64973e2cf 100644 --- a/libc/sysdeps/linux/sparc/bits/socket.h +++ b/libc/sysdeps/linux/sparc/bits/socket.h @@ -88,8 +88,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 @@ -120,7 +130,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. -- cgit v1.2.3 From 9a9a6365d5c5abb0fe3ec6cc09542e9c7e1d3bec Mon Sep 17 00:00:00 2001 From: Jones Desougi Date: Thu, 10 Jun 2010 15:04:51 +0200 Subject: *printf: Violation of precision with null string When a string format is processed and the argument is NULL, this yields "(null)" regardless of precision. This does not make sense, precision should not be exceeded. A simple test shows that glibc outputs nothing if precision is smaller than six and the attached patch implements this same behaviour. Consider the not uncommon case of strings implemented like this: struct string { int len; char *ptr; }; There is often no nultermination and they may be printed like this: printf("%.*s", string.len, string.ptr); If len is 0 then ptr may be anything, but NULL is a common value. Obviously the empty string would be expected, not "(null)". Signed-off-by: Jones Desougi Signed-off-by: Bernhard Reutner-Fischer --- libc/stdio/_vfprintf.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'libc') diff --git a/libc/stdio/_vfprintf.c b/libc/stdio/_vfprintf.c index 3b007084d..fa5dc44fc 100644 --- a/libc/stdio/_vfprintf.c +++ b/libc/stdio/_vfprintf.c @@ -1670,6 +1670,9 @@ static int _do_one_spec(FILE * __restrict stream, #endif s = "(null)"; slen = 6; + /* Use an empty string rather than truncation if precision is too small. */ + if (ppfs->info.prec >= 0 && ppfs->info.prec < slen) + slen = 0; } } else { /* char */ s = buf; @@ -1726,6 +1729,9 @@ static int _do_one_spec(FILE * __restrict stream, NULL_STRING: s = "(null)"; SLEN = slen = 6; + /* Use an empty string rather than truncation if precision is too small. */ + if (ppfs->info.prec >= 0 && ppfs->info.prec < slen) + SLEN = slen = 0; } } else { /* char */ *wbuf = btowc( (unsigned char)(*((const int *) *argptr)) ); -- cgit v1.2.3 From d0aa7016ee1a95849a5a448083d8f8e675d80b5b Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Wed, 9 Feb 2011 20:21:12 +0100 Subject: i386: extend IMA guards to also cover LTO See GCC PR47577; TODO: Remove them. Signed-off-by: Bernhard Reutner-Fischer --- libc/sysdeps/linux/i386/bits/syscalls.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'libc') diff --git a/libc/sysdeps/linux/i386/bits/syscalls.h b/libc/sysdeps/linux/i386/bits/syscalls.h index 9184bd6c3..eeafb3a48 100644 --- a/libc/sysdeps/linux/i386/bits/syscalls.h +++ b/libc/sysdeps/linux/i386/bits/syscalls.h @@ -43,9 +43,12 @@ /* We need some help from the assembler to generate optimal code. * We define some macros here which later will be used. */ +/* gcc>=4.6 with LTO need the same guards as IMA (a.k.a --combine) did. + * See gcc.gnu.org/PR47577 */ +/* FIXME: drop these b* macros! */ __asm__ ( -#ifdef __DOMULTI__ +#if defined __DOMULTI__ || __GNUC_PREREQ (4, 6) /* Protect against asm macro redefinition (happens in __DOMULTI__ mode). * Unfortunately, it ends up visible in .o files. */ ".ifndef _BITS_SYSCALLS_ASM\n\t" @@ -92,7 +95,7 @@ __asm__ ( ".endif\n\t" ".endm\n\t" -#ifdef __DOMULTI__ +#if defined __DOMULTI__ || __GNUC_PREREQ (4, 6) ".endif\n\t" /* _BITS_SYSCALLS_ASM */ #endif ); -- cgit v1.2.3 From da2d70ed69b57d63243a7b1e05ac7d43e91778ab Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Fri, 11 Feb 2011 17:26:19 +0100 Subject: arm: use CAS gcc builtin if SI-mode pattern is available Signed-off-by: Bernhard Reutner-Fischer --- libc/sysdeps/linux/arm/bits/atomic.h | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) (limited to 'libc') diff --git a/libc/sysdeps/linux/arm/bits/atomic.h b/libc/sysdeps/linux/arm/bits/atomic.h index 8f63e2510..07101fbe8 100644 --- a/libc/sysdeps/linux/arm/bits/atomic.h +++ b/libc/sysdeps/linux/arm/bits/atomic.h @@ -37,7 +37,12 @@ typedef uintmax_t uatomic_max_t; void __arm_link_error (void); -#ifdef __thumb2__ +/* Use the atomic builtins provided by GCC in case the backend provides + a pattern to do this efficiently. */ + +#ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 +#define atomic_full_barrier() __sync_synchronize () +#elif defined __thumb2__ #define atomic_full_barrier() \ __asm__ __volatile__ \ ("movw\tip, #0x0fa0\n\t" \ @@ -64,17 +69,21 @@ void __arm_link_error (void); #define __arch_compare_and_exchange_val_16_acq(mem, newval, oldval) \ ({ __arm_link_error (); oldval; }) +#ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 +#define __arch_compare_and_exchange_val_32_acq(mem, newval, oldval) \ + __sync_val_compare_and_swap ((mem), (oldval), (newval)) + /* It doesn't matter what register is used for a_oldval2, but we must specify one to work around GCC PR rtl-optimization/21223. Otherwise it may cause a_oldval or a_tmp to be moved to a different register. */ -#ifdef __thumb2__ +#elif defined __thumb2__ /* Thumb-2 has ldrex/strex. However it does not have barrier instructions, so we still need to use the kernel helper. */ #define __arch_compare_and_exchange_val_32_acq(mem, newval, oldval) \ - ({ register __typeof (oldval) a_oldval __asm__ ("r0"); \ - register __typeof (oldval) a_newval __asm__ ("r1") = (newval); \ - register __typeof (mem) a_ptr __asm__ ("r2") = (mem); \ + ({ register __typeof (oldval) a_oldval __asm__ ("r0"); \ + register __typeof (oldval) a_newval __asm__ ("r1") = (newval); \ + register __typeof (mem) a_ptr __asm__ ("r2") = (mem); \ register __typeof (oldval) a_tmp __asm__ ("r3"); \ register __typeof (oldval) a_oldval2 __asm__ ("r4") = (oldval); \ __asm__ __volatile__ \ @@ -95,9 +104,9 @@ void __arm_link_error (void); a_tmp; }) #else #define __arch_compare_and_exchange_val_32_acq(mem, newval, oldval) \ - ({ register __typeof (oldval) a_oldval __asm__ ("r0"); \ - register __typeof (oldval) a_newval __asm__ ("r1") = (newval); \ - register __typeof (mem) a_ptr __asm__ ("r2") = (mem); \ + ({ register __typeof (oldval) a_oldval __asm__ ("r0"); \ + register __typeof (oldval) a_newval __asm__ ("r1") = (newval); \ + register __typeof (mem) a_ptr __asm__ ("r2") = (mem); \ register __typeof (oldval) a_tmp __asm__ ("r3"); \ register __typeof (oldval) a_oldval2 __asm__ ("r4") = (oldval); \ __asm__ __volatile__ \ -- cgit v1.2.3 From 32814a2b15829df3a144391f5b8bd46e755f85f5 Mon Sep 17 00:00:00 2001 From: Kevin Cernekee Date: Thu, 10 Feb 2011 14:30:55 -0800 Subject: Fix GNU make v3.80 compatibility Commits 1f6601a and 094d82d introduced the "else ifeq" construct, which requires GNU make v3.81 or higher. This breaks the build on RHEL4 hosts. Signed-off-by: Kevin Cernekee Signed-off-by: Bernhard Reutner-Fischer --- libc/sysdeps/linux/common/Makefile.in | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'libc') diff --git a/libc/sysdeps/linux/common/Makefile.in b/libc/sysdeps/linux/common/Makefile.in index cf4cf8708..bd45d941b 100644 --- a/libc/sysdeps/linux/common/Makefile.in +++ b/libc/sysdeps/linux/common/Makefile.in @@ -42,9 +42,11 @@ 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) +else +ifeq ($(TARGET_ARCH),x86_64) CSRC := $(filter-out vfork.c, $(CSRC)) -else ifeq ($(TARGET_ARCH),mips) +else +ifeq ($(TARGET_ARCH),mips) ifeq ($(CONFIG_MIPS_O32_ABI),y) CSRC := $(filter-out waitpid.c, $(CSRC)) endif @@ -52,6 +54,8 @@ else CSRC := $(filter-out waitpid.c, $(CSRC)) endif endif +endif +endif ifneq ($(ARCH_USE_MMU),y) # stubbed out in mman.h -- cgit v1.2.3 From cdd129dbfe1234c41c7ebee538314417a757b8e8 Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Sun, 13 Feb 2011 15:56:30 +0100 Subject: nptl: fix typo in buildsys 0f85b228 used 'filter-pout' instead of 'filter-out'. Fix that. Signed-off-by: Bernhard Reutner-Fischer --- libc/sysdeps/linux/common/Makefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libc') diff --git a/libc/sysdeps/linux/common/Makefile.in b/libc/sysdeps/linux/common/Makefile.in index bd45d941b..30341fd35 100644 --- a/libc/sysdeps/linux/common/Makefile.in +++ b/libc/sysdeps/linux/common/Makefile.in @@ -34,7 +34,7 @@ CSRC := $(filter-out capget.c capset.c inotify.c ioperm.c iopl.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)) +CSRC := $(filter-out madvise.c,$(CSRC)) endif endif -- cgit v1.2.3 From 2c1c5db993c28e96b47a77148a4635931384810d Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Sun, 13 Feb 2011 16:19:12 +0100 Subject: regex: remove set but not used variable Signed-off-by: Bernhard Reutner-Fischer --- libc/misc/regex/regex_internal.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'libc') diff --git a/libc/misc/regex/regex_internal.c b/libc/misc/regex/regex_internal.c index de640e08d..c6ac8dda1 100644 --- a/libc/misc/regex/regex_internal.c +++ b/libc/misc/regex/regex_internal.c @@ -627,7 +627,7 @@ re_string_reconstruct (re_string_t *pstr, int idx, int eflags) if (pstr->is_utf8) { - const unsigned char *raw, *p, *q, *end; + const unsigned char *raw, *p, *end; /* Special case UTF-8. Multi-byte chars start with any byte other than 0x80 - 0xbf. */ @@ -654,13 +654,11 @@ re_string_reconstruct (re_string_t *pstr, int idx, int eflags) unsigned char buf[6]; size_t mbclen; - q = p; if (BE (pstr->trans != NULL, 0)) { int i = mlen < 6 ? mlen : 6; while (--i >= 0) buf[i] = pstr->trans[p[i]]; - q = buf; } /* XXX Don't use mbrtowc, we know which conversion to use (UTF-8 -> UCS4). */ -- cgit v1.2.3 From e5651d24e38e0a96f9f8ab7a44e34deb08e11084 Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Sun, 13 Feb 2011 18:31:27 +0100 Subject: buildsys: remove wrong file Somehow Makefile.in ended in there, remove it. Signed-off-by: Bernhard Reutner-Fischer --- libc/sysdeps/linux/common/Makefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libc') diff --git a/libc/sysdeps/linux/common/Makefile.in b/libc/sysdeps/linux/common/Makefile.in index 30341fd35..fdb06c5f4 100644 --- a/libc/sysdeps/linux/common/Makefile.in +++ b/libc/sysdeps/linux/common/Makefile.in @@ -74,7 +74,7 @@ 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)) +CSRC := $(filter-out 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,$(CSRC)) endif -- cgit v1.2.3 From 18e7136e79a89ba5e978f0dc445a8fcf8d619a40 Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Mon, 14 Feb 2011 20:54:57 +0100 Subject: buildsys: use kbuild style Signed-off-by: Bernhard Reutner-Fischer --- libc/sysdeps/linux/common/Makefile.in | 135 ++++++++++------------------------ 1 file changed, 39 insertions(+), 96 deletions(-) (limited to 'libc') diff --git a/libc/sysdeps/linux/common/Makefile.in b/libc/sysdeps/linux/common/Makefile.in index fdb06c5f4..229c39164 100644 --- a/libc/sysdeps/linux/common/Makefile.in +++ b/libc/sysdeps/linux/common/Makefile.in @@ -8,127 +8,70 @@ 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-$(UCLIBC_HAS_SSP) += 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-out 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 +CSRC-$(UCLIBC_HAS_THREADS_NATIVE) += fork.c getpid.c raise.c open.c close.c \ + read.c write.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- += waitpid.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 -endif -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 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 =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 -- cgit v1.2.3 From 0f4516e32c3a2186e6b6f074cfc6a57bde90e9cc Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Wed, 16 Feb 2011 19:31:06 +0100 Subject: buildsys: fix inverted logic with thread impls Signed-off-by: Bernhard Reutner-Fischer --- libc/sysdeps/linux/common/Makefile.in | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'libc') diff --git a/libc/sysdeps/linux/common/Makefile.in b/libc/sysdeps/linux/common/Makefile.in index 229c39164..a6d22e544 100644 --- a/libc/sysdeps/linux/common/Makefile.in +++ b/libc/sysdeps/linux/common/Makefile.in @@ -26,13 +26,12 @@ CSRC-$(UCLIBC_LINUX_SPECIFIC) += capget.c capset.c inotify.c ioperm.c iopl.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-$(if $(and $(UCLIBC_LINUX_SPECIFIC),$(UCLIBC_HAS_THREADS_NATIVE)),y) += madvise.c -CSRC-$(UCLIBC_HAS_THREADS_NATIVE) += fork.c getpid.c raise.c open.c close.c \ - read.c write.c ifeq ($(UCLIBC_HAS_THREADS_NATIVE),y) +CSRC- += fork.c getpid.c raise.c open.c close.c read.c write.c CSRC- += waitpid.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) +CSRC- += $(if $(findstring =mips=y=,=$(TARGET_ARCH)=$(CONFIG_MIPS_O32_ABI)=),waitpid.c) endif # stubbed out in mman.h CSRC-$(ARCH_USE_MMU) += msync.c -- cgit v1.2.3 From b3144c7169fe374b74172b55dfa547290b20fa9f Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Mon, 21 Feb 2011 19:38:39 -0500 Subject: bfin: add missing GNU-stack markings to __longjmp Signed-off-by: Mike Frysinger --- libc/sysdeps/linux/bfin/__longjmp.S | 2 ++ 1 file changed, 2 insertions(+) (limited to 'libc') diff --git a/libc/sysdeps/linux/bfin/__longjmp.S b/libc/sysdeps/linux/bfin/__longjmp.S index 673cd30e8..b2fafbb25 100644 --- a/libc/sysdeps/linux/bfin/__longjmp.S +++ b/libc/sysdeps/linux/bfin/__longjmp.S @@ -105,3 +105,5 @@ ___longjmp: .size ___longjmp,.-___longjmp libc_hidden_def(__longjmp) + +.section .note.GNU-stack,"",%progbits -- cgit v1.2.3 From f8355584a335a2a2dc03842f19ba9f1b587b2f5c Mon Sep 17 00:00:00 2001 From: Steve Kilbane Date: Mon, 21 Feb 2011 19:43:32 -0500 Subject: bfin: fix sram/dma syscall definitions Once we pull in the header, we're forced to declare the syscall with all the right types. Signed-off-by: Steve Kilbane Signed-off-by: Mike Frysinger --- libc/sysdeps/linux/bfin/dma-memcpy.c | 4 ++-- libc/sysdeps/linux/bfin/sram-alloc.c | 2 +- libc/sysdeps/linux/bfin/sram-free.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'libc') diff --git a/libc/sysdeps/linux/bfin/dma-memcpy.c b/libc/sysdeps/linux/bfin/dma-memcpy.c index 274b99e8c..b715aeba0 100644 --- a/libc/sysdeps/linux/bfin/dma-memcpy.c +++ b/libc/sysdeps/linux/bfin/dma-memcpy.c @@ -1,6 +1,6 @@ #include #include #include +#include -_syscall3 (__ptr_t, dma_memcpy, __ptr_t, dest, __ptr_t, src, size_t, len) - +_syscall3 (void *, dma_memcpy, void *, dest, const void *, src, size_t, len) diff --git a/libc/sysdeps/linux/bfin/sram-alloc.c b/libc/sysdeps/linux/bfin/sram-alloc.c index 6b33b2670..8518119d7 100644 --- a/libc/sysdeps/linux/bfin/sram-alloc.c +++ b/libc/sysdeps/linux/bfin/sram-alloc.c @@ -1,6 +1,6 @@ #include #include #include +#include _syscall2 (__ptr_t, sram_alloc, size_t, len, unsigned long, flags) - diff --git a/libc/sysdeps/linux/bfin/sram-free.c b/libc/sysdeps/linux/bfin/sram-free.c index 0fba936c8..8260eb660 100644 --- a/libc/sysdeps/linux/bfin/sram-free.c +++ b/libc/sysdeps/linux/bfin/sram-free.c @@ -1,6 +1,6 @@ #include #include #include +#include -_syscall1 (__ptr_t, sram_free, __ptr_t, addr) - +_syscall1 (int, sram_free, const void *, addr) -- cgit v1.2.3 From 128e290b1e4204ac33b4cad7fc6189447f029311 Mon Sep 17 00:00:00 2001 From: Steve Kilbane Date: Mon, 21 Feb 2011 19:44:42 -0500 Subject: bfin: add support for new cacheflush syscall Newer gcc's will generate a call to cacheflush when updating jump tables, and that has to be done in kernel space (to avoid hardware anomalies). So make sure uClibc provides that symbol. Signed-off-by: Steve Kilbane Signed-off-by: Mike Frysinger --- libc/sysdeps/linux/bfin/Makefile.arch | 2 +- libc/sysdeps/linux/bfin/cacheflush.c | 14 ++++++++++++++ libc/sysdeps/linux/bfin/sys/cachectl.h | 25 +++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 libc/sysdeps/linux/bfin/cacheflush.c create mode 100644 libc/sysdeps/linux/bfin/sys/cachectl.h (limited to 'libc') diff --git a/libc/sysdeps/linux/bfin/Makefile.arch b/libc/sysdeps/linux/bfin/Makefile.arch index 242703757..425a68898 100644 --- a/libc/sysdeps/linux/bfin/Makefile.arch +++ b/libc/sysdeps/linux/bfin/Makefile.arch @@ -6,7 +6,7 @@ # CSRC := bsdsetjmp.c clone.c \ - sram-alloc.c sram-free.c dma-memcpy.c + sram-alloc.c sram-free.c dma-memcpy.c cacheflush.c SSRC := __longjmp.S setjmp.S bsd-_setjmp.S diff --git a/libc/sysdeps/linux/bfin/cacheflush.c b/libc/sysdeps/linux/bfin/cacheflush.c new file mode 100644 index 000000000..a8d81c419 --- /dev/null +++ b/libc/sysdeps/linux/bfin/cacheflush.c @@ -0,0 +1,14 @@ +/* + * cacheflush.c - Cache control functions for Blackfin. + * + * Copyright (C) 2010 Analog Devices Inc. + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ + +#include +#include +#include +#include + +_syscall3 (int, cacheflush, void *, start, const int, nbytes, const int, flags) diff --git a/libc/sysdeps/linux/bfin/sys/cachectl.h b/libc/sysdeps/linux/bfin/sys/cachectl.h new file mode 100644 index 000000000..ee4c03155 --- /dev/null +++ b/libc/sysdeps/linux/bfin/sys/cachectl.h @@ -0,0 +1,25 @@ +/* + * cachectl.h - Functions for cache control on Blackfin. + * + * Copyright (C) 2010 Analog Devices, Inc. + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ + +#ifndef _SYS_CACHECTL_H +#define _SYS_CACHECTL_H 1 + +#include + +/* + * Get the kernel definition for the flag bits + */ +#include + +__BEGIN_DECLS + +extern int cacheflush (void *addr, __const int nbytes, __const int flags); + +__END_DECLS + +#endif /* sys/cachectl.h */ -- cgit v1.2.3 From 9bc14fb42980b738abfcd8be8cffcca0937b5220 Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Tue, 22 Feb 2011 18:12:26 +0100 Subject: nptl: imit waitpid just for MIPS O32 Signed-off-by: Bernhard Reutner-Fischer --- libc/sysdeps/linux/common/Makefile.in | 1 - 1 file changed, 1 deletion(-) (limited to 'libc') diff --git a/libc/sysdeps/linux/common/Makefile.in b/libc/sysdeps/linux/common/Makefile.in index a6d22e544..302fa6450 100644 --- a/libc/sysdeps/linux/common/Makefile.in +++ b/libc/sysdeps/linux/common/Makefile.in @@ -28,7 +28,6 @@ CSRC-$(UCLIBC_LINUX_SPECIFIC) += capget.c capset.c inotify.c ioperm.c iopl.c \ CSRC-$(if $(and $(UCLIBC_LINUX_SPECIFIC),$(UCLIBC_HAS_THREADS_NATIVE)),y) += madvise.c ifeq ($(UCLIBC_HAS_THREADS_NATIVE),y) CSRC- += fork.c getpid.c raise.c open.c close.c read.c write.c -CSRC- += waitpid.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) -- cgit v1.2.3 From 435f73337eff129943249b0d59aad50c8df5bd2e Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Mon, 21 Feb 2011 21:29:58 -0500 Subject: tempname: fix int precision warnings The printf precision takes an integer, not a size_t. Otherwise we get: libc/misc/internals/tempname.c: In function '___path_search': libc/misc/internals/tempname.c:116: warning: field precision should have type 'int', but argument 3 has type 'size_t' field precision should have type 'int', but argument 5 has type 'size_t' Signed-off-by: Mike Frysinger --- libc/misc/internals/tempname.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'libc') diff --git a/libc/misc/internals/tempname.c b/libc/misc/internals/tempname.c index 4145c9478..0db28455b 100644 --- a/libc/misc/internals/tempname.c +++ b/libc/misc/internals/tempname.c @@ -62,7 +62,10 @@ int attribute_hidden ___path_search (char *tmpl, size_t tmpl_len, const char *di const char *pfx /*, int try_tmpdir*/) { /*const char *d; */ - size_t dlen, plen; + /* dir and pfx lengths should always fit into an int, + so don't bother using size_t here. Especially since + the printf func requires an int for precision (%*s). */ + int dlen, plen; if (!pfx || !pfx[0]) { -- cgit v1.2.3 From 9112a2398ec58b32cd1a1c6feae195bd8f9a46a2 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Tue, 22 Feb 2011 16:23:23 -0500 Subject: bfin: fix fp reference in _JMPBUF_UNWINDS We want to access the frame pointer, so do so directly rather than "overflowing" the pregs array and ending up at the fp member. This fixes the Blackfin build warnings: libpthread/linuxthreads.old/ptlongjmp.c: In function 'pthread_cleanup_upto': libpthread/linuxthreads.old/ptlongjmp.c:35: warning: array subscript is above array bounds libpthread/linuxthreads.old/ptlongjmp.c:56: warning: array subscript is above array bounds Signed-off-by: Mike Frysinger --- libc/sysdeps/linux/bfin/bits/setjmp.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libc') diff --git a/libc/sysdeps/linux/bfin/bits/setjmp.h b/libc/sysdeps/linux/bfin/bits/setjmp.h index ee3f5e787..adb9c23af 100644 --- a/libc/sysdeps/linux/bfin/bits/setjmp.h +++ b/libc/sysdeps/linux/bfin/bits/setjmp.h @@ -52,6 +52,6 @@ typedef struct /* Test if longjmp to JMPBUF would unwind the frame containing a local variable at ADDRESS. */ #define _JMPBUF_UNWINDS(jmpbuf, address) \ - ((void *) (address) < (void *) (jmpbuf)->__pregs[6]) + ((void *) (address) < (void *) (jmpbuf)->fp) #endif /* bits/setjmp.h */ -- cgit v1.2.3 From 73d59554144f429b1cf0d4d7fa7de42bdf59ad92 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Thu, 23 Jul 2009 01:11:38 -0400 Subject: unify stub logic Signed-off-by: Mike Frysinger --- libc/sysdeps/linux/arm/posix_fadvise.c | 2 +- libc/sysdeps/linux/arm/posix_fadvise64.c | 2 +- libc/sysdeps/linux/common/__rt_sigtimedwait.c | 12 +- libc/sysdeps/linux/common/__rt_sigwaitinfo.c | 11 +- libc/sysdeps/linux/common/bdflush.c | 6 - libc/sysdeps/linux/common/capget.c | 6 - libc/sysdeps/linux/common/capset.c | 7 +- libc/sysdeps/linux/common/create_module.c | 7 - libc/sysdeps/linux/common/delete_module.c | 6 - libc/sysdeps/linux/common/epoll.c | 18 --- libc/sysdeps/linux/common/fdatasync.c | 7 - libc/sysdeps/linux/common/fork.c | 12 -- libc/sysdeps/linux/common/get_kernel_syms.c | 6 - libc/sysdeps/linux/common/getpgrp.c | 6 - libc/sysdeps/linux/common/init_module.c | 6 - libc/sysdeps/linux/common/pivot_root.c | 6 - libc/sysdeps/linux/common/posix_fadvise.c | 3 +- libc/sysdeps/linux/common/posix_fadvise64.c | 3 +- libc/sysdeps/linux/common/query_module.c | 7 - libc/sysdeps/linux/common/sched_getaffinity.c | 6 - libc/sysdeps/linux/common/sched_setaffinity.c | 11 -- libc/sysdeps/linux/common/signalfd.c | 6 +- libc/sysdeps/linux/common/splice.c | 7 - libc/sysdeps/linux/common/stubs.c | 183 ++++++++++++++++++++++++++ libc/sysdeps/linux/common/sync_file_range.c | 6 - libc/sysdeps/linux/common/umount.c | 9 -- libc/sysdeps/linux/common/umount2.c | 6 - libc/sysdeps/linux/common/vmsplice.c | 7 - libc/sysdeps/linux/common/xattr.c | 78 ----------- libc/sysdeps/linux/i386/posix_fadvise64.S | 9 +- 30 files changed, 195 insertions(+), 266 deletions(-) create mode 100644 libc/sysdeps/linux/common/stubs.c (limited to 'libc') diff --git a/libc/sysdeps/linux/arm/posix_fadvise.c b/libc/sysdeps/linux/arm/posix_fadvise.c index 278bff981..80d3c5044 100644 --- a/libc/sysdeps/linux/arm/posix_fadvise.c +++ b/libc/sysdeps/linux/arm/posix_fadvise.c @@ -39,7 +39,7 @@ int posix_fadvise(int fd, off_t offset, off_t len, int advise) /* weak_alias(__libc_posix_fadvise, posix_fadvise); */ -#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) { diff --git a/libc/sysdeps/linux/arm/posix_fadvise64.c b/libc/sysdeps/linux/arm/posix_fadvise64.c index 4b27381d1..678c42f90 100644 --- a/libc/sysdeps/linux/arm/posix_fadvise64.c +++ b/libc/sysdeps/linux/arm/posix_fadvise64.c @@ -47,7 +47,7 @@ int posix_fadvise64(int fd, __off64_t offset, __off64_t len, int advise) /* weak_alias(__libc_posix_fadvise64, posix_fadvise64); */ -#else +#elif defined __UCLIBC_HAS_STUBS__ int posix_fadvise64(int fd, __off64_t offset, __off64_t len, int advise) { 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/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/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 + 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/getpgrp.c b/libc/sysdeps/linux/common/getpgrp.c index 5d36ba155..80a53daee 100644 --- a/libc/sysdeps/linux/common/getpgrp.c +++ b/libc/sysdeps/linux/common/getpgrp.c @@ -19,10 +19,4 @@ 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/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/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/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/stubs.c b/libc/sysdeps/linux/common/stubs.c new file mode 100644 index 000000000..dd4a384f8 --- /dev/null +++ b/libc/sysdeps/linux/common/stubs.c @@ -0,0 +1,183 @@ +/* + * 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 +#include + +#ifdef __UCLIBC_HAS_STUBS__ + +attribute_hidden int enosys_stub(void); +libc_hidden_proto(enosys_stub) + +attribute_hidden int enosys_stub(void) +{ + __set_errno(ENOSYS); + return -1; +} +libc_hidden_def(enosys_stub) + +#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_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/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 #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