[uclibc-ng-devel] uClibc-ng - small C library for embedded systems branch 1.0 updated. v1.0.1-69-ga500a54

wbx wbx at helium.waldemar-brodkorb.de
Mon Apr 13 07:16:20 CEST 2015


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "uClibc-ng - small C library for embedded systems".

The branch, 1.0 has been updated
       via  a500a54bedc8081b9959cb03214047aead18b164 (commit)
       via  611eb585f50911f326f433e9827ca5948348ea7e (commit)
       via  c269f57d321991998a0aa5cc482c7e0124ccd45f (commit)
       via  bbe05b64872728cd3d78ed0ef06ac963a40c4400 (commit)
       via  64464f53eb2748ee9c615775a347685f2115d040 (commit)
       via  f07b6a12c449f2e5987e0b8fdcb6e72be8dbeb07 (commit)
       via  ccd00917a2cb69b80714f9b9d028288ddac23e69 (commit)
       via  08a82b3d60c36abdf28585e1b421f27431ef2452 (commit)
       via  50f076d01c77d8782c455349d702507255abdc9d (commit)
       via  0a3cc64d4c8050758482f68c48482e6e375c4ffa (commit)
       via  9df521f763d8dc96f06ee083caad57b8382424fb (commit)
       via  eb56ff55d410c8aa37161a0cd14c3d6850e85584 (commit)
       via  218bacae45c633536bed31c0cbe2f457cb378199 (commit)
      from  32d11b1454734c7931b8b0ec98cf5aba1970dde5 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit a500a54bedc8081b9959cb03214047aead18b164
Author: Waldemar Brodkorb <wbx at openadk.org>
Date:   Sat Apr 11 16:34:34 2015 -0500

    Revert "Revert "librt: Use -nodefaultlibs instead of -nostdlib""
    
    This reverts commit 3a14ea8812e8695b5205a70431d513fb905c0daf.

commit 611eb585f50911f326f433e9827ca5948348ea7e
Author: Waldemar Brodkorb <wbx at openadk.org>
Date:   Thu Apr 9 13:47:33 2015 -0500

    fix compile for m68k

commit c269f57d321991998a0aa5cc482c7e0124ccd45f
Author: Waldemar Brodkorb <wbx at openadk.org>
Date:   Thu Apr 9 13:47:06 2015 -0500

    return NULL for realloc(p,0) like glibc
    
    See discussion here about the issue:
    https://sourceware.org/bugzilla/show_bug.cgi?id=12547
    
    Fixes testsuite errors.

commit bbe05b64872728cd3d78ed0ef06ac963a40c4400
Author: Waldemar Brodkorb <wbx at openadk.org>
Date:   Thu Apr 9 13:45:42 2015 -0500

    still required for xtensa

commit 64464f53eb2748ee9c615775a347685f2115d040
Author: Waldemar Brodkorb <wbx at openadk.org>
Date:   Fri Apr 3 03:57:00 2015 -0500

    add GNU libc test for ifaddrs.c

commit f07b6a12c449f2e5987e0b8fdcb6e72be8dbeb07
Author: Waldemar Brodkorb <wbx at openadk.org>
Date:   Fri Apr 3 03:54:03 2015 -0500

    fix linking for m68k

commit ccd00917a2cb69b80714f9b9d028288ddac23e69
Author: Waldemar Brodkorb <wbx at openadk.org>
Date:   Sun Mar 29 16:20:54 2015 -0500

    gcc 4.4 does not have __builtin_unreachable
    
    For avr32 we still use gcc 4.4 compiler, so exlude the usage
    of __builtin_unreachable here.

commit 08a82b3d60c36abdf28585e1b421f27431ef2452
Author: Waldemar Brodkorb <wbx at openadk.org>
Date:   Sun Mar 29 04:43:37 2015 -0500

    disable new tests, atomic.h is missing

commit 50f076d01c77d8782c455349d702507255abdc9d
Author: Waldemar Brodkorb <wbx at openadk.org>
Date:   Mon Mar 30 11:15:45 2015 -0500

    Revert "gcc 4.9.x produces some calls to abort()"
    
    This reverts commit 69ba9dcaa13bb8bbdc8630265d73298c39945416.

commit 0a3cc64d4c8050758482f68c48482e6e375c4ffa
Author: Bernhard Reutner-Fischer <rep.dot.nop at gmail.com>
Date:   Tue Mar 31 22:44:25 2015 +0200

    libc: Fix page-size in getifaddrs()
    
    TODO: this could need a cleanup..
    
    Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop at gmail.com>

commit 9df521f763d8dc96f06ee083caad57b8382424fb
Author: Bernhard Reutner-Fischer <rep.dot.nop at gmail.com>
Date:   Tue Mar 31 22:44:22 2015 +0200

    buildsys: Do not build crt upon pregen
    
    No need to build crt when just generating headers
    
    Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop at gmail.com>

commit eb56ff55d410c8aa37161a0cd14c3d6850e85584
Author: Bernhard Reutner-Fischer <rep.dot.nop at gmail.com>
Date:   Tue Mar 31 22:44:19 2015 +0200

    buildsys: tweak ucontext_i.h prerequisites
    
    ucontext_i.h too depends on uClibc_config.h.
    Update it to look like the other MANGLE generated files and tweak
    prereqs
    
    Fixes: make realclean ; make -j libc/misc/internals/__uClibc_main.i
    
    Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop at gmail.com>

commit 218bacae45c633536bed31c0cbe2f457cb378199
Author: Bernhard Reutner-Fischer <rep.dot.nop at gmail.com>
Date:   Tue Mar 31 22:43:52 2015 +0200

    Revert "librt: Use -nodefaultlibs instead of -nostdlib"
    
    This reverts commit 534f44d53146457b3ca686c47efb9207543b88e1.
    
    I don't think this is wanted.
    
    Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop at gmail.com>

-----------------------------------------------------------------------

Summary of changes:
 Makefile.in                                        |   12 ++-
 Makerules                                          |   17 ++--
 Rules.mak                                          |    3 +-
 ldso/include/dl-syscall.h                          |    2 +-
 ldso/ldso/Makefile.in                              |    4 +-
 libc/Makefile.in                                   |    3 +-
 libc/inet/ifaddrs.c                                |   13 ++-
 libc/stdlib/malloc/realloc.c                       |    2 +-
 libc/sysdeps/linux/Makefile.commonarch             |   18 ++--
 libpthread/nptl/Makefile.in                        |    2 +-
 libpthread/nptl/sysdeps/Makefile.commonarch        |    2 +-
 .../sysdeps/unix/sysv/linux/Makefile.commonarch    |    2 +-
 librt/Makefile.in                                  |    2 +-
 test/inet/Makefile.in                              |    3 +-
 test/inet/tst-ifaddrs.c                            |   99 ++++++++++++++++++++
 test/misc/Makefile.in                              |    1 +
 test/silly/Makefile.in                             |    2 +-
 17 files changed, 147 insertions(+), 40 deletions(-)
 create mode 100644 test/inet/tst-ifaddrs.c

diff --git a/Makefile.in b/Makefile.in
index e764493..a86f29a 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -13,7 +13,7 @@ sub_headers := headers
 
 ifeq ($(HAVE_DOT_CONFIG),y)
 
-all: pregen libs
+all: pregen libs startfiles
 libs: pregen
 
 # In this section, we need .config
@@ -57,8 +57,9 @@ ifeq ($(HAVE_DOT_CONFIG),y)
 $(top_builddir)include/bits/uClibc_config.h: $(conf) $(KCONFIG_CONFIG) $(top_srcdir)extra/scripts/conf-header.sh | $(top_builddir)include/bits
 	@$(disp_gen)
 	$(Q)$< -s $(Kconfig)
-	$(Q)$(top_srcdir)extra/scripts/conf-header.sh $(KCONFIG_CONFIG) > $@
+	$(Q)$(top_srcdir)extra/scripts/conf-header.sh $(KCONFIG_CONFIG) > $@.tmp
 	$(Q)$(MAKE) headers-y
+	$(Q)mv $@.tmp $@
 
 # The above doesn't work for threads, though. Just using check-symlinks for now.
 # XXX: FIXME: this is ugly
@@ -183,7 +184,10 @@ headers-y += $(target-headers-sysdep)
 
 headers: $(top_builddir)include/bits/uClibc_config.h | subdirs
 subdirs: $(addprefix $(top_builddir),$(subdirs))
-pregen-headers: $(top_builddir)include/bits/sysnum.h $(pregen-headers-y)
+
+$(pregen-headers-y): $(headers_dep)
+
+pregen-headers: $(pregen-headers-y)
 pregen: headers pregen-headers
 	$(Q)$(if $(UCLIBC_HAS_LOCALE),$(MAKE) -C extra/locale locale_headers)
 
@@ -215,8 +219,6 @@ install: install_runtime install_dev
 
 RUNTIME_PREFIX_LIB_FROM_DEVEL_PREFIX_LIB=$(shell $(top_srcdir)extra/scripts/relative_path.sh $(DEVEL_PREFIX)$(MULTILIB_DIR) $(RUNTIME_PREFIX)$(MULTILIB_DIR))
 
-startfiles: $(crt-y)
-
 $(top_builddir)extra/scripts/unifdef: |$(top_builddir)extra/scripts
 $(top_builddir)extra/scripts/unifdef: $(top_srcdir)extra/scripts/unifdef.c
 	$(hcompile.u)
diff --git a/Makerules b/Makerules
index fd6bb19..10dc529 100644
--- a/Makerules
+++ b/Makerules
@@ -22,9 +22,9 @@ ifeq ($(UCLIBC_FORMAT_SHARED_FLAT),y)
 libs: $(lib-gdb-y)
 endif
 libs: $(lib-a-y)
-$(lib-a-y): | $(top_builddir)lib
 endif
 objs: all_objs
+$(lib-so-y) $(lib-a-y): | $(top_builddir)lib
 
 # apply unconditional per-directory flags
 define add_IS_IN_lib
@@ -451,18 +451,18 @@ CFLAGS-initfini.s := -S -g0 $(PICFLAG) -fno-inline-functions -finhibit-size-dire
 $(top_builddir)lib/initfini.s: $(top_srcdir)libc/sysdeps/linux/$(TARGET_ARCH)/initfini.c | $(top_builddir)lib
 	$(compile.c)
 
-$(top_builddir)lib/defs.h: $(top_builddir)lib/initfini.s | $(top_builddir)lib
-	$(Q)sed -n -e '/@TESTS_BEGIN/,/@TESTS_END/p' $< | \
-		gawk -f $(top_srcdir)extra/scripts/defs.awk > $@.tmp
+$(top_builddir)lib/defs.h: $(top_builddir)lib/initfini.s
+	$(do_sed) -n -e '/@TESTS_BEGIN/,/@TESTS_END/p' $< | \
+		$(AWK) -f $(top_srcdir)extra/scripts/defs.awk > $@.tmp
 	$(Q)mv $@.tmp $@
 
 $(top_builddir)lib/crti.S: $(top_builddir)lib/initfini.s $(top_builddir)lib/defs.h
-	$(Q)sed -n -e '1,/@HEADER_ENDS/p' \
+	$(do_sed) -n -e '1,/@HEADER_ENDS/p' \
 		-e '/@_.*_PROLOG_BEGINS/,/@_.*_PROLOG_ENDS/p' \
 		-e '/@TRAILER_BEGINS/,$$p' $< > $@
 
 $(top_builddir)lib/crtn.S: $(top_builddir)lib/initfini.s
-	$(Q)sed -n -e '1,/@HEADER_ENDS/p' \
+	$(do_sed) -n -e '1,/@HEADER_ENDS/p' \
 		-e '/@_.*_EPILOG_BEGINS/,/@_.*_EPILOG_ENDS/p' \
 		-e '/@TRAILER_BEGINS/,$$p' $< > $@
 
@@ -482,9 +482,10 @@ CRTS_COMPAT :=
 #endif
 
 startfiles = $(CRTS) $(CTOR_TARGETS) $(CRTS_COMPAT) $(CRTRELOC)
-$(crt-y): $(startfiles)
+startfiles: $(startfiles)
 $(CRTS) $(CTOR_TARGETS) $(CRTS_COMPAT) $(CRTRELOC): | headers
-$(CRTS) $(CTOR_TARGETS) $(CRTS_COMPAT) $(CRTRELOC) $(LINK_FLAT_CRTS) $(SHARED_START_FILES) $(SHARED_END_FILES) : | $(top_builddir)lib
+$(CRTS) $(CTOR_TARGETS) $(CRTS_COMPAT) $(CRTRELOC) \
+	$(LINK_FLAT_CRTS) $(SHARED_START_FILES) $(SHARED_END_FILES): | $(top_builddir)lib
 
 $(top_builddir)lib/$(NONSHARED_LIBNAME): $(libc-nonshared-y)
 	$(Q)$(RM) $@
diff --git a/Rules.mak b/Rules.mak
index e88eda1..77ca3cc 100644
--- a/Rules.mak
+++ b/Rules.mak
@@ -165,7 +165,8 @@ libpthread.depend := $(top_builddir)lib/libpthread.so
 endif
 interp := $(top_builddir)lib/interp.os
 ldso := $(top_builddir)lib/$(UCLIBC_LDSO)
-headers_dep := $(top_builddir)include/bits/sysnum.h
+headers_dep := $(top_builddir)include/bits/sysnum.h \
+	$(top_builddir)include/bits/uClibc_config.h
 sub_headers := $(headers_dep)
 
 #LIBS :=$(interp) -L$(top_builddir)lib -lc
diff --git a/ldso/include/dl-syscall.h b/ldso/include/dl-syscall.h
index 4749d7a..0acd2ba 100644
--- a/ldso/include/dl-syscall.h
+++ b/ldso/include/dl-syscall.h
@@ -51,7 +51,7 @@ extern int _dl_errno;
 static __always_inline attribute_noreturn __cold void _dl_exit(int status)
 {
 	INLINE_SYSCALL(_dl_exit, 1, status);
-#if defined __GNUC__
+#if defined __GNUC__ && !__GNUC_PREREQ (4, 4)
 	__builtin_unreachable(); /* shut up warning: 'noreturn' function does return*/
 #else
 	while (1);
diff --git a/ldso/ldso/Makefile.in b/ldso/ldso/Makefile.in
index 56f4a45..a0ae7b3 100644
--- a/ldso/ldso/Makefile.in
+++ b/ldso/ldso/Makefile.in
@@ -31,9 +31,6 @@ CFLAGS-ldso.c := -DLDSO_ELFINTERP=\"$(TARGET_ARCH)/elfinterp.c\"
 ifeq ($(TARGET_ARCH),xtensa)
 CFLAGS-ldso.c += -fno-delete-null-pointer-checks
 endif
-ifeq ($(TARGET_ARCH),sh)
-CFLAGS-ldso.c += -fno-delete-null-pointer-checks
-endif
 
 LDFLAGS-$(UCLIBC_FORMAT_DSBT_ELF)-$(UCLIBC_LDSO_NAME).so := -Wl,--dsbt-index=1
 ifneq ($(SUPPORT_LD_DEBUG),y)
@@ -76,6 +73,7 @@ LDFLAGS-$(UCLIBC_LDSO_NAME).so += -T $(ldso:.$(ABI_VERSION)=).lds
 endif
 
 $(ldso): $(ldso:.$(ABI_VERSION)=)
+$(ldso:.$(ABI_VERSION)=): | $(top_builddir)lib
 $(ldso:.$(ABI_VERSION)=): $($(UCLIBC_LDSO_NAME)_OUT)/$(UCLIBC_LDSO_NAME)_so.a
 ifeq ($(LDSO_PRELINK_SUPPORT),y)
 	$(call create-lds)
diff --git a/libc/Makefile.in b/libc/Makefile.in
index 9c8152d..2abc77d 100644
--- a/libc/Makefile.in
+++ b/libc/Makefile.in
@@ -87,8 +87,7 @@ $(libc_OUT)/libc.oS: $(libc-multi-y) | $(top_builddir)lib/libc.a $(top_builddir)
 	$(Q)$(RM) $@
 	$(compile-m)
 
-$(top_builddir)lib/libc.a: $(libc-a-y) | $(crt-y)
-	$(Q)$(INSTALL) -d $(dir $@)
+$(top_builddir)lib/libc.a: $(libc-a-y)
 	$(Q)$(RM) $@
 	$(do_ar)
 
diff --git a/libc/inet/ifaddrs.c b/libc/inet/ifaddrs.c
index 6d9ee89..0c93106 100644
--- a/libc/inet/ifaddrs.c
+++ b/libc/inet/ifaddrs.c
@@ -115,7 +115,8 @@ __netlink_request (struct netlink_handle *h, int type)
 {
   struct netlink_res *nlm_next;
   struct netlink_res **new_nlm_list;
-  static volatile size_t buf_size = 4096;
+  static volatile size_t buf_size = 0;
+  size_t this_buf_size;
   char *buf;
   struct sockaddr_nl nladdr;
   struct nlmsghdr *nlmh;
@@ -126,7 +127,15 @@ __netlink_request (struct netlink_handle *h, int type)
   if (__netlink_sendreq (h, type) < 0)
     return -1;
 
-  size_t this_buf_size = buf_size;
+  if (buf_size)
+	  this_buf_size = buf_size;
+  else {
+#ifdef PAGE_SIZE
+	  this_buf_size = PAGE_SIZE;
+#else
+	  this_buf_size = __pagesize;
+#endif
+  }
   if (__libc_use_alloca (this_buf_size))
     buf = alloca (this_buf_size);
   else
diff --git a/libc/stdlib/malloc/realloc.c b/libc/stdlib/malloc/realloc.c
index 8de0066..8d55289 100644
--- a/libc/stdlib/malloc/realloc.c
+++ b/libc/stdlib/malloc/realloc.c
@@ -30,7 +30,7 @@ realloc (void *mem, size_t new_size)
   if (! new_size)
     {
       free (mem);
-      return malloc (new_size);
+      return NULL;
     }
   if (! mem)
     return malloc (new_size);
diff --git a/libc/sysdeps/linux/Makefile.commonarch b/libc/sysdeps/linux/Makefile.commonarch
index 1bf2dc5..f8dc17d 100644
--- a/libc/sysdeps/linux/Makefile.commonarch
+++ b/libc/sysdeps/linux/Makefile.commonarch
@@ -15,7 +15,6 @@ ARCH_SOBJ = $(patsubst %.s,%.o,$(patsubst %.S,%.o,$(addprefix $(ARCH_OUT)/,$(SSR
 
 ARCH_OBJS-y = $(ARCH_COBJ) $(ARCH_SOBJ)
 
-crt-y          := FORCE
 libc-y         += $(ARCH_OBJS-y)
 libc-nomulti-y += $(ARCH_SOBJ)
 objclean-y     += CLEAN_$(subst $(top_builddir),,$(ARCH_OUT))
@@ -47,16 +46,13 @@ HEADERCLEAN_$(subst $(top_builddir),,$(ARCH_OUT)):
 	$(do_rm) $(ARCH_HEADERS_OUT)
 endif
 
-CFLAGS-ucontext_i.c = -S
-
-$(ARCH_OUT)/ucontext_i.c: $(ARCH_DIR)/ucontext_i.sym
-	$(do_awk) $(top_srcdir)extra/scripts/gen-as-const.awk $< > $@
-
-$(ARCH_OUT)/ucontext_i.s: $(ARCH_OUT)/ucontext_i.c
-	$(compile.c)
-
-$(ARCH_OUT)/ucontext_i.h: $(ARCH_OUT)/ucontext_i.s
-	$(do_sed) $(PTHREAD_GENERATE_MANGLE) $< > $@
+$(ARCH_OUT)/ucontext_i.h: $(top_srcdir)extra/scripts/gen-as-const.awk
+$(ARCH_OUT)/ucontext_i.h: $(ARCH_OUT)/ucontext_i.sym
+	@$(disp_gen)
+	$(do_awk) $(top_srcdir)extra/scripts/gen-as-const.awk $< \
+	| $(CC) $(CFLAGS) -x c - -S -o - \
+	| $(SED) $(PTHREAD_GENERATE_MANGLE) > $@
+	@if test ! -s $@ ; then rm -f $@ ; false ; fi
 
 pregen-headers-$(UCLIBC_HAS_CONTEXT_FUNCS) += $(ARCH_OUT)/ucontext_i.h
 
diff --git a/libpthread/nptl/Makefile.in b/libpthread/nptl/Makefile.in
index 0a981cd..55eeba2 100644
--- a/libpthread/nptl/Makefile.in
+++ b/libpthread/nptl/Makefile.in
@@ -92,7 +92,7 @@ $(top_builddir)lib/libpthread.a: $(libpthread-a-y)
 	$(Q)$(RM) $@
 	$(do_ar)
 
-$(libpthread_OUT)/pthread-errnos.h: $(top_srcdir)extra/scripts/gen-as-const.awk | headers
+$(libpthread_OUT)/pthread-errnos.h: $(top_srcdir)extra/scripts/gen-as-const.awk
 $(libpthread_OUT)/pthread-errnos.h: $(libpthread_DIR)/pthread-errnos.sym
 	@$(disp_gen)
 	$(do_awk) $(top_srcdir)extra/scripts/gen-as-const.awk $< \
diff --git a/libpthread/nptl/sysdeps/Makefile.commonarch b/libpthread/nptl/sysdeps/Makefile.commonarch
index a5952a6..7f531f5 100644
--- a/libpthread/nptl/sysdeps/Makefile.commonarch
+++ b/libpthread/nptl/sysdeps/Makefile.commonarch
@@ -40,7 +40,7 @@ librt_arch_COBJ = $(patsubst %.c,$(libpthread_arch_OUT)/%.o,$(librt_arch_CSRC))
 librt_arch_SOBJ = $(patsubst %.S,$(libpthread_arch_OUT)/%.o,$(librt_arch_SSRC))
 librt_arch_OBJS = $(librt_arch_COBJ) $(librt_arch_SOBJ)
 
-$(libpthread_arch_OUT)/tcb-offsets.h: $(top_srcdir)extra/scripts/gen-as-const.awk | headers
+$(libpthread_arch_OUT)/tcb-offsets.h: $(top_srcdir)extra/scripts/gen-as-const.awk
 $(libpthread_arch_OUT)/tcb-offsets.h: $(libpthread_arch_DIR)/tcb-offsets.sym
 	@$(disp_gen)
 	$(do_awk) $(top_srcdir)extra/scripts/gen-as-const.awk $< \
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/Makefile.commonarch b/libpthread/nptl/sysdeps/unix/sysv/linux/Makefile.commonarch
index e4a5fc5..4e14773 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/Makefile.commonarch
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/Makefile.commonarch
@@ -137,7 +137,7 @@ endif
 PTHREAD_LINUX_SYM   := $(notdir $(wildcard $(libpthread_linux_DIR)/*.sym))
 PTHREAD_LINUX_SYM_H := $(addprefix $(libpthread_linux_OUT)/,$(PTHREAD_LINUX_SYM:.sym=.h))
 
-$(PTHREAD_LINUX_SYM_H): $(top_srcdir)extra/scripts/gen-as-const.awk | headers
+$(PTHREAD_LINUX_SYM_H): $(top_srcdir)extra/scripts/gen-as-const.awk
 $(PTHREAD_LINUX_SYM_H): $(libpthread_linux_OUT)/%.h: $(libpthread_linux_DIR)/%.sym
 	@$(disp_gen)
 	$(do_awk) $(top_srcdir)extra/scripts/gen-as-const.awk $< \
diff --git a/librt/Makefile.in b/librt/Makefile.in
index fbbf5b4..1c1559c 100644
--- a/librt/Makefile.in
+++ b/librt/Makefile.in
@@ -76,7 +76,7 @@ $(librt_OUT)/librt_so.a: $(librt-so-y)
 	$(Q)$(RM) $@
 	$(do_ar)
 
-$(top_builddir)lib/librt.a: $(librt-a-y) | $(top_builddir)lib
+$(top_builddir)lib/librt.a: $(librt-a-y)
 	$(Q)$(RM) $@
 	$(do_ar)
 
diff --git a/test/inet/Makefile.in b/test/inet/Makefile.in
index 38aec61..1cede47 100644
--- a/test/inet/Makefile.in
+++ b/test/inet/Makefile.in
@@ -3,7 +3,7 @@
 #
 ifeq ($(UCLIBC_HAS_IPV4)$(UCLIBC_HAS_IPV6),)
 TESTS_DISABLED := bug-if1 gethost_r-align gethostid if_nameindex tst-aton \
-	tst-network tst-ntoa
+	tst-network tst-ntoa test-ifaddrs
 endif
 
 ifeq ($(UCLIBC_HAS_SOCKET)$(UCLIBC_HAS_IPV4)$(UCLIBC_HAS_IPV6),)
@@ -18,3 +18,4 @@ endif
 
 CFLAGS_bug-if1 = -fPIC
 CFLAGS_tst-sock-nonblock = -fPIC
+CFLAGS_tst-ifaddrs = -fPIC
diff --git a/test/inet/tst-ifaddrs.c b/test/inet/tst-ifaddrs.c
new file mode 100644
index 0000000..6e6c015
--- /dev/null
+++ b/test/inet/tst-ifaddrs.c
@@ -0,0 +1,99 @@
+/* Test listing of network interface addresses.
+   Copyright (C) 2002-2015 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, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ifaddrs.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+
+static int failures;
+
+static const char *
+addr_string (struct sockaddr *sa, char *buf, size_t size)
+{
+  if (sa == NULL)
+    return "<none>";
+
+  switch (sa->sa_family)
+    {
+    case AF_INET:
+      return inet_ntop (AF_INET, &((struct sockaddr_in *) sa)->sin_addr,
+			buf, size);
+    case AF_INET6:
+      return inet_ntop (AF_INET6, &((struct sockaddr_in6 *) sa)->sin6_addr,
+			buf, size);
+#ifdef AF_LINK
+    case AF_LINK:
+      return "<link>";
+#endif
+    case AF_UNSPEC:
+      return "---";
+
+#ifdef AF_PACKET
+    case AF_PACKET:
+      return "<packet>";
+#endif
+
+    default:
+      ++failures;
+      printf ("sa_family=%d %08x\n", sa->sa_family,
+	      *(int*)&((struct sockaddr_in *) sa)->sin_addr.s_addr);
+      return "<unexpected sockaddr family>";
+    }
+}
+
+
+static int
+do_test (void)
+{
+  struct ifaddrs *ifaces, *ifa;
+
+  if (getifaddrs (&ifaces) < 0)
+    {
+      if (errno != ENOSYS)
+	{
+	  printf ("Couldn't get any interfaces: %s.\n", strerror (errno));
+	  exit (1);
+	}
+      /* The function is simply not implemented.  */
+      exit (0);
+    }
+
+  puts ("\
+Name           Flags   Address         Netmask         Broadcast/Destination");
+
+  for (ifa = ifaces; ifa != NULL; ifa = ifa->ifa_next)
+    {
+      char abuf[64], mbuf[64], dbuf[64];
+      printf ("%-15s%#.4x  %-15s %-15s %-15s\n",
+	      ifa->ifa_name, ifa->ifa_flags,
+	      addr_string (ifa->ifa_addr, abuf, sizeof (abuf)),
+	      addr_string (ifa->ifa_netmask, mbuf, sizeof (mbuf)),
+	      addr_string (ifa->ifa_broadaddr, dbuf, sizeof (dbuf)));
+    }
+
+  freeifaddrs (ifaces);
+
+  return failures ? 1 : 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/test/misc/Makefile.in b/test/misc/Makefile.in
index d78b276..09ff5c3 100644
--- a/test/misc/Makefile.in
+++ b/test/misc/Makefile.in
@@ -45,3 +45,4 @@ CFLAGS_bug-glob2 = -fPIC
 CFLAGS_opendir-tst1 = -fPIC
 CFLAGS_tst-inotify = -fPIC
 CFLAGS_tst-utmp = -fPIC
+CFLAGS_tst-utmpx = -fPIC
diff --git a/test/silly/Makefile.in b/test/silly/Makefile.in
index 9bb4032..2114d4d 100644
--- a/test/silly/Makefile.in
+++ b/test/silly/Makefile.in
@@ -5,4 +5,4 @@ RET_hello := 42
 RET_tiny  := 42
 
 # missing internal headers, disable these
-GLIBC_TESTS_DISABLED := tst-atomic_glibc tst-atomic-long_glibc
+TESTS_DISABLED := tst-atomic tst-atomic-long


hooks/post-receive
-- 
uClibc-ng - small C library for embedded systems


More information about the devel mailing list