diff options
159 files changed, 1866 insertions, 1511 deletions
diff --git a/Makefile.in b/Makefile.in index aa4a76015..ef77f969d 100644 --- a/Makefile.in +++ b/Makefile.in @@ -14,24 +14,6 @@ noconfig_targets := menuconfig config oldconfig randconfig \ include $(top_builddir)Rules.mak -# need to have libc.so built, before we can build the others -ifeq ($(HAVE_SHARED),y) -PRE_DIRS = ldso libc -DIRS = ldso libcrypt libresolv libnsl libutil librt -else -PRE_DIRS = libc -DIRS = libcrypt libresolv libnsl libutil librt -endif -ifeq ($(UCLIBC_HAS_FLOATS),y) - DIRS += libm -endif -ifeq ($(UCLIBC_HAS_THREADS),y) - DIRS += libpthread -endif -ifeq ($(UCLIBC_HAS_GETTEXT_AWARENESS),y) - DIRS += libintl -endif - ifeq ($(HAVE_DOT_CONFIG),y) all: finished @@ -39,18 +21,30 @@ all: finished # In this section, we need .config -include .config.cmd -finished: subdirs +include $(top_srcdir)ldso/ldso/Makefile.in +include $(top_srcdir)libc/Makefile.in +include $(top_srcdir)ldso/libdl/Makefile.in +include $(top_srcdir)libcrypt/Makefile.in +include $(top_srcdir)libintl/Makefile.in +include $(top_srcdir)libm/Makefile.in +include $(top_srcdir)libnsl/Makefile.in +include $(top_srcdir)libresolv/Makefile.in +include $(top_srcdir)librt/Makefile.in +include $(top_srcdir)libutil/Makefile.in +include $(top_srcdir)libpthread/Makefile.in + +finished: pregen libs $(SECHO) $(SECHO) Finally finished compiling ... $(SECHO) include/bits/uClibc_config.h: .config - @if [ ! -x $(top_builddir)extra/config/conf ] ; then \ - $(MAKE) -C $(top_builddir)extra/config conf; \ + $(RM) -r include/bits + $(INSTALL) -d include/bits + @if [ ! -x extra/config/conf ] ; then \ + $(MAKE) -C extra/config conf; \ fi - $(RM) -r $(top_builddir)include/bits - $(INSTALL) -d $(top_builddir)include/bits - @$(top_builddir)extra/config/conf -o $(top_srcdir)extra/Configs/Config.in + @extra/config/conf -o $(top_srcdir)extra/Configs/Config.in # For the moment, we have to keep re-running this target # because the fix includes scripts rely on pre-processers @@ -62,7 +56,7 @@ export header_extra_args = else export header_extra_args = -n endif -headers: $(top_srcdir)include/bits/uClibc_config.h +headers: include/bits/uClibc_config.h @$(SHELL_SET_X); \ $(top_srcdir)extra/scripts/fix_includes.sh \ -k $(KERNEL_SOURCE) -t $(TARGET_ARCH) \ @@ -73,7 +67,7 @@ headers: $(top_srcdir)include/bits/uClibc_config.h $(LN) -fs ../libc/sysdeps/linux/common/fpu_control.h include/ ; \ fi $(LN) -fs ../libc/sysdeps/linux/common/dl-osinfo.h include/ - @cd $(top_builddir)include/bits; \ + @cd include/bits; \ set -e; \ for i in `ls ../../libc/sysdeps/linux/common/bits/*.h` ; do \ $(LN) -fs $$i .; \ @@ -83,7 +77,7 @@ headers: $(top_srcdir)include/bits/uClibc_config.h $(LN) -fs $$i .; \ done; \ fi - @cd $(top_builddir)include/sys; \ + @cd include/sys; \ set -e; \ for i in `ls ../../libc/sysdeps/linux/common/sys/*.h` ; do \ $(LN) -fs $$i .; \ @@ -96,20 +90,14 @@ headers: $(top_srcdir)include/bits/uClibc_config.h @cd $(top_builddir); \ set -e; \ $(SHELL_SET_X); \ - TOPDIR=. CC="$(CC)" /bin/sh extra/scripts/gen_bits_syscall_h.sh > include/bits/sysnum.h.new; \ + top_builddir=. CC="$(CC)" /bin/sh extra/scripts/gen_bits_syscall_h.sh > include/bits/sysnum.h.new; \ if cmp include/bits/sysnum.h include/bits/sysnum.h.new >/dev/null 2>&1; then \ $(RM) include/bits/sysnum.h.new; \ else \ $(RM) include/bits/sysnum.h; \ mv -f include/bits/sysnum.h.new include/bits/sysnum.h; \ fi -ifeq ($(HAVE_SHARED),y) - $(MAKE) -C ldso headers-y -endif -ifeq ($(UCLIBC_HAS_THREADS),y) - $(MAKE) -C libpthread headers-y -endif - $(MAKE) -C libc/sysdeps/linux headers-y + $(MAKE) headers-y # Command used to download source code WGET:=wget --passive-ftp @@ -128,14 +116,6 @@ ifeq ($(UCLIBC_PREGENERATED_LOCALE_DATA),y) $(MAKE) -C $(top_srcdir)extra/locale pregen endif -pre_subdirs: $(patsubst %, _pre_dir_%, $(PRE_DIRS)) -$(patsubst %, _pre_dir_%, $(PRE_DIRS)): pregen - @$(MAKE) -C $(patsubst _pre_dir_%, %, $@) - -subdirs: $(patsubst %, _dir_%, $(DIRS)) -$(patsubst %, _dir_%, $(DIRS)): pre_subdirs - @$(MAKE) -C $(patsubst _dir_%, %, $@) - install: install_runtime install_dev finished2 @@ -350,9 +330,7 @@ clean: $(RM) libc/stdio/*64.c $(RM) include/fpu_control.h include/dl-osinfo.h $(MAKE) -C extra/locale clean - $(MAKE) -C ldso headers_clean-y - $(MAKE) -C libpthread headers_clean-y - $(MAKE) -C libc/sysdeps/linux headers_clean-y + $(MAKE) headers_clean-y $(MAKE) -C test clean $(MAKE) -C utils clean @set -e; \ @@ -8,13 +8,36 @@ ifeq ($(HAVE_SHARED),y) .LIBPATTERNS: "lib%.so" libs: lib-so-y lib-a-y +objs: shared_objs ar_objs else .LIBPATTERNS: "lib%.a" libs: lib-a-y +objs: ar_objs endif -lib-a-y: $(lib-a-y) -lib-so-y: $(lib-so-y) +shared_objs-y = $(lduClibc-so-y) $(libc-so-y) $(libc-nonshared-y) $(libdl-so-y) +shared_objs-y += $(libcrypt-so-y) $(libintl-so-y) $(libm-so-y) $(libnsl-so-y) $(libpthread-so-y) +shared_objs-y += $(libresolv-so-y) $(librt-so-y) $(libutil-so-y) +ar_objs-y = $(libc-a-y) $(libcrypt-a-y) $(libintl-a-y) $(libm-a-y) $(libnsl-a-y) +ar_objs-y += $(libpthread-a-y) $(libresolv-a-y) $(librt-a-y) $(libutil-a-y) + +shared_objs: $(shared_objs-y) +ifeq ($(DOPIC),y) +ar_objs: $(ar_objs-y:.o=.os) +else +ar_objs: $(ar_objs-y) +endif + +headers-y: $(headers-y) +ld-uClibc-y: $(ld-uClibc-y) +interp-y: $(interp) +pre-y: interp-y ld-uClibc-y +libc-y: pre-y $(libc) crt-y +lib-a-y: headers_root crt-y $(lib-a-y) +lib-so-y: libc-y $(lib-so-y) + +headers_root: + @cd $(top_builddir); $(MAKE) headers ifneq ($(findstring s,$(MAKEFLAGS)),) DISP := sil @@ -35,9 +58,9 @@ pur_disp_compile.c = echo " "CC $(show_objs) pur_disp_compile.S = echo " "AS $(show_objs) pur_disp_compile.m = $(pur_disp_compile.c) pur_disp_compile-m = echo " "CC-m $(show_objs) -pur_disp_strip = echo " "STRIP $(STRIP_FLAGS) +pur_disp_strip = echo " "STRIP $(STRIP_FLAGS) $@:* pur_disp_ar = echo " "AR $(ARFLAGS) $@ -pur_disp_ld = echo " "LD $($(LIB_NAME)_FULL_NAME) +pur_disp_ld = echo " "LD $(1) sil_disp_compile.c = true sil_disp_compile.S = true @@ -63,10 +86,10 @@ disp_strip = $($(DISP)_disp_strip) disp_ar = $($(DISP)_disp_ar) disp_ld = $($(DISP)_disp_ld) -cmd_compile.c = $(CC) -c $< -o $@ $(CPPFLAGS) $(CFLAGS) $(ARCH_CFLAGS) $(CFLAGS-$(suffix $@)) $(CFLAGS-$(notdir $@)) $(CFLAGS-$(notdir $<)) -cmd_compile.S = $(cmd_compile.c) $(S_CPPFLAGS) $(ASFLAGS) $(ARCH_ASFLAGS) $(ASFLAGS-$(suffix $@)) $(ASFLAGS-$(notdir $@)) $(ASFLAGS-$(notdir $<)) +cmd_compile.c = $(CC) -c $< -o $@ $(CFLAGS) $(ARCH_CFLAGS) $(CFLAGS-$(suffix $@)) $(CFLAGS-$(notdir $(^D))) $(CFLAGS-$(subst $(top_srcdir),,$(dir $<))) $(CFLAGS-$(notdir $<)) $(CFLAGS-$(notdir $@)) +cmd_compile.S = $(cmd_compile.c) $(ASFLAGS) $(ARCH_ASFLAGS) $(ASFLAGS-$(suffix $@)) $(ASFLAGS-$(notdir $<)) $(ASFLAGS-$(notdir $@)) cmd_compile.m = $(cmd_compile.c) -DL_$(patsubst %$(suffix $(notdir $@)),%,$(notdir $@)) -cmd_compile-m = $(CC) $^ -c -o $@ $(CPPFLAGS) $(CFLAGS) $(ARCH_CFLAGS) $(CFLAGS-$(suffix $@)) $(CFLAGS-$(notdir $@)) $(CFLAGS-$(notdir $<)) $(CFLAGS-multi-y) +cmd_compile-m = $(CC) $^ -c -o $@ $(CFLAGS) $(ARCH_CFLAGS) $(CFLAGS-$(suffix $@)) $(CFLAGS-$(notdir $@)) $(CFLAGS-multi-y) cmd_strip = $(STRIPTOOL) $(STRIP_FLAGS) $^ cmd_ar = $(AR) $(ARFLAGS) $@ $^ @@ -78,6 +101,18 @@ compile-m = @$(disp_compile-m) ; $(cmd_compile-m) do_strip = @$(disp_strip) ; $(cmd_strip) do_ar = @$(disp_ar) ; $(cmd_ar) +define link.so + $(Q)$(INSTALL) -d $(dir $@) + $(Q)$(RM) $@ $@.$(2) $(dir $@)$(1) + @$(disp_ld) + $(Q)$(LD) $(LDFLAGS-$(notdir $@)) -soname=$(notdir $@).$(2) \ + -o $(dir $@)$(1) $(START_FILE-$(notdir $@)) \ + --whole-archive $(firstword $^) --no-whole-archive \ + $(LIBS-$(notdir $@)) $(LIBGCC) $(END_FILE-$(notdir $@)) + $(Q)$(LN) -sf $(1) $@.$(2) + $(Q)$(LN) -sf $(1) $@ +endef + CFLAGS-.os+=$(PICFLAG) CFLAGS-.oS+=$(PICFLAG) -DSHARED @@ -134,12 +169,6 @@ endif crt-y: $(crt-y) $(crt-y): $(CRTS) $(CTOR_TARGETS) -other-y: $(other-y) -headers-y: $(headers-y) - -objclean-y: $(objclean-y) -headers_clean-y: $(headers_clean-y) - $(top_builddir)lib/$(NONSHARED_LIBNAME): $(libc-nonshared-y) $(Q)$(INSTALL) -d $(dir $@) $(do_ar) @@ -147,109 +176,5 @@ $(top_builddir)lib/$(NONSHARED_LIBNAME): $(libc-nonshared-y) .PHONY: dummy create clean: objclean-y headers_clean-y -ifeq ($(strip $(LIB_NAME)),) -LIB_NAME=libc -endif - -ifeq ($(strip $($(LIB_NAME)_FULL_NAME)),) -$(LIB_NAME)_FULL_NAME:=$(LIB_NAME)-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so -endif - -$(LIB_NAME)-SHARED_OBJS=$($(LIB_NAME)-so-y) $($(LIB_NAME)-shared-y) -ifeq ($(HAVE_SHARED),y) -shared: $($(LIB_NAME)-SHARED_OBJS) -else -shared: -endif - -$(LIB_NAME)-ARCHIVE_OBJS=$($(LIB_NAME)-a-y) $($(LIB_NAME)-static-y) -ifeq ($(DOPIC),y) -objs: shared $($(LIB_NAME)-ARCHIVE_OBJS:.o=.os) $(crt-y) $(other-y) -else -objs: shared $($(LIB_NAME)-ARCHIVE_OBJS) $(crt-y) $(other-y) -endif - -libc=$(top_builddir)lib/libc.so -interp=$(top_builddir)libc/misc/internals/interp.os -ifeq ($(strip $(EXTRA_LINK_LIBS)),) -#EXTRA_LINK_LIBS:=$(interp) -L$(top_builddir)lib -lc $(LDADD_LIBFLOAT) $(LIBGCC) -EXTRA_LINK_LIBS:=$(interp) -L$(top_builddir)lib $(libc) $(LDADD_LIBFLOAT) $(LIBGCC) -endif - -ifneq ($(strip $(LIB_NAME)),libc) -ifneq ($(strip $(LIB_NAME)),ld-uClibc) -$(top_builddir)lib/$(LIB_NAME).so: $($(LIB_NAME)_OUT)/$(LIB_NAME)_so.a $(interp) $(libc) -else -$(top_builddir)lib/$(LIB_NAME).so: $($(LIB_NAME)_OUT)/$(LIB_NAME)_so.a -endif -else -$(top_builddir)lib/$(LIB_NAME).so: $($(LIB_NAME)_OUT)/$(LIB_NAME)_so.a $(interp) -endif - $(Q)$(INSTALL) -d $(dir $@) - $(Q)$(RM) $@ $@.$(MAJOR_VERSION) $(top_builddir)lib/$($(LIB_NAME)_FULL_NAME) - @$(disp_ld) - $(Q)$(LD) $(LDFLAGS) $(EXTRA_LINK_OPTS) -soname=$(notdir $@).$(MAJOR_VERSION) \ - -o $(top_builddir)lib/$($(LIB_NAME)_FULL_NAME) $(SHARED_START_FILES) \ - --whole-archive $(firstword $^) --no-whole-archive \ - $(EXTRA_LINK_LIBS) $(SHARED_END_FILES) - $(Q)$(LN) -sf $($(LIB_NAME)_FULL_NAME) $@.$(MAJOR_VERSION) -ifneq ($(strip $(LIB_NAME)),libc) -ifneq ($(strip $(LIB_NAME)),ld-uClibc) - $(Q)$(LN) -sf $($(LIB_NAME)_FULL_NAME) $@ -endif -else - $(Q)echo "/* GNU ld script" > $@ - $(Q)echo " * Use the shared library, but some functions are only in" >> $@ - $(Q)echo " * the static library, so try that secondarily. */" >> $@ -ifeq ($(COMPAT_ATEXIT),y) - $(Q)echo "GROUP ( $(NONSHARED_LIBNAME) $(SHARED_MAJORNAME) $(ASNEEDED) )" >> $@ -else - $(Q)echo "GROUP ( $(SHARED_MAJORNAME) $(NONSHARED_LIBNAME) $(ASNEEDED) )" >> $@ -endif -endif - -$($(LIB_NAME)_OUT)/$(LIB_NAME)_m.o $($(LIB_NAME)_OUT)/$(LIB_NAME)_m.os: $($(LIB_NAME)-multi-y) - $(compile-m) - -# local testing only until libc is multi-capable -libc_m.os: $(libc-multi-y) - $(compile-m) - -ifneq ($(DOMULTI),n) - -$($(LIB_NAME)_OUT)/$(LIB_NAME)_so.a: $($(LIB_NAME)_OUT)/$(LIB_NAME)_m.os $($(LIB_NAME)-nomulti-y:.o=.os) $($(LIB_NAME)-shared-y) - $(Q)$(RM) $@ - $(do_strip) - $(do_ar) - -ifeq ($(DOPIC),y) -$(top_builddir)lib/$(LIB_NAME).a: $($(LIB_NAME)_OUT)/$(LIB_NAME)_m.os $($(LIB_NAME)-nomulti-y:.o=.os) $($(LIB_NAME)-static-y:.o=.os) -else -$(top_builddir)lib/$(LIB_NAME).a: $($(LIB_NAME)_OUT)/$(LIB_NAME)_m.o $($(LIB_NAME)-nomulti-y) $($(LIB_NAME)-static-y) -endif - $(Q)$(INSTALL) -d $(dir $@) - $(Q)$(RM) $@ - $(do_strip) - $(do_ar) - -else # DOMULTI - -$($(LIB_NAME)_OUT)/$(LIB_NAME)_so.a: $($(LIB_NAME)-SHARED_OBJS) - $(Q)$(RM) $@ - $(do_strip) - $(do_ar) - -ifeq ($(DOPIC),y) -$(top_builddir)lib/$(LIB_NAME).a: $($(LIB_NAME)-ARCHIVE_OBJS:.o=.os) -else -$(top_builddir)lib/$(LIB_NAME).a: $($(LIB_NAME)-ARCHIVE_OBJS) -endif - $(Q)$(INSTALL) -d $(dir $@) - $(Q)$(RM) $@ - $(do_strip) - $(do_ar) - -endif # DOMULTI - -$(LIB_NAME)_clean: - $(RM) $($(LIB_NAME)_OUT)/*.{o,os,a} +objclean-y: $(objclean-y) +headers_clean-y: $(headers_clean-y) diff --git a/extra/Configs/Config.alpha b/extra/Configs/Config.alpha index acd847395..47545ce5d 100644 --- a/extra/Configs/Config.alpha +++ b/extra/Configs/Config.alpha @@ -6,7 +6,6 @@ config HAVE_ELF select ARCH_HAS_MMU select ARCH_HAS_NO_LDSO - select HAS_NO_THREADS select UCLIBC_HAS_LFS bool default y diff --git a/extra/Configs/Config.x86_64 b/extra/Configs/Config.x86_64 index 7bc0cd50f..68002268d 100644 --- a/extra/Configs/Config.x86_64 +++ b/extra/Configs/Config.x86_64 @@ -6,7 +6,7 @@ config HAVE_ELF bool select ARCH_HAS_MMU - select HAS_NO_THREADS + select UCLIBC_HAS_LFS default y config TARGET_ARCH diff --git a/ldso/Makefile.in b/ldso/Makefile.in index 8d3c5fcda..7bbef23a0 100644 --- a/ldso/Makefile.in +++ b/ldso/Makefile.in @@ -5,41 +5,5 @@ # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. # -DIRS=$(shell if test -f $(top_builddir)lib/libc.so ; then echo "ldso libdl" ; else echo "ldso" ; fi) - -libs: subdirs - -LN_HEADERS := $(patsubst %, include/%, elf.h) -LN_ARCH_HEADERS := $(patsubst %, include/%, dl-startup.h dl-syscalls.h dl-sysdep.h dl-debug.h) -HEADERS := $(LN_HEADERS) $(LN_ARCH_HEADERS) include/dl-progname.h - -headers-y+=ldso_headers - -ldso_headers: $(HEADERS) - -$(LN_HEADERS): - $(LN) -sf $(top_builddir)../$@ $@ - -$(LN_ARCH_HEADERS): - $(LN) -sf ../ldso/$(TARGET_ARCH)/$(patsubst include/%,%,$@) $@ - -include/dl-progname.h: - echo '#include "$(TARGET_ARCH)/elfinterp.c"' > $@ - -headers_clean-y+=ldso_headers_clean - -ldso_headers_clean: - $(RM) $(HEADERS) - -clean: subdirs_clean ldso_headers_clean - -subdirs: $(patsubst %, _dir_%, $(DIRS)) -subdirs_clean: $(patsubst %, _dirclean_%, $(DIRS)) - -$(patsubst %, _dir_%, $(DIRS)): ldso_headers - $(MAKE) -C $(patsubst _dir_%, %, $@) - -$(patsubst %, _dirclean_%, $(DIRS)): dummy - $(MAKE) -C $(patsubst _dirclean_%, %, $@) clean - -.PHONY: dummy +include $(top_srcdir)ldso/ldso/Makefile.in +include $(top_srcdir)ldso/libdl/Makefile.in diff --git a/ldso/ldso/Makefile.in b/ldso/ldso/Makefile.in index 47ab64bca..0bf5c02ed 100644 --- a/ldso/ldso/Makefile.in +++ b/ldso/ldso/Makefile.in @@ -5,66 +5,85 @@ # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. # -# psm: I do not know if the order of includes is relevant -# to be sure I have put them first -CFLAGS:=-I$(top_builddir)ldso/include -I. $(CFLAGS) $(PICFLAG) $(SSP_DISABLE_FLAGS) +CFLAGS-ldso := -DNOT_IN_libc #-DIS_IN_rtld -CFLAGS+=-DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\" -DUCLIBC_LDSO=\"$(UCLIBC_LDSO)\" +# This stuff will not work with -fomit-frame-pointer +CFLAGS-ldso += -fno-omit-frame-pointer + +CFLAGS-ldso += -I$(top_builddir)ldso/include -I$(top_builddir)ldso/ldso $(SSP_DISABLE_FLAGS) +CFLAGS-ldso += -DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\" -DUCLIBC_LDSO=\"$(UCLIBC_LDSO)\" ifeq ($(SUPPORT_LD_DEBUG),y) -CFLAGS+=-D__SUPPORT_LD_DEBUG__ +CFLAGS-ldso += -D__SUPPORT_LD_DEBUG__ endif ifeq ($(SUPPORT_LD_DEBUG_EARLY),y) -CFLAGS+=-D__SUPPORT_LD_DEBUG_EARLY__ +CFLAGS-ldso += -D__SUPPORT_LD_DEBUG_EARLY__ endif -CFLAGS+=-DNOT_IN_libc - ifeq ($(DODEBUG),y) # Not really much point in including debugging info, since gdb # can't really debug ldso, since gdb requires help from ldso to # debug things.... -# psm: keep this in sync w/ Rules.mak -CFLAGS:=$(CFLAGS:-O0 -g3=-Os -g) +CFLAGS-ldso += -Os -g endif -# BEWARE!!! At least mips* will die if -O0 is used!!! -ifeq ($(TARGET_ARCH),mips) -CFLAGS:=$(CFLAGS:-O0=-O1) +CFLAGS-ldso/ldso/$(TARGET_ARCH)/ := $(CFLAGS-ldso) + +ifneq ($(SUPPORT_LD_DEBUG),y) +LDFLAGS-ld-uClibc.so := $(LDFLAGS) +else +LDFLAGS-ld-uClibc.so := $(LDFLAGS_NOSTRIP) -z defs endif +LDFLAGS-ld-uClibc.so += -e _start -z now -Bsymbolic --export-dynamic --sort-common --discard-locals --discard-all --no-undefined -# This stuff will not work with -fomit-frame-pointer -CFLAGS:=$(CFLAGS:-fomit-frame-pointer=) +ldso_FULL_NAME := ld-uClibc-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so -ifeq ($(SUPPORT_LD_DEBUG),y) -LDFLAGS:=$(LDFLAGS_NOSTRIP) -endif +ld-uClibc_DIR := $(top_srcdir)ldso/ldso +ld-uClibc_OUT := $(top_builddir)ldso/ldso + +ld-uClibc_CSRC := $(ld-uClibc_DIR)/ldso.c +ld-uClibc_COBJ := $(patsubst $(ld-uClibc_DIR)/%.c,$(ld-uClibc_OUT)/%.o,$(ld-uClibc_CSRC)) + +ld-uClibc_SSRC := $(wildcard $(ld-uClibc_DIR)/$(TARGET_ARCH)/*.S) +ld-uClibc_SOBJ := $(patsubst $(ld-uClibc_DIR)/$(TARGET_ARCH)/%.S,$(ld-uClibc_OUT)/$(TARGET_ARCH)/%.o,$(ld-uClibc_SSRC)) + +ld-uClibc_OBJS := $(ld-uClibc_COBJ) $(ld-uClibc_SOBJ) -# can't combine .c w/ .S -DOMULTI=n +ld-uClibc-so-y := $(ld-uClibc_OBJS:.o=.os) -LIB_NAME:=ld-uClibc +LN_HEADERS := $(patsubst %, $(top_builddir)ldso/include/%, elf.h) +LN_ARCH_HEADERS := $(patsubst %, $(top_builddir)ldso/include/%, dl-startup.h dl-syscalls.h dl-sysdep.h dl-debug.h) +HEADERS := $(LN_HEADERS) $(LN_ARCH_HEADERS) $(top_builddir)ldso/include/dl-progname.h -ld-uClibc_DIR:=$(top_srcdir)ldso/ldso -ld-uClibc_OUT:=$(top_builddir)ldso/ldso +#lib-so-y := $(top_builddir)lib/$(patsubst %.$(MAJOR_VERSION),%,$(UCLIBC_LDSO)) +ld-uClibc-y := $(top_builddir)lib/$(patsubst %.$(MAJOR_VERSION),%,$(UCLIBC_LDSO)) +objclean-y += ld-uClibc_clean +headers-$(HAVE_SHARED) += ldso_headers +headers_clean-y += ldso_headers_clean -ld-uClibc_SRC:=$(ld-uClibc_DIR)/ldso.c -ld-uClibc_OBJ:=$(patsubst $(ld-uClibc_DIR)/%.c,$(ld-uClibc_OUT)/%.o,$(ld-uClibc_SRC)) +$(top_builddir)lib/$(patsubst %.$(MAJOR_VERSION),%,$(UCLIBC_LDSO)): $(ld-uClibc_OUT)/ld-uClibc_so.a headers_root + $(call link.so,$(ldso_FULL_NAME),$(MAJOR_VERSION)) + #(RM) $@ -ld-uClibc_SSRC:=$(wildcard $(ld-uClibc_DIR)/$(TARGET_ARCH)/*.S) -ld-uClibc_SOBJ:=$(patsubst $(ld-uClibc_DIR)/$(TARGET_ARCH)/%.S,$(ld-uClibc_OUT)/$(TARGET_ARCH)/%.o,$(ld-uClibc_SSRC)) +$(ld-uClibc_OUT)/ld-uClibc_so.a: $(ld-uClibc-so-y) + $(Q)$(RM) $@ + $(do_strip) + $(do_ar) -ld-uClibc_OBJS:=$(ld-uClibc_OBJ) $(ld-uClibc_SOBJ) +ldso_headers: $(HEADERS) -EXTRA_LINK_OPTS:=-e _start -z now -Bsymbolic --export-dynamic --sort-common --discard-locals --discard-all --no-undefined -EXTRA_LINK_LIBS:=$(LIBGCC) # $(LDADD_LIBFLOAT) +$(LN_HEADERS): + $(LN) -sf ../../$(top_srcdir)include/$(notdir $@) $@ -ld-uClibc-so-$(HAVE_SHARED):=$(ld-uClibc_OBJS:.o=.os) +$(LN_ARCH_HEADERS): + $(LN) -sf ../../$(top_srcdir)ldso/ldso/$(TARGET_ARCH)/$(notdir $@) $@ -objclean-y+=ld-uClibc_clean ld-uClibc_arch_clean +$(top_builddir)ldso/include/dl-progname.h: + echo '#include "$(TARGET_ARCH)/elfinterp.c"' > $@ -ld-uClibc_arch_clean: - $(RM) $(ld-uClibc_OUT)/*/*.{o,os} +ldso_headers_clean: + $(RM) $(HEADERS) -lib-so-$(HAVE_SHARED)+=$(top_builddir)lib/ld-uClibc.so +ld-uClibc_clean: + $(RM) $(ld-uClibc_OUT)/*.{o,os,a} $(ld-uClibc_OUT)/*/*.{o,os} diff --git a/ldso/libdl/Makefile.in b/ldso/libdl/Makefile.in index 96af1e4bf..6622226c5 100644 --- a/ldso/libdl/Makefile.in +++ b/ldso/libdl/Makefile.in @@ -6,46 +6,54 @@ # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. # -# psm: I do not know if the order of includes is relevant -# to be sure I added them first, Jocke please cleanup if needed -CFLAGS:=-I$(top_builddir)ldso/include -I$(top_builddir)ldso/ldso $(CFLAGS) $(SSP_ALL_CFLAGS) +CFLAGS-libdl := -DNOT_IN_libc -CFLAGS+=-DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\" +CFLAGS-libdl +=-I$(top_builddir)ldso/include -I$(top_builddir)ldso/ldso $(SSP_ALL_CFLAGS) + +CFLAGS-libdl += -DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\" ifeq ($(SUPPORT_LD_DEBUG),y) -CFLAGS+=-D__SUPPORT_LD_DEBUG__ +CFLAGS-libdl += -D__SUPPORT_LD_DEBUG__ endif -# BEWARE!!! At least mips* will die if -O0 is used!!! -ifeq ($(TARGET_ARCH),mips) -CFLAGS:=$(CFLAGS:-O0=-O1) -endif +LDFLAGS-libdl.so := $(LDFLAGS) -fini dl_cleanup -# can't combine .c w/ .S -DOMULTI=n +LIBS-libdl.so := $(LIBS) $(top_builddir)lib/$(UCLIBC_LDSO) -LIB_NAME:=libdl +libdl_FULL_NAME := libdl-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so -EXTRA_LINK_OPTS:=-fini dl_cleanup -# keep in sync w/ Makerules -EXTRA_LINK_LIBS:=$(top_builddir)libc/misc/internals/interp.os -L$(top_builddir)lib $(top_builddir)lib/libc.so $(LIBGCC) $(top_builddir)lib/$(UCLIBC_LDSO) +libdl_DIR := $(top_srcdir)ldso/libdl +libdl_OUT := $(top_builddir)ldso/libdl -libdl_DIR:=$(top_srcdir)ldso/libdl -libdl_OUT:=$(top_builddir)ldso/libdl +libdl_SRC := $(libdl_DIR)/libdl.c +libdl_OBJ := $(patsubst $(libdl_DIR)/%.c,$(libdl_OUT)/%.o,$(libdl_SRC)) -libdl_SRC:=$(libdl_DIR)/libdl.c -libdl_OBJ:=$(patsubst $(libdl_DIR)/%.c,$(libdl_OUT)/%.o,$(libdl_SRC)) +resolve := $(top_builddir)ldso/ldso/$(TARGET_ARCH)/resolve.o -resolve:=$(top_builddir)ldso/ldso/$(TARGET_ARCH)/resolve.o +libdl-a-y := $(libdl_OBJ) $(resolve) +libdl-so-y := $(libdl_OUT)/libdl.oS -libdl-a-$(HAVE_SHARED):=$(libdl_OBJ) -libdl-static-$(HAVE_SHARED):=$(resolve) -libdl-shared-$(HAVE_SHARED):=$(libdl_OUT)/libdl.oS +lib-a-$(HAVE_SHARED) += $(top_builddir)lib/libdl.a +lib-so-y += $(top_builddir)lib/libdl.so +objclean-y += libdl_clean -objclean-y+=libdl_clean libdl_extra_clean +$(top_builddir)lib/libdl.so: $(libdl_OUT)/libdl_so.a ld-uClibc-y libc-y + $(call link.so,$(libdl_FULL_NAME),$(MAJOR_VERSION)) -libdl_extra_clean: - $(RM) $(libdl_OUT)/*.oS +$(libdl_OUT)/libdl_so.a: $(libdl-so-y) + $(Q)$(RM) $@ + $(do_strip) + $(do_ar) + +ifeq ($(DOPIC),y) +$(top_builddir)lib/libdl.a: $(libdl-a-y:.o=.os) +else +$(top_builddir)lib/libdl.a: $(libdl-a-y) +endif + $(Q)$(INSTALL) -d $(dir $@) + $(Q)$(RM) $@ + $(do_strip) + $(do_ar) -lib-a-$(HAVE_SHARED)+=$(top_builddir)lib/libdl.a -lib-so-$(HAVE_SHARED)+=$(top_builddir)lib/libdl.so +libdl_clean: + $(RM) $(libdl_OUT)/*.{o,os,a,oS} diff --git a/libc/Makefile.in b/libc/Makefile.in index 1e0b58437..50201d4fd 100644 --- a/libc/Makefile.in +++ b/libc/Makefile.in @@ -6,17 +6,22 @@ # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. # -DOMULTI=n +# Check if the target architecture has a version script for +# libc, and if so, include it when linking. +VERSION_SCRIPT := $(wildcard $(libc_DIR)/sysdeps/linux/$(TARGET_ARCH)/libc.map) +ifneq ($(VERSION_SCRIPT),) +VERSION_SCRIPT := --version-script $(VERSION_SCRIPT) +endif -# we have SHARED_MAJORNAME=libc.so.$(MAJOR_VERSION) defined in Rules.mak -LIB_NAME:=libc +LDFLAGS-libc.so := $(LDFLAGS) $(VERSION_SCRIPT) -init __uClibc_init -libc_DIR:=$(top_srcdir)libc -libc_OUT:=$(top_builddir)libc +LIBS-libc.so := $(interp) $(top_builddir)lib/$(UCLIBC_LDSO) -libc_FULL_NAME:=libuClibc-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so +# we have SHARED_MAJORNAME=libc.so.$(MAJOR_VERSION) defined in Rules.mak +libc_FULL_NAME := libuClibc-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so -#DIRS:=misc pwd_grp stdio string termios inet signal stdlib sysdeps unistd +libc_DIR := $(top_srcdir)libc +libc_OUT := $(top_builddir)libc # this comes first, so duplicate removal works correctly include $(libc_DIR)/sysdeps/Makefile.in @@ -31,17 +36,41 @@ include $(libc_DIR)/signal/Makefile.in include $(libc_DIR)/stdlib/Makefile.in include $(libc_DIR)/unistd/Makefile.in -# Check if the target architecture has a version script for -# libc, and if so, include it when linking. -VERSION_SCRIPT := $(wildcard $(libc_DIR)/sysdeps/linux/$(TARGET_ARCH)/libc.map) -ifneq ($(VERSION_SCRIPT),) -VERSION_SCRIPT := --version-script $(VERSION_SCRIPT) +libc-a-y += $(libc-static-y) +libc-so-y += $(libc-shared-y) + +libc-nomulti-y += $(libc-shared-y) + +lib-a-y += $(top_builddir)lib/libc.a crt-y +lib-so-y += libc-y $(top_builddir)lib/$(NONSHARED_LIBNAME) crt-y +objclean-y += libc_clean + +$(top_builddir)lib/libc.so: $(libc_OUT)/libc_so.a pre-y + $(call link.so,$(libc_FULL_NAME),$(MAJOR_VERSION)) + $(Q)$(RM) $@ + $(Q)echo "/* GNU ld script" > $@ + $(Q)echo " * Use the shared library, but some functions are only in" >> $@ + $(Q)echo " * the static library, so try that secondarily. */" >> $@ +ifeq ($(COMPAT_ATEXIT),y) + $(Q)echo "GROUP ( $(NONSHARED_LIBNAME) $(SHARED_MAJORNAME) $(ASNEEDED) )" >> $@ +else + $(Q)echo "GROUP ( $(SHARED_MAJORNAME) $(NONSHARED_LIBNAME) $(ASNEEDED) )" >> $@ endif -EXTRA_LINK_OPTS:=$(VERSION_SCRIPT) -init __uClibc_init -EXTRA_LINK_LIBS:=$(libc_OUT)/misc/internals/interp.os $(top_builddir)lib/$(UCLIBC_LDSO) $(LIBGCC) # $(LDADD_LIBFLOAT) +$(libc_OUT)/libc_so.a: $(libc-so-y) + $(Q)$(RM) $@ + $(do_strip) + $(do_ar) -objclean-y+=libc_clean +ifeq ($(DOPIC),y) +$(top_builddir)lib/libc.a: $(libc-a-y:.o=.os) +else +$(top_builddir)lib/libc.a: $(libc-a-y) +endif + $(Q)$(INSTALL) -d $(dir $@) + $(Q)$(RM) $@ + $(do_strip) + $(do_ar) -lib-a-y+=$(top_builddir)lib/libc.a crt-y -lib-so-y+=$(top_builddir)lib/libc.so $(top_builddir)lib/$(NONSHARED_LIBNAME) crt-y other-y +libc_clean: + $(RM) $(libc_OUT)/*.{o,os,a} diff --git a/libc/inet/rpc/getrpcent.c b/libc/inet/rpc/getrpcent.c index b796d856d..56fbbbe45 100644 --- a/libc/inet/rpc/getrpcent.c +++ b/libc/inet/rpc/getrpcent.c @@ -166,8 +166,8 @@ static char *firstwhite(char *s) { char *s1, *s2; - s1 = index(s, ' '); - s2 = index(s, '\t'); + s1 = strchr(s, ' '); + s2 = strchr(s, '\t'); if (s1) { if (s2) return (s1 < s2) ? s1 : s2; @@ -187,9 +187,9 @@ static struct rpcent *interpret(register struct rpcdata *d) d->line[strlen(p)-1] = '\n'; if (*p == '#') return __get_next_rpcent(d); - cp = index(p, '#'); + cp = strchr(p, '#'); if (cp == NULL) { - cp = index(p, '\n'); + cp = strchr(p, '\n'); if (cp == NULL) return __get_next_rpcent(d); } @@ -200,9 +200,9 @@ static struct rpcent *interpret(register struct rpcdata *d) else return __get_next_rpcent(d); #else - cp = index(p, ' '); + cp = strchr(p, ' '); if (cp == NULL) { - cp = index(p, '\t'); + cp = strchr(p, '\t'); if (cp == NULL) return __get_next_rpcent(d); } @@ -218,11 +218,11 @@ static struct rpcent *interpret(register struct rpcdata *d) if ((cp = firstwhite(cp))) *cp++ = '\0'; #else - cp = index(p, ' '); + cp = strchr(p, ' '); if (cp != NULL) *cp++ = '\0'; else { - cp = index(p, '\t'); + cp = strchr(p, '\t'); if (cp != NULL) *cp++ = '\0'; } @@ -238,11 +238,11 @@ static struct rpcent *interpret(register struct rpcdata *d) if ((cp = firstwhite(cp))) *cp++ = '\0'; #else - cp = index(p, ' '); + cp = strchr(p, ' '); if (cp != NULL) *cp++ = '\0'; else { - cp = index(p, '\t'); + cp = strchr(p, '\t'); if (cp != NULL) *cp++ = '\0'; } diff --git a/libc/inet/rpc/rexec.c b/libc/inet/rpc/rexec.c index 7af948991..2c280d922 100644 --- a/libc/inet/rpc/rexec.c +++ b/libc/inet/rpc/rexec.c @@ -43,7 +43,7 @@ #include <unistd.h> #define SA_LEN(_x) __libc_sa_len((_x)->sa_family) -extern int __libc_sa_len (sa_family_t __af) __THROW; +extern int __libc_sa_len (sa_family_t __af) __THROW attribute_hidden; int rexecoptions; char ahostbuf[NI_MAXHOST]; diff --git a/libc/inet/rpc/sa_len.c b/libc/inet/rpc/sa_len.c index 50b4a7b12..21a6417af 100644 --- a/libc/inet/rpc/sa_len.c +++ b/libc/inet/rpc/sa_len.c @@ -31,7 +31,7 @@ #include <netrose/rose.h> #endif -int __libc_sa_len (sa_family_t af) +int attribute_hidden __libc_sa_len (sa_family_t af) { switch (af) { diff --git a/libc/misc/dirent/dirstream.h b/libc/misc/dirent/dirstream.h index 2dd0264fc..a90ca6312 100644 --- a/libc/misc/dirent/dirstream.h +++ b/libc/misc/dirent/dirstream.h @@ -71,9 +71,9 @@ struct __dirstream { }; /* stream data from opendir() */ -extern int __getdents(unsigned int fd, struct dirent *dirp, unsigned int count); +extern ssize_t __getdents(int fd, char *buf, size_t count) attribute_hidden; #ifdef __UCLIBC_HAS_LFS__ -extern int __getdents64 (unsigned int fd, struct dirent64 *dirp, unsigned int count); +extern ssize_t __getdents64 (int fd, char *buf, size_t count) attribute_hidden; #endif #endif /* dirent.h */ diff --git a/libc/misc/glob/glob.c b/libc/misc/glob/glob.c index a93cf0ab4..0d788df53 100644 --- a/libc/misc/glob/glob.c +++ b/libc/misc/glob/glob.c @@ -426,7 +426,7 @@ glob_in_dir (pattern, directory, flags, errfunc, pglob) if (! (d->d_ino != 0)) continue; name = d->d_name; -#ifdef HAVE_D_NAMLEN +#ifdef _DIRENT_HAVE_D_NAMLEN len = d->d_namlen; #else len = 0; diff --git a/libc/misc/internals/Makefile.in b/libc/misc/internals/Makefile.in index 2916475ec..bfae764e4 100644 --- a/libc/misc/internals/Makefile.in +++ b/libc/misc/internals/Makefile.in @@ -6,7 +6,7 @@ # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. # -CFLAGS-__uClibc_main.c=$(SSP_DISABLE_FLAGS) +CFLAGS-__uClibc_main.c:=$(SSP_DISABLE_FLAGS) CSRC:=tempname.c errno.c __errno_location.c __h_errno_location.c @@ -16,9 +16,7 @@ MISC_INTERNALS_OUT:=$(top_builddir)libc/misc/internals MISC_INTERNALS_SRC:=$(patsubst %.c,$(MISC_INTERNALS_DIR)/%.c,$(CSRC)) MISC_INTERNALS_OBJ:=$(patsubst %.c,$(MISC_INTERNALS_OUT)/%.o,$(CSRC)) -STATIC_SRC:=__uClibc_main.c - -$(MISC_INTERNALS_OUT)/interp.c: $(MISC_INTERNALS_DIR)/Makefile.in +$(MISC_INTERNALS_OUT)/interp.c: headers_root $(Q)echo "/* Force shared libraries to know about the correct library loader */" > $@ $(Q)echo "#include <features.h>" >> $@ $(Q)echo "#ifdef __HAVE_ELF__" >> $@ @@ -29,8 +27,7 @@ $(MISC_INTERNALS_OUT)/interp.c: $(MISC_INTERNALS_DIR)/Makefile.in libc-a-y+=$(MISC_INTERNALS_OBJ) libc-so-y+=$(MISC_INTERNALS_OBJ:.o=.os) libc-shared-y+=$(MISC_INTERNALS_OUT)/__uClibc_main.oS -libc-static-y+=$(patsubst %.c,$(MISC_INTERNALS_OUT)/%.o,$(STATIC_SRC)) -other-y+=$(MISC_INTERNALS_OUT)/interp.os +libc-static-y+=$(MISC_INTERNALS_OUT)/__uClibc_main.o libc-multi-y+=$(MISC_INTERNALS_SRC) diff --git a/libc/misc/pthread/no-tsd.c b/libc/misc/pthread/no-tsd.c index ef79cb832..1fabaae68 100644 --- a/libc/misc/pthread/no-tsd.c +++ b/libc/misc/pthread/no-tsd.c @@ -17,6 +17,7 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#define _GNU_SOURCE #include <bits/libc-tsd.h> /* This file provides uinitialized (common) definitions for the diff --git a/libc/misc/pthread/weaks.c b/libc/misc/pthread/weaks.c index 6767cfffb..b1e067eb4 100644 --- a/libc/misc/pthread/weaks.c +++ b/libc/misc/pthread/weaks.c @@ -17,6 +17,7 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#define _GNU_SOURCE #include <errno.h> #include <limits.h> #include <stdlib.h> diff --git a/libc/misc/syslog/syslog.c b/libc/misc/syslog/syslog.c index 2b478e13d..704336006 100644 --- a/libc/misc/syslog/syslog.c +++ b/libc/misc/syslog/syslog.c @@ -254,7 +254,7 @@ vsyslog( int pri, const char *fmt, va_list ap ) /* should mode be `O_WRONLY | O_NOCTTY' ? -- Uli */ if (LogStat & LOG_CONS && (fd = open(_PATH_CONSOLE, O_WRONLY, 0)) >= 0) { - p = index(tbuf, '>') + 1; + p = strchr(tbuf, '>') + 1; last_chr[0] = '\r'; last_chr[1] = '\n'; (void)write(fd, p, last_chr - p + 2); diff --git a/libc/misc/sysvipc/ipc.h b/libc/misc/sysvipc/ipc.h index a5d443543..c1d4e76c5 100644 --- a/libc/misc/sysvipc/ipc.h +++ b/libc/misc/sysvipc/ipc.h @@ -7,7 +7,7 @@ #ifdef __NR_ipc /* The actual system call: all functions are multiplexed by this. */ -extern int __syscall_ipc __P((int __call, int __first, int __second, +extern int __syscall_ipc __P((unsigned int __call, int __first, int __second, int __third, void *__ptr)); diff --git a/libc/misc/time/time.c b/libc/misc/time/time.c index c315baddc..21c4bb96b 100644 --- a/libc/misc/time/time.c +++ b/libc/misc/time/time.c @@ -1239,9 +1239,7 @@ __XL_ALIAS(strftime) /**********************************************************************/ #if defined(L_strptime) || defined(L_strptime_l) -#if defined(L_strptime) || defined(L_strptime_l) #define ISDIGIT(C) __isdigit_char((C)) -#endif #ifdef __UCLIBC_DO_XLOCALE #define ISSPACE(C) isspace_l((C), locale_arg) diff --git a/libc/misc/ttyent/getttyent.c b/libc/misc/ttyent/getttyent.c index 6e2fbd2f4..d7d77c1ba 100644 --- a/libc/misc/ttyent/getttyent.c +++ b/libc/misc/ttyent/getttyent.c @@ -96,7 +96,7 @@ static char * skip(register char *p) static char * value(register char *p) { - return ((p = index(p, '=')) ? ++p : NULL); + return ((p = strchr(p, '=')) ? ++p : NULL); } struct ttyent * getttyent(void) @@ -122,7 +122,7 @@ struct ttyent * getttyent(void) return (NULL); } /* skip lines that are too big */ - if (!index(p, '\n')) { + if (!strchr(p, '\n')) { while ((c = getc_unlocked(tf)) != '\n' && c != EOF) ; continue; @@ -171,7 +171,7 @@ struct ttyent * getttyent(void) tty.ty_comment = p; if (*p == 0) tty.ty_comment = 0; - if ((p = index(p, '\n'))) + if ((p = strchr(p, '\n'))) *p = '\0'; return (&tty); } diff --git a/libc/signal/killpg.c b/libc/signal/killpg.c index e75cfc483..1fcf6bfa5 100644 --- a/libc/signal/killpg.c +++ b/libc/signal/killpg.c @@ -2,19 +2,19 @@ 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 Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. + 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 - Library General Public License for more details. + Lesser General Public License for more details. - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + 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 <errno.h> #include <signal.h> @@ -23,13 +23,16 @@ /* Send SIG to all processes in process group PGRP. If PGRP is zero, send SIG to all processes in the current process's process group. */ -int killpg ( __pid_t pgrp, int sig) +int +killpg (pgrp, sig) + __pid_t pgrp; + int sig; { - if (pgrp < 0) + if (pgrp < 0) { - __set_errno (EINVAL); - return -1; + __set_errno (EINVAL); + return -1; } - return kill (- pgrp, sig); + return kill (- pgrp, sig); } diff --git a/libc/signal/raise.c b/libc/signal/raise.c index d4137aeb8..69b61385c 100644 --- a/libc/signal/raise.c +++ b/libc/signal/raise.c @@ -7,8 +7,11 @@ #include <signal.h> #include <sys/types.h> -int raise(int signo) +#undef raise +int attribute_hidden __raise(int signo) { return kill(getpid(), signo); } +/* psm: keep this weak, because the one in libpthread.so could overwrite it */ +weak_alias(__raise, raise) diff --git a/libc/signal/sigaction.c b/libc/signal/sigaction.c index 4b8503276..eedf98169 100644 --- a/libc/signal/sigaction.c +++ b/libc/signal/sigaction.c @@ -1,96 +1,116 @@ -/* Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. +/* Copyright (C) 1997,1998,1999,2000,2002,2003 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 Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. + 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 - Library General Public License for more details. + Lesser General Public License for more details. - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + 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 <errno.h> #include <signal.h> #include <string.h> + #include <sys/syscall.h> + + +/* The difference here is that the sigaction structure used in the + kernel is not the same as we use in the libc. Therefore we must + translate it here. */ #include <bits/kernel_sigaction.h> +int __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oact); #if defined __NR_rt_sigaction /* If ACT is not NULL, change the action for SIG to *ACT. If OACT is not NULL, put the old action for SIG in *OACT. */ -int __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oact) +int +__libc_sigaction (sig, act, oact) + int sig; + const struct sigaction *act; + struct sigaction *oact; { - int result; - struct kernel_sigaction kact, koact; + int result; + struct kernel_sigaction kact, koact; - if (act) { - kact.k_sa_handler = act->sa_handler; - memcpy (&kact.sa_mask, &act->sa_mask, sizeof (kact.sa_mask)); - kact.sa_flags = act->sa_flags; + if (act) { + kact.k_sa_handler = act->sa_handler; + memcpy (&kact.sa_mask, &act->sa_mask, sizeof (kact.sa_mask)); + kact.sa_flags = act->sa_flags; # ifdef HAVE_SA_RESTORER - kact.sa_restorer = act->sa_restorer; + kact.sa_restorer = act->sa_restorer; # endif - } - - /* XXX The size argument hopefully will have to be changed to the - real size of the user-level sigset_t. */ - result = __syscall_rt_sigaction(sig, act ? __ptrvalue (&kact) : NULL, - oact ? __ptrvalue (&koact) : NULL, _NSIG / 8); - - if (oact && result >= 0) { - oact->sa_handler = koact.k_sa_handler; - memcpy (&oact->sa_mask, &koact.sa_mask, sizeof (oact->sa_mask)); - oact->sa_flags = koact.sa_flags; + } + + /* XXX The size argument hopefully will have to be changed to the + real size of the user-level sigset_t. */ + result = __syscall_rt_sigaction(sig, + act ? __ptrvalue (&kact) : NULL, + oact ? __ptrvalue (&koact) : NULL, _NSIG / 8); + + if (oact && result >= 0) { + oact->sa_handler = koact.k_sa_handler; + memcpy (&oact->sa_mask, &koact.sa_mask, sizeof (oact->sa_mask)); + oact->sa_flags = koact.sa_flags; # ifdef HAVE_SA_RESTORER - oact->sa_restorer = koact.sa_restorer; + oact->sa_restorer = koact.sa_restorer; # endif - } - return result; -} + } + return result; +} #else /* If ACT is not NULL, change the action for SIG to *ACT. If OACT is not NULL, put the old action for SIG in *OACT. */ -int __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oact) +int +__libc_sigaction (sig, act, oact) + int sig; + const struct sigaction *act; + struct sigaction *oact; { - int result; - struct old_kernel_sigaction kact, koact; + int result; + struct old_kernel_sigaction kact, koact; - if (act) { - kact.k_sa_handler = act->sa_handler; - kact.sa_mask = act->sa_mask.__val[0]; - kact.sa_flags = act->sa_flags; + if (act) { + kact.k_sa_handler = act->sa_handler; + kact.sa_mask = act->sa_mask.__val[0]; + kact.sa_flags = act->sa_flags; # ifdef HAVE_SA_RESTORER - kact.sa_restorer = act->sa_restorer; + kact.sa_restorer = act->sa_restorer; # endif - } - result = __syscall_sigaction(sig, act ? __ptrvalue (&kact) : NULL, - oact ? __ptrvalue (&koact) : NULL); - - if (oact && result >= 0) { - oact->sa_handler = koact.k_sa_handler; - oact->sa_mask.__val[0] = koact.sa_mask; - oact->sa_flags = koact.sa_flags; + } + + result = __syscall_sigaction(sig, + act ? __ptrvalue (&kact) : NULL, + oact ? __ptrvalue (&koact) : NULL); + + if (oact && result >= 0) { + oact->sa_handler = koact.k_sa_handler; + oact->sa_mask.__val[0] = koact.sa_mask; + oact->sa_flags = koact.sa_flags; # ifdef HAVE_SA_RESTORER - oact->sa_restorer = koact.sa_restorer; + oact->sa_restorer = koact.sa_restorer; # endif - } - return result; + } + + return result; } #endif #ifndef LIBC_SIGACTION -weak_alias(__libc_sigaction, sigaction) +weak_alias (__libc_sigaction, __sigaction) +weak_alias (__libc_sigaction, sigaction) #endif diff --git a/libc/signal/sigaddset.c b/libc/signal/sigaddset.c index 2e4f5c540..e5813c117 100644 --- a/libc/signal/sigaddset.c +++ b/libc/signal/sigaddset.c @@ -1,31 +1,34 @@ -/* Copyright (C) 1991, 1996 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1996, 2003 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 Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. + 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 - Library General Public License for more details. + Lesser General Public License for more details. - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + 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 "sigsetops.h" /* Add SIGNO to SET. */ -int sigaddset (sigset_t *set, int signo) +int +sigaddset (set, signo) + sigset_t *set; + int signo; { - if (set == NULL || signo <= 0 || signo >= NSIG) + if (set == NULL || signo <= 0 || signo >= NSIG) { - __set_errno (EINVAL); - return -1; + __set_errno (EINVAL); + return -1; } - return __sigaddset (set, signo); + return __sigaddset (set, signo); } diff --git a/libc/signal/sigandset.c b/libc/signal/sigandset.c index a09e102ae..4e1abd969 100644 --- a/libc/signal/sigandset.c +++ b/libc/signal/sigandset.c @@ -2,19 +2,19 @@ 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 Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. + 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 - Library General Public License for more details. + Lesser General Public License for more details. - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + 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 <errno.h> #define __USE_GNU @@ -23,13 +23,17 @@ #include <stddef.h> /* Combine sets LEFT and RIGHT by logical AND and place result in DEST. */ -int sigandset (sigset_t *dest, const sigset_t *left, const sigset_t *right) +int +sigandset (dest, left, right) + sigset_t *dest; + const sigset_t *left; + const sigset_t *right; { - if (dest == NULL || left == NULL || right == NULL) + if (dest == NULL || left == NULL || right == NULL) { - __set_errno (EINVAL); - return -1; + __set_errno (EINVAL); + return -1; } - return __sigandset (dest, left, right); + return __sigandset (dest, left, right); } diff --git a/libc/signal/sigblock.c b/libc/signal/sigblock.c index 1d673f454..c02c234b6 100644 --- a/libc/signal/sigblock.c +++ b/libc/signal/sigblock.c @@ -17,11 +17,10 @@ 02111-1307 USA. */ #include <errno.h> -#define __USE_GNU #include <signal.h> /* Block signals in MASK, returning the old mask. */ -int sigblock (int mask) +int __sigblock (int mask) { register unsigned int sig; sigset_t set, oset; @@ -53,3 +52,4 @@ int sigblock (int mask) return mask; } +strong_alias (__sigblock, sigblock) diff --git a/libc/signal/sigdelset.c b/libc/signal/sigdelset.c index 76279a945..16bc9ea4a 100644 --- a/libc/signal/sigdelset.c +++ b/libc/signal/sigdelset.c @@ -1,31 +1,34 @@ -/* Copyright (C) 1991, 1996 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1996, 2003 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 Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. + 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 - Library General Public License for more details. + Lesser General Public License for more details. - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + 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 "sigsetops.h" /* Add SIGNO to SET. */ -int sigdelset (sigset_t *set, int signo) +int +sigdelset (set, signo) + sigset_t *set; + int signo; { - if (set == NULL || signo <= 0 || signo >= NSIG) + if (set == NULL || signo <= 0 || signo >= NSIG) { - __set_errno (EINVAL); - return -1; + __set_errno (EINVAL); + return -1; } - return __sigdelset (set, signo); + return __sigdelset (set, signo); } diff --git a/libc/signal/sigempty.c b/libc/signal/sigempty.c index 36b8f63fa..75b5be420 100644 --- a/libc/signal/sigempty.c +++ b/libc/signal/sigempty.c @@ -1,35 +1,37 @@ -/* Copyright (C) 1991, 1996, 1997 Free Software Foundation, Inc. +/* Copyright (C) 1991,96,97,2002 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 Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. + 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 - Library General Public License for more details. + Lesser General Public License for more details. - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + 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 <errno.h> #include <signal.h> #include <string.h> /* Clear all signals from SET. */ -int sigemptyset (sigset_t *set) +int +sigemptyset (set) + sigset_t *set; { - if (set == NULL) + if (set == NULL) { - __set_errno (EINVAL); - return -1; + __set_errno (EINVAL); + return -1; } - memset (set, 0, sizeof (sigset_t)); + memset (set, 0, sizeof (sigset_t)); - return 0; + return 0; } diff --git a/libc/signal/sigfillset.c b/libc/signal/sigfillset.c index 735359cf0..03361787e 100644 --- a/libc/signal/sigfillset.c +++ b/libc/signal/sigfillset.c @@ -1,44 +1,46 @@ -/* Copyright (C) 1991, 1996, 1997 Free Software Foundation, Inc. +/* Copyright (C) 1991,96,97,2002,2003,2004 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 Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. + 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 - Library General Public License for more details. + Lesser General Public License for more details. - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + 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 <errno.h> #include <signal.h> #include <string.h> /* Set all signals in SET. */ -int sigfillset (sigset_t *set) +int +sigfillset (set) + sigset_t *set; { - if (set == NULL) + if (set == NULL) { - __set_errno (EINVAL); - return -1; + __set_errno (EINVAL); + return -1; } - memset (set, 0xff, sizeof (sigset_t)); + memset (set, 0xff, sizeof (sigset_t)); - /* If implementation uses a cancellation signal don't set the bit. */ + /* If the implementation uses a cancellation signal don't set the bit. */ #ifdef SIGCANCEL - __sigdelset (set, SIGCANCEL); + __sigdelset (set, SIGCANCEL); #endif - /* Likewise for the signal to implement setxid. */ + /* Likewise for the signal to implement setxid. */ #ifdef SIGSETXID - __sigdelset (set, SIGSETXID); + __sigdelset (set, SIGSETXID); #endif - return 0; + return 0; } diff --git a/libc/signal/siggetmask.c b/libc/signal/siggetmask.c index 0436532a5..f139d3861 100644 --- a/libc/signal/siggetmask.c +++ b/libc/signal/siggetmask.c @@ -3,25 +3,28 @@ 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 Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. + 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 - Library General Public License for more details. + Lesser General Public License for more details. - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + 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. */ -#define __USE_GNU #include <signal.h> -int siggetmask (void) +extern int __sigblock (int __mask); +int +siggetmask (void) { - return sigblock (0); + return __sigblock (0); } +link_warning (siggetmask, + "warning: `siggetmask' is obsolete; `sigprocmask' is best") diff --git a/libc/signal/sighold.c b/libc/signal/sighold.c index d30a337f2..670a4872e 100644 --- a/libc/signal/sighold.c +++ b/libc/signal/sighold.c @@ -1,40 +1,42 @@ /* Add SIG to the calling process' signal mask. - Copyright (C) 1998, 2000 Free Software Foundation, Inc. + Copyright (C) 1998, 2000, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998. The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. + 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 - Library General Public License for more details. + Lesser General Public License for more details. - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + 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. */ #define __need_NULL #include <stddef.h> -#define __USE_GNU +#define _GNU_SOURCE #include <signal.h> -int sighold (int sig) +int +sighold (sig) + int sig; { - sigset_t set; + sigset_t set; - /* Retrieve current signal set. */ - if (sigprocmask (SIG_SETMASK, NULL, &set) < 0) - return -1; + /* Retrieve current signal set. */ + if (sigprocmask (SIG_SETMASK, NULL, &set) < 0) + return -1; - /* Add the specified signal. */ - if (__sigaddset (&set, sig) < 0) - return -1; + /* Add the specified signal. */ + if (sigaddset (&set, sig) < 0) + return -1; - /* Set the new mask. */ - return sigprocmask (SIG_SETMASK, &set, NULL); + /* Set the new mask. */ + return sigprocmask (SIG_SETMASK, &set, NULL); } diff --git a/libc/signal/sigignore.c b/libc/signal/sigignore.c index 64d1852ab..407b52e2a 100644 --- a/libc/signal/sigignore.c +++ b/libc/signal/sigignore.c @@ -1,36 +1,41 @@ /* Set the disposition of SIG to SIG_IGN. - Copyright (C) 1998 Free Software Foundation, Inc. + Copyright (C) 1998, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998. The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. + 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 - Library General Public License for more details. + Lesser General Public License for more details. - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + 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. */ +#define _GNU_SOURCE #include <errno.h> #define __need_NULL #include <stddef.h> #include <signal.h> +#include <string.h> /* For the real memset prototype. */ -int sigignore (int sig) + +int +sigignore (sig) + int sig; { - struct sigaction act; + struct sigaction act; - act.sa_handler = SIG_IGN; - if (__sigemptyset (&act.sa_mask) < 0) - return -1; - act.sa_flags = 0; + act.sa_handler = SIG_IGN; + if (__sigemptyset (&act.sa_mask) < 0) + return -1; + act.sa_flags = 0; - return sigaction (sig, &act, NULL); + return sigaction (sig, &act, NULL); } diff --git a/libc/signal/sigintr.c b/libc/signal/sigintr.c index e8cdd9814..8315c3a6b 100644 --- a/libc/signal/sigintr.c +++ b/libc/signal/sigintr.c @@ -1,20 +1,20 @@ -/* Copyright (C) 1992, 1994, 1996 Free Software Foundation, Inc. +/* Copyright (C) 1992, 1994, 1996, 2002 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 Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. + 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 - Library General Public License for more details. + Lesser General Public License for more details. - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + 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 <stddef.h> #include <signal.h> @@ -23,32 +23,35 @@ /* If INTERRUPT is nonzero, make signal SIG interrupt system calls (causing them to fail with EINTR); if INTERRUPT is zero, make system calls be restarted after signal SIG. */ -int siginterrupt (int sig, int interrupt) +int +siginterrupt (sig, interrupt) + int sig; + int interrupt; { #ifdef SA_RESTART - extern sigset_t _sigintr; /* Defined in signal.c. */ - struct sigaction action; + extern sigset_t _sigintr attribute_hidden; /* Defined in signal.c. */ + struct sigaction action; - if (sigaction (sig, (struct sigaction *) NULL, &action) < 0) - return -1; + if (sigaction (sig, (struct sigaction *) NULL, &action) < 0) + return -1; - if (interrupt) + if (interrupt) { - __sigaddset (&_sigintr, sig); - action.sa_flags &= ~SA_RESTART; + __sigaddset (&_sigintr, sig); + action.sa_flags &= ~SA_RESTART; } - else + else { - __sigdelset (&_sigintr, sig); - action.sa_flags |= SA_RESTART; + __sigdelset (&_sigintr, sig); + action.sa_flags |= SA_RESTART; } - if (sigaction (sig, &action, (struct sigaction *) NULL) < 0) - return -1; + if (sigaction (sig, &action, (struct sigaction *) NULL) < 0) + return -1; - return 0; + return 0; #else - __set_errno (ENOSYS); - return -1; + __set_errno (ENOSYS); + return -1; #endif } diff --git a/libc/signal/sigisempty.c b/libc/signal/sigisempty.c index 9067ff08a..6d1de45a8 100644 --- a/libc/signal/sigisempty.c +++ b/libc/signal/sigisempty.c @@ -2,19 +2,19 @@ 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 Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. + 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 - Library General Public License for more details. + Lesser General Public License for more details. - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + 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 <errno.h> #define __USE_GNU @@ -23,12 +23,14 @@ #include <stddef.h> /* Test whether SET is empty. */ -int sigisemptyset (const sigset_t *set) +int +sigisemptyset (set) + const sigset_t *set; { - if (set == NULL) + if (set == NULL) { - __set_errno (EINVAL); - return -1; + __set_errno (EINVAL); + return -1; } return __sigisemptyset (set); diff --git a/libc/signal/sigismem.c b/libc/signal/sigismem.c index f1c79d2da..6423a1a02 100644 --- a/libc/signal/sigismem.c +++ b/libc/signal/sigismem.c @@ -1,31 +1,34 @@ -/* Copyright (C) 1991, 1996 Free Software Foundation, Inc. +/* Copyright (C) 1991,96,2002 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 Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. + 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 - Library General Public License for more details. + Lesser General Public License for more details. - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + 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 "sigsetops.h" /* Return 1 if SIGNO is in SET, 0 if not. */ -int sigismember (const sigset_t *set, int signo) +int +sigismember (set, signo) + const sigset_t *set; + int signo; { - if (set == NULL || signo <= 0 || signo >= NSIG) + if (set == NULL || signo <= 0 || signo >= NSIG) { - __set_errno (EINVAL); - return -1; + __set_errno (EINVAL); + return -1; } - return __sigismember (set, signo); + return __sigismember (set, signo); } diff --git a/libc/signal/signal.c b/libc/signal/signal.c index 463de1e50..7df88eff0 100644 --- a/libc/signal/signal.c +++ b/libc/signal/signal.c @@ -1,49 +1,53 @@ /* BSD-like signal function. - Copyright (C) 1991, 1992, 1996, 1997, 2000 Free Software Foundation, Inc. + Copyright (C) 1991,1992,1996,1997,2000,2002,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 Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. + 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 - Library General Public License for more details. + Lesser General Public License for more details. - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + 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 <errno.h> #include <signal.h> +#include <string.h> /* For the real memset prototype. */ -sigset_t _sigintr; /* Set by siginterrupt. */ +sigset_t _sigintr attribute_hidden; /* Set by siginterrupt. */ /* Set the handler for the signal SIG to HANDLER, returning the old handler, or SIG_ERR on error. */ -__sighandler_t bsd_signal (int sig, __sighandler_t handler) +__sighandler_t +__bsd_signal (int sig, __sighandler_t handler) { - struct sigaction act, oact; + struct sigaction act, oact; - /* Check signal extents to protect __sigismember. */ - if (handler == SIG_ERR || sig < 1 || sig >= NSIG) + /* Check signal extents to protect __sigismember. */ + if (handler == SIG_ERR || sig < 1 || sig >= NSIG) { - __set_errno (EINVAL); - return SIG_ERR; + __set_errno (EINVAL); + return SIG_ERR; } - act.sa_handler = handler; - if (__sigemptyset (&act.sa_mask) < 0 - || __sigaddset (&act.sa_mask, sig) < 0) - return SIG_ERR; - act.sa_flags = __sigismember (&_sigintr, sig) ? 0 : SA_RESTART; - if (sigaction (sig, &act, &oact) < 0) - return SIG_ERR; + act.sa_handler = handler; + if (__sigemptyset (&act.sa_mask) < 0 + || __sigaddset (&act.sa_mask, sig) < 0) + return SIG_ERR; + act.sa_flags = __sigismember (&_sigintr, sig) ? 0 : SA_RESTART; + if (sigaction (sig, &act, &oact) < 0) + return SIG_ERR; - return oact.sa_handler; + return oact.sa_handler; } -weak_alias (bsd_signal, signal) +weak_alias (__bsd_signal, bsd_signal) +weak_alias (__bsd_signal, signal) diff --git a/libc/signal/sigorset.c b/libc/signal/sigorset.c index 017f3ba06..ffabf3704 100644 --- a/libc/signal/sigorset.c +++ b/libc/signal/sigorset.c @@ -2,19 +2,19 @@ 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 Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. + 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 - Library General Public License for more details. + Lesser General Public License for more details. - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + 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 <errno.h> #define __USE_GNU @@ -23,13 +23,17 @@ #include <stddef.h> /* Combine sets LEFT and RIGHT by logical OR and place result in DEST. */ -int sigorset (sigset_t *dest, const sigset_t *left, const sigset_t *right) +int +sigorset (dest, left, right) + sigset_t *dest; + const sigset_t *left; + const sigset_t *right; { - if (dest == NULL || left == NULL || right == NULL) + if (dest == NULL || left == NULL || right == NULL) { - __set_errno (EINVAL); - return -1; + __set_errno (EINVAL); + return -1; } - return __sigorset (dest, left, right); + return __sigorset (dest, left, right); } diff --git a/libc/signal/sigpause.c b/libc/signal/sigpause.c index 433b92b0c..dd05e6e0a 100644 --- a/libc/signal/sigpause.c +++ b/libc/signal/sigpause.c @@ -1,20 +1,21 @@ -/* Copyright (C) 1991, 92, 1994-1998, 2000 Free Software Foundation, Inc. +/* Copyright (C) 1991,92,94-98,2000,2002,2003,2004 + 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 Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. + 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 - Library General Public License for more details. + Lesser General Public License for more details. - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + 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 <errno.h> #include <signal.h> diff --git a/libc/signal/sigrelse.c b/libc/signal/sigrelse.c index ae3b20ae2..091f97de5 100644 --- a/libc/signal/sigrelse.c +++ b/libc/signal/sigrelse.c @@ -1,40 +1,42 @@ /* Remove SIG from the calling process' signal mask. - Copyright (C) 1998, 2000 Free Software Foundation, Inc. + Copyright (C) 1998, 2000, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998. The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. + 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 - Library General Public License for more details. + Lesser General Public License for more details. - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + 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. */ #define __need_NULL #include <stddef.h> -#define __USE_GNU +#define _GNU_SOURCE #include <signal.h> -int sigrelse (int sig) +int +sigrelse (sig) + int sig; { - sigset_t set; + sigset_t set; - /* Retrieve current signal set. */ - if (sigprocmask (SIG_SETMASK, NULL, &set) < 0) - return -1; + /* Retrieve current signal set. */ + if (sigprocmask (SIG_SETMASK, NULL, &set) < 0) + return -1; - /* Remove the specified signal. */ - if (__sigdelset (&set, sig) < 0) - return -1; + /* Remove the specified signal. */ + if (sigdelset (&set, sig) < 0) + return -1; - /* Set the new mask. */ - return sigprocmask (SIG_SETMASK, &set, NULL); + /* Set the new mask. */ + return sigprocmask (SIG_SETMASK, &set, NULL); } diff --git a/libc/signal/sigset.c b/libc/signal/sigset.c index e0cda7b9f..0ce411c8c 100644 --- a/libc/signal/sigset.c +++ b/libc/signal/sigset.c @@ -1,78 +1,83 @@ -/* Copyright (C) 1998, 2000 Free Software Foundation, Inc. +/* Copyright (C) 1998, 2000, 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 Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. + 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 - Library General Public License for more details. + Lesser General Public License for more details. - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + 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 <errno.h> #define __need_NULL #include <stddef.h> +#define __USE_XOPEN_EXTENDED #include <signal.h> +#include <string.h> /* For the real memset prototype. */ /* Set the disposition for SIG. */ -__sighandler_t sigset (int sig, __sighandler_t disp) +__sighandler_t +sigset (sig, disp) + int sig; + __sighandler_t disp; { - struct sigaction act, oact; - sigset_t set; + struct sigaction act, oact; + sigset_t set; #ifdef SIG_HOLD - /* Handle SIG_HOLD first. */ - if (disp == SIG_HOLD) + /* Handle SIG_HOLD first. */ + if (disp == SIG_HOLD) { - /* Create an empty signal set. */ - if (__sigemptyset (&set) < 0) - return SIG_ERR; + /* Create an empty signal set. */ + if (__sigemptyset (&set) < 0) + return SIG_ERR; - /* Add the specified signal. */ - if (__sigaddset (&set, sig) < 0) - return SIG_ERR; + /* Add the specified signal. */ + if (__sigaddset (&set, sig) < 0) + return SIG_ERR; - /* Add the signal set to the current signal mask. */ - if (sigprocmask (SIG_BLOCK, &set, NULL) < 0) - return SIG_ERR; + /* Add the signal set to the current signal mask. */ + if (sigprocmask (SIG_BLOCK, &set, NULL) < 0) + return SIG_ERR; - return SIG_HOLD; + return SIG_HOLD; } #endif /* SIG_HOLD */ - /* Check signal extents to protect __sigismember. */ - if (disp == SIG_ERR || sig < 1 || sig >= NSIG) + /* Check signal extents to protect __sigismember. */ + if (disp == SIG_ERR || sig < 1 || sig >= NSIG) { - __set_errno (EINVAL); - return SIG_ERR; + __set_errno (EINVAL); + return SIG_ERR; } - act.sa_handler = disp; - if (__sigemptyset (&act.sa_mask) < 0) - return SIG_ERR; - act.sa_flags = 0; - if (sigaction (sig, &act, &oact) < 0) - return SIG_ERR; + act.sa_handler = disp; + if (__sigemptyset (&act.sa_mask) < 0) + return SIG_ERR; + act.sa_flags = 0; + if (sigaction (sig, &act, &oact) < 0) + return SIG_ERR; - /* Create an empty signal set. */ - if (__sigemptyset (&set) < 0) - return SIG_ERR; + /* Create an empty signal set. */ + if (__sigemptyset (&set) < 0) + return SIG_ERR; - /* Add the specified signal. */ - if (__sigaddset (&set, sig) < 0) - return SIG_ERR; + /* Add the specified signal. */ + if (__sigaddset (&set, sig) < 0) + return SIG_ERR; - /* Remove the signal set from the current signal mask. */ - if (sigprocmask (SIG_UNBLOCK, &set, NULL) < 0) - return SIG_ERR; + /* Remove the signal set from the current signal mask. */ + if (sigprocmask (SIG_UNBLOCK, &set, NULL) < 0) + return SIG_ERR; - return oact.sa_handler; + return oact.sa_handler; } diff --git a/libc/signal/sigsetmask.c b/libc/signal/sigsetmask.c index 632eaff2a..4c7a43e5f 100644 --- a/libc/signal/sigsetmask.c +++ b/libc/signal/sigsetmask.c @@ -1,20 +1,20 @@ -/* Copyright (C) 1991,1994,1995,1996,1997,2001 Free Software Foundation, Inc. +/* Copyright (C) 1991,1994-1997,2001-2002 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 Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. + 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 - Library General Public License for more details. + Lesser General Public License for more details. - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + 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 <errno.h> #include <signal.h> diff --git a/libc/signal/sigsetops.h b/libc/signal/sigsetops.h index 8cdbf0d9b..52081c2ba 100644 --- a/libc/signal/sigsetops.h +++ b/libc/signal/sigsetops.h @@ -2,24 +2,23 @@ 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 Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. + 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 - Library General Public License for more details. + Lesser General Public License for more details. - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + 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. */ /* Definitions relevant to functions that operate on `sigset_t's. */ #include <errno.h> -#define __USE_GNU #include <signal.h> #include <string.h> diff --git a/libc/signal/sigwait.c b/libc/signal/sigwait.c index 9cd2b6d12..99ddfc481 100644 --- a/libc/signal/sigwait.c +++ b/libc/signal/sigwait.c @@ -3,31 +3,35 @@ * * Copyright (C) 2003 by Erik Andersen <andersen@uclibc.org> * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU Library General Public License as published by - * the Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. + * This program 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. * - * This program 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 Library General Public License - * for more details. + * 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 Library General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ + * 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 <errno.h> #include <signal.h> #include <string.h> -int sigwait (const sigset_t *set, int *sig) +#undef sigwait +int attribute_hidden __sigwait (const sigset_t *set, int *sig) { - int ret = 1; - if ((ret = sigwaitinfo(set, NULL)) != -1) { - *sig = ret; - return 0; - } - return 1; + int ret = 1; + if ((ret = sigwaitinfo(set, NULL)) != -1) { + *sig = ret; + return 0; + } + return 1; } + +/* psm: keep this weak, because the one in libpthread.so could overwrite it */ +weak_alias(__sigwait, sigwait) diff --git a/libc/signal/sysv_signal.c b/libc/signal/sysv_signal.c index 0c94577be..576fc0b8d 100644 --- a/libc/signal/sysv_signal.c +++ b/libc/signal/sysv_signal.c @@ -1,23 +1,25 @@ -/* Copyright (C) 1991, 1992, 1996, 1997 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1992, 1996, 1997, 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 Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. + 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 - Library General Public License for more details. + Lesser General Public License for more details. - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + 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 <errno.h> #include <signal.h> +#include <string.h> /* For the real memset prototype. */ + /* Tolerate non-threads versions of Posix */ #ifndef SA_ONESHOT @@ -32,25 +34,29 @@ /* Set the handler for the signal SIG to HANDLER, returning the old handler, or SIG_ERR on error. */ -__sighandler_t __sysv_signal (int sig, __sighandler_t handler) +__sighandler_t +__sysv_signal (sig, handler) + int sig; + __sighandler_t handler; { - struct sigaction act, oact; + struct sigaction act, oact; - /* Check signal extents to protect __sigismember. */ - if (handler == SIG_ERR || sig < 1 || sig >= NSIG) + /* Check signal extents to protect __sigismember. */ + if (handler == SIG_ERR || sig < 1 || sig >= NSIG) { - __set_errno (EINVAL); - return SIG_ERR; + __set_errno (EINVAL); + return SIG_ERR; } - act.sa_handler = handler; - if (__sigemptyset (&act.sa_mask) < 0) - return SIG_ERR; - act.sa_flags = SA_ONESHOT | SA_NOMASK | SA_INTERRUPT; - act.sa_flags &= ~SA_RESTART; - if (sigaction (sig, &act, &oact) < 0) - return SIG_ERR; + act.sa_handler = handler; + if (__sigemptyset (&act.sa_mask) < 0) + return SIG_ERR; + act.sa_flags = SA_ONESHOT | SA_NOMASK | SA_INTERRUPT; + act.sa_flags &= ~SA_RESTART; + if (sigaction (sig, &act, &oact) < 0) + return SIG_ERR; - return oact.sa_handler; + return oact.sa_handler; } + weak_alias (__sysv_signal, sysv_signal) diff --git a/libc/stdio/_READ.c b/libc/stdio/_READ.c index 7d3c38ce6..013ca0281 100644 --- a/libc/stdio/_READ.c +++ b/libc/stdio/_READ.c @@ -20,7 +20,7 @@ * NOT THREADSAFE! Assumes stream already locked if necessary. */ -size_t __stdio_READ(register FILE *stream, +size_t attribute_hidden __stdio_READ(register FILE *stream, unsigned char *buf, size_t bufsize) { ssize_t rv = 0; diff --git a/libc/stdio/_WRITE.c b/libc/stdio/_WRITE.c index d300d3919..877d055f7 100644 --- a/libc/stdio/_WRITE.c +++ b/libc/stdio/_WRITE.c @@ -28,7 +28,7 @@ * NOT THREADSAFE! Assumes stream already locked if necessary. */ -size_t __stdio_WRITE(register FILE *stream, +size_t attribute_hidden __stdio_WRITE(register FILE *stream, register const unsigned char *buf, size_t bufsize) { size_t todo; diff --git a/libc/stdio/_adjust_pos.c b/libc/stdio/_adjust_pos.c index bc48d32b7..bc6e90555 100644 --- a/libc/stdio/_adjust_pos.c +++ b/libc/stdio/_adjust_pos.c @@ -16,7 +16,7 @@ * If position is unrepresentable, set errno to EOVERFLOW. */ -int __stdio_adjust_position(register FILE * __restrict stream, +int attribute_hidden __stdio_adjust_position(register FILE * __restrict stream, register __offmax_t *pos) { __offmax_t oldpos; diff --git a/libc/stdio/_cs_funcs.c b/libc/stdio/_cs_funcs.c index fd81a6f95..9df93f227 100644 --- a/libc/stdio/_cs_funcs.c +++ b/libc/stdio/_cs_funcs.c @@ -1,6 +1,6 @@ -/* Copyright (C) 2004 Manuel Novoa III <mjn3@codepoet.org> +/* Copyright (C) 2004-2005 Manuel Novoa III <mjn3@codepoet.org> * - * GNU Library General Public License (LGPL) version 2 or later. + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. * * Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details. */ @@ -11,21 +11,21 @@ #ifdef __UCLIBC_HAS_GLIBC_CUSTOM_STREAMS__ /**********************************************************************/ -ssize_t _cs_read(void *cookie, char *buf, size_t bufsize) +ssize_t attribute_hidden _cs_read(void *cookie, char *buf, size_t bufsize) { return read(*((int *) cookie), buf, bufsize); } /**********************************************************************/ -ssize_t _cs_write(void *cookie, const char *buf, size_t bufsize) +ssize_t attribute_hidden _cs_write(void *cookie, const char *buf, size_t bufsize) { return write(*((int *) cookie), (char *) buf, bufsize); } /**********************************************************************/ -int _cs_seek(void *cookie, register __offmax_t *pos, int whence) +int attribute_hidden _cs_seek(void *cookie, register __offmax_t *pos, int whence) { __offmax_t res; @@ -40,7 +40,7 @@ int _cs_seek(void *cookie, register __offmax_t *pos, int whence) /**********************************************************************/ -int _cs_close(void *cookie) +int attribute_hidden _cs_close(void *cookie) { return close(*((int *) cookie)); } @@ -49,7 +49,7 @@ int _cs_close(void *cookie) #else /**********************************************************************/ -int __stdio_seek(FILE *stream, register __offmax_t *pos, int whence) +int attribute_hidden __stdio_seek(FILE *stream, register __offmax_t *pos, int whence) { __offmax_t res; diff --git a/libc/stdio/_fopen.c b/libc/stdio/_fopen.c index bba8cfdfd..508c36d1c 100644 --- a/libc/stdio/_fopen.c +++ b/libc/stdio/_fopen.c @@ -27,7 +27,7 @@ /* Internal function -- reentrant (locks open file list) */ -FILE *_stdio_fopen(intptr_t fname_or_mode, +FILE attribute_hidden *_stdio_fopen(intptr_t fname_or_mode, register const char * __restrict mode, register FILE * __restrict stream, int filedes) { diff --git a/libc/stdio/_fpmaxtostr.c b/libc/stdio/_fpmaxtostr.c index b9aacdca8..9ffa5493e 100644 --- a/libc/stdio/_fpmaxtostr.c +++ b/libc/stdio/_fpmaxtostr.c @@ -19,7 +19,7 @@ typedef size_t (__fp_outfunc_t)(FILE *fp, intptr_t type, intptr_t len, * * Function: * - * size_t _fpmaxtostr(FILE * fp, __fpmax_t x, struct printf_info *info, + * ssize_t _fpmaxtostr(FILE * fp, __fpmax_t x, struct printf_info *info, * __fp_outfunc_t fp_outfunc); * * This is derived from the old _dtostr, whic I wrote for uClibc to provide @@ -198,7 +198,7 @@ static const __fpmax_t exp16_table[] = { #define FPO_STR_WIDTH (0x80 | ' '); #define FPO_STR_PREC 'p' -ssize_t _fpmaxtostr(FILE * fp, __fpmax_t x, struct printf_info *info, +ssize_t attribute_hidden _fpmaxtostr(FILE * fp, __fpmax_t x, struct printf_info *info, __fp_outfunc_t fp_outfunc) { #ifdef __UCLIBC_HAS_HEXADECIMAL_FLOATS__ diff --git a/libc/stdio/_fwrite.c b/libc/stdio/_fwrite.c index a706ba7e6..d9d0bc2a8 100644 --- a/libc/stdio/_fwrite.c +++ b/libc/stdio/_fwrite.c @@ -11,7 +11,7 @@ /* Either buffer data or (commit buffer if necessary and) write. */ -size_t __stdio_fwrite(const unsigned char * __restrict buffer, +size_t attribute_hidden __stdio_fwrite(const unsigned char * __restrict buffer, size_t bytes, register FILE * __restrict stream) { diff --git a/libc/stdio/_load_inttype.c b/libc/stdio/_load_inttype.c index 2dd559a53..e4dc61e9c 100644 --- a/libc/stdio/_load_inttype.c +++ b/libc/stdio/_load_inttype.c @@ -8,7 +8,7 @@ #include "_stdio.h" #include <printf.h> -uintmax_t _load_inttype(int desttype, register const void *src, int uflag) +uintmax_t attribute_hidden _load_inttype(int desttype, register const void *src, int uflag) { if (uflag >= 0) { /* unsigned */ #if LONG_MAX != INT_MAX diff --git a/libc/stdio/_rfill.c b/libc/stdio/_rfill.c index 145c1d78e..d61b1a9f9 100644 --- a/libc/stdio/_rfill.c +++ b/libc/stdio/_rfill.c @@ -19,7 +19,7 @@ * Side effects are those of _stdio_READ. */ -size_t __stdio_rfill(register FILE *__restrict stream) +size_t attribute_hidden __stdio_rfill(register FILE *__restrict stream) { size_t rv; diff --git a/libc/stdio/_stdio.h b/libc/stdio/_stdio.h index c167b177e..1ed349533 100644 --- a/libc/stdio/_stdio.h +++ b/libc/stdio/_stdio.h @@ -1,6 +1,6 @@ -/* Copyright (C) 2004 Manuel Novoa III <mjn3@codepoet.org> +/* Copyright (C) 2004-2005 Manuel Novoa III <mjn3@codepoet.org> * - * GNU Library General Public License (LGPL) version 2 or later. + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. * * Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details. */ @@ -59,10 +59,10 @@ /**********************************************************************/ #ifdef __UCLIBC_HAS_GLIBC_CUSTOM_STREAMS__ -extern __ssize_t _cs_read(void *cookie, char *buf, size_t bufsize); -extern __ssize_t _cs_write(void *cookie, const char *buf, size_t bufsize); -extern int _cs_seek(void *cookie, __offmax_t *pos, int whence); -extern int _cs_close(void *cookie); +extern __ssize_t _cs_read(void *cookie, char *buf, size_t bufsize) attribute_hidden; +extern __ssize_t _cs_write(void *cookie, const char *buf, size_t bufsize) attribute_hidden; +extern int _cs_seek(void *cookie, __offmax_t *pos, int whence) attribute_hidden; +extern int _cs_close(void *cookie) attribute_hidden; #define __STDIO_STREAM_RESET_GCS(S) \ (S)->__cookie = &((S)->__filedes); \ @@ -87,7 +87,7 @@ extern int _cs_close(void *cookie); #else /* __UCLIBC_HAS_GLIBC_CUSTOM_STREAMS__ */ -extern int __stdio_seek(FILE *stream, register __offmax_t *pos, int whence); +extern int __stdio_seek(FILE *stream, register __offmax_t *pos, int whence) attribute_hidden; #define __STDIO_STREAM_RESET_GCS(S) ((void)0) @@ -249,13 +249,13 @@ extern int __stdio_seek(FILE *stream, register __offmax_t *pos, int whence); /* Assume stream in valid writing state. Do not reset writing flag * or disble putc macro unless error. */ /* Should we assume that buffer is not empty to avoid a check? */ -extern size_t __stdio_wcommit(FILE *__restrict stream); +extern size_t __stdio_wcommit(FILE *__restrict stream) attribute_hidden; /* Remember to fail if at EOF! */ -extern size_t __stdio_rfill(FILE *__restrict stream); +extern size_t __stdio_rfill(FILE *__restrict stream) attribute_hidden; extern size_t __stdio_fwrite(const unsigned char *__restrict buffer, - size_t bytes, FILE *__restrict stream); + size_t bytes, FILE *__restrict stream) attribute_hidden; #else #define __stdio_fwrite(B,N,S) __stdio_WRITE((S),(B),(N)) @@ -263,14 +263,14 @@ extern size_t __stdio_fwrite(const unsigned char *__restrict buffer, #endif extern size_t __stdio_WRITE(FILE *stream, const unsigned char *buf, - size_t bufsize); -extern size_t __stdio_READ(FILE *stream, unsigned char *buf, size_t bufsize); + size_t bufsize) attribute_hidden; +extern size_t __stdio_READ(FILE *stream, unsigned char *buf, size_t bufsize) attribute_hidden; -extern int __stdio_trans2r(FILE *__restrict stream); -extern int __stdio_trans2w(FILE *__restrict stream); +extern int __stdio_trans2r(FILE *__restrict stream) attribute_hidden; +extern int __stdio_trans2w(FILE *__restrict stream) attribute_hidden; -extern int __stdio_trans2r_o(FILE *__restrict stream, int oflag); -extern int __stdio_trans2w_o(FILE *__restrict stream, int oflag); +extern int __stdio_trans2r_o(FILE *__restrict stream, int oflag) attribute_hidden; +extern int __stdio_trans2w_o(FILE *__restrict stream, int oflag) attribute_hidden; /**********************************************************************/ #ifdef __STDIO_BUFFERS @@ -374,7 +374,7 @@ extern int __fputc_unlocked(int c, FILE *stream); extern int __fflush_unlocked(FILE *stream); -extern int __stdio_adjust_position(FILE *__restrict stream, __offmax_t *pos); +extern int __stdio_adjust_position(FILE *__restrict stream, __offmax_t *pos) attribute_hidden; extern void __clearerr_unlocked(FILE *stream); extern int __feof_unlocked(FILE *stream); @@ -427,8 +427,8 @@ extern size_t _stdio_fread(unsigned char *buffer, size_t bytes, FILE *stream); extern FILE *_stdio_fopen(intptr_t fname_or_mode, - const char *__restrict mode, - FILE *__restrict stream, int filedes); + const char *__restrict mode, + FILE *__restrict stream, int filedes) attribute_hidden; #ifdef __UCLIBC_HAS_WCHAR__ extern size_t _wstdio_fwrite(const wchar_t *__restrict ws, size_t n, diff --git a/libc/stdio/_store_inttype.c b/libc/stdio/_store_inttype.c index 228e90619..82fb894c6 100644 --- a/libc/stdio/_store_inttype.c +++ b/libc/stdio/_store_inttype.c @@ -28,7 +28,7 @@ /* We assume int may be short or long, but short and long are different. */ -void _store_inttype(register void *dest, int desttype, uintmax_t val) +void attribute_hidden _store_inttype(register void *dest, int desttype, uintmax_t val) { if (desttype == __PA_FLAG_CHAR) { /* assume char not int */ *((unsigned char *) dest) = val; diff --git a/libc/stdio/_trans2r.c b/libc/stdio/_trans2r.c index 9afb75428..1f3930070 100644 --- a/libc/stdio/_trans2r.c +++ b/libc/stdio/_trans2r.c @@ -22,9 +22,9 @@ */ #ifdef __UCLIBC_HAS_WCHAR__ -int __stdio_trans2r_o(FILE * __restrict stream, int oflag) +int attribute_hidden __stdio_trans2r_o(FILE * __restrict stream, int oflag) #else -int __stdio_trans2r(FILE * __restrict stream) +int attribute_hidden __stdio_trans2r(FILE * __restrict stream) #endif { __STDIO_STREAM_VALIDATE(stream); diff --git a/libc/stdio/_trans2w.c b/libc/stdio/_trans2w.c index 7ab3403c0..e85f45a24 100644 --- a/libc/stdio/_trans2w.c +++ b/libc/stdio/_trans2w.c @@ -21,9 +21,9 @@ */ #ifdef __UCLIBC_HAS_WCHAR__ -int __stdio_trans2w_o(FILE * __restrict stream, int oflag) +int attribute_hidden __stdio_trans2w_o(FILE * __restrict stream, int oflag) #else -int __stdio_trans2w(FILE * __restrict stream) +int attribute_hidden __stdio_trans2w(FILE * __restrict stream) #endif { __STDIO_STREAM_VALIDATE(stream); diff --git a/libc/stdio/_wcommit.c b/libc/stdio/_wcommit.c index 71720e83f..a0b3219b1 100644 --- a/libc/stdio/_wcommit.c +++ b/libc/stdio/_wcommit.c @@ -14,7 +14,7 @@ * Side effects are those of _stdio_WRITE */ -size_t __stdio_wcommit(register FILE * __restrict stream) +size_t attribute_hidden __stdio_wcommit(register FILE * __restrict stream) { size_t bufsize; diff --git a/libc/stdio/old_vfprintf.c b/libc/stdio/old_vfprintf.c index 23cb10f94..8caa3d66d 100644 --- a/libc/stdio/old_vfprintf.c +++ b/libc/stdio/old_vfprintf.c @@ -217,7 +217,7 @@ typedef void (__fp_outfunc_t)(FILE *fp, intptr_t type, intptr_t len, intptr_t buf); extern size_t _fpmaxtostr(FILE * fp, __fpmax_t x, struct printf_info *info, - __fp_outfunc_t fp_outfunc); + __fp_outfunc_t fp_outfunc) attribute_hidden; static void _charpad(FILE * __restrict stream, int padchar, size_t numpad) { @@ -261,8 +261,8 @@ static const char spec[] = "+-#0 "; /**********************************************************************/ -extern void _store_inttype(void *dest, int desttype, uintmax_t val); -extern uintmax_t _load_inttype(int desttype, const void *src, int uflag); +extern void _store_inttype(void *dest, int desttype, uintmax_t val) attribute_hidden; +extern uintmax_t _load_inttype(int desttype, const void *src, int uflag) attribute_hidden; /* * In order to ease translation to what arginfo and _print_info._flags expect, diff --git a/libc/stdio/scanf.c b/libc/stdio/scanf.c index feaec3b44..d99896893 100644 --- a/libc/stdio/scanf.c +++ b/libc/stdio/scanf.c @@ -46,7 +46,6 @@ #define _ISOC99_SOURCE /* for LLONG_MAX primarily... */ #define _GNU_SOURCE -#define _STDIO_UTILITY #include <features.h> #include "_stdio.h" #include <stdlib.h> @@ -661,16 +660,16 @@ typedef struct { /**********************************************************************/ extern void __init_scan_cookie(register struct scan_cookie *sc, - register FILE *fp); -extern int __scan_getc(register struct scan_cookie *sc); -extern void __scan_ungetc(register struct scan_cookie *sc); + register FILE *fp) attribute_hidden; +extern int __scan_getc(register struct scan_cookie *sc) attribute_hidden; +extern void __scan_ungetc(register struct scan_cookie *sc) attribute_hidden; #ifdef __UCLIBC_HAS_FLOATS__ extern int __scan_strtold(long double *ld, struct scan_cookie *sc); #endif /* __UCLIBC_HAS_FLOATS__ */ -extern int __psfs_parse_spec(psfs_t *psfs); -extern int __psfs_do_numeric(psfs_t *psfs, struct scan_cookie *sc); +extern int __psfs_parse_spec(psfs_t *psfs) attribute_hidden; +extern int __psfs_do_numeric(psfs_t *psfs, struct scan_cookie *sc) attribute_hidden; /**********************************************************************/ #ifdef L___scan_cookie @@ -682,7 +681,7 @@ extern int __psfs_do_numeric(psfs_t *psfs, struct scan_cookie *sc); static const char decpt_str[] = "."; #endif -void __init_scan_cookie(register struct scan_cookie *sc, +void attribute_hidden __init_scan_cookie(register struct scan_cookie *sc, register FILE *fp) { sc->fp = fp; @@ -723,7 +722,7 @@ void __init_scan_cookie(register struct scan_cookie *sc, } -int __scan_getc(register struct scan_cookie *sc) +int attribute_hidden __scan_getc(register struct scan_cookie *sc) { int c; @@ -771,7 +770,7 @@ int __scan_getc(register struct scan_cookie *sc) return sc->cc = sc->ungot_char; } -void __scan_ungetc(register struct scan_cookie *sc) +void attribute_hidden __scan_ungetc(register struct scan_cookie *sc) { ++sc->width; if (sc->ungot_flag == 2) { /* last was EOF */ @@ -797,7 +796,7 @@ static const unsigned char qual_chars[] = QUAL_CHARS; static const unsigned char spec_ranges[] = SPEC_RANGES; static const unsigned short spec_allowed[] = SPEC_ALLOWED_FLAGS; -int __psfs_parse_spec(register psfs_t *psfs) +int attribute_hidden __psfs_parse_spec(register psfs_t *psfs) { const unsigned char *p; const unsigned char *fmt0 = psfs->fmt; @@ -1756,7 +1755,7 @@ int VFSCANF (FILE *__restrict fp, const Wchar *__restrict format, va_list arg) static const unsigned char spec_base[] = SPEC_BASE; static const unsigned char nil_string[] = "(nil)"; -int __psfs_do_numeric(psfs_t *psfs, struct scan_cookie *sc) +int attribute_hidden __psfs_do_numeric(psfs_t *psfs, struct scan_cookie *sc) { unsigned char *b; const unsigned char *p; diff --git a/libc/stdio/vfprintf.c b/libc/stdio/vfprintf.c index 10114f061..73bbe63d3 100644 --- a/libc/stdio/vfprintf.c +++ b/libc/stdio/vfprintf.c @@ -91,7 +91,6 @@ #define _ISOC99_SOURCE /* for ULLONG primarily... */ #define _GNU_SOURCE -#define _STDIO_UTILITY /* We're using _uintmaxtostr. */ #include <features.h> #include "_stdio.h" #include <stdlib.h> @@ -414,16 +413,16 @@ typedef size_t (__fp_outfunc_t)(FILE *fp, intptr_t type, intptr_t len, intptr_t buf); extern ssize_t _fpmaxtostr(FILE * fp, __fpmax_t x, struct printf_info *info, - __fp_outfunc_t fp_outfunc); + __fp_outfunc_t fp_outfunc) attribute_hidden; #endif -extern int _ppfs_init(ppfs_t *ppfs, const char *fmt0); /* validates */ -extern void _ppfs_prepargs(ppfs_t *ppfs, va_list arg); /* sets posargptrs */ -extern void _ppfs_setargs(ppfs_t *ppfs); /* sets argptrs for current spec */ -extern int _ppfs_parsespec(ppfs_t *ppfs); /* parses specifier */ +extern int _ppfs_init(ppfs_t *ppfs, const char *fmt0) attribute_hidden; /* validates */ +extern void _ppfs_prepargs(ppfs_t *ppfs, va_list arg) attribute_hidden; /* sets posargptrs */ +extern void _ppfs_setargs(ppfs_t *ppfs) attribute_hidden; /* sets argptrs for current spec */ +extern int _ppfs_parsespec(ppfs_t *ppfs) attribute_hidden; /* parses specifier */ -extern void _store_inttype(void *dest, int desttype, uintmax_t val); -extern uintmax_t _load_inttype(int desttype, const void *src, int uflag); +extern void _store_inttype(void *dest, int desttype, uintmax_t val) attribute_hidden; +extern uintmax_t _load_inttype(int desttype, const void *src, int uflag) attribute_hidden; /**********************************************************************/ #ifdef L_parse_printf_format @@ -498,7 +497,7 @@ size_t parse_printf_format(register const char *template, /**********************************************************************/ #ifdef L__ppfs_init -int _ppfs_init(register ppfs_t *ppfs, const char *fmt0) +int attribute_hidden _ppfs_init(register ppfs_t *ppfs, const char *fmt0) { int r; @@ -588,7 +587,7 @@ int _ppfs_init(register ppfs_t *ppfs, const char *fmt0) #endif /**********************************************************************/ #ifdef L__ppfs_prepargs -void _ppfs_prepargs(register ppfs_t *ppfs, va_list arg) +void attribute_hidden _ppfs_prepargs(register ppfs_t *ppfs, va_list arg) { int i; @@ -607,7 +606,7 @@ void _ppfs_prepargs(register ppfs_t *ppfs, va_list arg) /**********************************************************************/ #ifdef L__ppfs_setargs -void _ppfs_setargs(register ppfs_t *ppfs) +void attribute_hidden _ppfs_setargs(register ppfs_t *ppfs) { #ifdef __va_arg_ptr register void **p = ppfs->argptr; @@ -821,7 +820,7 @@ printf_arginfo_function *_custom_printf_arginfo[MAX_USER_SPEC]; printf_function _custom_printf_handler[MAX_USER_SPEC]; #endif /* __UCLIBC_HAS_GLIBC_CUSTOM_PRINTF__ */ -extern int _ppfs_parsespec(ppfs_t *ppfs) +int attribute_hidden _ppfs_parsespec(ppfs_t *ppfs) { register const char *fmt; register const char *p; diff --git a/libc/stdlib/abort.c b/libc/stdlib/abort.c index 77c2cdc69..6457836e8 100644 --- a/libc/stdlib/abort.c +++ b/libc/stdlib/abort.c @@ -81,6 +81,7 @@ static pthread_mutex_t mylock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; #endif +extern int __raise (int __sig) __THROW attribute_hidden; /* Cause an abnormal program termination with core-dump */ void abort(void) { @@ -111,7 +112,7 @@ void abort(void) abort_it: UNLOCK; - raise(SIGABRT); + __raise(SIGABRT); LOCK; } diff --git a/libc/string/generic/memchr.c b/libc/string/generic/memchr.c index 6116b8f92..bc0623f3f 100644 --- a/libc/string/generic/memchr.c +++ b/libc/string/generic/memchr.c @@ -32,7 +32,7 @@ #undef memchr /* Search no more than N bytes of S for C. */ -void * memchr (const void * s, int c_in, size_t n) +void attribute_hidden *__memchr (const void * s, int c_in, size_t n) { const unsigned char *char_ptr; const unsigned long int *longword_ptr; @@ -173,3 +173,5 @@ void * memchr (const void * s, int c_in, size_t n) return 0; } + +strong_alias(__memchr, memchr) diff --git a/libc/string/generic/memcmp.c b/libc/string/generic/memcmp.c index d9c3a7cab..a3fcba036 100644 --- a/libc/string/generic/memcmp.c +++ b/libc/string/generic/memcmp.c @@ -275,10 +275,7 @@ memcmp_not_common_alignment (srcp1, srcp2, len) } int -memcmp (s1, s2, len) - const __ptr_t s1; - const __ptr_t s2; - size_t len; +attribute_hidden __memcmp (const __ptr_t s1, const __ptr_t s2, size_t len) { op_t a0; op_t b0; @@ -334,7 +331,7 @@ memcmp (s1, s2, len) return 0; } -#ifdef weak_alias -# undef bcmp -weak_alias (memcmp, bcmp) -#endif + +strong_alias(__memcmp, memcmp) + +weak_alias(memcmp, bcmp) diff --git a/libc/string/generic/memcpy.c b/libc/string/generic/memcpy.c index 9851fdea6..2fb48ebef 100644 --- a/libc/string/generic/memcpy.c +++ b/libc/string/generic/memcpy.c @@ -211,7 +211,7 @@ static void _wordcopy_fwd_dest_aligned (long int dstp, long int srcp, size_t len ((op_t *) dstp)[0] = MERGE (a2, sh_1, a3, sh_2); } -void *memcpy (void *dstpp, const void *srcpp, size_t len) +void attribute_hidden *__memcpy (void *dstpp, const void *srcpp, size_t len) { unsigned long int dstp = (long int) dstpp; unsigned long int srcp = (long int) srcpp; @@ -244,3 +244,5 @@ void *memcpy (void *dstpp, const void *srcpp, size_t len) return dstpp; } + +strong_alias(__memcpy, memcpy) diff --git a/libc/string/generic/memmem.c b/libc/string/generic/memmem.c index c0f2bd192..5f2c1e244 100644 --- a/libc/string/generic/memmem.c +++ b/libc/string/generic/memmem.c @@ -22,7 +22,7 @@ #undef memmem /* Return the first occurrence of NEEDLE in HAYSTACK. */ -void *memmem (const void *haystack, size_t haystack_len, +void attribute_hidden *__memmem (const void *haystack, size_t haystack_len, const void *needle, size_t needle_len) { const char *begin; @@ -48,3 +48,5 @@ void *memmem (const void *haystack, size_t haystack_len, return NULL; } + +strong_alias(__memmem, memmem) diff --git a/libc/string/generic/memmove.c b/libc/string/generic/memmove.c index 21876ce6e..ddf7c8aa4 100644 --- a/libc/string/generic/memmove.c +++ b/libc/string/generic/memmove.c @@ -206,7 +206,9 @@ static void _wordcopy_bwd_dest_aligned (long int dstp, long int srcp, size_t len ((op_t *) dstp)[3] = MERGE (a0, sh_1, a1, sh_2); } -void *memmove (void *dest, const void *src, size_t len) +#undef memmove + +void attribute_hidden *__memmove (void *dest, const void *src, size_t len) { unsigned long int dstp = (long int) dest; unsigned long int srcp = (long int) src; @@ -276,3 +278,5 @@ void *memmove (void *dest, const void *src, size_t len) return (dest); } + +strong_alias(__memmove, memmove) diff --git a/libc/string/generic/mempcpy.c b/libc/string/generic/mempcpy.c index 46a2eaf92..cda156edf 100644 --- a/libc/string/generic/mempcpy.c +++ b/libc/string/generic/mempcpy.c @@ -8,11 +8,11 @@ #include <string.h> #undef mempcpy -#undef __mempcpy -void *__mempcpy (void *dstpp, const void *srcpp, size_t len) +void attribute_hidden *__mempcpy (void *dstpp, const void *srcpp, size_t len) { memcpy(dstpp, srcpp, len); return (void *)(((char *)dstpp) + len); } -weak_alias (__mempcpy, mempcpy) + +strong_alias (__mempcpy, mempcpy) diff --git a/libc/string/generic/memrchr.c b/libc/string/generic/memrchr.c index f4d435e09..3f7583919 100644 --- a/libc/string/generic/memrchr.c +++ b/libc/string/generic/memrchr.c @@ -33,7 +33,7 @@ #undef memrchr /* Search no more than N bytes of S for C. */ -void *memrchr (const void * s, int c_in, size_t n) +void attribute_hidden *__memrchr (const void * s, int c_in, size_t n) { const unsigned char *char_ptr; const unsigned long int *longword_ptr; @@ -172,3 +172,5 @@ void *memrchr (const void * s, int c_in, size_t n) return 0; } + +strong_alias(__memrchr, memrchr) diff --git a/libc/string/generic/memset.c b/libc/string/generic/memset.c index 1fedb2c39..0185ad57b 100644 --- a/libc/string/generic/memset.c +++ b/libc/string/generic/memset.c @@ -21,11 +21,7 @@ #undef memset -void * -memset (dstpp, c, len) - void *dstpp; - int c; - size_t len; +void attribute_hidden *__memset (void *dstpp, int c, size_t len) { long int dstp = (long int) dstpp; @@ -88,3 +84,5 @@ memset (dstpp, c, len) return dstpp; } + +strong_alias(__memset, memset) diff --git a/libc/string/generic/rawmemchr.c b/libc/string/generic/rawmemchr.c index 0e2ac1c7e..02cb8f629 100644 --- a/libc/string/generic/rawmemchr.c +++ b/libc/string/generic/rawmemchr.c @@ -32,7 +32,7 @@ #undef rawmemchr /* Find the first occurrence of C in S. */ -void *rawmemchr (const void * s, int c_in) +void attribute_hidden *__rawmemchr (const void * s, int c_in) { const unsigned char *char_ptr; const unsigned long int *longword_ptr; @@ -158,3 +158,5 @@ void *rawmemchr (const void * s, int c_in) } } } + +strong_alias(__rawmemchr, rawmemchr) diff --git a/libc/string/generic/strcat.c b/libc/string/generic/strcat.c index a9ed4a442..0996f9a29 100644 --- a/libc/string/generic/strcat.c +++ b/libc/string/generic/strcat.c @@ -22,10 +22,7 @@ #undef strcat /* Append SRC on the end of DEST. */ -char * -strcat (dest, src) - char *dest; - const char *src; +char attribute_hidden *__strcat (char *dest, const char *src) { char *s1 = dest; const char *s2 = src; @@ -49,3 +46,5 @@ strcat (dest, src) return dest; } + +strong_alias(__strcat, strcat) diff --git a/libc/string/generic/strchr.c b/libc/string/generic/strchr.c index d0745060b..c776380e2 100644 --- a/libc/string/generic/strchr.c +++ b/libc/string/generic/strchr.c @@ -29,10 +29,7 @@ #undef strchr /* Find the first occurrence of C in S. */ -char * -strchr (s, c_in) - const char *s; - int c_in; +char attribute_hidden *__strchr (const char *s, int c_in) { const unsigned char *char_ptr; const unsigned long int *longword_ptr; @@ -184,7 +181,6 @@ strchr (s, c_in) return NULL; } -#ifdef weak_alias -#undef index -weak_alias (strchr, index) -#endif +strong_alias(__strchr, strchr) + +weak_alias(strchr, index) diff --git a/libc/string/generic/strchrnul.c b/libc/string/generic/strchrnul.c index 908409a4c..faa0f4ff9 100644 --- a/libc/string/generic/strchrnul.c +++ b/libc/string/generic/strchrnul.c @@ -26,11 +26,10 @@ #include "memcopy.h" -#undef __strchrnul #undef strchrnul /* Find the first occurrence of C in S or the final NUL byte. */ -char *__strchrnul (const char *s, int c_in) +char attribute_hidden *__strchrnul (const char *s, int c_in) { const unsigned char *char_ptr; const unsigned long int *longword_ptr; @@ -165,4 +164,4 @@ char *__strchrnul (const char *s, int c_in) return NULL; } -weak_alias (__strchrnul, strchrnul) +strong_alias(__strchrnul, strchrnul) diff --git a/libc/string/generic/strcmp.c b/libc/string/generic/strcmp.c index c8212f04b..e42ba9763 100644 --- a/libc/string/generic/strcmp.c +++ b/libc/string/generic/strcmp.c @@ -26,10 +26,7 @@ /* Compare S1 and S2, returning less than, equal to or greater than zero if S1 is lexicographically less than, equal to or greater than S2. */ -int -strcmp (p1, p2) - const char *p1; - const char *p2; +int attribute_hidden __strcmp (const char *p1, const char *p2) { register const unsigned char *s1 = (const unsigned char *) p1; register const unsigned char *s2 = (const unsigned char *) p2; @@ -47,6 +44,9 @@ strcmp (p1, p2) return c1 - c2; } +strong_alias(__strcmp, strcmp) + #ifdef __LOCALE_C_ONLY -weak_alias(strcmp,strcoll); +weak_alias(__strcmp, __strcoll) +strong_alias(__strcoll, strcoll) #endif /* __LOCALE_C_ONLY */ diff --git a/libc/string/generic/strcpy.c b/libc/string/generic/strcpy.c index 7e40aab3f..08c810f31 100644 --- a/libc/string/generic/strcpy.c +++ b/libc/string/generic/strcpy.c @@ -25,10 +25,7 @@ #undef strcpy /* Copy SRC to DEST. */ -char * -strcpy (dest, src) - char *dest; - const char *src; +char attribute_hidden *__strcpy (char *dest, const char *src) { reg_char c; char *__unbounded s = (char *__unbounded) CHECK_BOUNDS_LOW (src); @@ -48,3 +45,5 @@ strcpy (dest, src) return dest; } + +strong_alias(__strcpy, strcpy) diff --git a/libc/string/generic/strcspn.c b/libc/string/generic/strcspn.c index c5d2d769d..c41132cf6 100644 --- a/libc/string/generic/strcspn.c +++ b/libc/string/generic/strcspn.c @@ -22,10 +22,7 @@ /* Return the length of the maximum initial segment of S which contains no characters from REJECT. */ -size_t -strcspn (s, reject) - const char *s; - const char *reject; +size_t attribute_hidden __strcspn (const char *s, const char *reject) { size_t count = 0; @@ -37,3 +34,5 @@ strcspn (s, reject) return count; } + +strong_alias(__strcspn, strcspn) diff --git a/libc/string/generic/strlen.c b/libc/string/generic/strlen.c index 2bbf8203f..aca8c2bd9 100644 --- a/libc/string/generic/strlen.c +++ b/libc/string/generic/strlen.c @@ -26,9 +26,7 @@ /* Return the length of the null-terminated string STR. Scan for the null terminator quickly by testing four bytes at a time. */ -size_t -strlen (str) - const char *str; +size_t attribute_hidden __strlen (const char *str) { const char *char_ptr; const unsigned long int *longword_ptr; @@ -150,3 +148,5 @@ strlen (str) } } } + +strong_alias(__strlen, strlen) diff --git a/libc/string/generic/strncat.c b/libc/string/generic/strncat.c index a3d283bf7..f35e0865b 100644 --- a/libc/string/generic/strncat.c +++ b/libc/string/generic/strncat.c @@ -22,11 +22,7 @@ #undef strncat -char * -strncat (s1, s2, n) - char *s1; - const char *s2; - size_t n; +char attribute_hidden *__strncat (char *s1, const char *s2, size_t n) { reg_char c; char *s = s1; @@ -79,3 +75,5 @@ strncat (s1, s2, n) return s; } + +strong_alias(__strncat, strncat) diff --git a/libc/string/generic/strncmp.c b/libc/string/generic/strncmp.c index d9964a883..22aa179b0 100644 --- a/libc/string/generic/strncmp.c +++ b/libc/string/generic/strncmp.c @@ -25,11 +25,7 @@ returning less than, equal to or greater than zero if S1 is lexicographically less than, equal to or greater than S2. */ -int -strncmp (s1, s2, n) - const char *s1; - const char *s2; - size_t n; +int attribute_hidden __strncmp (const char *s1, const char *s2, size_t n) { unsigned reg_char c1 = '\0'; unsigned reg_char c2 = '\0'; @@ -70,3 +66,5 @@ strncmp (s1, s2, n) return c1 - c2; } + +strong_alias(__strncmp, strncmp) diff --git a/libc/string/generic/strncpy.c b/libc/string/generic/strncpy.c index 214f38430..a43c48502 100644 --- a/libc/string/generic/strncpy.c +++ b/libc/string/generic/strncpy.c @@ -21,11 +21,7 @@ #undef strncpy -char * -strncpy (s1, s2, n) - char *s1; - const char *s2; - size_t n; +char attribute_hidden *__strncpy (char *s1, const char *s2, size_t n) { reg_char c; char *s = s1; @@ -84,3 +80,5 @@ strncpy (s1, s2, n) return s; } + +strong_alias(__strncpy, strncpy) diff --git a/libc/string/generic/strnlen.c b/libc/string/generic/strnlen.c index bdd3bb475..ff5c13739 100644 --- a/libc/string/generic/strnlen.c +++ b/libc/string/generic/strnlen.c @@ -24,9 +24,11 @@ #include <string.h> #include <stdlib.h> +#undef strnlen + /* Find the length of S, but scan at most MAXLEN characters. If no '\0' terminator is found in that many characters, return MAXLEN. */ -size_t strnlen (const char *str, size_t maxlen) +size_t attribute_hidden __strnlen (const char *str, size_t maxlen) { const char *char_ptr, *end_ptr = str + maxlen; const unsigned long int *longword_ptr; @@ -156,3 +158,5 @@ size_t strnlen (const char *str, size_t maxlen) char_ptr = end_ptr; return char_ptr - str; } + +strong_alias(__strnlen, strnlen) diff --git a/libc/string/generic/strrchr.c b/libc/string/generic/strrchr.c index 8f815e9ff..bde4d4da0 100644 --- a/libc/string/generic/strrchr.c +++ b/libc/string/generic/strrchr.c @@ -21,8 +21,7 @@ #undef strrchr /* Find the last occurrence of C in S. */ -char * -strrchr (const char *s, int c) +char attribute_hidden *__strrchr (const char *s, int c) { register const char *found, *p; @@ -43,7 +42,6 @@ strrchr (const char *s, int c) return (char *) found; } -#ifdef weak_alias -#undef rindex +strong_alias(__strrchr, strrchr) + weak_alias (strrchr, rindex) -#endif diff --git a/libc/string/generic/strsep.c b/libc/string/generic/strsep.c index 345c722bf..77670607b 100644 --- a/libc/string/generic/strsep.c +++ b/libc/string/generic/strsep.c @@ -20,7 +20,7 @@ #undef strsep -char *strsep (char **stringp, const char *delim) +char attribute_hidden *__strsep (char **stringp, const char *delim) { char *begin, *end; @@ -63,3 +63,5 @@ char *strsep (char **stringp, const char *delim) return begin; } + +strong_alias(__strsep, strsep) diff --git a/libc/string/generic/strspn.c b/libc/string/generic/strspn.c index dcf8b135d..1923f8afd 100644 --- a/libc/string/generic/strspn.c +++ b/libc/string/generic/strspn.c @@ -22,10 +22,7 @@ /* Return the length of the maximum initial segment of S which contains only characters in ACCEPT. */ -size_t -strspn (s, accept) - const char *s; - const char *accept; +size_t attribute_hidden __strspn (const char *s, const char *accept) { const char *p; const char *a; @@ -44,3 +41,5 @@ strspn (s, accept) return count; } + +strong_alias(__strspn, strspn) diff --git a/libc/string/generic/strstr.c b/libc/string/generic/strstr.c index 45a64bb9b..b16261e56 100644 --- a/libc/string/generic/strstr.c +++ b/libc/string/generic/strstr.c @@ -32,10 +32,7 @@ typedef unsigned chartype; #undef strstr -char * -strstr (phaystack, pneedle) - const char *phaystack; - const char *pneedle; +char attribute_hidden *__strstr (const char *phaystack, const char *pneedle) { const unsigned char *haystack, *needle; chartype b; @@ -114,3 +111,5 @@ foundneedle: ret0: return 0; } + +strong_alias(__strstr, strstr) diff --git a/libc/string/generic/strtok_r.c b/libc/string/generic/strtok_r.c index 15ca8b4ba..40d4e1a78 100644 --- a/libc/string/generic/strtok_r.c +++ b/libc/string/generic/strtok_r.c @@ -21,7 +21,6 @@ #include <string.h> #undef strtok_r -#undef __strtok_r /* Parse S into tokens separated by characters in DELIM. If S is NULL, the saved pointer in SAVE_PTR is used as @@ -33,8 +32,7 @@ x = strtok_r(NULL, "=", &sp); // x = NULL // s = "abc\0-def\0" */ -char * -__strtok_r (s, delim, save_ptr) +char attribute_hidden *__strtok_r (s, delim, save_ptr) char *s; const char *delim; char **save_ptr; @@ -66,4 +64,5 @@ __strtok_r (s, delim, save_ptr) } return token; } -weak_alias (__strtok_r, strtok_r) + +strong_alias(__strtok_r, strtok_r) diff --git a/libc/sysdeps/linux/alpha/bits/setjmp.h b/libc/sysdeps/linux/alpha/bits/setjmp.h index fcd57d61d..441313cba 100644 --- a/libc/sysdeps/linux/alpha/bits/setjmp.h +++ b/libc/sysdeps/linux/alpha/bits/setjmp.h @@ -1,5 +1,5 @@ /* Define the machine-dependent type `jmp_buf'. Alpha version. - Copyright (C) 1992, 1997 Free Software Foundation, Inc. + Copyright (C) 1992, 1997, 2003 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 @@ -17,7 +17,10 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#ifndef _SETJMP_H +#ifndef _BITS_SETJMP_H +#define _BITS_SETJMP_H 1 + +#if !defined _SETJMP_H && !defined _PTHREAD_H # error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead." #endif @@ -80,3 +83,5 @@ typedef long int __jmp_buf[17]; #define _JMPBUF_UNWINDS(_jmpbuf, _address) \ ((void *)(_address) < (void *)((_jmpbuf)[JB_SP])) #endif + +#endif /* bits/setjmp.h */ diff --git a/libc/sysdeps/linux/bfin/bits/setjmp.h b/libc/sysdeps/linux/bfin/bits/setjmp.h index abb7db6a0..ee3f5e787 100644 --- a/libc/sysdeps/linux/bfin/bits/setjmp.h +++ b/libc/sysdeps/linux/bfin/bits/setjmp.h @@ -2,23 +2,25 @@ 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 Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. + 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 - Library General Public License for more details. + Lesser General Public License for more details. - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + 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. */ /* Define the machine-dependent type `jmp_buf'. bfin version. Lineo, Inc. 2001*/ +#ifndef _BITS_SETJMP_H +#define _BITS_SETJMP_H 1 -#ifndef _SETJMP_H +#if !defined _SETJMP_H && !defined _PTHREAD_H # error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead." #endif @@ -51,3 +53,5 @@ typedef struct containing a local variable at ADDRESS. */ #define _JMPBUF_UNWINDS(jmpbuf, address) \ ((void *) (address) < (void *) (jmpbuf)->__pregs[6]) + +#endif /* bits/setjmp.h */ diff --git a/libc/sysdeps/linux/common/__syscall_fcntl.c b/libc/sysdeps/linux/common/__syscall_fcntl.c index e4257b0c8..701877c06 100644 --- a/libc/sysdeps/linux/common/__syscall_fcntl.c +++ b/libc/sysdeps/linux/common/__syscall_fcntl.c @@ -2,9 +2,9 @@ /* * __syscall_fcntl() for uClibc * - * Copyright (C) 2000-2004 by Erik Andersen <andersen@codepoet.org> + * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org> * - * GNU Library General Public License (LGPL) version 2 or later. + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. */ #include "syscalls.h" @@ -12,7 +12,7 @@ #include <fcntl.h> #if defined __UCLIBC_HAS_LFS__ && defined __NR_fcntl64 -extern int __libc_fcntl64(int fd, int cmd, long arg); +extern int __libc_fcntl64(int fd, int cmd, ...); #endif #define __NR___syscall_fcntl __NR_fcntl @@ -39,7 +39,7 @@ int __libc_fcntl(int fd, int cmd, ...) return (__syscall_fcntl(fd, cmd, arg)); } -weak_alias(__libc_fcntl, fcntl); +weak_alias(__libc_fcntl, fcntl) #if ! defined __NR_fcntl64 && defined __UCLIBC_HAS_LFS__ -weak_alias(__libc_fcntl, fcntl64); +weak_alias(__libc_fcntl, fcntl64) #endif diff --git a/libc/sysdeps/linux/common/__syscall_fcntl64.c b/libc/sysdeps/linux/common/__syscall_fcntl64.c index bf7082969..7f9164b52 100644 --- a/libc/sysdeps/linux/common/__syscall_fcntl64.c +++ b/libc/sysdeps/linux/common/__syscall_fcntl64.c @@ -2,9 +2,9 @@ /* * __syscall_fcntl64() for uClibc * - * Copyright (C) 2000-2004 by Erik Andersen <andersen@codepoet.org> + * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org> * - * GNU Library General Public License (LGPL) version 2 or later. + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. */ #include "syscalls.h" @@ -26,5 +26,5 @@ int __libc_fcntl64(int fd, int cmd, ...) return (__syscall_fcntl64(fd, cmd, arg)); } -weak_alias(__libc_fcntl64, fcntl64); +weak_alias(__libc_fcntl64, fcntl64) #endif diff --git a/libc/sysdeps/linux/common/_exit.c b/libc/sysdeps/linux/common/_exit.c index 2a1b2c941..d0a4ee1d6 100644 --- a/libc/sysdeps/linux/common/_exit.c +++ b/libc/sysdeps/linux/common/_exit.c @@ -32,8 +32,10 @@ static inline _syscall1(void, __syscall_exit, int, status); #endif -void _exit(int status) +void attribute_noreturn _exit(int status) { - INLINE_SYSCALL(exit, 1, status); + /* The loop is added only to keep gcc happy. */ + while(1) + INLINE_SYSCALL(exit, 1, status); } diff --git a/libc/sysdeps/linux/common/bits/byteswap.h b/libc/sysdeps/linux/common/bits/byteswap.h index 38d854013..949ed0bc9 100644 --- a/libc/sysdeps/linux/common/bits/byteswap.h +++ b/libc/sysdeps/linux/common/bits/byteswap.h @@ -1,5 +1,5 @@ /* Macros to swap the order of bytes in integer values. - Copyright (C) 1997, 1998, 2000, 2001, 2002 Free Software Foundation, Inc. + Copyright (C) 1997,1998,2000,2001,2002,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 @@ -25,32 +25,35 @@ #define _BITS_BYTESWAP_H 1 /* Swap bytes in 16 bit value. */ +#define __bswap_constant_16(x) \ + ((((x) >> 8) & 0xffu) | (((x) & 0xffu) << 8)) + #ifdef __GNUC__ # define __bswap_16(x) \ (__extension__ \ - ({ unsigned short int __bsx = (x); \ - ((((__bsx) >> 8) & 0xff) | (((__bsx) & 0xff) << 8)); })) + ({ unsigned short int __bsx = (x); __bswap_constant_16 (__bsx); })) #else static __inline unsigned short int __bswap_16 (unsigned short int __bsx) { - return ((((__bsx) >> 8) & 0xff) | (((__bsx) & 0xff) << 8)); + return __bswap_constant_16 (__bsx); } #endif /* Swap bytes in 32 bit value. */ +#define __bswap_constant_32(x) \ + ((((x) & 0xff000000u) >> 24) | (((x) & 0x00ff0000u) >> 8) | \ + (((x) & 0x0000ff00u) << 8) | (((x) & 0x000000ffu) << 24)) + #ifdef __GNUC__ # define __bswap_32(x) \ - (__extension__ \ - ({ unsigned int __bsx = (x); \ - ((((__bsx) & 0xff000000) >> 24) | (((__bsx) & 0x00ff0000) >> 8) | \ - (((__bsx) & 0x0000ff00) << 8) | (((__bsx) & 0x000000ff) << 24)); })) + (__extension__ \ + ({ register unsigned int __bsx = (x); __bswap_constant_32 (__bsx); })) #else static __inline unsigned int __bswap_32 (unsigned int __bsx) { - return ((((__bsx) & 0xff000000) >> 24) | (((__bsx) & 0x00ff0000) >> 8) | - (((__bsx) & 0x0000ff00) << 8) | (((__bsx) & 0x000000ff) << 24)); + return __bswap_constant_32 (__bsx); } #endif diff --git a/libc/sysdeps/linux/common/bits/confname.h b/libc/sysdeps/linux/common/bits/confname.h index ba8868af4..a66f85aac 100644 --- a/libc/sysdeps/linux/common/bits/confname.h +++ b/libc/sysdeps/linux/common/bits/confname.h @@ -1,5 +1,6 @@ /* `sysconf', `pathconf', and `confstr' NAME values. Generic version. - Copyright (C) 1993, 1995-1998, 2000, 2001 Free Software Foundation, Inc. + Copyright (C) 1993,1995-1998,2000,2001,2003,2004 + 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 @@ -471,96 +472,96 @@ enum _CS_PATH, /* The default search path. */ #define _CS_PATH _CS_PATH + _CS_V6_WIDTH_RESTRICTED_ENVS, +# define _CS_V6_WIDTH_RESTRICTED_ENVS _CS_V6_WIDTH_RESTRICTED_ENVS + # if (defined __USE_FILE_OFFSET64 || defined __USE_LARGEFILE64 \ || defined __USE_LARGEFILE) _CS_LFS_CFLAGS = 1000, -# define _CS_LFS_CFLAGS _CS_LFS_CFLAGS +#define _CS_LFS_CFLAGS _CS_LFS_CFLAGS _CS_LFS_LDFLAGS, -# define _CS_LFS_LDFLAGS _CS_LFS_LDFLAGS +#define _CS_LFS_LDFLAGS _CS_LFS_LDFLAGS _CS_LFS_LIBS, -# define _CS_LFS_LIBS _CS_LFS_LIBS +#define _CS_LFS_LIBS _CS_LFS_LIBS _CS_LFS_LINTFLAGS, -# define _CS_LFS_LINTFLAGS _CS_LFS_LINTFLAGS +#define _CS_LFS_LINTFLAGS _CS_LFS_LINTFLAGS _CS_LFS64_CFLAGS, -# define _CS_LFS64_CFLAGS _CS_LFS64_CFLAGS +#define _CS_LFS64_CFLAGS _CS_LFS64_CFLAGS _CS_LFS64_LDFLAGS, -# define _CS_LFS64_LDFLAGS _CS_LFS64_LDFLAGS +#define _CS_LFS64_LDFLAGS _CS_LFS64_LDFLAGS _CS_LFS64_LIBS, -# define _CS_LFS64_LIBS _CS_LFS64_LIBS +#define _CS_LFS64_LIBS _CS_LFS64_LIBS _CS_LFS64_LINTFLAGS, -# define _CS_LFS64_LINTFLAGS _CS_LFS64_LINTFLAGS +#define _CS_LFS64_LINTFLAGS _CS_LFS64_LINTFLAGS # endif # ifdef __USE_UNIX98 _CS_XBS5_ILP32_OFF32_CFLAGS = 1100, -# define _CS_XBS5_ILP32_OFF32_CFLAGS _CS_XBS5_ILP32_OFF32_CFLAGS +#define _CS_XBS5_ILP32_OFF32_CFLAGS _CS_XBS5_ILP32_OFF32_CFLAGS _CS_XBS5_ILP32_OFF32_LDFLAGS, -# define _CS_XBS5_ILP32_OFF32_LDFLAGS _CS_XBS5_ILP32_OFF32_LDFLAGS +#define _CS_XBS5_ILP32_OFF32_LDFLAGS _CS_XBS5_ILP32_OFF32_LDFLAGS _CS_XBS5_ILP32_OFF32_LIBS, -# define _CS_XBS5_ILP32_OFF32_LIBS _CS_XBS5_ILP32_OFF32_LIBS +#define _CS_XBS5_ILP32_OFF32_LIBS _CS_XBS5_ILP32_OFF32_LIBS _CS_XBS5_ILP32_OFF32_LINTFLAGS, -# define _CS_XBS5_ILP32_OFF32_LINTFLAGS _CS_XBS5_ILP32_OFF32_LINTFLAGS +#define _CS_XBS5_ILP32_OFF32_LINTFLAGS _CS_XBS5_ILP32_OFF32_LINTFLAGS _CS_XBS5_ILP32_OFFBIG_CFLAGS, -# define _CS_XBS5_ILP32_OFFBIG_CFLAGS _CS_XBS5_ILP32_OFFBIG_CFLAGS +#define _CS_XBS5_ILP32_OFFBIG_CFLAGS _CS_XBS5_ILP32_OFFBIG_CFLAGS _CS_XBS5_ILP32_OFFBIG_LDFLAGS, -# define _CS_XBS5_ILP32_OFFBIG_LDFLAGS _CS_XBS5_ILP32_OFFBIG_LDFLAGS +#define _CS_XBS5_ILP32_OFFBIG_LDFLAGS _CS_XBS5_ILP32_OFFBIG_LDFLAGS _CS_XBS5_ILP32_OFFBIG_LIBS, -# define _CS_XBS5_ILP32_OFFBIG_LIBS _CS_XBS5_ILP32_OFFBIG_LIBS +#define _CS_XBS5_ILP32_OFFBIG_LIBS _CS_XBS5_ILP32_OFFBIG_LIBS _CS_XBS5_ILP32_OFFBIG_LINTFLAGS, -# define _CS_XBS5_ILP32_OFFBIG_LINTFLAGS _CS_XBS5_ILP32_OFFBIG_LINTFLAGS +#define _CS_XBS5_ILP32_OFFBIG_LINTFLAGS _CS_XBS5_ILP32_OFFBIG_LINTFLAGS _CS_XBS5_LP64_OFF64_CFLAGS, -# define _CS_XBS5_LP64_OFF64_CFLAGS _CS_XBS5_LP64_OFF64_CFLAGS +#define _CS_XBS5_LP64_OFF64_CFLAGS _CS_XBS5_LP64_OFF64_CFLAGS _CS_XBS5_LP64_OFF64_LDFLAGS, -# define _CS_XBS5_LP64_OFF64_LDFLAGS _CS_XBS5_LP64_OFF64_LDFLAGS +#define _CS_XBS5_LP64_OFF64_LDFLAGS _CS_XBS5_LP64_OFF64_LDFLAGS _CS_XBS5_LP64_OFF64_LIBS, -# define _CS_XBS5_LP64_OFF64_LIBS _CS_XBS5_LP64_OFF64_LIBS +#define _CS_XBS5_LP64_OFF64_LIBS _CS_XBS5_LP64_OFF64_LIBS _CS_XBS5_LP64_OFF64_LINTFLAGS, -# define _CS_XBS5_LP64_OFF64_LINTFLAGS _CS_XBS5_LP64_OFF64_LINTFLAGS +#define _CS_XBS5_LP64_OFF64_LINTFLAGS _CS_XBS5_LP64_OFF64_LINTFLAGS _CS_XBS5_LPBIG_OFFBIG_CFLAGS, -# define _CS_XBS5_LPBIG_OFFBIG_CFLAGS _CS_XBS5_LPBIG_OFFBIG_CFLAGS +#define _CS_XBS5_LPBIG_OFFBIG_CFLAGS _CS_XBS5_LPBIG_OFFBIG_CFLAGS _CS_XBS5_LPBIG_OFFBIG_LDFLAGS, -# define _CS_XBS5_LPBIG_OFFBIG_LDFLAGS _CS_XBS5_LPBIG_OFFBIG_LDFLAGS +#define _CS_XBS5_LPBIG_OFFBIG_LDFLAGS _CS_XBS5_LPBIG_OFFBIG_LDFLAGS _CS_XBS5_LPBIG_OFFBIG_LIBS, -# define _CS_XBS5_LPBIG_OFFBIG_LIBS _CS_XBS5_LPBIG_OFFBIG_LIBS +#define _CS_XBS5_LPBIG_OFFBIG_LIBS _CS_XBS5_LPBIG_OFFBIG_LIBS _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS, -# define _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS +#define _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS # endif # ifdef __USE_XOPEN2K _CS_POSIX_V6_ILP32_OFF32_CFLAGS, -# define _CS_POSIX_V6_ILP32_OFF32_CFLAGS _CS_POSIX_V6_ILP32_OFF32_CFLAGS +#define _CS_POSIX_V6_ILP32_OFF32_CFLAGS _CS_POSIX_V6_ILP32_OFF32_CFLAGS _CS_POSIX_V6_ILP32_OFF32_LDFLAGS, -# define _CS_POSIX_V6_ILP32_OFF32_LDFLAGS _CS_POSIX_V6_ILP32_OFF32_LDFLAGS +#define _CS_POSIX_V6_ILP32_OFF32_LDFLAGS _CS_POSIX_V6_ILP32_OFF32_LDFLAGS _CS_POSIX_V6_ILP32_OFF32_LIBS, -# define _CS_POSIX_V6_ILP32_OFF32_LIBS _CS_POSIX_V6_ILP32_OFF32_LIBS +#define _CS_POSIX_V6_ILP32_OFF32_LIBS _CS_POSIX_V6_ILP32_OFF32_LIBS _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS, -# define _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS +#define _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS, -# define _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS +#define _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS, -# define _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS +#define _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS _CS_POSIX_V6_ILP32_OFFBIG_LIBS, -# define _CS_POSIX_V6_ILP32_OFFBIG_LIBS _CS_POSIX_V6_ILP32_OFFBIG_LIBS +#define _CS_POSIX_V6_ILP32_OFFBIG_LIBS _CS_POSIX_V6_ILP32_OFFBIG_LIBS _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS, -# define _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS +#define _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS _CS_POSIX_V6_LP64_OFF64_CFLAGS, -# define _CS_POSIX_V6_LP64_OFF64_CFLAGS _CS_POSIX_V6_LP64_OFF64_CFLAGS +#define _CS_POSIX_V6_LP64_OFF64_CFLAGS _CS_POSIX_V6_LP64_OFF64_CFLAGS _CS_POSIX_V6_LP64_OFF64_LDFLAGS, -# define _CS_POSIX_V6_LP64_OFF64_LDFLAGS _CS_POSIX_V6_LP64_OFF64_LDFLAGS +#define _CS_POSIX_V6_LP64_OFF64_LDFLAGS _CS_POSIX_V6_LP64_OFF64_LDFLAGS _CS_POSIX_V6_LP64_OFF64_LIBS, -# define _CS_POSIX_V6_LP64_OFF64_LIBS _CS_POSIX_V6_LP64_OFF64_LIBS +#define _CS_POSIX_V6_LP64_OFF64_LIBS _CS_POSIX_V6_LP64_OFF64_LIBS _CS_POSIX_V6_LP64_OFF64_LINTFLAGS, -# define _CS_POSIX_V6_LP64_OFF64_LINTFLAGS _CS_POSIX_V6_LP64_OFF64_LINTFLAGS +#define _CS_POSIX_V6_LP64_OFF64_LINTFLAGS _CS_POSIX_V6_LP64_OFF64_LINTFLAGS _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS, -# define _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS +#define _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS, -# define _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS +#define _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS _CS_POSIX_V6_LPBIG_OFFBIG_LIBS, -# define _CS_POSIX_V6_LPBIG_OFFBIG_LIBS _CS_POSIX_V6_LPBIG_OFFBIG_LIBS - _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS, -# define _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS +#define _CS_POSIX_V6_LPBIG_OFFBIG_LIBS _CS_POSIX_V6_LPBIG_OFFBIG_LIBS + _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS +#define _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS # endif - - _CS_V6_WIDTH_RESTRICTED_ENVS -# define _CS_V6_WIDTH_RESTRICTED_ENVS _CS_V6_WIDTH_RESTRICTED_ENVS }; #endif diff --git a/libc/sysdeps/linux/common/bits/environments.h b/libc/sysdeps/linux/common/bits/environments.h index c3829927b..4617dc45f 100644 --- a/libc/sysdeps/linux/common/bits/environments.h +++ b/libc/sysdeps/linux/common/bits/environments.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1999, 2001 Free Software Foundation, Inc. +/* Copyright (C) 1999, 2001, 2004 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 @@ -72,4 +72,7 @@ # define _XBS5_LP64_OFF64 -1 # define _XBS5_LPBIG_OFFBIG -1 +/* CFLAGS. */ +#define __ILP32_OFFBIG_CFLAGS "-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" + #endif /* __WORDSIZE == 32 */ diff --git a/libc/sysdeps/linux/common/bits/getopt.h b/libc/sysdeps/linux/common/bits/getopt.h index fd1cb7b15..a192c039b 100644 --- a/libc/sysdeps/linux/common/bits/getopt.h +++ b/libc/sysdeps/linux/common/bits/getopt.h @@ -1,5 +1,6 @@ /* Declarations for getopt. - Copyright (C) 1989-1994, 1996-1999, 2001 Free Software Foundation, Inc. + Copyright (C) 1989-1994,1996-1999,2001,2003,2004 + 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 @@ -19,6 +20,8 @@ #ifndef _GETOPT_H +#include <features.h> + #ifndef __need_getopt # define _GETOPT_H 1 #endif @@ -34,6 +37,17 @@ # include <ctype.h> #endif +#ifndef __THROW +# ifndef __GNUC_PREREQ +# define __GNUC_PREREQ(maj, min) (0) +# endif +# if defined __cplusplus && __GNUC_PREREQ (2,8) +# define __THROW throw () +# else +# define __THROW +# endif +#endif + #ifdef __cplusplus extern "C" { #endif @@ -133,23 +147,26 @@ struct option arguments to the option '\0'. This behavior is specific to the GNU `getopt'. */ +#if defined __GNU_LIBRARY__ || defined __UCLIBC__ /* Many other libraries have conflicting prototypes for getopt, with differences in the consts, in stdlib.h. To avoid compilation errors, only prototype getopt for the GNU C library. */ -extern int getopt (int __argc, char *const *__argv, const char *__shortopts); +extern int getopt (int ___argc, char *const *___argv, const char *__shortopts) + __THROW; +#else /* not __GNU_LIBRARY__ */ +extern int getopt (); +#endif /* __GNU_LIBRARY__ */ #ifndef __need_getopt -extern int getopt_long (int __argc, char *const *__argv, const char *__shortopts, - const struct option *__longopts, int *__longind); -extern int getopt_long_only (int __argc, char *const *__argv, +extern int getopt_long (int ___argc, char *const *___argv, + const char *__shortopts, + const struct option *__longopts, int *__longind) + __THROW; +extern int getopt_long_only (int ___argc, char *const *___argv, const char *__shortopts, - const struct option *__longopts, int *__longind); + const struct option *__longopts, int *__longind) + __THROW; -/* Internal only. Users should not call this directly. */ -extern int _getopt_internal (int __argc, char *const *__argv, - const char *__shortopts, - const struct option *__longopts, int *__longind, - int __long_only); #endif #ifdef __cplusplus diff --git a/libc/sysdeps/linux/common/bits/in.h b/libc/sysdeps/linux/common/bits/in.h index e6cf57574..14d3db858 100644 --- a/libc/sysdeps/linux/common/bits/in.h +++ b/libc/sysdeps/linux/common/bits/in.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-1999, 2000 Free Software Foundation, Inc. +/* Copyright (C) 1991-1999, 2000, 2004 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 @@ -30,8 +30,8 @@ #define IP_HDRINCL 3 /* int; Header is included with data. */ #define IP_OPTIONS 4 /* ip_opts; IP per-packet options. */ #define IP_ROUTER_ALERT 5 /* bool */ -#define IP_RECVOPTS 6 /* bool */ -#define IP_RETOPTS 7 /* bool */ +#define IP_RECVOPTS 6 /* bool; Receive all IP options w/datagram. */ +#define IP_RETOPTS 7 /* bool; Set/get IP per-packet options. */ #define IP_PKTINFO 8 /* bool */ #define IP_PKTOPTIONS 9 #define IP_PMTUDISC 10 /* obsolete name? */ @@ -44,9 +44,24 @@ #define IP_MULTICAST_LOOP 34 /* i_char; set/get IP multicast loopback */ #define IP_ADD_MEMBERSHIP 35 /* ip_mreq; add an IP group membership */ #define IP_DROP_MEMBERSHIP 36 /* ip_mreq; drop an IP group membership */ +#define IP_UNBLOCK_SOURCE 37 /* ip_mreq_source: unblock data from source */ +#define IP_BLOCK_SOURCE 38 /* ip_mreq_source: block data from source */ +#define IP_ADD_SOURCE_MEMBERSHIP 39 /* ip_mreq_source: join source group */ +#define IP_DROP_SOURCE_MEMBERSHIP 40 /* ip_mreq_source: leave source group */ +#define IP_MSFILTER 41 +#define MCAST_JOIN_GROUP 42 /* group_req: join any-source group */ +#define MCAST_BLOCK_SOURCE 43 /* group_source_req: block from given group */ +#define MCAST_UNBLOCK_SOURCE 44 /* group_source_req: unblock from given group*/ +#define MCAST_LEAVE_GROUP 45 /* group_req: leave any-source group */ +#define MCAST_JOIN_SOURCE_GROUP 46 /* group_source_req: join source-spec gr */ +#define MCAST_LEAVE_SOURCE_GROUP 47 /* group_source_req: leave source-spec gr*/ +#define MCAST_MSFILTER 48 + +#define MCAST_EXCLUDE 0 +#define MCAST_INCLUDE 1 /* For BSD compatibility. */ -#define IP_RECVRETOPTS IP_RETOPTS +#define IP_RECVRETOPTS IP_RETOPTS /* bool; Receive IP options for response. */ /* IP_MTU_DISCOVER arguments. */ #define IP_PMTUDISC_DONT 0 /* Never send DF frames. */ @@ -60,9 +75,9 @@ #define IP_DEFAULT_MULTICAST_LOOP 1 #define IP_MAX_MEMBERSHIPS 20 -/* Structure used to describe IP options for IP_OPTIONS. The `ip_dst' - field is used for the first-hop gateway when using a source route - (this gets put into the header proper). */ +/* Structure used to describe IP options for IP_OPTIONS and IP_RETOPTS. + The `ip_dst' field is used for the first-hop gateway when using a + source route (this gets put into the header proper). */ struct ip_opts { struct in_addr ip_dst; /* First hop; zero without source route. */ @@ -115,15 +130,19 @@ struct in_pktinfo #define IPV6_MTU_DISCOVER 23 #define IPV6_MTU 24 #define IPV6_RECVERR 25 +#define IPV6_V6ONLY 26 +#define IPV6_JOIN_ANYCAST 27 +#define IPV6_LEAVE_ANYCAST 28 +#define IPV6_IPSEC_POLICY 34 +#define IPV6_XFRM_POLICY 35 #define SCM_SRCRT IPV6_RXSRCRT /* Obsolete synonyms for the above. */ -#define IPV6_RXHOPOPTS IPV6_HOPOPTS -#define IPV6_RXDSTOPTS IPV6_DSTOPTS #define IPV6_ADD_MEMBERSHIP IPV6_JOIN_GROUP #define IPV6_DROP_MEMBERSHIP IPV6_LEAVE_GROUP - +#define IPV6_RXHOPOPTS IPV6_HOPOPTS +#define IPV6_RXDSTOPTS IPV6_DSTOPTS /* IPV6_MTU_DISCOVER values. */ #define IPV6_PMTUDISC_DONT 0 /* Never send DF frames. */ diff --git a/libc/sysdeps/linux/common/bits/ioctls.h b/libc/sysdeps/linux/common/bits/ioctls.h index b49ca2076..11bb4c485 100644 --- a/libc/sysdeps/linux/common/bits/ioctls.h +++ b/libc/sysdeps/linux/common/bits/ioctls.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc. +/* Copyright (C) 1996, 1997, 1998, 2003 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 @@ -48,6 +48,7 @@ #define SIOCSIFMEM 0x8920 /* set memory address (BSD) */ #define SIOCGIFMTU 0x8921 /* get MTU size */ #define SIOCSIFMTU 0x8922 /* set MTU size */ +#define SIOCSIFNAME 0x8923 /* set interface name */ #define SIOCSIFHWADDR 0x8924 /* set hardware address */ #define SIOCGIFENCAP 0x8925 /* get/set encapsulations */ #define SIOCSIFENCAP 0x8926 diff --git a/libc/sysdeps/linux/common/bits/kernel_stat.h b/libc/sysdeps/linux/common/bits/kernel_stat.h index 4bcc0fe3a..571c08fa6 100644 --- a/libc/sysdeps/linux/common/bits/kernel_stat.h +++ b/libc/sysdeps/linux/common/bits/kernel_stat.h @@ -1,57 +1,2 @@ -#ifndef _BITS_STAT_STRUCT_H -#define _BITS_STAT_STRUCT_H - -/* This file provides whatever this particular arch's kernel thinks - * struct kernel_stat should look like... It turns out each arch has a - * different opinion on the subject... */ -#warning "Please verify struct kernel_stat for your architecture actually matches struct kernel_stat for x86 If it doesn't, then you will need to add a proper kernel_stat.h for your architecture..." - -struct kernel_stat { - unsigned short st_dev; - unsigned short __pad1; - unsigned long st_ino; - unsigned short st_mode; - unsigned short st_nlink; - unsigned short st_uid; - unsigned short st_gid; - unsigned short st_rdev; - unsigned short __pad2; - unsigned long st_size; - unsigned long st_blksize; - unsigned long st_blocks; - unsigned long st_atime; - unsigned long __unused1; - unsigned long st_mtime; - unsigned long __unused2; - unsigned long st_ctime; - unsigned long __unused3; - unsigned long __unused4; - unsigned long __unused5; -}; - -struct kernel_stat64 { - unsigned short st_dev; - unsigned char __pad0[10]; -#define _HAVE_STAT64___ST_INO - unsigned long __st_ino; - unsigned int st_mode; - unsigned int st_nlink; - unsigned long st_uid; - unsigned long st_gid; - unsigned short st_rdev; - unsigned char __pad3[10]; - long long st_size; - unsigned long st_blksize; - unsigned long st_blocks; /* Number 512-byte blocks allocated. */ - unsigned long __pad4; /* future possible st_blocks high bits */ - unsigned long st_atime; - unsigned long __pad5; - unsigned long st_mtime; - unsigned long __pad6; - unsigned long st_ctime; - unsigned long __pad7; /* will be high 32 bits of ctime someday */ - unsigned long long st_ino; -}; - -#endif /* _BITS_STAT_STRUCT_H */ - +/* bits/kernel_stat.h is architecture specific. */ +#error "This file must be supplied by every Linux architecture." diff --git a/libc/sysdeps/linux/common/bits/local_lim.h b/libc/sysdeps/linux/common/bits/local_lim.h index 0a7c83706..d4671e4a8 100644 --- a/libc/sysdeps/linux/common/bits/local_lim.h +++ b/libc/sysdeps/linux/common/bits/local_lim.h @@ -1,21 +1,21 @@ /* Minimum guaranteed maximum values for system limits. Linux version. - Copyright (C) 1993, 94, 95, 96, 97, 98, 2000 Free Software Foundation, Inc. + Copyright (C) 1993-1998, 2000, 2003, 2004 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 Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. + 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 - Library General Public License for more details. + Lesser General Public License for more details. - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + 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. */ /* The kernel header pollutes the namespace with the NR_OPEN symbol and defines LINK_MAX although filesystems have different maxima. A @@ -66,12 +66,24 @@ /* This is the value this implementation supports. */ #define PTHREAD_THREADS_MAX 1024 +/* Minimum size for a thread. We are free to choose a reasonable value. */ +#define PTHREAD_STACK_MIN 16384 + /* Maximum amount by which a process can descrease its asynchronous I/O priority level. */ #define AIO_PRIO_DELTA_MAX 20 -/* Minimum size for a thread. We are free to choose a reasonable value. */ -#define PTHREAD_STACK_MIN 16384 +/* Maximum tty name length. */ +#define TTY_NAME_MAX 32 + +/* Maximum login name length. This is arbitrary. */ +#define LOGIN_NAME_MAX 256 + +/* Maximum host name length. */ +#define HOST_NAME_MAX 64 + +/* Maximum message queue priority level. */ +#define MQ_PRIO_MAX 32768 /* Maximum number of POSIX timers available. */ #define TIMER_MAX 256 diff --git a/libc/sysdeps/linux/common/bits/msq.h b/libc/sysdeps/linux/common/bits/msq.h index cd4624301..32a49b592 100644 --- a/libc/sysdeps/linux/common/bits/msq.h +++ b/libc/sysdeps/linux/common/bits/msq.h @@ -32,6 +32,7 @@ typedef unsigned long int msgqnum_t; typedef unsigned long int msglen_t; + /* Structure of record for one message inside the kernel. The type `struct msg' is opaque. */ struct msqid_ds diff --git a/libc/sysdeps/linux/common/bits/posix_opt.h b/libc/sysdeps/linux/common/bits/posix_opt.h index 9329dfc15..330989128 100644 --- a/libc/sysdeps/linux/common/bits/posix_opt.h +++ b/libc/sysdeps/linux/common/bits/posix_opt.h @@ -1,24 +1,28 @@ /* Define POSIX options for Linux. - Copyright (C) 1996,1997,1998,1999,2000,2001 Free Software Foundation, Inc. + Copyright (C) 1996,1997,1999,2000,2002,2003 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 Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. + 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 - Library General Public License for more details. + Lesser General Public License for more details. - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + 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. */ -#ifndef _POSIX_OPT_H -#define _POSIX_OPT_H 1 +/* + * Never include this file directly; use <unistd.h> instead. + */ + +#ifndef _BITS_POSIX_OPT_H +#define _BITS_POSIX_OPT_H 1 /* Job control is supported. */ #define _POSIX_JOB_CONTROL 1 @@ -27,27 +31,27 @@ #define _POSIX_SAVED_IDS 1 /* Priority scheduling is supported. */ -#define _POSIX_PRIORITY_SCHEDULING 1 +#define _POSIX_PRIORITY_SCHEDULING 200112L /* Synchronizing file data is supported. */ -#define _POSIX_SYNCHRONIZED_IO 1 +#define _POSIX_SYNCHRONIZED_IO 200112L /* The fsync function is present. */ -#define _POSIX_FSYNC 1 +#define _POSIX_FSYNC 200112L /* Mapping of files to memory is supported. */ -#define _POSIX_MAPPED_FILES 1 +#define _POSIX_MAPPED_FILES 200112L /* Locking of all memory is supported. */ #ifdef __ARCH_HAS_MMU__ -# define _POSIX_MEMLOCK 1 +# define _POSIX_MEMLOCK 200112L #else # undef _POSIX_MEMLOCK #endif /* Locking of ranges of memory is supported. */ #ifdef __ARCH_HAS_MMU__ -# define _POSIX_MEMLOCK_RANGE 1 +# define _POSIX_MEMLOCK_RANGE 200112L #else # define _POSIX_MEMLOCK_RANGE #endif @@ -105,7 +109,7 @@ #endif /* We provide priority scheduling for threads. */ -#define _POSIX_THREAD_PRIORITY_SCHEDULING 1 +#define _POSIX_THREAD_PRIORITY_SCHEDULING 1 /* We support user-defined stack sizes. */ #define _POSIX_THREAD_ATTR_STACKSIZE 1 @@ -121,7 +125,7 @@ #endif /* Real-time signals are supported. */ -#define _POSIX_REALTIME_SIGNALS 1 +#define _POSIX_REALTIME_SIGNALS 200112L /* We support asynchronous I/O. */ #define _POSIX_ASYNCHRONOUS_IO 1 @@ -147,46 +151,46 @@ # undef _LFS64_STDIO #endif -/* POSIX shared memory objects are implemented. */ -#define _POSIX_SHARED_MEMORY_OBJECTS 1 +/* POSIX timers are available. */ +#define _POSIX_TIMERS 200112L -/* GNU libc provides regular expression handling. */ -#ifdef __UCLIBC_HAS_REGEX__ -# define _POSIX_REGEXP 1 -#else -# undef _POSIX_REGEXP -#endif +/* POSIX shared memory objects are implemented. */ +#define _POSIX_SHARED_MEMORY_OBJECTS 200112L #if defined(__i386__) /* CPU-time clocks supported. */ -#define _POSIX_CPUTIME 200912L +# define _POSIX_CPUTIME 200912L /* We support the clock also in threads. */ -#define _POSIX_THREAD_CPUTIME 200912L +# define _POSIX_THREAD_CPUTIME 200912L #endif /* Reader/Writer locks are available. */ #define _POSIX_READER_WRITER_LOCKS 200912L +/* GNU libc provides regular expression handling. */ +#ifdef __UCLIBC_HAS_REGEX__ +# define _POSIX_REGEXP 1 +#else +# undef _POSIX_REGEXP +#endif + /* We have a POSIX shell. */ #define _POSIX_SHELL 1 +/* The `spawn' function family is supported. */ +#define _POSIX_SPAWN 200912L + /* We support the Timeouts option. */ #define _POSIX_TIMEOUTS 200912L /* We support spinlocks. */ #define _POSIX_SPIN_LOCKS 200912L -/* The `spawn' function family is supported. */ -#define _POSIX_SPAWN 200912L - -/* We have POSIX timers. */ -#define _POSIX_TIMERS 1 - /* The barrier functions are available. */ #define _POSIX_BARRIERS 200912L /* POSIX message queues are not yet supported. */ #undef _POSIX_MESSAGE_PASSING -#endif /* posix_opt.h */ +#endif /* bits/posix_opt.h */ diff --git a/libc/sysdeps/linux/common/bits/resource.h b/libc/sysdeps/linux/common/bits/resource.h index 30825c2e0..1d438122e 100644 --- a/libc/sysdeps/linux/common/bits/resource.h +++ b/libc/sysdeps/linux/common/bits/resource.h @@ -1,5 +1,6 @@ /* Bit values & structures for resource limits. Linux version. - Copyright (C) 1994,1996,1997,1998,1999,2000 Free Software Foundation, Inc. + Copyright (C) 1994, 1996, 1997, 1998, 1999, 2000, 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 @@ -55,34 +56,35 @@ enum __rlimit_resource This affects swapping; processes that are exceeding their resident set size will be more likely to have physical memory taken from them. */ - RLIMIT_RSS = 5, -#define RLIMIT_RSS RLIMIT_RSS + __RLIMIT_RSS = 5, +#define RLIMIT_RSS __RLIMIT_RSS /* Number of open files. */ RLIMIT_NOFILE = 7, - RLIMIT_OFILE = RLIMIT_NOFILE, /* BSD name for same. */ + __RLIMIT_OFILE = RLIMIT_NOFILE, /* BSD name for same. */ #define RLIMIT_NOFILE RLIMIT_NOFILE -#define RLIMIT_OFILE RLIMIT_OFILE +#define RLIMIT_OFILE __RLIMIT_OFILE - /* Address space limit (?) */ + /* Address space limit. */ RLIMIT_AS = 9, #define RLIMIT_AS RLIMIT_AS /* Number of processes. */ - RLIMIT_NPROC = 6, -#define RLIMIT_NPROC RLIMIT_NPROC + __RLIMIT_NPROC = 6, +#define RLIMIT_NPROC __RLIMIT_NPROC /* Locked-in-memory address space. */ - RLIMIT_MEMLOCK = 8, -#define RLIMIT_MEMLOCK RLIMIT_MEMLOCK + __RLIMIT_MEMLOCK = 8, +#define RLIMIT_MEMLOCK __RLIMIT_MEMLOCK /* Maximum number of file locks. */ - RLIMIT_LOCKS = 10, -#define RLIMIT_LOCKS RLIMIT_LOCKS + __RLIMIT_LOCKS = 10, +#define RLIMIT_LOCKS __RLIMIT_LOCKS - RLIM_NLIMITS = 11 -#define RLIMIT_NLIMITS RLIMIT_NLIMITS -#define RLIM_NLIMITS RLIM_NLIMITS + __RLIMIT_NLIMITS = 11, + __RLIM_NLIMITS = __RLIMIT_NLIMITS +#define RLIMIT_NLIMITS __RLIMIT_NLIMITS +#define RLIM_NLIMITS __RLIM_NLIMITS }; /* Value to indicate that there is no limit. */ diff --git a/libc/sysdeps/linux/common/bits/setjmp.h b/libc/sysdeps/linux/common/bits/setjmp.h index 9150d8d76..ad9f04d71 100644 --- a/libc/sysdeps/linux/common/bits/setjmp.h +++ b/libc/sysdeps/linux/common/bits/setjmp.h @@ -1,7 +1,2 @@ -/* Define the machine-dependent type `jmp_buf'. Stub version. */ - -#ifndef _SETJMP_H -# error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead." -#endif - -typedef int __jmp_buf[1]; +/* bits/setjmp.h is architecture specific. */ +#error "This file must be supplied by every Linux architecture." diff --git a/libc/sysdeps/linux/common/bits/sigthread.h b/libc/sysdeps/linux/common/bits/sigthread.h index 0a634ac68..9e6b62e4b 100644 --- a/libc/sysdeps/linux/common/bits/sigthread.h +++ b/libc/sysdeps/linux/common/bits/sigthread.h @@ -1,21 +1,21 @@ -/* Signal handling function for threaded programs. - Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc. +/* Signal handling function for threaded programs. Generic version. + Copyright (C) 2000 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 Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. + 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 - Library General Public License for more details. + Lesser General Public License for more details. - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + 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. */ #ifndef _BITS_SIGTHREAD_H #define _BITS_SIGTHREAD_H 1 @@ -24,10 +24,10 @@ # error "Never include this file directly. Use <pthread.h> instead" #endif -/* Functions for handling signals. */ - -/* Modify the signal mask for the calling thread. The arguments have - the same meaning as for sigprocmask(2). */ +/* Modify the signal mask for the calling thread. The arguments have the + same meaning as for sigprocmask; in fact, this and sigprocmask might be + the same function. We declare this the same on all platforms, since it + doesn't use any thread-related types. */ extern int pthread_sigmask (int __how, __const __sigset_t *__restrict __newmask, __sigset_t *__restrict __oldmask)__THROW; diff --git a/libc/sysdeps/linux/common/bits/socket.h b/libc/sysdeps/linux/common/bits/socket.h index 61644073b..894cf0da2 100644 --- a/libc/sysdeps/linux/common/bits/socket.h +++ b/libc/sysdeps/linux/common/bits/socket.h @@ -1,5 +1,5 @@ /* System-specific socket constants and types. Linux version. - Copyright (C) 1991,1992,1994-1999,2000,2001 Free Software Foundation, Inc. + Copyright (C) 1991,1992,1994-2001, 2004 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 @@ -212,6 +212,9 @@ enum /* Structure describing messages sent by `sendmsg' and received by `recvmsg'. */ +/* Note: do not change these members to match glibc; these match the + SuSv3 spec already (e.g. msg_iovlen/msg_controllen). + http://www.opengroup.org/onlinepubs/009695399/basedefs/sys/socket.h.html */ struct msghdr { void *msg_name; /* Address to send to/receive from. */ diff --git a/libc/sysdeps/linux/common/bits/statvfs.h b/libc/sysdeps/linux/common/bits/statvfs.h index 32e03f31e..cca0871ac 100644 --- a/libc/sysdeps/linux/common/bits/statvfs.h +++ b/libc/sysdeps/linux/common/bits/statvfs.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997, 1998, 2000, 2001 Free Software Foundation, Inc. +/* Copyright (C) 1997, 1998, 2000, 2001, 2002 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 @@ -22,6 +22,10 @@ #include <bits/types.h> /* For __fsblkcnt_t and __fsfilcnt_t. */ +#if __WORDSIZE == 32 +#define _STATVFSBUF_F_UNUSED +#endif + struct statvfs { unsigned long int f_bsize; @@ -42,12 +46,13 @@ struct statvfs __fsfilcnt64_t f_favail; #endif unsigned long int f_fsid; +#ifdef _STATVFSBUF_F_UNUSED int __f_unused; +#endif unsigned long int f_flag; unsigned long int f_namemax; int __f_spare[6]; }; -#define _STATVFSBUF_F_UNUSED #ifdef __USE_LARGEFILE64 struct statvfs64 @@ -61,7 +66,9 @@ struct statvfs64 __fsfilcnt64_t f_ffree; __fsfilcnt64_t f_favail; unsigned long int f_fsid; +#ifdef _STATVFSBUF_F_UNUSED int __f_unused; +#endif unsigned long int f_flag; unsigned long int f_namemax; int __f_spare[6]; @@ -69,14 +76,15 @@ struct statvfs64 #endif /* Definitions for the flag in `f_flag'. These definitions should be - kept in sync which the definitions in <sys/mount.h>. */ + kept in sync with the definitions in <sys/mount.h>. */ enum { ST_RDONLY = 1, /* Mount read-only. */ #define ST_RDONLY ST_RDONLY - ST_NOSUID = 2, /* Ignore suid and sgid bits. */ + ST_NOSUID = 2 /* Ignore suid and sgid bits. */ #define ST_NOSUID ST_NOSUID #ifdef __USE_GNU + , ST_NODEV = 4, /* Disallow access to device special files. */ # define ST_NODEV ST_NODEV ST_NOEXEC = 8, /* Disallow program execution. */ @@ -93,7 +101,7 @@ enum # define ST_IMMUTABLE ST_IMMUTABLE ST_NOATIME = 1024, /* Do not update access times. */ # define ST_NOATIME ST_NOATIME - ST_NODIRATIME /* Do not update directory access times. */ + ST_NODIRATIME = 2048 /* Do not update directory access times. */ # define ST_NODIRATIME ST_NODIRATIME #endif /* Use GNU. */ }; diff --git a/libc/sysdeps/linux/common/bits/termios.h b/libc/sysdeps/linux/common/bits/termios.h index 887b309ad..c71e4ad1f 100644 --- a/libc/sysdeps/linux/common/bits/termios.h +++ b/libc/sysdeps/linux/common/bits/termios.h @@ -1,5 +1,6 @@ /* termios type and macro definitions. Linux version. - Copyright (C) 1993, 94, 95, 96, 97, 98, 99 Free Software Foundation, Inc. + Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2003, 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 @@ -36,6 +37,8 @@ struct termios cc_t c_cc[NCCS]; /* control characters */ speed_t c_ispeed; /* input speed */ speed_t c_ospeed; /* output speed */ +#define _HAVE_STRUCT_TERMIOS_C_ISPEED 1 +#define _HAVE_STRUCT_TERMIOS_C_OSPEED 1 }; /* c_cc characters */ @@ -72,6 +75,7 @@ struct termios #define IXANY 0004000 #define IXOFF 0010000 #define IMAXBEL 0020000 +#define IUTF8 0040000 /* c_oflag bits */ #define OPOST 0000001 @@ -168,6 +172,7 @@ struct termios #define __MAX_BAUD B4000000 #ifdef __USE_MISC # define CIBAUD 002003600000 /* input baud rate (not used) */ +# define CMSPAR 010000000000 /* mark or space (stick) parity */ # define CRTSCTS 020000000000 /* flow control */ #endif diff --git a/libc/sysdeps/linux/common/bits/types.h b/libc/sysdeps/linux/common/bits/types.h index aebd8b8c5..6068f6fd2 100644 --- a/libc/sysdeps/linux/common/bits/types.h +++ b/libc/sysdeps/linux/common/bits/types.h @@ -37,22 +37,7 @@ typedef unsigned short int __u_short; typedef unsigned int __u_int; typedef unsigned long int __u_long; -#if __WORDSIZE == 64 -typedef long int __quad_t; -typedef unsigned long int __u_quad_t; -#elif defined(__GNUC__) -__extension__ typedef unsigned long long int __u_quad_t; -__extension__ typedef long long int __quad_t; -#else -typedef struct - { - long int __val[2]; - } __quad_t; -typedef struct - { - __u_long __val[2]; - } __u_quad_t; -#endif +/* Fixed-size types, underlying types depend on word size and compiler. */ typedef signed char __int8_t; typedef unsigned char __uint8_t; typedef signed short int __int16_t; @@ -66,7 +51,24 @@ typedef unsigned long int __uint64_t; __extension__ typedef signed long long int __int64_t; __extension__ typedef unsigned long long int __uint64_t; #endif -typedef __quad_t *__qaddr_t; + +/* quad_t is also 64 bits. */ +#if __WORDSIZE == 64 +typedef long int __quad_t; +typedef unsigned long int __u_quad_t; +#elif defined(__GNUC__) +__extension__ typedef long long int __quad_t; +__extension__ typedef unsigned long long int __u_quad_t; +#else +typedef struct +{ + long __val[2]; +} __quad_t; +typedef struct +{ + __u_long __val[2]; +} __u_quad_t; +#endif #if __WORDSIZE == 32 # define __SWORD_TYPE int @@ -97,6 +99,7 @@ typedef struct /* Everythin' else. */ typedef int __daddr_t; /* The type of a disk address. */ +typedef __quad_t *__rqaddr_t; typedef char *__caddr_t; typedef long int __time_t; typedef unsigned int __useconds_t; @@ -150,7 +153,7 @@ typedef long int __t_scalar_t; typedef unsigned long int __t_uscalar_t; /* Duplicates info from stdint.h but this is used in unistd.h. */ -typedef int __intptr_t; +typedef __SWORD_TYPE __intptr_t; /* Duplicate info from sys/socket.h. */ typedef unsigned int __socklen_t; diff --git a/libc/sysdeps/linux/common/bits/uClibc_ctype.h b/libc/sysdeps/linux/common/bits/uClibc_ctype.h index f682d9762..7c2d412cf 100644 --- a/libc/sysdeps/linux/common/bits/uClibc_ctype.h +++ b/libc/sysdeps/linux/common/bits/uClibc_ctype.h @@ -1,18 +1,19 @@ /* Copyright (C) 2002 Manuel Novoa III * * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public + * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * 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 - * Library General Public License for more details. + * Lesser General Public License for more details. * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * 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. */ /* ATTENTION! ATTENTION! ATTENTION! ATTENTION! ATTENTION! diff --git a/libc/sysdeps/linux/common/bits/uClibc_fpmax.h b/libc/sysdeps/linux/common/bits/uClibc_fpmax.h index 08d47129c..690f7b23b 100644 --- a/libc/sysdeps/linux/common/bits/uClibc_fpmax.h +++ b/libc/sysdeps/linux/common/bits/uClibc_fpmax.h @@ -1,18 +1,19 @@ /* Copyright (C) 2003 Manuel Novoa III * * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public + * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * 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 - * Library General Public License for more details. + * Lesser General Public License for more details. * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * 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. */ /* Define a maximal floating point type, and the associated constants diff --git a/libc/sysdeps/linux/common/bits/uClibc_locale.h b/libc/sysdeps/linux/common/bits/uClibc_locale.h index 9287e557e..a6191a32d 100644 --- a/libc/sysdeps/linux/common/bits/uClibc_locale.h +++ b/libc/sysdeps/linux/common/bits/uClibc_locale.h @@ -1,18 +1,19 @@ /* Copyright (C) 2002, 2003 Manuel Novoa III * * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public + * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * 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 - * Library General Public License for more details. + * Lesser General Public License for more details. * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * 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. */ /* ATTENTION! ATTENTION! ATTENTION! ATTENTION! ATTENTION! diff --git a/libc/sysdeps/linux/common/bits/uClibc_page.h b/libc/sysdeps/linux/common/bits/uClibc_page.h index e91be2d13..134094536 100644 --- a/libc/sysdeps/linux/common/bits/uClibc_page.h +++ b/libc/sysdeps/linux/common/bits/uClibc_page.h @@ -1,18 +1,19 @@ /* Copyright (C) 2004 Erik Andersen * * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public + * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * 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 - * Library General Public License for more details. + * Lesser General Public License for more details. * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * 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. */ /* Supply an architecture specific value for PAGE_SIZE and friends. */ diff --git a/libc/sysdeps/linux/common/bits/uClibc_pthread.h b/libc/sysdeps/linux/common/bits/uClibc_pthread.h index 348fd9d7d..b757ef439 100644 --- a/libc/sysdeps/linux/common/bits/uClibc_pthread.h +++ b/libc/sysdeps/linux/common/bits/uClibc_pthread.h @@ -1,18 +1,19 @@ /* Copyright (C) 2003 Manuel Novoa III * * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public + * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * 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 - * Library General Public License for more details. + * Lesser General Public License for more details. * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * 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. */ /* Supply prototypes for the (weak) thread functions used by the diff --git a/libc/sysdeps/linux/common/bits/uClibc_stdio.h b/libc/sysdeps/linux/common/bits/uClibc_stdio.h index 18ec2beca..1b3f839a4 100644 --- a/libc/sysdeps/linux/common/bits/uClibc_stdio.h +++ b/libc/sysdeps/linux/common/bits/uClibc_stdio.h @@ -1,8 +1,21 @@ /* Copyright (C) 2002-2004 Manuel Novoa III <mjn3@codepoet.org> * - * GNU Library General Public License (LGPL) version 2 or later. - * * Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details. + * + * This 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. */ #ifndef _STDIO_H @@ -399,7 +412,9 @@ extern pthread_mutex_t _stdio_openlist_lock; #endif extern int _stdio_openlist_delflag; extern int _stdio_user_locking; -extern void __stdio_init_mutex(pthread_mutex_t *m); +#ifdef _LIBC +extern void __stdio_init_mutex(pthread_mutex_t *m) attribute_hidden; +#endif #endif #endif diff --git a/libc/sysdeps/linux/common/bits/uClibc_touplow.h b/libc/sysdeps/linux/common/bits/uClibc_touplow.h index d79d3cde7..28d4e2f48 100644 --- a/libc/sysdeps/linux/common/bits/uClibc_touplow.h +++ b/libc/sysdeps/linux/common/bits/uClibc_touplow.h @@ -1,18 +1,19 @@ /* Copyright (C) 2003 Manuel Novoa III * * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public + * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * 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 - * Library General Public License for more details. + * Lesser General Public License for more details. * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * 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. */ /* ATTENTION! ATTENTION! ATTENTION! ATTENTION! ATTENTION! diff --git a/libc/sysdeps/linux/common/bits/uClibc_uintmaxtostr.h b/libc/sysdeps/linux/common/bits/uClibc_uintmaxtostr.h index 9b98054a6..726558ad8 100644 --- a/libc/sysdeps/linux/common/bits/uClibc_uintmaxtostr.h +++ b/libc/sysdeps/linux/common/bits/uClibc_uintmaxtostr.h @@ -1,18 +1,19 @@ /* Copyright (C) 2003 Manuel Novoa III * * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public + * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * 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 - * Library General Public License for more details. + * Lesser General Public License for more details. * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * 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. */ /* ATTENTION! ATTENTION! ATTENTION! ATTENTION! ATTENTION! diff --git a/libc/sysdeps/linux/common/bits/uClibc_uwchar.h b/libc/sysdeps/linux/common/bits/uClibc_uwchar.h index 206191276..ba2c42db7 100644 --- a/libc/sysdeps/linux/common/bits/uClibc_uwchar.h +++ b/libc/sysdeps/linux/common/bits/uClibc_uwchar.h @@ -1,18 +1,19 @@ /* Copyright (C) 2003 Manuel Novoa III * * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public + * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * 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 - * Library General Public License for more details. + * Lesser General Public License for more details. * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * 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. */ /* ATTENTION! ATTENTION! ATTENTION! ATTENTION! ATTENTION! diff --git a/libc/sysdeps/linux/common/bits/uClibc_va_copy.h b/libc/sysdeps/linux/common/bits/uClibc_va_copy.h index cc41b6029..98663fc0e 100644 --- a/libc/sysdeps/linux/common/bits/uClibc_va_copy.h +++ b/libc/sysdeps/linux/common/bits/uClibc_va_copy.h @@ -1,8 +1,21 @@ /* Copyright (C) 2005 Manuel Novoa III <mjn3@codepoet.org> * - * GNU Library General Public License (LGPL) version 2 or later. - * * Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details. + * + * This 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. */ #ifndef _UCLIBC_VA_COPY_H diff --git a/libc/sysdeps/linux/common/bits/waitflags.h b/libc/sysdeps/linux/common/bits/waitflags.h index 1303c6c36..464cedb1f 100644 --- a/libc/sysdeps/linux/common/bits/waitflags.h +++ b/libc/sysdeps/linux/common/bits/waitflags.h @@ -1,5 +1,5 @@ /* Definitions of flag bits for `waitpid' et al. - Copyright (C) 1992, 1996, 1997, 2000 Free Software Foundation, Inc. + Copyright (C) 1992,1996,1997,2000,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 @@ -26,5 +26,13 @@ #define WNOHANG 1 /* Don't block waiting. */ #define WUNTRACED 2 /* Report status of stopped children. */ +/* Bits in the fourth argument to `waitid'. */ +#define WSTOPPED 2 /* Report stopped child (same as WUNTRACED). */ +#define WEXITED 4 /* Report dead child. */ +#define WCONTINUED 8 /* Report continued child. */ +#define WNOWAIT 0x01000000 /* Don't reap, just poll status. */ + +#define __WNOTHREAD 0x20000000 /* Don't wait on children of other threads + in this group */ #define __WALL 0x40000000 /* Wait for any child. */ #define __WCLONE 0x80000000 /* Wait for cloned process. */ diff --git a/libc/sysdeps/linux/common/dl-osinfo.h b/libc/sysdeps/linux/common/dl-osinfo.h index ee3e2ce99..4976b2b46 100644 --- a/libc/sysdeps/linux/common/dl-osinfo.h +++ b/libc/sysdeps/linux/common/dl-osinfo.h @@ -24,6 +24,9 @@ #define GETTIMEOFDAY gettimeofday #endif #else +#ifdef __SSP__ +#error "file must not be compiled with stack protection enabled on it. Use -fno-stack-protector" +#endif #ifndef __SSP_QUICK_CANARY__ #define OPEN _dl_open #define READ _dl_read diff --git a/libc/sysdeps/linux/common/fork.c b/libc/sysdeps/linux/common/fork.c index 9f87ea4e2..e766799c0 100644 --- a/libc/sysdeps/linux/common/fork.c +++ b/libc/sysdeps/linux/common/fork.c @@ -11,7 +11,9 @@ #include <unistd.h> #ifdef __ARCH_HAS_MMU__ +#ifdef __NR_fork #define __NR___libc_fork __NR_fork _syscall0(pid_t, __libc_fork); weak_alias(__libc_fork, fork); #endif +#endif diff --git a/libc/sysdeps/linux/common/getcwd.c b/libc/sysdeps/linux/common/getcwd.c index a1de4510c..c6a2fc005 100644 --- a/libc/sysdeps/linux/common/getcwd.c +++ b/libc/sysdeps/linux/common/getcwd.c @@ -153,7 +153,7 @@ int __syscall_getcwd(char * buf, unsigned long size) #endif -char *getcwd(char *buf, int size) +char *getcwd(char *buf, size_t size) { int ret; char *path; diff --git a/libc/sysdeps/linux/common/getdents.c b/libc/sysdeps/linux/common/getdents.c index 416ced4ea..623041866 100644 --- a/libc/sysdeps/linux/common/getdents.c +++ b/libc/sysdeps/linux/common/getdents.c @@ -44,7 +44,7 @@ struct kernel_dirent static inline _syscall3(int, __syscall_getdents, int, fd, unsigned char *, kdirp, size_t, count); -ssize_t __getdents (int fd, char *buf, size_t nbytes) +ssize_t attribute_hidden __getdents (int fd, char *buf, size_t nbytes) { struct dirent *dp; off_t last_offset = -1; diff --git a/libc/sysdeps/linux/common/getdents64.c b/libc/sysdeps/linux/common/getdents64.c index 1b4b0c368..7b4c0d4ce 100644 --- a/libc/sysdeps/linux/common/getdents64.c +++ b/libc/sysdeps/linux/common/getdents64.c @@ -49,7 +49,7 @@ struct kernel_dirent64 static inline _syscall3(int, __syscall_getdents64, int, fd, unsigned char *, dirp, size_t, count); -ssize_t __getdents64 (int fd, char *buf, size_t nbytes) +ssize_t attribute_hidden __getdents64 (int fd, char *buf, size_t nbytes) { struct dirent64 *dp; off64_t last_offset = -1; @@ -104,8 +104,8 @@ ssize_t __getdents64 (int fd, char *buf, size_t nbytes) return (char *) dp - buf; } #else -ssize_t __getdents (int fd, char *buf, size_t nbytes); -ssize_t __getdents64 (int fd, char *buf, size_t nbytes) +extern ssize_t __getdents (int fd, char *buf, size_t nbytes) attribute_hidden; +ssize_t attribute_hidden __getdents64 (int fd, char *buf, size_t nbytes) { return(__getdents(fd, buf, nbytes)); } diff --git a/libc/sysdeps/linux/common/getpgrp.c b/libc/sysdeps/linux/common/getpgrp.c index b8b599eae..a910cb0cc 100644 --- a/libc/sysdeps/linux/common/getpgrp.c +++ b/libc/sysdeps/linux/common/getpgrp.c @@ -9,4 +9,7 @@ #include "syscalls.h" #include <unistd.h> + +#ifdef __NR_getpgrp _syscall0(pid_t, getpgrp); +#endif diff --git a/libc/sysdeps/linux/common/open64.c b/libc/sysdeps/linux/common/open64.c index 543aa138f..d9a27a7bc 100644 --- a/libc/sysdeps/linux/common/open64.c +++ b/libc/sysdeps/linux/common/open64.c @@ -26,7 +26,7 @@ #endif #ifdef __UCLIBC_HAS_LFS__ -extern int __libc_open (__const char *file, int oflag, mode_t mode); +extern int __libc_open (__const char *file, int oflag, ...); /* Open FILE with access OFLAG. If OFLAG includes O_CREAT, a third argument is the file protection. */ diff --git a/libc/sysdeps/linux/common/ssp-local.c b/libc/sysdeps/linux/common/ssp-local.c index a835ced0e..091c34c5d 100644 --- a/libc/sysdeps/linux/common/ssp-local.c +++ b/libc/sysdeps/linux/common/ssp-local.c @@ -23,12 +23,12 @@ #include <features.h> -extern void __stack_chk_fail (void) __attribute__ ((noreturn)); +extern void __stack_chk_fail (void) attribute_noreturn; /* On some architectures, this helps needless PIC pointer setup that would be needed just for the __stack_chk_fail call. */ -void __attribute__ ((noreturn)) attribute_hidden +void attribute_noreturn attribute_hidden __stack_chk_fail_local (void) { __stack_chk_fail (); diff --git a/libc/sysdeps/linux/common/ssp.c b/libc/sysdeps/linux/common/ssp.c index 2f3a28ba4..43708fe61 100644 --- a/libc/sysdeps/linux/common/ssp.c +++ b/libc/sysdeps/linux/common/ssp.c @@ -57,8 +57,8 @@ static __always_inline void terminate(void) EXIT(127); } -void __attribute__ ((noreturn)) __stack_smash_handler(char func[], int damaged __attribute__ ((unused))); -void __attribute__ ((noreturn)) __stack_smash_handler(char func[], int damaged) +void attribute_noreturn __stack_smash_handler(char func[], int damaged __attribute__ ((unused))); +void attribute_noreturn __stack_smash_handler(char func[], int damaged) { extern char *__progname; static const char message[] = ": stack smashing attack in function "; @@ -72,7 +72,7 @@ void __attribute__ ((noreturn)) __stack_smash_handler(char func[], int damaged) terminate(); } -void __attribute__ ((noreturn)) __stack_chk_fail(void) +void attribute_noreturn __stack_chk_fail(void) { extern char *__progname; static const char msg1[] = "stack smashing detected: "; @@ -88,7 +88,7 @@ void __attribute__ ((noreturn)) __stack_chk_fail(void) } #if 0 -void __attribute__ ((noreturn)) __chk_fail(void) +void attribute_noreturn __chk_fail(void) { extern char *__progname; static const char msg1[] = "buffer overflow detected: "; diff --git a/libc/sysdeps/linux/common/wait4.c b/libc/sysdeps/linux/common/wait4.c index db60e167d..5434a009e 100644 --- a/libc/sysdeps/linux/common/wait4.c +++ b/libc/sysdeps/linux/common/wait4.c @@ -8,12 +8,13 @@ */ #include "syscalls.h" +#include <sys/resource.h> #define __NR___syscall_wait4 __NR_wait4 static inline _syscall4(int, __syscall_wait4, __kernel_pid_t, pid, - int *, status, int, opts, void *, rusage); + int *, status, int, opts, struct rusage *, rusage); -int wait4(pid_t pid, int *status, int opts, void *rusage) +pid_t wait4(pid_t pid, int *status, int opts, struct rusage *rusage) { return (__syscall_wait4(pid, status, opts, rusage)); } diff --git a/libc/sysdeps/linux/cris/bits/setjmp.h b/libc/sysdeps/linux/cris/bits/setjmp.h index ba9cbc93c..2a29c8ca9 100644 --- a/libc/sysdeps/linux/cris/bits/setjmp.h +++ b/libc/sysdeps/linux/cris/bits/setjmp.h @@ -2,23 +2,25 @@ 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 Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. + 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 - Library General Public License for more details. + Lesser General Public License for more details. - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + 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. */ /* Define the machine-dependent type `jmp_buf'. CRIS version. */ +#ifndef _BITS_SETJMP_H +#define _BITS_SETJMP_H 1 -#ifndef _SETJMP_H +#if !defined _SETJMP_H && !defined _PTHREAD_H # error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead." #endif @@ -61,4 +63,4 @@ typedef int __jmp_buf[_JBLEN]; #define _JMPBUF_UNWINDS(jmpbuf, address) \ ((void *) (address) < (void *) (jmpbuf)[JB_SP]) - +#endif /* bits/setjmp.h */ diff --git a/libc/sysdeps/linux/e1/bits/setjmp.h b/libc/sysdeps/linux/e1/bits/setjmp.h index 88ded3837..88fa76fdf 100644 --- a/libc/sysdeps/linux/e1/bits/setjmp.h +++ b/libc/sysdeps/linux/e1/bits/setjmp.h @@ -3,7 +3,10 @@ * Yannis Mitsos <yannis.mitsos@gdt.gr> */ -#ifndef _SETJMP_H +#ifndef _BITS_SETJMP_H +#define _BITS_SETJMP_H 1 + +#if !defined _SETJMP_H && !defined _PTHREAD_H # error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead." #endif @@ -16,3 +19,4 @@ typedef struct { unsigned long ReturnValue; } __jmp_buf[1]; +#endif /* bits/setjmp.h */ diff --git a/libc/sysdeps/linux/frv/bits/setjmp.h b/libc/sysdeps/linux/frv/bits/setjmp.h index 5c20c4f54..d49ad7b71 100644 --- a/libc/sysdeps/linux/frv/bits/setjmp.h +++ b/libc/sysdeps/linux/frv/bits/setjmp.h @@ -2,23 +2,26 @@ 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 Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. + 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 - Library General Public License for more details. + Lesser General Public License for more details. - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + 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. */ /* Define the machine-dependent type `jmp_buf'. FRV version. */ -#ifndef _SETJMP_H +#ifndef _BITS_SETJMP_H +#define _BITS_SETJMP_H 1 + +#if !defined _SETJMP_H && !defined _PTHREAD_H # error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead." #endif @@ -50,4 +53,6 @@ __attribute__((__aligned__(8))) /* Test if longjmp to JMPBUF would unwind the frame containing a local variable at ADDRESS. */ #define _JMPBUF_UNWINDS(jmpbuf, address) \ - ((unsigned long) (address) < (jmpbuf)->__sp) + ((void *) (address) < (void *) (jmpbuf)->__sp) + +#endif /* bits/setjmp.h */ diff --git a/libc/sysdeps/linux/h8300/bits/setjmp.h b/libc/sysdeps/linux/h8300/bits/setjmp.h index 024861440..15f8d8445 100644 --- a/libc/sysdeps/linux/h8300/bits/setjmp.h +++ b/libc/sysdeps/linux/h8300/bits/setjmp.h @@ -2,7 +2,10 @@ /* Copyright (C) 2004, Yoshinori Sato <ysato@users.sourceforge.jp> */ /* Define the machine-dependent type `jmp_buf'. H8/300 version. */ -#ifndef _SETJMP_H +#ifndef _BITS_SETJMP_H +#define _BITS_SETJMP_H 1 + +#if !defined _SETJMP_H && !defined _PTHREAD_H # error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead." #endif @@ -25,3 +28,5 @@ typedef struct containing a local variable at ADDRESS. */ #define _JMPBUF_UNWINDS(jmpbuf, address) \ ((void *) (address) < (void *) (jmpbuf)->__regs[3]) + +#endif /* bits/setjmp.h */ diff --git a/libc/sysdeps/linux/i386/bits/setjmp.h b/libc/sysdeps/linux/i386/bits/setjmp.h index e5e493bca..107fe58b3 100644 --- a/libc/sysdeps/linux/i386/bits/setjmp.h +++ b/libc/sysdeps/linux/i386/bits/setjmp.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997, 1998, 2000, 2001 Free Software Foundation, Inc. +/* Copyright (C) 1997, 1998, 2000, 2001, 2003 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 @@ -17,8 +17,10 @@ 02111-1307 USA. */ /* Define the machine-dependent type `jmp_buf'. Intel 386 version. */ +#ifndef _BITS_SETJMP_H +#define _BITS_SETJMP_H 1 -#ifndef _SETJMP_H +#if !defined _SETJMP_H && !defined _PTHREAD_H # error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead." #endif @@ -40,3 +42,5 @@ typedef int __jmp_buf[6]; containing a local variable at ADDRESS. */ #define _JMPBUF_UNWINDS(jmpbuf, address) \ ((void *) (address) < (void *) (jmpbuf)[JB_SP]) + +#endif /* bits/setjmp.h */ diff --git a/libc/sysdeps/linux/i960/bits/setjmp.h b/libc/sysdeps/linux/i960/bits/setjmp.h index 29fe2439f..f90e4cec7 100644 --- a/libc/sysdeps/linux/i960/bits/setjmp.h +++ b/libc/sysdeps/linux/i960/bits/setjmp.h @@ -1,6 +1,9 @@ /* Define the machine-dependent type `jmp_buf'. i960 version. */ -#ifndef _SETJMP_H +#ifndef _BITS_SETJMP_H +#define _BITS_SETJMP_H 1 + +#if !defined _SETJMP_H && !defined _PTHREAD_H # error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead." #endif @@ -29,5 +32,7 @@ typedef struct __jmp_buf__ { /* Test if longjmp to JMPBUF would unwind the frame containing a local variable at ADDRESS. */ #define _JMPBUF_UNWINDS(jmpbuf, address) \ - ((void *) (address) < (jmpbuf)[0].__sp) + ((void *) (address) < (void *) (jmpbuf)[0].__sp) #endif + +#endif /* bits/setjmp.h */ diff --git a/libc/sysdeps/linux/m68k/bits/setjmp.h b/libc/sysdeps/linux/m68k/bits/setjmp.h index 9969aba02..efad14c13 100644 --- a/libc/sysdeps/linux/m68k/bits/setjmp.h +++ b/libc/sysdeps/linux/m68k/bits/setjmp.h @@ -1,8 +1,27 @@ - /* Copyright (C) 2002, David McCullough <davidm@snapgear.com> */ -/* This file is released under the LGPL, any version you like */ +/* Copyright (C) 1997, 1998 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. -#ifndef _SETJMP_H + 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. */ + +/* Define the machine-dependent type `jmp_buf'. m68k version. */ +#ifndef _BITS_SETJMP_H +#define _BITS_SETJMP_H 1 + +#if !defined _SETJMP_H && !defined _PTHREAD_H # error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead." #endif @@ -41,3 +60,5 @@ typedef struct containing a local variable at ADDRESS. */ #define _JMPBUF_UNWINDS(jmpbuf, address) \ ((void *) (address) < (void *) (jmpbuf)->__aregs[5]) + +#endif /* bits/setjmp.h */ diff --git a/libc/sysdeps/linux/microblaze/bits/setjmp.h b/libc/sysdeps/linux/microblaze/bits/setjmp.h index 80cddb05d..c3e218955 100644 --- a/libc/sysdeps/linux/microblaze/bits/setjmp.h +++ b/libc/sysdeps/linux/microblaze/bits/setjmp.h @@ -12,7 +12,10 @@ * Written by Miles Bader <miles@gnu.org> */ -#ifndef _SETJMP_H +#ifndef _BITS_SETJMP_H +#define _BITS_SETJMP_H 1 + +#if !defined _SETJMP_H && !defined _PTHREAD_H # error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead." #endif @@ -35,4 +38,6 @@ typedef struct /* Test if longjmp to JMPBUF would unwind the frame containing a local variable at ADDRESS. */ #define _JMPBUF_UNWINDS(jmpbuf, address) \ - ((__ptr_t) (address) < &(jmpbuf)[0].__sp) + ((void *) (address) < (void *) (jmpbuf)[0].__sp) + +#endif /* bits/setjmp.h */ diff --git a/libc/sysdeps/linux/mips/bits/setjmp.h b/libc/sysdeps/linux/mips/bits/setjmp.h index 8cb53ee29..4eb8e9f2a 100644 --- a/libc/sysdeps/linux/mips/bits/setjmp.h +++ b/libc/sysdeps/linux/mips/bits/setjmp.h @@ -17,7 +17,10 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#ifndef _SETJMP_H +#ifndef _BITS_SETJMP_H +#define _BITS_SETJMP_H 1 + +#if !defined _SETJMP_H && !defined _PTHREAD_H # error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead." #endif @@ -54,4 +57,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) < (jmpbuf)[0].__sp) + ((void *) (address) < (void *) (jmpbuf)[0].__sp) + +#endif /* bits/setjmp.h */ diff --git a/libc/sysdeps/linux/nios/bits/setjmp.h b/libc/sysdeps/linux/nios/bits/setjmp.h index 33467f7d7..807ebea02 100644 --- a/libc/sysdeps/linux/nios/bits/setjmp.h +++ b/libc/sysdeps/linux/nios/bits/setjmp.h @@ -2,23 +2,25 @@ 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 Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. + 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 - Library General Public License for more details. + Lesser General Public License for more details. - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + 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. */ /* Define the machine-dependent type `jmp_buf'. Nios version. */ +#ifndef _BITS_SETJMP_H +#define _BITS_SETJMP_H 1 -#ifndef _SETJMP_H +#if !defined _SETJMP_H && !defined _PTHREAD_H # error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead." #endif @@ -71,4 +73,4 @@ typedef struct #endif /* _ASM */ - +#endif /* bits/setjmp.h */ diff --git a/libc/sysdeps/linux/nios2/bits/setjmp.h b/libc/sysdeps/linux/nios2/bits/setjmp.h index ea7699d09..5d33caa98 100644 --- a/libc/sysdeps/linux/nios2/bits/setjmp.h +++ b/libc/sysdeps/linux/nios2/bits/setjmp.h @@ -17,7 +17,10 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#ifndef _SETJMP_H +#ifndef _BITS_SETJMP_H +#define _BITS_SETJMP_H 1 + +#if !defined _SETJMP_H && !defined _PTHREAD_H # error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead." #endif @@ -65,3 +68,5 @@ typedef struct containing a local variable at ADDRESS. */ #define _JMPBUF_UNWINDS(jmpbuf, address) \ ((void *) (address) < (void*)(jmpbuf)->__sp) + +#endif /* bits/setjmp.h */ diff --git a/libc/sysdeps/linux/powerpc/bits/setjmp.h b/libc/sysdeps/linux/powerpc/bits/setjmp.h index b53cdea3b..dad90c74c 100644 --- a/libc/sysdeps/linux/powerpc/bits/setjmp.h +++ b/libc/sysdeps/linux/powerpc/bits/setjmp.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997, 1998, 2000 Free Software Foundation, Inc. +/* Copyright (C) 1997, 1998, 2000, 2003, 2004 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 @@ -17,8 +17,10 @@ 02111-1307 USA. */ /* Define the machine-dependent type `jmp_buf'. PowerPC version. */ +#ifndef _BITS_SETJMP_H +#define _BITS_SETJMP_H 1 -#ifndef _SETJMP_H +#if !defined _SETJMP_H && !defined _PTHREAD_H # error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead." #endif @@ -27,21 +29,52 @@ assembler easier. Naturally, user code should not depend on either representation. */ +#include <bits/wordsize.h> + #if defined __USE_MISC || defined _ASM # define JB_GPR1 0 /* Also known as the stack pointer */ # define JB_GPR2 1 # define JB_LR 2 /* The address we will return to */ -# define JB_GPRS 3 /* GPRs 14 through 31 are saved, 18 in total */ -# define JB_CR 21 /* Condition code registers. */ -# define JB_FPRS 22 /* FPRs 14 through 31 are saved, 18*2 words total */ -# define JB_SIZE (58*4) +# if __WORDSIZE == 64 +# define JB_GPRS 3 /* GPRs 14 through 31 are saved, 18*2 words total. */ +# define JB_CR 21 /* Condition code registers with the VRSAVE at */ + /* offset 172 (low half of the double word. */ +# define JB_FPRS 22 /* FPRs 14 through 31 are saved, 18*2 words total. */ +# define JB_SIZE (64 * 8) /* As per PPC64-VMX ABI. */ +# define JB_VRSAVE 21 /* VRSAVE shares a double word with the CR at offset */ + /* 168 (high half of the double word). */ +# define JB_VRS 40 /* VRs 20 through 31 are saved, 12*4 words total. */ +# else +# define JB_GPRS 3 /* GPRs 14 through 31 are saved, 18 in total. */ +# define JB_CR 21 /* Condition code registers. */ +# define JB_FPRS 22 /* FPRs 14 through 31 are saved, 18*2 words total. */ +# define JB_SIZE ((64 + (12 * 4)) * 4) +# define JB_VRSAVE 62 +# define JB_VRS 64 +# endif #endif + +/* The current powerpc 32-bit Altivec ABI specifies for SVR4 ABI and EABI + the vrsave must be at byte 248 & v20 at byte 256. So we must pad this + correctly on 32 bit. It also insists that vecregs are only gauranteed + 4 byte alignment so we need to use vperm in the setjmp/longjmp routines. + We have to version the code because members like int __mask_was_saved + in the jmp_buf will move as jmp_buf is now larger than 248 bytes. We + cannot keep the altivec jmp_buf backward compatible with the jmp_buf. */ #ifndef _ASM -typedef long int __jmp_buf[58]; +# if __WORDSIZE == 64 +typedef long int __jmp_buf[64] __attribute__ ((__aligned__ (16))); +# else +/* The alignment is not essential, i.e.the buffer can be copied to a 4 byte + aligned buffer as per the ABI it is just added for performance reasons. */ +typedef long int __jmp_buf[64 + (12 * 4)] __attribute__ ((__aligned__ (16))); +# endif #endif /* Test if longjmp to JMPBUF would unwind the frame containing a local variable at ADDRESS. */ #define _JMPBUF_UNWINDS(jmpbuf, address) \ ((void *) (address) < (void *) (jmpbuf)[JB_GPR1]) + +#endif /* bits/setjmp.h */ diff --git a/libc/sysdeps/linux/sh/bits/setjmp.h b/libc/sysdeps/linux/sh/bits/setjmp.h index c9d7d8fcd..6458dfefd 100644 --- a/libc/sysdeps/linux/sh/bits/setjmp.h +++ b/libc/sysdeps/linux/sh/bits/setjmp.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1999, 2000, 2003 Free Software Foundation, Inc. +/* Copyright (C) 1999, 2000, 2003, 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 @@ -51,6 +51,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)[0].__regs[7]) + ((void *) (address) < (void *) (jmpbuf)[0].__regs[7]) #endif /* bits/setjmp.h */ diff --git a/libc/sysdeps/linux/sh64/bits/setjmp.h b/libc/sysdeps/linux/sh64/bits/setjmp.h index 08ffbc78c..ad1ec9d4b 100644 --- a/libc/sysdeps/linux/sh64/bits/setjmp.h +++ b/libc/sysdeps/linux/sh64/bits/setjmp.h @@ -2,23 +2,25 @@ 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 Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. + 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 - Library General Public License for more details. + Lesser General Public License for more details. - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + 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. */ /* Define the machine-dependent type `jmp_buf'. SH-5 version. */ +#ifndef _BITS_SETJMP_H +#define _BITS_SETJMP_H 1 -#ifndef _SETJMP_H +#if !defined _SETJMP_H && !defined _PTHREAD_H # error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead." #endif @@ -45,4 +47,4 @@ typedef struct } __jmp_buf[1]; #endif - +#endif /* bits/setjmp.h */ diff --git a/libc/sysdeps/linux/sparc/bits/setjmp.h b/libc/sysdeps/linux/sparc/bits/setjmp.h index 664a06f60..574085664 100644 --- a/libc/sysdeps/linux/sparc/bits/setjmp.h +++ b/libc/sysdeps/linux/sparc/bits/setjmp.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997,1999,2000 Free Software Foundation, Inc. +/* Copyright (C) 1997,1999,2000,2003 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 @@ -16,8 +16,10 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#ifndef _BITS_SETJMP_H +#define _BITS_SETJMP_H 1 -#ifndef _SETJMP_H +#if !defined _SETJMP_H && !defined _PTHREAD_H # error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead." #endif @@ -75,6 +77,8 @@ typedef int __jmp_buf[3]; /* Test if longjmp to JMPBUF would unwind the frame containing a local variable at ADDRESS. */ #define _JMPBUF_UNWINDS(jmpbuf, address) \ - ((int) (address) < (jmpbuf)[JB_SP]) + ((void *) (address) < (void *) (jmpbuf)[JB_SP]) #endif + +#endif /* bits/setjmp.h */ diff --git a/libc/sysdeps/linux/v850/bits/setjmp.h b/libc/sysdeps/linux/v850/bits/setjmp.h index 3e4214a27..93395ade4 100644 --- a/libc/sysdeps/linux/v850/bits/setjmp.h +++ b/libc/sysdeps/linux/v850/bits/setjmp.h @@ -11,7 +11,10 @@ * Written by Miles Bader <miles@gnu.org> */ -#ifndef _SETJMP_H +#ifndef _BITS_SETJMP_H +#define _BITS_SETJMP_H 1 + +#if !defined _SETJMP_H && !defined _PTHREAD_H # error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead." #endif @@ -34,4 +37,6 @@ typedef struct /* Test if longjmp to JMPBUF would unwind the frame containing a local variable at ADDRESS. */ #define _JMPBUF_UNWINDS(jmpbuf, address) \ - ((__ptr_t) (address) < &(jmpbuf)[0].__sp) + ((void *) (address) < (void *) (jmpbuf)[0].__sp) + +#endif /* bits/setjmp.h */ diff --git a/libc/sysdeps/linux/x86_64/bits/setjmp.h b/libc/sysdeps/linux/x86_64/bits/setjmp.h index 96646efdd..515d769be 100644 --- a/libc/sysdeps/linux/x86_64/bits/setjmp.h +++ b/libc/sysdeps/linux/x86_64/bits/setjmp.h @@ -18,7 +18,7 @@ /* Define the machine-dependent type `jmp_buf'. x86-64 version. */ #ifndef _BITS_SETJMP_H -#define _BITS_SETJMP_H 1 +#define _BITS_SETJMP_H 1 #if !defined _SETJMP_H && !defined _PTHREAD_H # error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead." @@ -75,4 +75,4 @@ typedef int __jmp_buf[6]; # endif #endif -#endif /* bits/setjmp.h */ +#endif /* bits/setjmp.h */ diff --git a/libcrypt/Makefile.in b/libcrypt/Makefile.in index 4e1466e72..6138ef51f 100644 --- a/libcrypt/Makefile.in +++ b/libcrypt/Makefile.in @@ -6,22 +6,46 @@ # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. # -CFLAGS+=$(SSP_ALL_CFLAGS) +CFLAGS-libcrypt := -DNOT_IN_libc $(SSP_ALL_CFLAGS) -LIB_NAME:=libcrypt +LDFLAGS-libcrypt.so := $(LDFLAGS) -libcrypt_DIR:=$(top_srcdir)libcrypt -libcrypt_OUT:=$(top_builddir)libcrypt +LIBS-libcrypt.so := $(LIBS) -libcrypt_SRC:=$(wildcard $(libcrypt_DIR)/*.c) -libcrypt_OBJ:=$(patsubst $(libcrypt_DIR)/%.c,$(libcrypt_OUT)/%.o,$(libcrypt_SRC)) +libcrypt_FULL_NAME := libcrypt-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so -libcrypt-a-y:=$(libcrypt_OBJ) -libcrypt-so-y:=$(libcrypt_OBJ:.o=.os) +libcrypt_DIR := $(top_srcdir)libcrypt +libcrypt_OUT := $(top_builddir)libcrypt -libcrypt-multi-y:=$(libcrypt_SRC) +libcrypt_SRC := $(wildcard $(libcrypt_DIR)/*.c) +libcrypt_OBJ := $(patsubst $(libcrypt_DIR)/%.c,$(libcrypt_OUT)/%.o,$(libcrypt_SRC)) -objclean-y+=libcrypt_clean +libcrypt-a-y := $(libcrypt_OBJ) +libcrypt-so-y := $(libcrypt_OBJ:.o=.os) -lib-a-y+=$(top_builddir)lib/libcrypt.a -lib-so-y+=$(top_builddir)lib/libcrypt.so +libcrypt-multi-y := $(libcrypt_SRC) + +lib-a-y += $(top_builddir)lib/libcrypt.a +lib-so-y += $(top_builddir)lib/libcrypt.so +objclean-y += libcrypt_clean + +$(top_builddir)lib/libcrypt.so: $(libcrypt_OUT)/libcrypt_so.a libc-y + $(call link.so,$(libcrypt_FULL_NAME),$(MAJOR_VERSION)) + +$(libcrypt_OUT)/libcrypt_so.a: $(libcrypt-so-y) + $(Q)$(RM) $@ + $(do_strip) + $(do_ar) + +ifeq ($(DOPIC),y) +$(top_builddir)lib/libcrypt.a: $(libcrypt-a-y:.o=.os) +else +$(top_builddir)lib/libcrypt.a: $(libcrypt-a-y) +endif + $(Q)$(INSTALL) -d $(dir $@) + $(Q)$(RM) $@ + $(do_strip) + $(do_ar) + +libcrypt_clean: + $(RM) $(libcrypt_OUT)/*.{o,os,a} diff --git a/libintl/Makefile.in b/libintl/Makefile.in index 8c77262a0..78bcc8d0d 100644 --- a/libintl/Makefile.in +++ b/libintl/Makefile.in @@ -6,21 +6,54 @@ # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. # -CFLAGS+=$(SSP_ALL_CFLAGS) +CFLAGS-libintl := -DNOT_IN_libc $(SSP_ALL_CFLAGS) -LIB_NAME:=libintl +LDFLAGS-libintl.so := $(LDFLAGS) -MOBJ:=gettext.o ngettext.o dgettext.o dcgettext.o dngettext.o dcngettext.o \ +LIBS-libintl.so := $(LIBS) + +libintl_FULL_NAME := libintl-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so + +MOBJ := \ + gettext.o ngettext.o dgettext.o dcgettext.o dngettext.o dcngettext.o \ textdomain.o bindtextdomain.o bind_textdomain_codeset.o \ _nl_expand_alias.o _nl_msg_cat_cntr.o # glibc-isms -libintl_DIR:=$(top_srcdir)libintl -libintl_OUT:=$(top_builddir)libintl +libintl_DIR := $(top_srcdir)libintl +libintl_OUT := $(top_builddir)libintl + +libintl_MSRC := $(libintl_DIR)/intl.c +libintl_MOBJ := $(patsubst %.o,$(libintl_OUT)/%.o,$(MOBJ)) + +libintl_DEF := $(patsubst %,-DL_%,$(subst .o,,$(notdir $(libintl_MOBJ)))) + +libintl-a-y := $(libintl_MOBJ) +libintl-so-y := $(libintl_MOBJ:.o=.os) + +CFLAGS-multi-y := $(libintl_DEF) +libintl-multi-y := $(libintl_MSRC) -libintl_MSRC:=$(libintl_DIR)/intl.c -libintl_MOBJ:=$(patsubst %.o,$(libintl_OUT)/%.o,$(MOBJ)) +lib-a-$(UCLIBC_HAS_GETTEXT_AWARENESS) += $(top_builddir)lib/libintl.a +lib-so-$(UCLIBC_HAS_GETTEXT_AWARENESS) += $(top_builddir)lib/libintl.so +objclean-y += libintl_clean -libintl_DEF:=$(patsubst %,-DL_%,$(subst .o,,$(notdir $(libintl_MOBJ)))) +$(top_builddir)lib/libintl.so: $(libintl_OUT)/libintl_so.a libc-y + $(call link.so,$(libintl_FULL_NAME),$(MAJOR_VERSION)) + +$(libintl_OUT)/libintl_so.a: $(libintl-so-y) + $(Q)$(RM) $@ + $(do_strip) + $(do_ar) + +ifeq ($(DOPIC),y) +$(top_builddir)lib/libintl.a: $(libintl-a-y:.o=.os) +else +$(top_builddir)lib/libintl.a: $(libintl-a-y) +endif + $(Q)$(INSTALL) -d $(dir $@) + $(Q)$(RM) $@ + $(do_strip) + $(do_ar) $(libintl_MOBJ): $(libintl_MSRC) $(compile.m) @@ -28,13 +61,5 @@ $(libintl_MOBJ): $(libintl_MSRC) $(libintl_MOBJ:.o=.os): $(libintl_MSRC) $(compile.m) -libintl-a-$(UCLIBC_HAS_GETTEXT_AWARENESS):=$(libintl_MOBJ) -libintl-so-$(UCLIBC_HAS_GETTEXT_AWARENESS):=$(libintl_MOBJ:.o=.os) - -CFLAGS-multi-$(UCLIBC_HAS_GETTEXT_AWARENESS):=$(libintl_DEF) -libintl-multi-$(UCLIBC_HAS_GETTEXT_AWARENESS):=$(libintl_MSRC) - -objclean-y+=libintl_clean - -lib-a-$(UCLIBC_HAS_GETTEXT_AWARENESS)+=$(top_builddir)lib/libintl.a -lib-so-$(UCLIBC_HAS_GETTEXT_AWARENESS)+=$(top_builddir)lib/libintl.so +libintl_clean: + $(RM) $(libintl_OUT)/*.{o,os,a} diff --git a/libm/Makefile b/libm/Makefile index 8230921bc..dc65064f8 100644 --- a/libm/Makefile +++ b/libm/Makefile @@ -60,7 +60,7 @@ CSRC = e_acos.c e_acosh.c e_asin.c e_atan2.c e_atanh.c e_cosh.c\ w_cosh.c w_drem.c w_exp.c w_fmod.c w_gamma.c w_gamma_r.c\ w_hypot.c w_j0.c w_j1.c w_jn.c w_lgamma.c w_lgamma_r.c\ w_log.c w_log10.c w_pow.c w_remainder.c w_scalb.c w_sinh.c\ - w_sqrt.c fpmacros.c nan.c + w_sqrt.c fpmacros.c nan.c s_lround.c s_llround.c s_round.c FL_MOBJ = acosf.o acoshf.o asinf.o asinhf.o atan2f.o atanf.o atanhf.o cbrtf.o \ ceilf.o copysignf.o cosf.o coshf.o erfcf.o erff.o exp2f.o expf.o \ expm1f.o fabsf.o fdimf.o floorf.o fmaf.o fmaxf.o fminf.o fmodf.o \ diff --git a/libm/Makefile.in b/libm/Makefile.in index 541b6fb91..4057203fa 100644 --- a/libm/Makefile.in +++ b/libm/Makefile.in @@ -20,49 +20,55 @@ # by Erik Andersen <andersen@codepoet.org> # -CFLAGS+=$(SSP_ALL_CFLAGS) +CFLAGS-libm := -DNOT_IN_libc $(SSP_ALL_CFLAGS) +CFLAGS-libm += -D_IEEE_LIBM -D_ISOC99_SOURCE -D_SVID_SOURCE -CFLAGS+=-D_IEEE_LIBM -D_ISOC99_SOURCE -D_SVID_SOURCE +CFLAGS-libm/$(TARGET_ARCH)/ := $(CFLAGS-libm) -CFLAGS-s_lib_version.c=-D_POSIX_MODE +CFLAGS-s_lib_version.c := -D_POSIX_MODE -#DOMULTI=n +LDFLAGS-libm.so := $(LDFLAGS) -LIB_NAME:=libm +LIBS-libm.so := $(LIBS) + +libm_FULL_NAME := libm-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so ifeq ($(HAS_FPU),y) -include $(top_srcdir)libm/$(TARGET_ARCH)/Makefile.arch endif -FL_MSRC:=float_wrappers.c +FL_MSRC := float_wrappers.c ifeq ($(DO_C99_MATH),y) -CSRC:= e_acos.c e_acosh.c e_asin.c e_atan2.c e_atanh.c e_cosh.c \ +CSRC := \ + e_acos.c e_acosh.c e_asin.c e_atan2.c e_atanh.c e_cosh.c \ e_exp.c e_fmod.c e_gamma.c e_gamma_r.c e_hypot.c e_j0.c \ e_j1.c e_jn.c e_lgamma.c e_lgamma_r.c e_log.c e_log10.c \ e_pow.c e_remainder.c e_rem_pio2.c e_scalb.c e_sinh.c \ e_sqrt.c k_cos.c k_rem_pio2.c k_sin.c k_standard.c k_tan.c \ s_asinh.c s_atan.c s_cbrt.c s_ceil.c s_copysign.c s_cos.c \ s_erf.c s_expm1.c s_fabs.c s_finite.c s_floor.c s_frexp.c \ - s_ilogb.c s_ldexp.c s_lib_version.c s_log1p.c s_logb.c \ - s_matherr.c s_modf.c s_nextafter.c s_rint.c s_scalbn.c \ - s_signgam.c s_significand.c s_sin.c s_tan.c s_tanh.c \ - w_acos.c w_acosh.c w_asin.c w_atan2.c w_atanh.c w_cabs.c \ + s_ilogb.c s_ldexp.c s_lib_version.c s_lround.c s_llround.c \ + s_log1p.c s_logb.c s_matherr.c s_modf.c s_nextafter.c s_round.c \ + s_rint.c s_scalbn.c s_signgam.c s_significand.c s_sin.c s_tan.c \ + s_tanh.c w_acos.c w_acosh.c w_asin.c w_atan2.c w_atanh.c w_cabs.c \ w_cosh.c w_drem.c w_exp.c w_fmod.c w_gamma.c w_gamma_r.c \ w_hypot.c w_j0.c w_j1.c w_jn.c w_lgamma.c w_lgamma_r.c \ w_log.c w_log10.c w_pow.c w_remainder.c w_scalb.c w_sinh.c \ w_sqrt.c fpmacros.c nan.c -FL_MOBJ:=acosf.o acoshf.o asinf.o asinhf.o atan2f.o atanf.o atanhf.o cbrtf.o \ +FL_MOBJ := \ + acosf.o acoshf.o asinf.o asinhf.o atan2f.o atanf.o atanhf.o cbrtf.o \ ceilf.o copysignf.o cosf.o coshf.o erfcf.o erff.o exp2f.o expf.o \ expm1f.o fabsf.o fdimf.o floorf.o fmaf.o fmaxf.o fminf.o fmodf.o \ - frexpf.o hypotf.o ilogbf.o ldexpf.o lgammaf.o log10f.o log1pf.o \ - log2f.o logbf.o logf.o lrintf.o lroundf.o modff.o nearbyintf.o \ + frexpf.o hypotf.o ilogbf.o ldexpf.o lgammaf.o llroundf.o log10f.o \ + log1pf.o log2f.o logbf.o logf.o lrintf.o lroundf.o modff.o nearbyintf.o \ nextafterf.o powf.o remainderf.o remquof.o rintf.o roundf.o \ scalblnf.o scalbnf.o sinf.o sinhf.o sqrtf.o tanf.o tanhf.o \ tgammaf.o truncf.o else # This list of math functions was taken from POSIX/IEEE 1003.1b-1993 -CSRC:= w_acos.c w_asin.c s_atan.c w_atan2.c s_ceil.c s_cos.c \ +CSRC := \ + w_acos.c w_asin.c s_atan.c w_atan2.c s_ceil.c s_cos.c \ w_cosh.c w_exp.c s_fabs.c s_floor.c w_fmod.c s_frexp.c \ s_ldexp.c w_log.c w_log10.c s_modf.c w_pow.c s_sin.c \ w_sinh.c w_sqrt.c s_tan.c s_tanh.c \ @@ -71,11 +77,11 @@ CSRC:= w_acos.c w_asin.c s_atan.c w_atan2.c s_ceil.c s_cos.c \ k_sin.c e_sinh.c e_sqrt.c k_tan.c e_rem_pio2.c k_rem_pio2.c \ s_finite.c # We'll add sqrtf to avoid problems with libstdc++ -FL_MOBJ:=sqrtf.o +FL_MOBJ := sqrtf.o endif -libm_DIR:=$(top_srcdir)libm -libm_OUT:=$(top_builddir)libm +libm_DIR := $(top_srcdir)libm +libm_OUT := $(top_builddir)libm # assume that arch specific versions are provided as single sources/objects ifeq ($(HAS_FPU),y) @@ -83,52 +89,68 @@ ifneq ($(strip $(libm_ARCH_OBJS)),) # remove generic sources, if arch specific version is present ifneq ($(strip $(libm_ARCH_SRC)),) -CSRC:=$(filter-out $(notdir $(libm_ARCH_SRC)),$(CSRC)) +CSRC := $(filter-out $(notdir $(libm_ARCH_SRC)),$(CSRC)) endif # remove generic objects built from multi-sources, if arch specific version is present -FL_MOBJ:=$(filter-out $(notdir $(libm_ARCH_OBJS)),$(FL_MOBJ)) +FL_MOBJ := $(filter-out $(notdir $(libm_ARCH_OBJS)),$(FL_MOBJ)) # we also try to remove % if s_% is in arch specific subdir -FL_MOBJ:=$(filter-out $(patsubst s_%.o,%.o,$(notdir $(libm_ARCH_OBJS))),$(FL_MOBJ)) +FL_MOBJ := $(filter-out $(patsubst s_%.o,%.o,$(notdir $(libm_ARCH_OBJS))),$(FL_MOBJ)) endif endif ifneq ($(DOMULTI),n) ifeq ($(DO_C99_MATH),y) -LIBM_NO_MULTI:=s_lib_version.c -CSRC:=$(filter-out $(LIBM_NO_MULTI),$(CSRC)) +LIBM_NO_MULTI := s_lib_version.c +CSRC := $(filter-out $(LIBM_NO_MULTI),$(CSRC)) endif endif -libm_SRC:=$(patsubst %.c,$(libm_DIR)/%.c,$(CSRC)) -libm_OBJ:=$(patsubst $(libm_DIR)/%.c,$(libm_OUT)/%.o,$(libm_SRC)) +libm_SRC := $(patsubst %.c,$(libm_DIR)/%.c,$(CSRC)) +libm_OBJ := $(patsubst $(libm_DIR)/%.c,$(libm_OUT)/%.o,$(libm_SRC)) -libm_MSRC:=$(libm_DIR)/$(FL_MSRC) -libm_MOBJ:=$(patsubst %.o,$(libm_OUT)/%.o,$(FL_MOBJ)) +libm_MSRC := $(libm_DIR)/$(FL_MSRC) +libm_MOBJ := $(patsubst %.o,$(libm_OUT)/%.o,$(FL_MOBJ)) -libm_DEF:=$(patsubst %,-DL_%,$(subst .o,,$(notdir $(libm_MOBJ)))) +libm_DEF := $(patsubst %,-DL_%,$(subst .o,,$(notdir $(libm_MOBJ)))) -libm_OBJS:=$(libm_OBJ) $(libm_MOBJ) -ifneq ($(DOMULTI),n) -ifeq ($(DO_C99_MATH),y) -libm_OBJS+=$(patsubst %.c,$(libm_OUT)/%.o,$(LIBM_NO_MULTI)) -endif -endif +libm_OBJS := $(libm_OBJ) $(libm_MOBJ) -$(libm_MOBJ) $(libm_MOBJ:.o=.os): $(libm_MSRC) - $(compile.m) +libm-a-y += $(libm_OBJS) +libm-so-y += $(libm_OBJS:.o=.os) -libm-a-$(UCLIBC_HAS_FLOATS)+=$(libm_OBJS) -libm-so-$(UCLIBC_HAS_FLOATS)+=$(libm_OBJS:.o=.os) +CFLAGS-multi-y := $(libm_DEF) +libm-multi-y += $(libm_SRC) $(libm_MSRC) +libm-nomulti-$(DO_C99_MATH) += $(patsubst %.c,$(libm_OUT)/%.o,$(LIBM_NO_MULTI)) -CFLAGS-multi-$(UCLIBC_HAS_FLOATS)+=$(libm_DEF) -libm-multi-$(UCLIBC_HAS_FLOATS)+=$(libm_SRC) $(libm_MSRC) -ifeq ($(DO_C99_MATH),y) -libm-nomulti-$(UCLIBC_HAS_FLOATS)+=$(patsubst %.c,$(libm_OUT)/%.o,$(LIBM_NO_MULTI)) +lib-a-$(UCLIBC_HAS_FLOATS) += $(top_builddir)lib/libm.a +lib-so-$(UCLIBC_HAS_FLOATS) += $(top_builddir)lib/libm.so +objclean-y += libm_clean + +$(top_builddir)lib/libm.so: $(libm_OUT)/libm_so.a libc-y + $(call link.so,$(libm_FULL_NAME),$(MAJOR_VERSION)) + +$(libm_OUT)/libm_so.a: $(libm-so-y) + $(Q)$(RM) $@ + $(do_strip) + $(do_ar) + +ifeq ($(DOPIC),y) +$(top_builddir)lib/libm.a: $(libm-a-y:.o=.os) +else +$(top_builddir)lib/libm.a: $(libm-a-y) endif + $(Q)$(INSTALL) -d $(dir $@) + $(Q)$(RM) $@ + $(do_strip) + $(do_ar) -objclean-y+=libm_clean +$(libm_MOBJ): $(libm_MSRC) + $(compile.m) + +$(libm_MOBJ:.o=.os): $(libm_MSRC) + $(compile.m) -lib-a-$(UCLIBC_HAS_FLOATS)+=$(top_builddir)lib/libm.a -lib-so-$(UCLIBC_HAS_FLOATS)+=$(top_builddir)lib/libm.so +libm_clean: + $(RM) $(libm_OUT)/*.{o,os,a} diff --git a/libnsl/Makefile.in b/libnsl/Makefile.in index b4dcefae2..765868e54 100644 --- a/libnsl/Makefile.in +++ b/libnsl/Makefile.in @@ -5,22 +5,46 @@ # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. # -CFLAGS+=$(SSP_ALL_CFLAGS) +CFLAGS-libnsl := -DNOT_IN_libc $(SSP_ALL_CFLAGS) -LIB_NAME:=libnsl +LDFLAGS-libnsl.so := $(LDFLAGS) -libnsl_DIR:=$(top_srcdir)libnsl -libnsl_OUT:=$(top_builddir)libnsl +LIBS-libnsl.so := $(LIBS) -libnsl_SRC:=$(libnsl_DIR)/nsl.c -libnsl_OBJ:=$(patsubst $(libnsl_DIR)/%.c,$(libnsl_OUT)/%.o,$(libnsl_SRC)) +libnsl_FULL_NAME := libnsl-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so -libnsl-a-y:=$(libnsl_OBJ) -libnsl-so-y:=$(libnsl_OBJ:.o=.os) +libnsl_DIR := $(top_srcdir)libnsl +libnsl_OUT := $(top_builddir)libnsl -libnsl-multi-y:=$(libnsl_SRC) +libnsl_SRC := $(libnsl_DIR)/nsl.c +libnsl_OBJ := $(patsubst $(libnsl_DIR)/%.c,$(libnsl_OUT)/%.o,$(libnsl_SRC)) -objclean-y+=libnsl_clean +libnsl-a-y := $(libnsl_OBJ) +libnsl-so-y := $(libnsl_OBJ:.o=.os) -lib-a-y+=$(top_builddir)lib/libnsl.a -lib-so-y+=$(top_builddir)lib/libnsl.so +libnsl-multi-y := $(libnsl_SRC) + +lib-a-y += $(top_builddir)lib/libnsl.a +lib-so-y += $(top_builddir)lib/libnsl.so +objclean-y += libnsl_clean + +$(top_builddir)lib/libnsl.so: $(libnsl_OUT)/libnsl_so.a libc-y + $(call link.so,$(libnsl_FULL_NAME),$(MAJOR_VERSION)) + +$(libnsl_OUT)/libnsl_so.a: $(libnsl-so-y) + $(Q)$(RM) $@ + $(do_strip) + $(do_ar) + +ifeq ($(DOPIC),y) +$(top_builddir)lib/libnsl.a: $(libnsl-a-y:.o=.os) +else +$(top_builddir)lib/libnsl.a: $(libnsl-a-y) +endif + $(Q)$(INSTALL) -d $(dir $@) + $(Q)$(RM) $@ + $(do_strip) + $(do_ar) + +libnsl_clean: + $(RM) $(libnsl_OUT)/*.{o,os,a} diff --git a/libpthread/Makefile.in b/libpthread/Makefile.in index 1ce452c1b..4772cba32 100644 --- a/libpthread/Makefile.in +++ b/libpthread/Makefile.in @@ -5,57 +5,5 @@ # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. # -ifeq ($(UCLIBC_HAS_THREADS),y) -ifeq ($(PTHREADS_DEBUG_SUPPORT),y) -DIRS:= $(PTNAME) $(PTNAME)_db -libs: subdirs -else -# both do not work at once include $(PTDIR)/Makefile.in -#include $(PTDIR)_db/Makefile.in -endif - -headers-y+=threads_headers - -# NPTL does not have a generic pthreadtypes.h -# and each arch has to have both semaphore.h/pthreadtypes.h ? -threads_headers: - $(LN) -sf $(PTDIR)/sysdeps/pthread/pthread.h $(top_builddir)include/ - $(LN) -sf $(PTDIR)/semaphore.h $(top_builddir)include/ -ifeq ($(PTHREADS_DEBUG_SUPPORT),y) - $(LN) -sf $(PTDIR)_db/thread_db.h $(top_builddir)include/ -endif -ifeq ($(UCLIBC_HAS_THREADS_NATIVE),y) - $(LN) -sf ../$(PTDIR)/sysdeps/unix/sysv/linux/$(TARGET_ARCH)/bits/semaphore.h $(top_builddir)include/bits/ - $(LN) -sf ../$(PTDIR)/sysdeps/unix/sysv/linux/$(TARGET_ARCH)/bits/pthreadtypes.h $(top_builddir)include/bits/ - $(LN) -sf ../$(PTDIR)/sysdeps/pthread/bits/libc-lock.h $(top_builddir)include/bits/ - $(LN) -sf ../$(PTDIR)/sysdeps/pthread/bits/stdio-lock.h $(top_builddir)include/bits/ -else - $(LN) -sf ../$(PTDIR)/sysdeps/pthread/bits/pthreadtypes.h $(top_builddir)include/bits/ -endif - -endif - -headers_clean-y+=threads_headers_clean - -threads_headers_clean: - $(RM) $(top_builddir)include/pthread.h $(top_builddir)include/semaphore.h \ - $(top_builddir)include/thread_db.h \ - $(top_builddir)include/bits/pthreadtypes.h $(top_builddir)include/bits/semaphore.h \ - $(top_builddir)include/bits/libc-lock.h $(top_builddir)include/bits/stdio-lock -# note to sjhill: the clean target shouldn't depend on PTNAME/PTDIR -ifeq ($(UCLIBC_HAS_THREADS_NATIVE),y) - $(RM) $(PTNAME)/version.h $(PTDIR)/banner.h \ - $(PTDIR)/sysdeps/unix/sysv/linux/rtld-libc-lowlevellock.c -endif - -objclean-y+=libpthread_gen_clean - -libpthread_gen_clean: - $(RM) $(top_builddir)libpthread/*/*.{o,os,a} - -ifeq ($(PTHREADS_DEBUG_SUPPORT),y) -subdirs: $(patsubst %, _dir_%, $(DIRS)) -$(patsubst %, _dir_%, $(DIRS)): - $(MAKE) -C $(patsubst _dir_%, %, $@) -endif +include $(PTDIR)_db/Makefile.in diff --git a/libpthread/linuxthreads.old/Makefile.in b/libpthread/linuxthreads.old/Makefile.in index 3aec4c562..98ef6307b 100644 --- a/libpthread/linuxthreads.old/Makefile.in +++ b/libpthread/linuxthreads.old/Makefile.in @@ -6,57 +6,94 @@ # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. # -CFLAGS+=$(SSP_ALL_CFLAGS) +CFLAGS-linuxthreads.old := -DNOT_IN_libc $(SSP_ALL_CFLAGS) -# This stuff will not compile without at least -O1 -CFLAGS:=$(CFLAGS:-O0=-O1) - -LDFLAGS:=$(LDFLAGS_NOSTRIP) +CFLAGS-libpthread/linuxthreads.old/sysdeps/$(TARGET_ARCH)/ := $(CFLAGS-linuxthreads.old) -ifeq ($(UCLIBC_CTOR_DTOR),y) -SHARED_START_FILES:=$(top_builddir)lib/crti.o $(LIBGCC_DIR)crtbeginS.o -SHARED_END_FILES:=$(LIBGCC_DIR)crtendS.o $(top_builddir)lib/crtn.o -endif +# This stuff will not compile without at least -O1 +# psm: can't handle this here, could maybe search for -O0 in CFLAGS +# and append -O1 if found +#CFLAGS:=$(CFLAGS:-O0=-O1) ifeq ($(PTHREADS_DEBUG_SUPPORT),y) -STRIP_FLAGS:=-X --strip-debug -R .note -R .comment +LDFLAGS-libpthread.so := $(LDFLAGS_NOSTRIP) -z defs +else +LDFLAGS-libpthread.so := $(LDFLAGS) endif -DOMULTI=n +LIBS-libpthread.so := $(LIBS) -LIB_NAME:=libpthread +START_FILE-libpthread.so := $(SHARED_START_FILES) +END_FILE-libpthread.so := $(SHARED_END_FILES) -libpthread_DIR:=$(top_srcdir)libpthread/linuxthreads.old -libpthread_OUT:=$(top_builddir)libpthread/linuxthreads.old +libpthread_FULL_NAME := libpthread-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so + +libpthread_DIR := $(top_srcdir)libpthread/linuxthreads.old +libpthread_OUT := $(top_builddir)libpthread/linuxthreads.old -ARCH_CFLAGS:=$(CFLAGS) -include $(libpthread_DIR)/sysdeps/$(TARGET_ARCH)/Makefile.arch -CFLAGS:=$(ARCH_CFLAGS) -libpthread_SRC:=$(wildcard $(libpthread_DIR)/*.c) +libpthread_SRC := $(wildcard $(libpthread_DIR)/*.c) ifneq ($(UCLIBC_HAS_XLOCALE),y) -libpthread_SRC:=$(filter-out $(libpthread_DIR)/locale.c,$(libpthread_SRC)) +libpthread_SRC := $(filter-out $(libpthread_DIR)/locale.c,$(libpthread_SRC)) endif ifneq ($(DOMULTI),n) -libpthread_NO_MULTI:=manager.c pt-machine.c -libpthread_SRC:=$(filter-out $(patsubst %.c,$(libpthread_DIR)/%.c,$(libpthread_NO_MULTI)),$(libpthread_SRC)) +libpthread_NO_MULTI := manager.c pt-machine.c +libpthread_SRC := $(filter-out $(patsubst %.c,$(libpthread_DIR)/%.c,$(libpthread_NO_MULTI)),$(libpthread_SRC)) endif # remove generic sources, if arch specific version is present ifneq ($(strip $(libpthread_ARCH_SRC)),) -libpthread_SRC:=$(filter-out $(patsubst %.c,$(libpthread_DIR)/%.c,$(notdir $(libpthread_ARCH_SRC))),$(libpthread_SRC)) +libpthread_SRC := $(filter-out $(patsubst %.c,$(libpthread_DIR)/%.c,$(notdir $(libpthread_ARCH_SRC))),$(libpthread_SRC)) +endif + +libpthread_OBJ := $(patsubst $(libpthread_DIR)/%.c,$(libpthread_OUT)/%.o,$(libpthread_SRC)) + +libpthread-a-y += $(libpthread_OBJ) +libpthread-so-y += $(libpthread_OBJ:.o=.os) + +libpthread-multi-y += $(libpthread_SRC) +libpthread-nomulti-y += $(patsubst %.c,$(libpthread_OUT)/%.o,$(libpthread_NO_MULTI)) + +lib-a-$(UCLIBC_HAS_THREADS) += $(top_builddir)lib/libpthread.a +lib-so-$(UCLIBC_HAS_THREADS) += $(top_builddir)lib/libpthread.so +objclean-y += libpthread_clean +headers-$(UCLIBC_HAS_THREADS) += linuxthreads_headers +headers_clean-y += linuxthreads_headers_clean + +$(top_builddir)lib/libpthread.so: $(libpthread_OUT)/libpthread_so.a libc-y + $(call link.so,$(libpthread_FULL_NAME),$(MAJOR_VERSION)) + +$(libpthread_OUT)/libpthread_so.a: $(libpthread-so-y) + $(Q)$(RM) $@ +ifeq ($(PTHREADS_DEBUG_SUPPORT),y) + $(do_strip:-x=-X --strip-debug) +else + $(do_strip) endif + $(do_ar) -libpthread_OBJ:=$(patsubst $(libpthread_DIR)/%.c,$(libpthread_OUT)/%.o,$(libpthread_SRC)) +ifeq ($(DOPIC),y) +$(top_builddir)lib/libpthread.a: $(libpthread-a-y:.o=.os) +else +$(top_builddir)lib/libpthread.a: $(libpthread-a-y) +endif + $(Q)$(INSTALL) -d $(dir $@) + $(Q)$(RM) $@ + $(do_strip) + $(do_ar) -libpthread-a-$(UCLIBC_HAS_THREADS)+=$(libpthread_OBJ) -libpthread-so-$(UCLIBC_HAS_THREADS)+=$(libpthread_OBJ:.o=.os) +linuxthreads_headers: + $(LN) -sf ../$(PTDIR)/sysdeps/pthread/pthread.h $(top_builddir)include/ + $(LN) -sf ../$(PTDIR)/semaphore.h $(top_builddir)include/ + $(INSTALL) -d $(top_builddir)include/bits + $(LN) -sf ../../$(PTDIR)/sysdeps/pthread/bits/pthreadtypes.h $(top_builddir)include/bits/ -libpthread-multi-$(UCLIBC_HAS_THREADS)+=$(libpthread_SRC) -libpthread-nomulti-$(UCLIBC_HAS_THREADS)+=$(patsubst %.c,$(libpthread_OUT)/%.o,$(libpthread_NO_MULTI)) -objclean-y+=libpthread_clean +linuxthreads_headers_clean: + $(RM) $(top_builddir)include/pthread.h $(top_builddir)include/semaphore.h \ + $(top_builddir)include/bits/pthreadtypes.h -lib-a-$(UCLIBC_HAS_THREADS)+=$(top_builddir)lib/libpthread.a -lib-so-$(UCLIBC_HAS_THREADS)+=$(top_builddir)lib/libpthread.so +libpthread_clean: + $(RM) $(libpthread_OUT)/*.{o,os,a} diff --git a/libpthread/linuxthreads.old/sysdeps/sh64/Makefile.arch b/libpthread/linuxthreads.old/sysdeps/sh64/Makefile.arch index 38cd12db6..e4cb95b76 100644 --- a/libpthread/linuxthreads.old/sysdeps/sh64/Makefile.arch +++ b/libpthread/linuxthreads.old/sysdeps/sh64/Makefile.arch @@ -6,21 +6,25 @@ # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. # -# We need to build as SHcompact for tas.. -ARCH_CFLAGS:=$(subst 32media,compact,$(ARCH_CFLAGS)) - -libpthread_ARCH_DIR:=$(top_srcdir)libpthread/linuxthreads/sysdeps/sh64 -libpthread_ARCH_OUT:=$(top_builddir)libpthread/linuxthreads/sysdeps/sh64 +libpthread_ARCH_DIR:=$(top_srcdir)libpthread/linuxthreads.old/sysdeps/sh64 +libpthread_ARCH_OUT:=$(top_builddir)libpthread/linuxthreads.old/sysdeps/sh64 libpthread_ARCH_SRC:=$(wildcard $(libpthread_ARCH_DIR)/*.c) libpthread_ARCH_OBJ:=$(patsubst $(libpthread_ARCH_DIR)/%.c,$(libpthread_ARCH_OUT)/%.o,$(libpthread_ARCH_SRC)) -libpthread-a-$(UCLIBC_HAS_THREADS)+=$(libpthread_ARCH_OBJ) -libpthread-so-$(UCLIBC_HAS_THREADS)+=$(libpthread_ARCH_OBJ:.o=.os) +libpthread-a-y+=$(libpthread_ARCH_OBJ) +libpthread-so-y+=$(libpthread_ARCH_OBJ:.o=.os) -libpthread-multi-$(UCLIBC_HAS_THREADS)+=$(libpthread_ARCH_SRC) +libpthread-multi-y+=$(libpthread_ARCH_SRC) objclean-y+=libpthread_arch_objclean +# We need to build as SHcompact for tas.. +$(libpthread_ARCH_OBJ): %.o : %.c + $(compile.c:32media=compact) + +$(libpthread_ARCH_OBJ:.o=.os): %.os : %.c + $(compile.c:32media=compact) + libpthread_arch_objclean: $(RM) $(libpthread_ARCH_OUT)/*.{o,os} diff --git a/libresolv/Makefile.in b/libresolv/Makefile.in index 06938da9b..d94a076f8 100644 --- a/libresolv/Makefile.in +++ b/libresolv/Makefile.in @@ -5,22 +5,46 @@ # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. # -CFLAGS+=$(SSP_ALL_CFLAGS) +CFLAGS-libresolv := -DNOT_IN_libc $(SSP_ALL_CFLAGS) -LIB_NAME:=libresolv +LDFLAGS-libresolv.so := $(LDFLAGS) -libresolv_DIR:=$(top_srcdir)libresolv -libresolv_OUT:=$(top_builddir)libresolv +LIBS-libresolv.so := $(LIBS) -libresolv_SRC:=$(libresolv_DIR)/resolv.c -libresolv_OBJ:=$(patsubst $(libresolv_DIR)/%.c,$(libresolv_OUT)/%.o,$(libresolv_SRC)) +libresolv_FULL_NAME := libresolv-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so -libresolv-a-y:=$(libresolv_OBJ) -libresolv-so-y:=$(libresolv_OBJ:.o=.os) +libresolv_DIR := $(top_srcdir)libresolv +libresolv_OUT := $(top_builddir)libresolv -libresolv-multi-y:=$(libresolv_SRC) +libresolv_SRC := $(libresolv_DIR)/resolv.c +libresolv_OBJ := $(patsubst $(libresolv_DIR)/%.c,$(libresolv_OUT)/%.o,$(libresolv_SRC)) -objclean-y+=libresolv_clean +libresolv-a-y := $(libresolv_OBJ) +libresolv-so-y := $(libresolv_OBJ:.o=.os) -lib-a-y+=$(top_builddir)lib/libresolv.a -lib-so-y+=$(top_builddir)lib/libresolv.so +libresolv-multi-y := $(libresolv_SRC) + +lib-a-y += $(top_builddir)lib/libresolv.a +lib-so-y += $(top_builddir)lib/libresolv.so +objclean-y += libresolv_clean + +$(top_builddir)lib/libresolv.so: $(libresolv_OUT)/libresolv_so.a libc-y + $(call link.so,$(libresolv_FULL_NAME),$(MAJOR_VERSION)) + +$(libresolv_OUT)/libresolv_so.a: $(libresolv-so-y) + $(Q)$(RM) $@ + $(do_strip) + $(do_ar) + +ifeq ($(DOPIC),y) +$(top_builddir)lib/libresolv.a: $(libresolv-a-y:.o=.os) +else +$(top_builddir)lib/libresolv.a: $(libresolv-a-y) +endif + $(Q)$(INSTALL) -d $(dir $@) + $(Q)$(RM) $@ + $(do_strip) + $(do_ar) + +libresolv_clean: + $(RM) $(libresolv_OUT)/*.{o,os,a} diff --git a/librt/Makefile.in b/librt/Makefile.in index 0122f123a..7a2a44d03 100644 --- a/librt/Makefile.in +++ b/librt/Makefile.in @@ -5,22 +5,46 @@ # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. # -CFLAGS+=$(SSP_ALL_CFLAGS) +CFLAGS-librt := -DNOT_IN_libc $(SSP_ALL_CFLAGS) -LIB_NAME:=librt +LDFLAGS-librt.so := $(LDFLAGS) -librt_DIR:=$(top_srcdir)librt -librt_OUT:=$(top_builddir)librt +LIBS-librt.so := $(LIBS) -librt_SRC:=$(wildcard $(librt_DIR)/*.c) -librt_OBJ:=$(patsubst $(librt_DIR)/%.c,$(librt_OUT)/%.o,$(librt_SRC)) +librt_FULL_NAME := librt-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so -librt-a-y:=$(librt_OBJ) -librt-so-y:=$(librt_OBJ:.o=.os) +librt_DIR := $(top_srcdir)librt +librt_OUT := $(top_builddir)librt -librt-multi-y+=$(librt_SRC) +librt_SRC := $(wildcard $(librt_DIR)/*.c) +librt_OBJ := $(patsubst $(librt_DIR)/%.c,$(librt_OUT)/%.o,$(librt_SRC)) -objclean-y+=librt_clean +librt-a-y := $(librt_OBJ) +librt-so-y := $(librt_OBJ:.o=.os) -lib-a-y+=$(top_builddir)lib/librt.a -lib-so-y+=$(top_builddir)lib/librt.so +librt-multi-y += $(librt_SRC) + +lib-a-y += $(top_builddir)lib/librt.a +lib-so-y += $(top_builddir)lib/librt.so +objclean-y += librt_clean + +$(top_builddir)lib/librt.so: $(librt_OUT)/librt_so.a libc-y + $(call link.so,$(librt_FULL_NAME),$(MAJOR_VERSION)) + +$(librt_OUT)/librt_so.a: $(librt-so-y) + $(Q)$(RM) $@ + $(do_strip) + $(do_ar) + +ifeq ($(DOPIC),y) +$(top_builddir)lib/librt.a: $(librt-a-y:.o=.os) +else +$(top_builddir)lib/librt.a: $(librt-a-y) +endif + $(Q)$(INSTALL) -d $(dir $@) + $(Q)$(RM) $@ + $(do_strip) + $(do_ar) + +librt_clean: + $(RM) $(librt_OUT)/*.{o,os,a} diff --git a/libutil/Makefile.in b/libutil/Makefile.in index 8c5846400..79c329a33 100644 --- a/libutil/Makefile.in +++ b/libutil/Makefile.in @@ -1,21 +1,53 @@ -# Makefile.in for uClibc +# Makefile for uClibc # -# Licensed under LGPL v2.1, see the file COPYING.LIB in this tarball for details. +# Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org> # +# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. +# + +CFLAGS-libutil := -DNOT_IN_libc $(SSP_ALL_CFLAGS) + +LDFLAGS-libutil.so := $(LDFLAGS) -CFLAGS+=$(SSP_ALL_CFLAGS) +LIBS-libutil.so := $(LIBS) -LIB_NAME:=libutil +libutil_FULL_NAME := libutil-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so -srcdir=$(top_srcdir)$(LIB_NAME) +libutil_DIR := $(top_srcdir)libutil +libutil_OUT := $(top_builddir)libutil -$(LIB_NAME)_SRC:=$(wildcard $(srcdir)/*.c) +libutil_SRC := $(wildcard $(libutil_DIR)/*.c) ifneq ($(ARCH_HAS_MMU),y) -$(LIB_NAME)_SRC:=$(filter-out $(srcdir)/forkpty.c,$($(LIB_NAME)_SRC)) +libutil_SRC := $(filter-out $(libutil_DIR)/forkpty.c,$(libutil_SRC)) endif +libutil_OBJ := $(patsubst $(libutil_DIR)/%.c,$(libutil_OUT)/%.o,$(libutil_SRC)) + +libutil-a-y := $(libutil_OBJ) +libutil-so-y := $(libutil_OBJ:.o=.os) + +libutil-multi-y := $(libutil_SRC) -libso-y+=$(top_builddir)lib/$(LIB_NAME).so -liba-y+=$(top_builddir)lib/$(LIB_NAME).a -libclean-y+=$(LIB_NAME)_clean +lib-a-y += $(top_builddir)lib/libutil.a +lib-so-y += $(top_builddir)lib/libutil.so +objclean-y += libutil_clean + +$(top_builddir)lib/libutil.so: $(libutil_OUT)/libutil_so.a libc-y + $(call link.so,$(libutil_FULL_NAME),$(MAJOR_VERSION)) + +$(libutil_OUT)/libutil_so.a: $(libutil-so-y) + $(Q)$(RM) $@ + $(do_strip) + $(do_ar) + +ifeq ($(DOPIC),y) +$(top_builddir)lib/libutil.a: $(libutil-a-y:.o=.os) +else +$(top_builddir)lib/libutil.a: $(libutil-a-y) +endif + $(Q)$(INSTALL) -d $(dir $@) + $(Q)$(RM) $@ + $(do_strip) + $(do_ar) -include $(top_srcdir)Makefile.libs +libutil_clean: + $(RM) $(libutil_OUT)/*.{o,os,a} diff --git a/utils/Makefile b/utils/Makefile index b928c9fe7..b665fb7a8 100644 --- a/utils/Makefile +++ b/utils/Makefile @@ -5,10 +5,11 @@ # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. # -TOPDIR=../ -include $(TOPDIR)Rules.mak +top_srcdir=../ +top_builddir=../ +include $(top_builddir)Rules.mak -CFLAGS += $(SSP_ALL_CFLAGS) -B$(TOPDIR)lib -I$(TOPDIR)ldso/include +CFLAGS += $(SSP_ALL_CFLAGS) -B$(top_builddir)lib -I$(top_builddir)ldso/include TARGETS = ldd ldconfig @@ -33,8 +34,8 @@ all: $(TARGET_ICONV) endif headers: - @$(LN) -fs $(TOPDIR)include/elf.h - @$(LN) -fs $(TOPDIR)include/link.h + @$(LN) -fs $(top_builddir)include/elf.h + @$(LN) -fs $(top_builddir)include/link.h readelf.c ldconfig.c ldd.c: headers @@ -63,7 +64,7 @@ ldd: ldd.c $(STRIPTOOL) -s -x -R .note -R .comment $@ ICONV_CFLAGS := $(PIEFLAG) $(LDPIEFLAG) -iconv: $(TOPDIR)libc/misc/wchar/wchar.c +iconv: $(top_srcdir)libc/misc/wchar/wchar.c $(CC) $(CFLAGS) $(ICONV_CFLAGS) \ -DL_iconv_main \ $^ -o $@ @@ -78,13 +79,13 @@ endif ldd.host: ldd.c $(HOSTCC) $(HOSTCFLAGS) -Wl,-s \ -DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\" $(HOST_LDSO_CACHE_FLAG) \ - -DUCLIBC_LDSO=$(UCLIBC_LDSO) -I. -I$(TOPDIR)ldso/include \ + -DUCLIBC_LDSO=$(UCLIBC_LDSO) -I. -I$(top_builddir)ldso/include \ $^ -o $@ ldconfig.host: ldconfig.c chroot_realpath.c $(HOSTCC) $(HOSTCFLAGS) -Wl,-s \ -DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\" $(HOST_LDSO_CACHE_FLAG) \ - -DUCLIBC_LDSO=$(UCLIBC_LDSO) -I. -I$(TOPDIR)ldso/include \ + -DUCLIBC_LDSO=$(UCLIBC_LDSO) -I. -I$(top_builddir)ldso/include \ $^ -o $@ readelf.host: readelf.c |