From e949d522a31db675889bc87b6023e7edb6b30caa Mon Sep 17 00:00:00 2001 From: Austin Foxley Date: Sun, 27 Dec 2009 12:13:52 -0800 Subject: test/math: put scalbf test under susv3 legacy define Signed-off-by: Austin Foxley --- test/math/compile_test.c | 2 ++ test/math/libm-test.inc | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/test/math/compile_test.c b/test/math/compile_test.c index 361556a81..61488857a 100644 --- a/test/math/compile_test.c +++ b/test/math/compile_test.c @@ -51,7 +51,9 @@ r += remainderf(float_x, float_x); /*r += remquof(float_x, float_x, &int_x); - uclibc does not have it (yet?) */ r += rintf(float_x); r += roundf(float_x); +#ifdef __UCLIBC_SUSV3_LEGACY__ r += scalbf(float_x, float_x); +#endif /*r += scalblnf(float_x, long_x); - uclibc does not have it (yet?) */ r += scalbnf(float_x, int_x); r += significandf(float_x); diff --git a/test/math/libm-test.inc b/test/math/libm-test.inc index 37ebd3c28..4570bcc09 100644 --- a/test/math/libm-test.inc +++ b/test/math/libm-test.inc @@ -4233,6 +4233,7 @@ scalb_test (void) { START (scalb); #ifndef TEST_LDOUBLE /* uclibc doesn't have scalbl */ +#ifdef __UCLIBC_SUSV3_LEGACY__ /* scalbf is susv3 legacy */ TEST_ff_f (scalb, 2.0, 0.5, nan_value, INVALID_EXCEPTION); TEST_ff_f (scalb, 3.0, -2.5, nan_value, INVALID_EXCEPTION); @@ -4283,7 +4284,8 @@ scalb_test (void) TEST_ff_f (scalb, 0.8L, 4, 12.8L); TEST_ff_f (scalb, -0.854375L, 5, -27.34L); -#endif +#endif /* __UCLIBC_SUSV3_LEGACY__ */ +#endif /* TEST_LDOUBLE */ END (scalb); } -- cgit v1.2.3 From 957e238614326198452b53498ae98e546fce7366 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Sat, 9 Jan 2010 21:58:50 +0100 Subject: ctime: do not use static struct tm buffer text data bss dec hex filename - 19 0 0 19 13 libc/misc/time/ctime.o + 25 0 0 25 19 libc/misc/time/ctime.o Signed-off-by: Denys Vlasenko --- libc/misc/time/time.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/libc/misc/time/time.c b/libc/misc/time/time.c index 583c17aad..dfa8c0daf 100644 --- a/libc/misc/time/time.c +++ b/libc/misc/time/time.c @@ -274,7 +274,7 @@ libc_hidden_def(asctime) * If we take the implicit assumption as given, then the implementation below * is still incorrect for tm_year values < -900, as there will be either * 0-padding and/or a missing negative sign for the year conversion . But given - * the ususal use of asctime(), I think it isn't unreasonable to restrict correct + * the usual use of asctime(), I think it isn't unreasonable to restrict correct * operation to the domain of years between 1000 and 9999. */ @@ -465,8 +465,22 @@ clock_t clock(void) char *ctime(const time_t *t) { - /* ANSI/ISO/SUSv3 say that ctime is equivalent to the following. */ - return asctime(localtime(t)); + /* ANSI/ISO/SUSv3 say that ctime is equivalent to the following: + * return asctime(localtime(t)); + * I don't think "equivalent" means "it uses the same internal buffer", + * it means "gives the same resultant string". + * + * I doubt anyone ever uses weird code like: + * struct tm *ptm = localtime(t1); ...; ctime(t2); use(ptm); + * which relies on the assumption that ctime's and localtime's + * internal static struct tm is the same. + * + * Using localtime_r instead of localtime avoids linking in + * localtime's static buffer: + */ + struct tm xtm; + + return asctime(localtime_r(t, &xtm)); } libc_hidden_def(ctime) #endif -- cgit v1.2.3 From 9c343fd4030dcd7a52616f365893177dded50346 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Tue, 12 Jan 2010 17:51:32 -0800 Subject: mips/nptl: Pass correct parameters to dl_find_hash when resolving TLS relocations. Make use of macros from sys/asm.h in crt1.S These two changes are needed for mips nptl to boot once again. Signed-off-by: Khem Raj --- ldso/ldso/mips/elfinterp.c | 20 ++++++++++++------ libc/sysdeps/linux/mips/crt1.S | 46 ++++++++++++------------------------------ 2 files changed, 27 insertions(+), 39 deletions(-) diff --git a/ldso/ldso/mips/elfinterp.c b/ldso/ldso/mips/elfinterp.c index b49f09d36..40c3e0939 100644 --- a/ldso/ldso/mips/elfinterp.c +++ b/ldso/ldso/mips/elfinterp.c @@ -148,7 +148,7 @@ int _dl_parse_relocation_information(struct dyn_elf *xpnt, unsigned long rel_addr, unsigned long rel_size) { ElfW(Sym) *symtab; - ElfW(Rel) *rpnt; + ELF_RELOC *rpnt; char *strtab; unsigned long i; unsigned long *got; @@ -162,7 +162,7 @@ int _dl_parse_relocation_information(struct dyn_elf *xpnt, /* Now parse the relocation information */ rel_size = rel_size / sizeof(ElfW(Rel)); - rpnt = (ElfW(Rel) *) rel_addr; + rpnt = (ELF_RELOC *) rel_addr; symtab = (ElfW(Sym) *) tpnt->dynamic_info[DT_SYMTAB]; strtab = (char *) tpnt->dynamic_info[DT_STRTAB]; @@ -172,8 +172,8 @@ int _dl_parse_relocation_information(struct dyn_elf *xpnt, char *symname = NULL; reloc_addr = (unsigned long *) (tpnt->loadaddr + (unsigned long) rpnt->r_offset); - reloc_type = ELF_R_TYPE(rpnt->r_info); - symtab_index = ELF_R_SYM(rpnt->r_info); + reloc_type = ELF32_R_TYPE(rpnt->r_info); + symtab_index = ELF32_R_SYM(rpnt->r_info); symbol_addr = 0; debug_sym(symtab,strtab,symtab_index); @@ -206,12 +206,20 @@ int _dl_parse_relocation_information(struct dyn_elf *xpnt, # endif { ElfW(Sym) *sym_tls = &symtab[symtab_index]; - struct elf_resolve *tpnt_tls = tpnt; + struct elf_resolve *tpnt_tls = NULL; if (ELF32_ST_BIND(symtab[symtab_index].st_info) != STB_LOCAL) { _dl_find_hash((strtab + symtab[symtab_index].st_name), - _dl_symbol_tables, tpnt_tls, 1, &sym_tls); + _dl_symbol_tables, tpnt, + elf_machine_type_class(reloc_type), &tpnt_tls); } +#if USE_TLS + /* In case of a TLS reloc, tpnt_tls NULL means we have an 'anonymous' + symbol. This is the case for a static tls variable, so the lookup + module is just that one is referencing the tls variable. */ + if (!tpnt_tls) + tpnt_tls = tpnt; +#endif switch (reloc_type) { case R_MIPS_TLS_DTPMOD64: diff --git a/libc/sysdeps/linux/mips/crt1.S b/libc/sysdeps/linux/mips/crt1.S index e851d52d2..6a804125e 100644 --- a/libc/sysdeps/linux/mips/crt1.S +++ b/libc/sysdeps/linux/mips/crt1.S @@ -85,29 +85,10 @@ __start: #ifdef __PIC__ -#if _MIPS_SIM == _MIPS_SIM_ABI32 - .frame sp, 24, sp - .set noreorder - move $0, $31 /* Save old ra. */ - bal 10f /* Find addr of cpload. */ - nop -10: - .cpload $31 - move $31, $0 - .set reorder - .cprestore 16 -#else - move $0, $31; /* Save old ra. */ - .set noreorder - bal 10f /* Find addr of .cpsetup. */ - nop -10: - .set reorder - .cpsetup $31, $25, 10b - move $31, $0 -#endif + SETUP_GPX($0) + SETUP_GPX64($25,$0) #else - la $28, _gp /* Setup GP correctly if we're non-PIC. */ + PTR_LA $28, _gp /* Setup GP correctly if we're non-PIC. */ move $31, $0 #endif @@ -118,18 +99,18 @@ __start: /* Allocate space on the stack for seven arguments and * make sure the stack is aligned to double words (8 bytes) */ + and $29, -2 * SZREG + #if _MIPS_SIM == _MIPS_SIM_ABI32 - and $29, -2 * 4 - subu $29, 32 - la $7, _init /* init */ - la $8, _fini - sw $8, 16($29) /* fini */ - sw $2, 20($29) /* rtld_fini */ - sw $29, 24($29) /* stack_end */ -#else - and $29, -2 * PTRSIZE + PTR_SUBIU $29, 32 +#endif PTR_LA $7, _init /* init */ - PTR_LA $8, _fini /* fini */ + PTR_LA $8, _fini +#if _MIPS_SIM == _MIPS_SIM_ABI32 + PTR_S $8, 16($29) /* fini */ + PTR_S $2, 20($29) /* rtld_fini */ + PTR_S $29, 24($29) /* stack_end */ +#else move $9, $2 /* rtld_fini */ move $10, $29 /* stack_end */ #endif @@ -148,4 +129,3 @@ __data_start: .weak data_start data_start = __data_start - -- cgit v1.2.3 From df9130a0dc1c9e3553fcfee68bb8a809e4f4a458 Mon Sep 17 00:00:00 2001 From: Yoshinori Sato Date: Sat, 16 Jan 2010 19:14:29 +0100 Subject: include unistd.h for smallint Signed-off-by: Yoshinori Sato Signed-off-by: Bernhard Reutner-Fischer --- libc/signal/sigwait.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libc/signal/sigwait.c b/libc/signal/sigwait.c index 6bca1b1e5..d0421f3d3 100644 --- a/libc/signal/sigwait.c +++ b/libc/signal/sigwait.c @@ -21,6 +21,7 @@ #include #include #include +#include #if defined __UCLIBC_HAS_REALTIME__ -- cgit v1.2.3 From c13dd47ecbbdb841042e1370c8011e84634db0e4 Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Fri, 15 Jan 2010 15:59:56 +0100 Subject: randconfig.sh: set number of make jobs Signed-off-by: Bernhard Reutner-Fischer --- extra/scripts/randconfig.sh | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/extra/scripts/randconfig.sh b/extra/scripts/randconfig.sh index 5986a9b12..4c7126bbc 100755 --- a/extra/scripts/randconfig.sh +++ b/extra/scripts/randconfig.sh @@ -6,6 +6,7 @@ # # The above builds random i386 configs and automatically stops after 30 minutes +test "x$AWK" = "x" && AWK=awk test "x$ARCH" = "x" && ARCH=`uname -m` KCONFIG_ALLCONFIG=.config.allconfig (echo TARGET_$ARCH=y @@ -15,12 +16,21 @@ KCONFIG_ALLCONFIG=.config.allconfig ) > $KCONFIG_ALLCONFIG export KCONFIG_ALLCONFIG +if test "x$NCPU" = "x" +then + test -r /proc/cpuinfo && \ + eval `$AWK 'BEGIN{NCPU=0} +/processor/{let NCPU++} +END{if (NCPU<1) {NCPU=1}; print("NCPU="NCPU);}' /proc/cpuinfo` || \ + NCPU=1 +fi +MAKELEVEL="-j$NCPU" i=0 while test ! -f STOP do - make $* randconfig > /dev/null - make $* silentoldconfig > /dev/null - if (make $*) 2>&1 >& mk.log + ARCH=$ARCH make $* randconfig > /dev/null + ARCH=$ARCH make $* silentoldconfig > /dev/null + if (make $MAKELEVEL $*) 2>&1 >& mk.log then : else -- cgit v1.2.3 From f331f6d2eff5fb623bcc42213ccec12c7dbf95fd Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Sat, 16 Jan 2010 19:14:12 +0100 Subject: rename exp(onent) to ex to avoid shadow warnings Signed-off-by: Bernhard Reutner-Fischer --- libm/ldouble_wrappers.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/libm/ldouble_wrappers.c b/libm/ldouble_wrappers.c index 34f06722e..7d5af90b6 100644 --- a/libm/ldouble_wrappers.c +++ b/libm/ldouble_wrappers.c @@ -313,9 +313,9 @@ long double fmodl (long double x, long double y) #endif #ifdef L_frexpl -long double frexpl (long double x, int *exp) +long double frexpl (long double x, int *ex) { - return (long double) frexp( (double)x, exp ); + return (long double) frexp( (double)x, ex ); } #endif @@ -340,9 +340,9 @@ int_WRAPPER1(ilogb) #endif #ifdef L_ldexpl -long double ldexpl (long double x, int exp) +long double ldexpl (long double x, int ex) { - return (long double) ldexp( (double)x, exp ); + return (long double) ldexp( (double)x, ex ); } #endif @@ -450,16 +450,16 @@ WRAPPER1(round) #endif #ifdef L_scalblnl -long double scalblnl (long double x, long exp) +long double scalblnl (long double x, long ex) { - return (long double) scalbln( (double)x, exp ); + return (long double) scalbln( (double)x, ex ); } #endif #ifdef L_scalbnl -long double scalbnl (long double x, int exp) +long double scalbnl (long double x, int ex) { - return (long double) scalbn( (double)x, exp ); + return (long double) scalbn( (double)x, ex ); } #endif -- cgit v1.2.3 From d0a8b14169c6f01dadd07f6b4e14cc335a62f234 Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Sat, 16 Jan 2010 19:18:38 +0100 Subject: futimens: add missing local prototype Signed-off-by: Bernhard Reutner-Fischer --- libc/sysdeps/linux/common/futimens.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libc/sysdeps/linux/common/futimens.c b/libc/sysdeps/linux/common/futimens.c index 32b21395b..0eaf26a4c 100644 --- a/libc/sysdeps/linux/common/futimens.c +++ b/libc/sysdeps/linux/common/futimens.c @@ -21,6 +21,7 @@ extern int utimensat (int __fd, __const char *__path, int __flags) __THROW; libc_hidden_proto(utimensat) +int futimens (int __fd, __const struct timespec __times[2]) __THROW; int futimens (int fd, __const struct timespec ts[2]) { return utimensat(fd, 0, ts, 0); -- cgit v1.2.3 From 1571ed1315ff95278fed019b838f183ee37cc198 Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Wed, 20 Jan 2010 23:42:57 +0100 Subject: test commit Signed-off-by: Bernhard Reutner-Fischer --- TODO | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TODO b/TODO index fcfaf011b..b94d5415f 100644 --- a/TODO +++ b/TODO @@ -16,9 +16,9 @@ TODO list for the uClibc 0.9.31 release: support arches: (- todo; + done) + arm + sh + + mips - i386 - x86_64 - - mips - ... *) Go through SUSv4 TOC: http://www.opengroup.org/onlinepubs/9699919799/xrat/contents.html -- cgit v1.2.3 From 81264e8097b705f3b2a7e29be0a1a2ea853230cb Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Tue, 19 Jan 2010 17:21:52 +0100 Subject: ether_line: fix build for socket && !ip The internal __ether_line helper needs ether_ntoa_r() Signed-off-by: Bernhard Reutner-Fischer --- include/netinet/ether.h | 7 +++---- libc/inet/Makefile.in | 4 ++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/include/netinet/ether.h b/include/netinet/ether.h index c850e3e4f..2e52679fa 100644 --- a/include/netinet/ether.h +++ b/include/netinet/ether.h @@ -31,7 +31,8 @@ __BEGIN_DECLS -#if defined __UCLIBC_HAS_IPV4__ || defined __UCLIBC_HAS_IPV6__ +#if defined __UCLIBC_HAS_SOCKET__ || defined __UCLIBC_HAS_IPV4__ || \ + defined __UCLIBC_HAS_IPV6__ /* Convert 48 bit Ethernet ADDRess to ASCII. */ extern char *ether_ntoa (__const struct ether_addr *__addr) __THROW; extern char *ether_ntoa_r (__const struct ether_addr *__addr, char *__buf) @@ -43,10 +44,8 @@ extern struct ether_addr *ether_aton (__const char *__asc) __THROW; extern struct ether_addr *ether_aton_r (__const char *__asc, struct ether_addr *__addr) __THROW; libc_hidden_proto(ether_aton_r) -#endif -#if defined __UCLIBC_HAS_SOCKET__ || defined __UCLIBC_HAS_IPV4__ || \ - defined __UCLIBC_HAS_IPV6__ + /* Map 48 bit Ethernet number ADDR to HOSTNAME. */ extern int ether_ntohost (char *__hostname, __const struct ether_addr *__addr) __THROW; diff --git a/libc/inet/Makefile.in b/libc/inet/Makefile.in index 23e8732b2..81319452f 100644 --- a/libc/inet/Makefile.in +++ b/libc/inet/Makefile.in @@ -20,7 +20,7 @@ endif ifneq ($(UCLIBC_HAS_IPV4)$(UCLIBC_HAS_IPV6),) CSRC += getservice.c getproto.c hostid.c getnetent.c getnetbynm.c getnetbyad.c \ inet_net.c herror.c if_index.c gai_strerror.c getaddrinfo.c \ - ether_addr.c ifaddrs.c ntop.c + ifaddrs.c ntop.c endif ifeq ($(UCLIBC_HAS_IPV6),y) CSRC += in6_addr.c @@ -62,7 +62,7 @@ CSRC += $(socketcalls_CSRC) opensock.c endif ifneq ($(UCLIBC_HAS_SOCKET)$(UCLIBC_HAS_IPV4)$(UCLIBC_HAS_IPV6),) -CSRC += ethers.c +CSRC += ethers.c ether_addr.c endif INET_SRC := $(patsubst %.c,$(INET_DIR)/%.c,$(CSRC)) -- cgit v1.2.3 From 2b12ef1e789227cf9425ae8645e62ba7c3a7d3a9 Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Tue, 19 Jan 2010 17:26:11 +0100 Subject: rename exp(onent) to _exp to avoid shadow warnings Signed-off-by: Bernhard Reutner-Fischer --- libm/s_ldexp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libm/s_ldexp.c b/libm/s_ldexp.c index b2809afc8..bc0f08e99 100644 --- a/libm/s_ldexp.c +++ b/libm/s_ldexp.c @@ -27,11 +27,11 @@ * does not (it does not set ERRNO). */ -double ldexp(double value, int exp) +double ldexp(double value, int _exp) { if (!isfinite(value) || value == 0.0) return value; - value = scalbn(value, exp); + value = scalbn(value, _exp); if (!isfinite(value) || value == 0.0) errno = ERANGE; return value; -- cgit v1.2.3 From 6140a2a7175a796a7c06119f036357db87a1b865 Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Tue, 19 Jan 2010 17:33:14 +0100 Subject: ldso: tweak shadow warning with preload file support The stat buffer is already declared at the top of the function. Signed-off-by: Bernhard Reutner-Fischer --- ldso/ldso/ldso.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/ldso/ldso/ldso.c b/ldso/ldso/ldso.c index 1f5c87a0d..0fbc8f135 100644 --- a/ldso/ldso/ldso.c +++ b/ldso/ldso/ldso.c @@ -683,7 +683,6 @@ void _dl_get_ready_to_run(struct elf_resolve *tpnt, DL_LOADADDR_TYPE load_addr, #ifdef __LDSO_PRELOAD_FILE_SUPPORT__ do { - struct stat st; char *preload; int fd; char c, *cp, *cp2; @@ -735,11 +734,11 @@ void _dl_get_ready_to_run(struct elf_resolve *tpnt, DL_LOADADDR_TYPE load_addr, tpnt1 = _dl_load_shared_library(0, &rpnt, NULL, cp2, trace_loaded_objects); if (!tpnt1) { -#ifdef __LDSO_LDD_SUPPORT__ +# ifdef __LDSO_LDD_SUPPORT__ if (trace_loaded_objects) _dl_dprintf(1, "\t%s => not found\n", cp2); else -#endif +# endif { _dl_dprintf(_dl_debug_file, "%s: can't load library '%s'\n", _dl_progname, cp2); _dl_exit(15); @@ -749,14 +748,14 @@ void _dl_get_ready_to_run(struct elf_resolve *tpnt, DL_LOADADDR_TYPE load_addr, _dl_debug_early("Loading: (%x) %s\n", DL_LOADADDR_BASE(tpnt1->loadaddr), tpnt1->libname); -#ifdef __LDSO_LDD_SUPPORT__ +# ifdef __LDSO_LDD_SUPPORT__ if (trace_loaded_objects && tpnt1->usage_count == 1) { _dl_dprintf(1, "\t%s => %s (%x)\n", cp2, tpnt1->libname, DL_LOADADDR_BASE(tpnt1->loadaddr)); } -#endif +# endif } /* find start of next library */ -- cgit v1.2.3 From 0d30e6a7666c3cab001e7343a71bfa2d3e5abbd4 Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Thu, 21 Jan 2010 10:36:13 +0100 Subject: fix typo in version mismatch msg Signed-off-by: Bernhard Reutner-Fischer --- libc/inet/rpc/rpc_prot.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libc/inet/rpc/rpc_prot.c b/libc/inet/rpc/rpc_prot.c index 2b1609ea9..bf55a3cfc 100644 --- a/libc/inet/rpc/rpc_prot.c +++ b/libc/inet/rpc/rpc_prot.c @@ -219,7 +219,7 @@ rejected (enum reject_stat rjct_stat, { switch (rjct_stat) { - case RPC_VERSMISMATCH: + case RPC_MISMATCH: error->re_status = RPC_VERSMISMATCH; return; case AUTH_ERROR: -- cgit v1.2.3 From 831ea78623556cbfae002477afc6256cacaaf2c6 Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Thu, 21 Jan 2010 10:42:02 +0100 Subject: wordexp: silence shadow warning Signed-off-by: Bernhard Reutner-Fischer --- libc/misc/wordexp/wordexp.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/libc/misc/wordexp/wordexp.c b/libc/misc/wordexp/wordexp.c index 1737ccc48..2f529158c 100644 --- a/libc/misc/wordexp/wordexp.c +++ b/libc/misc/wordexp/wordexp.c @@ -1444,28 +1444,28 @@ parse_param(char **word, size_t * word_length, size_t * max_length, size_t exp_len; size_t exp_maxl; char *p; - int quoted = 0; /* 1: single quotes; 2: double */ + int quotes = 0; /* 1: single quotes; 2: double */ expanded = w_newword(&exp_len, &exp_maxl); for (p = pattern; p && *p; p++) { - size_t offset; + size_t _offset; switch (*p) { case '"': - if (quoted == 2) - quoted = 0; - else if (quoted == 0) - quoted = 2; + if (quotes == 2) + quotes = 0; + else if (quotes == 0) + quotes = 2; else break; continue; case '\'': - if (quoted == 1) - quoted = 0; - else if (quoted == 0) - quoted = 1; + if (quotes == 1) + quotes = 0; + else if (quotes == 0) + quotes = 1; else break; @@ -1473,7 +1473,7 @@ parse_param(char **word, size_t * word_length, size_t * max_length, case '*': case '?': - if (quoted) { + if (quotes) { /* Convert quoted wildchar to escaped wildchar. */ expanded = w_addchar(expanded, &exp_len, &exp_maxl, '\\'); @@ -1484,9 +1484,9 @@ parse_param(char **word, size_t * word_length, size_t * max_length, break; case '$': - offset = 0; + _offset = 0; error = parse_dollars(&expanded, &exp_len, &exp_maxl, p, - &offset, flags, NULL, NULL, NULL, 1); + &_offset, flags, NULL, NULL, NULL, 1); if (error) { if (free_value) free(value); @@ -1496,16 +1496,16 @@ parse_param(char **word, size_t * word_length, size_t * max_length, goto do_error; } - p += offset; + p += _offset; continue; case '~': - if (quoted || exp_len) + if (quotes || exp_len) break; - offset = 0; + _offset = 0; error = parse_tilde(&expanded, &exp_len, &exp_maxl, p, - &offset, 0); + &_offset, 0); if (error) { if (free_value) free(value); @@ -1515,7 +1515,7 @@ parse_param(char **word, size_t * word_length, size_t * max_length, goto do_error; } - p += offset; + p += _offset; continue; case '\\': -- cgit v1.2.3 From 2b69e9906e5087a796b3a15e9aabcd102c705b19 Mon Sep 17 00:00:00 2001 From: Hans-Christian Egtvedt Date: Wed, 16 Dec 2009 13:16:08 +0100 Subject: avr32: add varargs handling of prctl syscall prctl is defined to use varargs in the header file, hence it needs varargs specific handling in the source. This patch properly handles the variodic argument before the syscall is passed to the kernel for the AVR32 architecture. Signed-off-by: Hans-Christian Egtvedt --- libc/sysdeps/linux/avr32/Makefile.arch | 2 +- libc/sysdeps/linux/avr32/prctl.c | 36 ++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 libc/sysdeps/linux/avr32/prctl.c diff --git a/libc/sysdeps/linux/avr32/Makefile.arch b/libc/sysdeps/linux/avr32/Makefile.arch index bc5f62550..98b85a7ce 100644 --- a/libc/sysdeps/linux/avr32/Makefile.arch +++ b/libc/sysdeps/linux/avr32/Makefile.arch @@ -5,7 +5,7 @@ # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. # -CSRC := brk.c clone.c mmap.c sigaction.c +CSRC := brk.c clone.c mmap.c prctl.c sigaction.c SSRC := __longjmp.S setjmp.S bsd-setjmp.S bsd-_setjmp.S \ sigrestorer.S syscall.S vfork.S diff --git a/libc/sysdeps/linux/avr32/prctl.c b/libc/sysdeps/linux/avr32/prctl.c new file mode 100644 index 000000000..4e146e35e --- /dev/null +++ b/libc/sysdeps/linux/avr32/prctl.c @@ -0,0 +1,36 @@ +/* + * prctl syscall for AVR32 Linux. + * + * Copyright (C) 2010 Atmel Corporation + * + * This file is subject to the terms and conditions of the GNU Lesser General + * Public License. See the file "COPYING.LIB" in the main directory of this + * archive for more details. + */ +#include +#include +#include + +#ifdef __NR_prctl +#define __NR___syscall_prctl __NR_prctl +static inline _syscall5(int, __syscall_prctl, int, option, long, arg2, + long, arg3, long, arg4, long, arg5); + +int prctl(int __option, ...) +{ + long arg2; + long arg3; + long arg4; + long arg5; + va_list ap; + + va_start(ap, __option); + arg2 = va_arg(ap, long); + arg3 = va_arg(ap, long); + arg4 = va_arg(ap, long); + arg5 = va_arg(ap, long); + va_end(ap); + + return INLINE_SYSCALL(prctl, 5, __option, arg2, arg3, arg4, arg5); +} +#endif -- cgit v1.2.3 From 8a2d6677c3d485e5cbc19a6a550ead83990f2b5d Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Fri, 22 Jan 2010 13:57:32 +0100 Subject: silence warning about implicit decl of sysctl ... and reinstate comment explaining the gory details Signed-off-by: Bernhard Reutner-Fischer --- libc/sysdeps/linux/common/sysctl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libc/sysdeps/linux/common/sysctl.c b/libc/sysdeps/linux/common/sysctl.c index f65a3eaa2..dde00be46 100644 --- a/libc/sysdeps/linux/common/sysctl.c +++ b/libc/sysdeps/linux/common/sysctl.c @@ -10,6 +10,7 @@ #include #if defined __NR__sysctl && (defined __USE_GNU || defined __USE_BSD) +/* psm: including sys/sysctl.h would depend on kernel headers */ struct __sysctl_args { int *name; int nlen; @@ -19,7 +20,8 @@ struct __sysctl_args { size_t newlen; unsigned long __unused[4]; }; - +extern int sysctl (int *__name, int __nlen, void *__oldval, + size_t *__oldlenp, void *__newval, size_t __newlen) __THROW; int sysctl(int *name, int nlen, void *oldval, size_t * oldlenp, void *newval, size_t newlen) { -- cgit v1.2.3 From 3266866d3545d9dcbff4ac5c97167078ddf6d888 Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Sat, 23 Jan 2010 21:11:47 +0100 Subject: libc/inet: convert to foo-y kbuild style Signed-off-by: Bernhard Reutner-Fischer --- libc/inet/Makefile.in | 52 +++++++++++++++++++-------------------------------- 1 file changed, 19 insertions(+), 33 deletions(-) diff --git a/libc/inet/Makefile.in b/libc/inet/Makefile.in index 81319452f..a91d37fce 100644 --- a/libc/inet/Makefile.in +++ b/libc/inet/Makefile.in @@ -12,61 +12,47 @@ include $(top_srcdir)libc/inet/rpc/Makefile.in INET_DIR := $(top_srcdir)libc/inet INET_OUT := $(top_builddir)libc/inet -CSRC := -ifneq ($(UCLIBC_HAS_CRYPT_IMPL)$(UCLIBC_HAS_IPV4)$(UCLIBC_HAS_IPV6),) +CSRC-y := # des uses ntohl -CSRC += ntohl.c -endif -ifneq ($(UCLIBC_HAS_IPV4)$(UCLIBC_HAS_IPV6),) -CSRC += getservice.c getproto.c hostid.c getnetent.c getnetbynm.c getnetbyad.c \ +CSRC-$(findstring y,$(UCLIBC_HAS_CRYPT_IMPL)$(UCLIBC_HAS_IPV4)$(UCLIBC_HAS_IPV6)) += ntohl.c +CSRC-$(findstring y,$(UCLIBC_HAS_IPV4)$(UCLIBC_HAS_IPV6)) += \ + getservice.c getproto.c hostid.c getnetent.c getnetbynm.c getnetbyad.c \ inet_net.c herror.c if_index.c gai_strerror.c getaddrinfo.c \ ifaddrs.c ntop.c -endif -ifeq ($(UCLIBC_HAS_IPV6),y) -CSRC += in6_addr.c -endif - +CSRC-$(UCLIBC_HAS_IPV6) += in6_addr.c # multi source addr.c -addr_CSRC := \ +CSRC-$(findstring y,$(UCLIBC_HAS_IPV4)$(UCLIBC_HAS_IPV6)) += \ inet_aton.c inet_addr.c inet_ntoa.c inet_makeaddr.c \ inet_lnaof.c inet_netof.c -ifneq ($(UCLIBC_HAS_IPV4)$(UCLIBC_HAS_IPV6),) -CSRC += $(addr_CSRC) -endif - # multi source resolv.c -resolv_CSRC += \ +CSRC-$(findstring y,$(UCLIBC_HAS_IPV4)$(UCLIBC_HAS_IPV6)) += \ encodeh.c decodeh.c encoded.c decoded.c \ encodeq.c encodea.c \ + read_etc_hosts_r.c \ dnslookup.c opennameservers.c closenameservers.c \ - read_etc_hosts_r.c get_hosts_byaddr_r.c get_hosts_byname_r.c \ getnameinfo.c \ - gethostbyaddr_r.c gethostbyname_r.c gethostbyname2_r.c gethostent_r.c \ - gethostbyaddr.c gethostbyname.c gethostbyname2.c gethostent.c \ + gethostent.c gethostent_r.c +CSRC-$(findstring y,$(UCLIBC_HAS_IPV4)$(UCLIBC_HAS_IPV6)) += \ + get_hosts_byaddr_r.c get_hosts_byname_r.c \ + gethostbyaddr_r.c gethostbyname_r.c gethostbyname2_r.c \ + gethostbyaddr.c gethostbyname.c gethostbyname2.c +CSRC-$(findstring y,$(UCLIBC_HAS_IPV4)$(UCLIBC_HAS_IPV6)) += \ res_init.c res_query.c res_comp.c ns_name.c \ _res_state.c -ifneq ($(UCLIBC_HAS_IPV4)$(UCLIBC_HAS_IPV6),) -CSRC += $(resolv_CSRC) ## # unused ATM -## CSRC += encodep.c decodep.c formquery.c -endif - +## CSRC-y += encodep.c decodep.c formquery.c # multi source socketcalls.c socketcalls_CSRC += \ accept.c bind.c connect.c getpeername.c getsockname.c \ getsockopt.c listen.c recv.c recvfrom.c recvmsg.c send.c sendmsg.c \ sendto.c setsockopt.c shutdown.c socket.c socketpair.c -ifeq ($(UCLIBC_HAS_SOCKET),y) -CSRC += $(socketcalls_CSRC) opensock.c -endif +CSRC-$(UCLIBC_HAS_SOCKET) += $(socketcalls_CSRC) opensock.c -ifneq ($(UCLIBC_HAS_SOCKET)$(UCLIBC_HAS_IPV4)$(UCLIBC_HAS_IPV6),) -CSRC += ethers.c ether_addr.c -endif +CSRC-$(findstring y,$(UCLIBC_HAS_SOCKET)$(UCLIBC_HAS_IPV4)$(UCLIBC_HAS_IPV6)) += ethers.c ether_addr.c -INET_SRC := $(patsubst %.c,$(INET_DIR)/%.c,$(CSRC)) -INET_OBJ := $(patsubst %.c,$(INET_OUT)/%.o,$(CSRC)) +INET_SRC := $(patsubst %.c,$(INET_DIR)/%.c,$(CSRC-y)) +INET_OBJ := $(patsubst %.c,$(INET_OUT)/%.o,$(CSRC-y)) libc-y += $(INET_OBJ) -- cgit v1.2.3 From 8df555e6f7c3f27c07ef0f45759b7f5a38fe67f9 Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Sat, 23 Jan 2010 21:22:32 +0100 Subject: libc/inet: set path to resolver file via CPP No objcode changes. Signed-off-by: Bernhard Reutner-Fischer --- libc/inet/Makefile.in | 1 + libc/inet/_res_state.c | 2 +- libc/inet/closenameservers.c | 2 +- libc/inet/decodea.c | 2 +- libc/inet/decoded.c | 2 +- libc/inet/decodeh.c | 2 +- libc/inet/decodep.c | 2 +- libc/inet/decodeq.c | 2 +- libc/inet/dnslookup.c | 2 +- libc/inet/encodea.c | 2 +- libc/inet/encoded.c | 2 +- libc/inet/encodeh.c | 2 +- libc/inet/encodep.c | 2 +- libc/inet/encodeq.c | 2 +- libc/inet/formquery.c | 2 +- libc/inet/get_hosts_byaddr_r.c | 2 +- libc/inet/get_hosts_byname_r.c | 2 +- libc/inet/gethostbyaddr.c | 2 +- libc/inet/gethostbyaddr_r.c | 2 +- libc/inet/gethostbyname.c | 2 +- libc/inet/gethostbyname2.c | 2 +- libc/inet/gethostbyname2_r.c | 2 +- libc/inet/gethostbyname_r.c | 2 +- libc/inet/gethostent.c | 2 +- libc/inet/gethostent_r.c | 2 +- libc/inet/getnameinfo.c | 2 +- libc/inet/lengthd.c | 2 +- libc/inet/lengthq.c | 2 +- libc/inet/ns_name.c | 2 +- libc/inet/opennameservers.c | 2 +- libc/inet/read_etc_hosts_r.c | 2 +- libc/inet/res_comp.c | 2 +- libc/inet/res_init.c | 2 +- libc/inet/res_query.c | 2 +- 34 files changed, 34 insertions(+), 33 deletions(-) diff --git a/libc/inet/Makefile.in b/libc/inet/Makefile.in index a91d37fce..702642f00 100644 --- a/libc/inet/Makefile.in +++ b/libc/inet/Makefile.in @@ -12,6 +12,7 @@ include $(top_srcdir)libc/inet/rpc/Makefile.in INET_DIR := $(top_srcdir)libc/inet INET_OUT := $(top_builddir)libc/inet +CFLAGS-inet := -DRESOLVER="\"resolv.c\"" CSRC-y := # des uses ntohl CSRC-$(findstring y,$(UCLIBC_HAS_CRYPT_IMPL)$(UCLIBC_HAS_IPV4)$(UCLIBC_HAS_IPV6)) += ntohl.c diff --git a/libc/inet/_res_state.c b/libc/inet/_res_state.c index 8ca4ac192..dc0d89f40 100644 --- a/libc/inet/_res_state.c +++ b/libc/inet/_res_state.c @@ -5,4 +5,4 @@ */ #define L_res_state -#include "resolv.c" +#include RESOLVER diff --git a/libc/inet/closenameservers.c b/libc/inet/closenameservers.c index ca4dae3fb..65889a79a 100644 --- a/libc/inet/closenameservers.c +++ b/libc/inet/closenameservers.c @@ -5,4 +5,4 @@ */ #define L_closenameservers -#include "resolv.c" +#include RESOLVER diff --git a/libc/inet/decodea.c b/libc/inet/decodea.c index 409a97843..112d5d9e0 100644 --- a/libc/inet/decodea.c +++ b/libc/inet/decodea.c @@ -5,4 +5,4 @@ */ #define L_decodea -#include "resolv.c" +#include RESOLVER diff --git a/libc/inet/decoded.c b/libc/inet/decoded.c index 73849ef5f..378cbfad7 100644 --- a/libc/inet/decoded.c +++ b/libc/inet/decoded.c @@ -5,4 +5,4 @@ */ #define L_decoded -#include "resolv.c" +#include RESOLVER diff --git a/libc/inet/decodeh.c b/libc/inet/decodeh.c index 86681fa88..7744287f6 100644 --- a/libc/inet/decodeh.c +++ b/libc/inet/decodeh.c @@ -5,4 +5,4 @@ */ #define L_decodeh -#include "resolv.c" +#include RESOLVER diff --git a/libc/inet/decodep.c b/libc/inet/decodep.c index 40b0bda0d..0e946e01f 100644 --- a/libc/inet/decodep.c +++ b/libc/inet/decodep.c @@ -5,4 +5,4 @@ */ #define L_decodep -#include "resolv.c" +#include RESOLVER diff --git a/libc/inet/decodeq.c b/libc/inet/decodeq.c index a6109677e..9e36b95d4 100644 --- a/libc/inet/decodeq.c +++ b/libc/inet/decodeq.c @@ -5,4 +5,4 @@ */ #define L_decodeq -#include "resolv.c" +#include RESOLVER diff --git a/libc/inet/dnslookup.c b/libc/inet/dnslookup.c index 4ffc34f0a..b9f59a2ff 100644 --- a/libc/inet/dnslookup.c +++ b/libc/inet/dnslookup.c @@ -5,4 +5,4 @@ */ #define L_dnslookup -#include "resolv.c" +#include RESOLVER diff --git a/libc/inet/encodea.c b/libc/inet/encodea.c index 628f9bad5..b42ee4a79 100644 --- a/libc/inet/encodea.c +++ b/libc/inet/encodea.c @@ -5,4 +5,4 @@ */ #define L_encodea -#include "resolv.c" +#include RESOLVER diff --git a/libc/inet/encoded.c b/libc/inet/encoded.c index d60618771..27f92becd 100644 --- a/libc/inet/encoded.c +++ b/libc/inet/encoded.c @@ -5,4 +5,4 @@ */ #define L_encoded -#include "resolv.c" +#include RESOLVER diff --git a/libc/inet/encodeh.c b/libc/inet/encodeh.c index 1d5488017..6a69a948b 100644 --- a/libc/inet/encodeh.c +++ b/libc/inet/encodeh.c @@ -5,4 +5,4 @@ */ #define L_encodeh -#include "resolv.c" +#include RESOLVER diff --git a/libc/inet/encodep.c b/libc/inet/encodep.c index d2f248b40..d298c2131 100644 --- a/libc/inet/encodep.c +++ b/libc/inet/encodep.c @@ -5,4 +5,4 @@ */ #define L_encodep -#include "resolv.c" +#include RESOLVER diff --git a/libc/inet/encodeq.c b/libc/inet/encodeq.c index be1a3123b..5555aa548 100644 --- a/libc/inet/encodeq.c +++ b/libc/inet/encodeq.c @@ -5,4 +5,4 @@ */ #define L_encodeq -#include "resolv.c" +#include RESOLVER diff --git a/libc/inet/formquery.c b/libc/inet/formquery.c index 2c53e33de..4bc0ebe3f 100644 --- a/libc/inet/formquery.c +++ b/libc/inet/formquery.c @@ -5,4 +5,4 @@ */ #define L_formquery -#include "resolv.c" +#include RESOLVER diff --git a/libc/inet/get_hosts_byaddr_r.c b/libc/inet/get_hosts_byaddr_r.c index c377aec13..eeac8907f 100644 --- a/libc/inet/get_hosts_byaddr_r.c +++ b/libc/inet/get_hosts_byaddr_r.c @@ -5,4 +5,4 @@ */ #define L_get_hosts_byaddr_r -#include "resolv.c" +#include RESOLVER diff --git a/libc/inet/get_hosts_byname_r.c b/libc/inet/get_hosts_byname_r.c index 7ad1e3fa5..caad0bcc7 100644 --- a/libc/inet/get_hosts_byname_r.c +++ b/libc/inet/get_hosts_byname_r.c @@ -5,4 +5,4 @@ */ #define L_get_hosts_byname_r -#include "resolv.c" +#include RESOLVER diff --git a/libc/inet/gethostbyaddr.c b/libc/inet/gethostbyaddr.c index ae8a543e5..dc16dd9eb 100644 --- a/libc/inet/gethostbyaddr.c +++ b/libc/inet/gethostbyaddr.c @@ -5,4 +5,4 @@ */ #define L_gethostbyaddr -#include "resolv.c" +#include RESOLVER diff --git a/libc/inet/gethostbyaddr_r.c b/libc/inet/gethostbyaddr_r.c index 6235c82e1..6e27e6207 100644 --- a/libc/inet/gethostbyaddr_r.c +++ b/libc/inet/gethostbyaddr_r.c @@ -5,4 +5,4 @@ */ #define L_gethostbyaddr_r -#include "resolv.c" +#include RESOLVER diff --git a/libc/inet/gethostbyname.c b/libc/inet/gethostbyname.c index 3d46ab015..9c9e9ca03 100644 --- a/libc/inet/gethostbyname.c +++ b/libc/inet/gethostbyname.c @@ -5,4 +5,4 @@ */ #define L_gethostbyname -#include "resolv.c" +#include RESOLVER diff --git a/libc/inet/gethostbyname2.c b/libc/inet/gethostbyname2.c index 685801642..5b9e74ba0 100644 --- a/libc/inet/gethostbyname2.c +++ b/libc/inet/gethostbyname2.c @@ -5,4 +5,4 @@ */ #define L_gethostbyname2 -#include "resolv.c" +#include RESOLVER diff --git a/libc/inet/gethostbyname2_r.c b/libc/inet/gethostbyname2_r.c index 06d058ae7..0de0dd5e1 100644 --- a/libc/inet/gethostbyname2_r.c +++ b/libc/inet/gethostbyname2_r.c @@ -5,4 +5,4 @@ */ #define L_gethostbyname2_r -#include "resolv.c" +#include RESOLVER diff --git a/libc/inet/gethostbyname_r.c b/libc/inet/gethostbyname_r.c index fc9e56da5..4b34f8d17 100644 --- a/libc/inet/gethostbyname_r.c +++ b/libc/inet/gethostbyname_r.c @@ -5,4 +5,4 @@ */ #define L_gethostbyname_r -#include "resolv.c" +#include RESOLVER diff --git a/libc/inet/gethostent.c b/libc/inet/gethostent.c index 16133c0e4..64c183177 100644 --- a/libc/inet/gethostent.c +++ b/libc/inet/gethostent.c @@ -5,4 +5,4 @@ */ #define L_gethostent -#include "resolv.c" +#include RESOLVER diff --git a/libc/inet/gethostent_r.c b/libc/inet/gethostent_r.c index aeade155d..48225d7fa 100644 --- a/libc/inet/gethostent_r.c +++ b/libc/inet/gethostent_r.c @@ -5,4 +5,4 @@ */ #define L_gethostent_r -#include "resolv.c" +#include RESOLVER diff --git a/libc/inet/getnameinfo.c b/libc/inet/getnameinfo.c index fbfd3ede1..86edc51f3 100644 --- a/libc/inet/getnameinfo.c +++ b/libc/inet/getnameinfo.c @@ -5,4 +5,4 @@ */ #define L_getnameinfo -#include "resolv.c" +#include RESOLVER diff --git a/libc/inet/lengthd.c b/libc/inet/lengthd.c index 07c7fc6f1..d2db685b9 100644 --- a/libc/inet/lengthd.c +++ b/libc/inet/lengthd.c @@ -5,4 +5,4 @@ */ #define L_lengthd -#include "resolv.c" +#include RESOLVER diff --git a/libc/inet/lengthq.c b/libc/inet/lengthq.c index e62e6f25a..beeafc1d2 100644 --- a/libc/inet/lengthq.c +++ b/libc/inet/lengthq.c @@ -5,4 +5,4 @@ */ #define L_lengthq -#include "resolv.c" +#include RESOLVER diff --git a/libc/inet/ns_name.c b/libc/inet/ns_name.c index 158a1a331..9df9464a3 100644 --- a/libc/inet/ns_name.c +++ b/libc/inet/ns_name.c @@ -5,4 +5,4 @@ */ #define L_ns_name -#include "resolv.c" +#include RESOLVER diff --git a/libc/inet/opennameservers.c b/libc/inet/opennameservers.c index effd10800..576c8cae3 100644 --- a/libc/inet/opennameservers.c +++ b/libc/inet/opennameservers.c @@ -5,4 +5,4 @@ */ #define L_opennameservers -#include "resolv.c" +#include RESOLVER diff --git a/libc/inet/read_etc_hosts_r.c b/libc/inet/read_etc_hosts_r.c index 6504e541f..1ec74a50d 100644 --- a/libc/inet/read_etc_hosts_r.c +++ b/libc/inet/read_etc_hosts_r.c @@ -5,4 +5,4 @@ */ #define L_read_etc_hosts_r -#include "resolv.c" +#include RESOLVER diff --git a/libc/inet/res_comp.c b/libc/inet/res_comp.c index 8aee6b17c..51ea4f2e6 100644 --- a/libc/inet/res_comp.c +++ b/libc/inet/res_comp.c @@ -5,4 +5,4 @@ */ #define L_res_comp -#include "resolv.c" +#include RESOLVER diff --git a/libc/inet/res_init.c b/libc/inet/res_init.c index 09caf4927..b1a175752 100644 --- a/libc/inet/res_init.c +++ b/libc/inet/res_init.c @@ -5,4 +5,4 @@ */ #define L_res_init -#include "resolv.c" +#include RESOLVER diff --git a/libc/inet/res_query.c b/libc/inet/res_query.c index c662510e6..f3e569fad 100644 --- a/libc/inet/res_query.c +++ b/libc/inet/res_query.c @@ -5,4 +5,4 @@ */ #define L_res_query -#include "resolv.c" +#include RESOLVER -- cgit v1.2.3 From 03c4f490a60c1535ee9a9b87c54b3e3531d89ecf Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Sat, 23 Jan 2010 21:29:19 +0100 Subject: libc/inet: mark other odd /etc/conf/ spot and wrap it in FALLBACK_TO_CONFIG_RESOLVCONF too. -24b Signed-off-by: Bernhard Reutner-Fischer --- libc/inet/resolv.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libc/inet/resolv.c b/libc/inet/resolv.c index abb84df79..4087f8db8 100644 --- a/libc/inet/resolv.c +++ b/libc/inet/resolv.c @@ -1539,7 +1539,9 @@ FILE * __open_etc_hosts(void) { FILE * fp; if ((fp = fopen("/etc/hosts", "r")) == NULL) { +#ifdef FALLBACK_TO_CONFIG_RESOLVCONF fp = fopen("/etc/config/hosts", "r"); +#endif } return fp; } -- cgit v1.2.3 From d75f980f379dfbbe70ae8fb0956693a95af2fca2 Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Sat, 23 Jan 2010 22:36:27 +0100 Subject: ftw.h installation: fix inverted logic Signed-off-by: Bernhard Reutner-Fischer --- Makefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.in b/Makefile.in index 39dd18cc1..879b7300d 100644 --- a/Makefile.in +++ b/Makefile.in @@ -262,7 +262,7 @@ HEADERS_RM-$(UCLIBC_HAS_BSD_ERR) += err.h HEADERS_RM-$(UCLIBC_HAS_CRYPT) += crypt.h HEADERS_RM-$(UCLIBC_HAS_EPOLL) += sys/epoll.h HEADERS_RM-$(UCLIBC_HAS_FENV) += fenv.h bits/fenv.h bits/fenvinline.h -HEADERS_RM-$(findstring y,$(UCLIBC_HAS_FTW)$(UCLIBC_HAS_NFTW)) += ftw.h +HEADERS_RM-$(if $(findstring y,$(UCLIBC_HAS_FTW)$(UCLIBC_HAS_NFTW)),,y) += ftw.h HEADERS_RM-$(UCLIBC_HAS_GETTEXT_AWARENESS) += libintl.h HEADERS_RM-$(UCLIBC_HAS_GLIBC_CUSTOM_PRINTF) += printf.h HEADERS_RM-$(UCLIBC_HAS_GLOB) += glob.h -- cgit v1.2.3 From 95bb1ae902f590156048149c73da48fe851ed224 Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Sat, 23 Jan 2010 22:37:01 +0100 Subject: silence some warnings about unused params Signed-off-by: Bernhard Reutner-Fischer --- libc/misc/glob/glob-susv3.c | 3 ++- libc/misc/internals/__uClibc_main.c | 5 +++-- libc/misc/regex/regex_old.c | 2 +- libc/pwd_grp/lckpwdf.c | 4 ++-- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/libc/misc/glob/glob-susv3.c b/libc/misc/glob/glob-susv3.c index 1d64249c7..59b4d8e5f 100644 --- a/libc/misc/glob/glob-susv3.c +++ b/libc/misc/glob/glob-susv3.c @@ -183,7 +183,8 @@ int __glob_match_in_dir(const char *d, const char *p, int flags, int (*errfunc)( # ifndef BUILD_GLOB64 static # endif -int __glob_ignore_err(const char *path, int err) +int __glob_ignore_err(const char * path attribute_unused, + int err attribute_unused) { return 0; } diff --git a/libc/misc/internals/__uClibc_main.c b/libc/misc/internals/__uClibc_main.c index b166aaaa7..19acbe0d6 100644 --- a/libc/misc/internals/__uClibc_main.c +++ b/libc/misc/internals/__uClibc_main.c @@ -257,10 +257,11 @@ libc_hidden_def(__uClibc_fini) */ void __uClibc_main(int (*main)(int, char **, char **), int argc, char **argv, void (*app_init)(void), void (*app_fini)(void), - void (*rtld_fini)(void), void *stack_end) attribute_noreturn; + void (*rtld_fini)(void), + void *stack_end attribute_unused) attribute_noreturn; void __uClibc_main(int (*main)(int, char **, char **), int argc, char **argv, void (*app_init)(void), void (*app_fini)(void), - void (*rtld_fini)(void), void *stack_end) + void (*rtld_fini)(void), void *stack_end attribute_unused) { #ifndef __ARCH_HAS_NO_LDSO__ unsigned long *aux_dat; diff --git a/libc/misc/regex/regex_old.c b/libc/misc/regex/regex_old.c index cbfb7ae7c..bc2ad6cb8 100644 --- a/libc/misc/regex/regex_old.c +++ b/libc/misc/regex/regex_old.c @@ -8140,7 +8140,7 @@ libc_hidden_def(regexec) size_t regerror ( int errcode, - const regex_t *preg, + const regex_t * preg attribute_unused, char *errbuf, size_t errbuf_size) { diff --git a/libc/pwd_grp/lckpwdf.c b/libc/pwd_grp/lckpwdf.c index e02cab6ad..da72b0fcb 100644 --- a/libc/pwd_grp/lckpwdf.c +++ b/libc/pwd_grp/lckpwdf.c @@ -146,7 +146,7 @@ ulckpwdf (void) static void -noop_handler (int sig) -{ +noop_handler (int sig attribute_unused) + /* We simply return which makes the `fcntl' call return with an error. */ } -- cgit v1.2.3 From b448835995a7459e3f2e0f0cdce0e51b95ac7662 Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Sat, 23 Jan 2010 22:41:25 +0100 Subject: fix typo in previous commit Signed-off-by: Bernhard Reutner-Fischer --- libc/pwd_grp/lckpwdf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libc/pwd_grp/lckpwdf.c b/libc/pwd_grp/lckpwdf.c index da72b0fcb..adbc616a9 100644 --- a/libc/pwd_grp/lckpwdf.c +++ b/libc/pwd_grp/lckpwdf.c @@ -146,7 +146,7 @@ ulckpwdf (void) static void -noop_handler (int sig attribute_unused) +noop_handler (int sig attribute_unused) { /* We simply return which makes the `fcntl' call return with an error. */ } -- cgit v1.2.3 From d2924a76c315a4cd0f4649511c55b08422b06342 Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Sat, 23 Jan 2010 23:25:01 +0100 Subject: getprotoent_r: use correct define for return value Doesn't correctly set result=NULL on error or EOF. Signed-off-by: Bernhard Reutner-Fischer --- libc/inet/getproto.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libc/inet/getproto.c b/libc/inet/getproto.c index c297a6549..bf7c09371 100644 --- a/libc/inet/getproto.c +++ b/libc/inet/getproto.c @@ -144,7 +144,7 @@ int getprotoent_r(struct protoent *result_buf, } again: if ((p = fgets(line, BUFSIZ, protof)) == NULL) { - rv=TRY_AGAIN; + rv=ENOENT; goto DONE; } -- cgit v1.2.3 From 64b256b98412206cb6da4ca6491528aa360e56bf Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Sun, 24 Jan 2010 00:39:57 +0100 Subject: gethostid: switch to getaddrinfo and shrink text data bss dec hex filename 382 0 0 382 17e libc/inet/hostid.os.old 326 0 0 326 146 libc/inet/hostid.os Signed-off-by: Bernhard Reutner-Fischer --- libc/inet/hostid.c | 67 +++++++++++++++++++++--------------------------------- 1 file changed, 26 insertions(+), 41 deletions(-) diff --git a/libc/inet/hostid.c b/libc/inet/hostid.c index 99346d7f8..ac4c56c35 100644 --- a/libc/inet/hostid.c +++ b/libc/inet/hostid.c @@ -1,3 +1,4 @@ +/* vi: set sw=4 ts=4: */ /* * Copyright (C) 2000-2006 Erik Andersen * @@ -6,15 +7,13 @@ #define __FORCE_GLIBC #include -#include -#include #include -#include -#include -#include -#include #include - +#include +#include +#include +#include +#include #define HOSTID "/etc/hostid" @@ -35,23 +34,23 @@ int sethostid(long int new_id) } #endif +#define _addr(a) (((struct sockaddr_in*)a->ai_addr)->sin_addr.s_addr) long int gethostid(void) { - char host[MAXHOSTNAMELEN + 1]; - int fd, id; + char host[HOST_NAME_MAX + 1]; + int fd, id = 0; /* If hostid was already set then we can return that value. * It is not an error if we cannot read this file. It is not even an * error if we cannot read all the bytes, we just carry on trying... */ fd = open(HOSTID, O_RDONLY); - if (fd >= 0 && read(fd, &id, sizeof(id))) - { - close (fd); - return id; + if (fd >= 0) { + int i = read(fd, &id, sizeof(id)); + close(fd); + if (i > 0) + return id; } - if (fd >= 0) close (fd); - /* Try some methods of returning a unique 32 bit id. Clearly IP * numbers, if on the internet, will have a unique address. If they * are not on the internet then we can return 0 which means they should @@ -63,32 +62,18 @@ long int gethostid(void) * setting one anyway. * Mitch */ - if (gethostname(host, MAXHOSTNAMELEN) >= 0 && *host) { - struct hostent *hp; - struct in_addr in; - struct hostent ghbn_h; - char ghbn_buf[sizeof(struct in_addr) + - sizeof(struct in_addr *)*2 + - sizeof(char *)*((2 + 5/*MAX_ALIASES*/ + - 1)/*ALIAS_DIM*/) + - 256/*namebuffer*/ + 32/* margin */]; - int ghbn_errno; - - /* replace gethostbyname() with gethostbyname_r() - ron@zing.net */ - /*if ((hp = gethostbyname(host)) == (struct hostent *)NULL)*/ - gethostbyname_r(host, &ghbn_h, ghbn_buf, sizeof(ghbn_buf), &hp, &ghbn_errno); - - if (hp == NULL) { - /* This is not a error if we get here, as all it means is that - * this host is not on a network and/or they have not - * configured their network properly. So we return the unset - * hostid which should be 0, meaning that they should set it !! - */ - return 0; + if (gethostname(host, HOST_NAME_MAX) >= 0 && *host) { + struct addrinfo hints, *results, *addr; + memset(&hints, 0, sizeof(struct addrinfo)); + if (!getaddrinfo(host, NULL, &hints, &results)) { + for (addr = results; addr; addr = results->ai_next) { + /* Just so it doesn't look exactly like the + IP addr */ + id = _addr(addr) << 16 | _addr(addr) >> 16; + break; + } + freeaddrinfo(results); } - memcpy(&in, hp->h_addr, hp->h_length); - /* Just so it doesn't look exactly like the IP addr */ - return (in.s_addr<<16 | in.s_addr>>16); } - return 0; + return id; } -- cgit v1.2.3 From a9df793a753f259b7e31cde3d1be39632b29f454 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Sun, 24 Jan 2010 02:26:26 +0100 Subject: wchar.c: fix indentation Signed-off-by: Denys Vlasenko --- libc/misc/wchar/wchar.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/libc/misc/wchar/wchar.c b/libc/misc/wchar/wchar.c index 448baafa1..7380ac9ae 100644 --- a/libc/misc/wchar/wchar.c +++ b/libc/misc/wchar/wchar.c @@ -286,7 +286,7 @@ size_t mbrtowc(wchar_t *__restrict pwc, const char *__restrict s, s = empty_string; n = 1; } else if (*s == '\0') { - /* According to the ISO C 89 standard this is the expected behaviour. */ + /* According to the ISO C 89 standard this is the expected behaviour. */ return 0; } else if (!n) { /* TODO: change error code? */ @@ -600,7 +600,7 @@ size_t attribute_hidden _wchar_wcsntoutf8s(char *__restrict s, size_t n, if (!s) { n = SIZE_MAX; } - s = buf; + s = buf; store = 0; } @@ -1026,9 +1026,9 @@ static const signed char new_wtbl[] = { int wcswidth(const wchar_t *pwcs, size_t n) { - int h, l, m, count; - wchar_t wc; - unsigned char b; + int h, l, m, count; + wchar_t wc; + unsigned char b; if (ENCODING == __ctype_encoding_7_bit) { size_t i; @@ -1064,7 +1064,7 @@ int wcswidth(const wchar_t *pwcs, size_t n) } #endif /* __CTYPE_HAS_UTF_8_LOCALES */ - for (count = 0 ; n && (wc = *pwcs++) ; n--) { + for (count = 0 ; n && (wc = *pwcs++) ; n--) { if (wc <= 0xff) { /* If we're here, wc != 0. */ if ((wc < 32) || ((wc >= 0x7f) && (wc < 0xa0))) { @@ -1114,9 +1114,9 @@ int wcswidth(const wchar_t *pwcs, size_t n) } ++count; - } + } - return count; + return count; } #else /* __UCLIBC_HAS_LOCALE__ */ @@ -1133,7 +1133,7 @@ int wcswidth(const wchar_t *pwcs, size_t n) } } - for (count = 0 ; n && (wc = *pwcs++) ; n--) { + for (count = 0 ; n && (wc = *pwcs++) ; n--) { if (wc <= 0xff) { /* If we're here, wc != 0. */ if ((wc < 32) || ((wc >= 0x7f) && (wc < 0xa0))) { @@ -1160,7 +1160,7 @@ libc_hidden_def(wcswidth) int wcwidth(wchar_t wc) { - return wcswidth(&wc, 1); + return wcswidth(&wc, 1); } #endif -- cgit v1.2.3 From c4b750195714ec7c10aa4de15610c5aae0751c1c Mon Sep 17 00:00:00 2001 From: Henning Heinold Date: Sat, 23 Jan 2010 21:29:42 -0800 Subject: Makefile.in: Make install_dev depend on install_runtime. * Helps in parallel build. Signed-off-by: Henning Heinold Signed-off-by: Khem Raj --- Makefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.in b/Makefile.in index 879b7300d..26fbc0fba 100644 --- a/Makefile.in +++ b/Makefile.in @@ -298,7 +298,7 @@ else endif # Installs development library links. -install_dev: install_headers all +install_dev: install_headers install_runtime $(INSTALL) -d $(PREFIX)$(DEVEL_PREFIX)lib -$(INSTALL) -m 644 lib/*.[ao] $(PREFIX)$(DEVEL_PREFIX)lib/ ifeq ($(HAVE_SHARED),y) -- cgit v1.2.3