From 251a3c19cb4bba47fcd38c697b3d7679b3edb137 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Fri, 22 Oct 2010 15:24:13 +0200 Subject: sleep: employ __USE_EXTERN_INLINES (with necessary fixes) __USE_EXTERN_INLINES was unused and had bit-rotted, had to fix it when it didn't work as intended at first. text data bss dec hex filename - 168 0 0 168 a8 libc/unistd/sleep.o + 146 0 0 146 92 libc/unistd/sleep.o Signed-off-by: Denys Vlasenko --- libc/sysdeps/linux/common/bits/sigset.h | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'libc/sysdeps/linux/common') diff --git a/libc/sysdeps/linux/common/bits/sigset.h b/libc/sysdeps/linux/common/bits/sigset.h index 2f67a4ebf..7c2ce0ebe 100644 --- a/libc/sysdeps/linux/common/bits/sigset.h +++ b/libc/sysdeps/linux/common/bits/sigset.h @@ -53,10 +53,6 @@ typedef struct { #if !defined _SIGSET_H_fns && defined _SIGNAL_H # define _SIGSET_H_fns 1 -# ifndef _EXTERN_INLINE -# define _EXTERN_INLINE extern __inline -# endif - /* Return a mask that includes the bit for SIG only. */ /* Unsigned cast ensures shift/mask insns are used. */ # define __sigmask(sig) \ @@ -156,14 +152,24 @@ typedef struct { /* These functions needn't check for a bogus signal number -- error checking is done in the non __ versions. */ +# if !defined __USE_EXTERN_INLINES || defined __PROVIDE_OUT_OF_LINE_SIGSETFN extern int __sigismember (__const __sigset_t *, int); libc_hidden_proto(__sigismember) extern int __sigaddset (__sigset_t *, int); libc_hidden_proto(__sigaddset) extern int __sigdelset (__sigset_t *, int); libc_hidden_proto(__sigdelset) +# endif # ifdef __USE_EXTERN_INLINES +# undef _EXTERN_INLINE +# ifdef __PROVIDE_OUT_OF_LINE_SIGSETFN +# define _EXTERN_INLINE +# else /* normal case */ + /* dropped extern below: otherwise every module with __USE_EXTERN_INLINES + * will have its own copy of out-of line function emitted. */ +# define _EXTERN_INLINE /*extern*/ __always_inline +# endif # define __SIGSETFN(NAME, BODY, CONST) \ _EXTERN_INLINE int \ NAME (CONST __sigset_t *__set, int __sig) \ -- cgit v1.2.3 From 4bbf7dfe44bb83391b12ac94ca478df71fcf3dd7 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Fri, 22 Oct 2010 16:52:41 +0200 Subject: remove superfluous libc_hidden_proto(memcpy) and #include Signed-off-by: Denys Vlasenko --- libc/sysdeps/linux/common/__rt_sigtimedwait.c | 4 ---- libc/sysdeps/linux/common/__rt_sigwaitinfo.c | 4 ---- 2 files changed, 8 deletions(-) (limited to 'libc/sysdeps/linux/common') diff --git a/libc/sysdeps/linux/common/__rt_sigtimedwait.c b/libc/sysdeps/linux/common/__rt_sigtimedwait.c index 79b94adef..a7ab8fb61 100644 --- a/libc/sysdeps/linux/common/__rt_sigtimedwait.c +++ b/libc/sysdeps/linux/common/__rt_sigtimedwait.c @@ -12,11 +12,7 @@ #include #include -libc_hidden_proto(memcpy) - #ifdef __NR_rt_sigtimedwait -#include -libc_hidden_proto(memcpy) # ifdef __UCLIBC_HAS_THREADS_NATIVE__ # include diff --git a/libc/sysdeps/linux/common/__rt_sigwaitinfo.c b/libc/sysdeps/linux/common/__rt_sigwaitinfo.c index c8953bfbc..92a11c9b6 100644 --- a/libc/sysdeps/linux/common/__rt_sigwaitinfo.c +++ b/libc/sysdeps/linux/common/__rt_sigwaitinfo.c @@ -12,12 +12,8 @@ #include #include -libc_hidden_proto(memcpy) - #ifdef __NR_rt_sigtimedwait -#include - # ifdef __UCLIBC_HAS_THREADS_NATIVE__ # include -- cgit v1.2.3 From 162cfaea20d807f0ae329efe39292a9b22593b41 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Fri, 22 Oct 2010 17:01:05 +0200 Subject: *: inline constant __sig{add,del}set and __sigismember text data bss dec hex filename - 318 4 0 322 142 libc/pwd_grp/lckpwdf.o + 312 4 0 316 13c libc/pwd_grp/lckpwdf.o - 166 0 1 167 a7 libc/stdlib/abort.o + 157 0 1 158 9e libc/stdlib/abort.o - 42 0 0 42 2a libc/sysdeps/linux/common/pause.o + 27 0 0 27 1b libc/sysdeps/linux/common/pause.o Signed-off-by: Denys Vlasenko --- libc/sysdeps/linux/common/bits/sigset.h | 35 ++++++++++++++++++++++++++++++++- libc/sysdeps/linux/common/pause.c | 2 +- 2 files changed, 35 insertions(+), 2 deletions(-) (limited to 'libc/sysdeps/linux/common') diff --git a/libc/sysdeps/linux/common/bits/sigset.h b/libc/sysdeps/linux/common/bits/sigset.h index 7c2ce0ebe..4ef22311a 100644 --- a/libc/sysdeps/linux/common/bits/sigset.h +++ b/libc/sysdeps/linux/common/bits/sigset.h @@ -175,7 +175,7 @@ _EXTERN_INLINE int \ NAME (CONST __sigset_t *__set, int __sig) \ { \ unsigned long __mask = __sigmask (__sig); \ - unsigned long __word = __sigword (__sig); \ + unsigned __word = __sigword (__sig); \ return BODY; \ } @@ -186,5 +186,38 @@ __SIGSETFN (__sigdelset, ((__set->__val[__word] &= ~__mask), 0), ) # undef __SIGSETFN # endif +# ifdef _LIBC +/* It's far too much PITA to __USE_EXTERN_INLINES from within libc. + * Especially since we want to inline only calls with const sig, + * but __USE_EXTERN_INLINES will inline all calls! + */ +static __always_inline unsigned long +const_sigismember(const __sigset_t *set, int sig) +{ + unsigned long mask = __sigmask(sig); + unsigned word = __sigword(sig); + return (set->__val[word] & mask); +} +# define __sigismember(set, sig) \ + (__builtin_constant_p(sig) ? (const_sigismember(set, sig) != 0) : __sigismember(set, sig)) +static __always_inline void +const_sigaddset(__sigset_t *set, int sig) +{ + unsigned long mask = __sigmask(sig); + unsigned word = __sigword(sig); + set->__val[word] |= mask; +} +# define __sigaddset(set, sig) \ + (__builtin_constant_p(sig) ? (const_sigaddset(set, sig), 0) : __sigaddset(set, sig)) +static __always_inline void +const_sigdelset(__sigset_t *set, int sig) +{ + unsigned long mask = __sigmask(sig); + unsigned word = __sigword(sig); + set->__val[word] &= ~mask; +} +# define __sigdelset(set, sig) \ + (__builtin_constant_p(sig) ? (const_sigdelset(set, sig), 0) : __sigdelset(set, sig)) +# endif #endif /* ! _SIGSET_H_fns. */ diff --git a/libc/sysdeps/linux/common/pause.c b/libc/sysdeps/linux/common/pause.c index 33eb409c6..ab16fa73c 100644 --- a/libc/sysdeps/linux/common/pause.c +++ b/libc/sysdeps/linux/common/pause.c @@ -25,7 +25,7 @@ __libc_pause (void) { sigset_t set; - __sigemptyset (&set); + /*__sigemptyset (&set); - why? */ sigprocmask (SIG_BLOCK, NULL, &set); /* pause is a cancellation point, but so is sigsuspend. -- cgit v1.2.3 From fe713659049ac9127b58f2268004037e83e2cac4 Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Wed, 27 Oct 2010 22:18:23 +0200 Subject: Fix msync() redefinition for noMMU build An architecture that _may_ have a MMU (and thus implements the msync syscall), but for which the kernel and uClibc are built as noMMU, we have a stub for msync. Thanks to Steven J. Magnani for noticing. Signed-off-by: Bernhard Reutner-Fischer --- libc/sysdeps/linux/common/Makefile.in | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'libc/sysdeps/linux/common') diff --git a/libc/sysdeps/linux/common/Makefile.in b/libc/sysdeps/linux/common/Makefile.in index 4222912fc..8a4add813 100644 --- a/libc/sysdeps/linux/common/Makefile.in +++ b/libc/sysdeps/linux/common/Makefile.in @@ -49,6 +49,11 @@ CSRC := $(filter-out waitpid.c, $(CSRC)) endif endif +ifneq ($(ARCH_USE_MMU),y) +# stubbed out in mman.h +CSRC := $(filter-out msync.c, $(CSRC)) +endif + ifneq ($(UCLIBC_BSD_SPECIFIC),y) # we need these internally: getdomainname.c CSRC := $(filter-out mincore.c setdomainname.c,$(CSRC)) -- cgit v1.2.3 From 7e308604ee0aa67bc37f37d6f69ed41481c427a0 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Sun, 31 Oct 2010 03:03:38 +0100 Subject: libm: improve readability of math.h; expand comments and docs Signed-off-by: Denys Vlasenko --- libc/sysdeps/linux/common/bits/mathcalls.h | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'libc/sysdeps/linux/common') diff --git a/libc/sysdeps/linux/common/bits/mathcalls.h b/libc/sysdeps/linux/common/bits/mathcalls.h index 3772b7d0d..1e92b527e 100644 --- a/libc/sysdeps/linux/common/bits/mathcalls.h +++ b/libc/sysdeps/linux/common/bits/mathcalls.h @@ -48,11 +48,16 @@ #endif -/* __MATHCALLX and __MATHCALLI include libm_hidden_def +/* __MATHCALLX(type,function,[suffix],args,attrib) and + * __MATHCALLI(type,function,[suffix],args) include libm_hidden_def * (for "double" versions only, xxxf and xxxl do not get this treatment). - * __MATHCALL does not. - * __MATHDECL_PRIV includes libm_hidden_def (always) - * and declares __foo, not foo. + * + * __MATHDECL(type,function,[suffix],args) does not. + * __MATHCALL(function,[suffix],args) also does not + * (it is just a shortcut to __MATHDECL(_Mdouble_,function,[suffix],args)). + * + * __MATHDECL_PRIV(type,function,[suffix],args,attrib) + * includes libm_hidden_def (always) and declares __foo, not foo. */ -- cgit v1.2.3