diff options
-rw-r--r-- | include/resolv.h | 107 | ||||
-rw-r--r-- | libc/inet/resolv.c | 4 | ||||
-rw-r--r-- | libc/misc/elf/Makefile.in | 3 | ||||
-rw-r--r-- | libc/misc/elf/dl-support.c | 13 | ||||
-rw-r--r-- | libc/misc/internals/__uClibc_main.c | 8 | ||||
-rw-r--r-- | libc/misc/internals/errno.c | 16 | ||||
-rw-r--r-- | libc/misc/utmp/utent.c | 4 | ||||
-rw-r--r-- | libc/sysdeps/linux/common/__syscall_rt_sigaction.c | 6 | ||||
-rw-r--r-- | libc/sysdeps/linux/common/creat.c | 16 | ||||
-rw-r--r-- | libc/sysdeps/linux/common/open64.c | 2 | ||||
-rw-r--r-- | libc/sysdeps/linux/i386/bits/kernel_types.h | 8 | ||||
-rw-r--r-- | librt/Makefile.in | 9 |
12 files changed, 111 insertions, 85 deletions
diff --git a/include/resolv.h b/include/resolv.h index 546de96a9..f253cef1a 100644 --- a/include/resolv.h +++ b/include/resolv.h @@ -98,56 +98,87 @@ typedef res_sendhookact (*res_send_rhook) (const struct sockaddr_in *ns, # define RES_MAXNDOTS 15 /* should reflect bit field size */ # define RES_MAXRETRANS 30 /* only for resolv.conf/RES_OPTIONS */ # define RES_MAXRETRY 5 /* only for resolv.conf/RES_OPTIONS */ -# define RES_DFLRETRY 2 /* Default #/tries. */ +# define RES_DFLRETRY 3 /* Default #/tries. */ +/* (glibc uses RES_DFLRETRY of 2 but also does _res.retry = 4 sometimes (!) */ # define RES_MAXTIME 65535 /* Infinity, in milliseconds. */ +/* _res (an instance of this structure) uses 0.5kb in bss + * in "ordinary" libc's (glibc, xBSD). We want to be less wasteful. + * We (1) shuffle and shrink some integer fields, + * and (2) can switch off stuff we don't support. + * Everything inside __UCLIBC_HAS_COMPAT_RES_STATE__ + * is not actually used by uclibc and can be configured off. + * However, this will prevent some programs from building. + * Really obscure stuff with no observed users in the wild is under + * __UCLIBC_HAS_EXTRA_COMPAT_RES_STATE__. + * I guess it's safe to set that to N. + */ struct __res_state { - int retrans; /* retransmition time interval */ +#ifdef __UCLIBC_HAS_COMPAT_RES_STATE__ + int retrans; /* retransmission time interval */ int retry; /* number of times to retransmit */ - u_long options; /* option flags - see below. */ - int nscount; /* number of name servers */ - struct sockaddr_in - nsaddr_list[MAXNS]; /* address of name server */ -# define nsaddr nsaddr_list[0] /* for backward compatibility */ - u_short id; /* current message id */ - char *dnsrch[MAXDNSRCH+1]; /* components of domain to search */ +#endif + u_int32_t options; /* (was: ulong) option flags - see below. */ + struct sockaddr_in nsaddr_list[MAXNS]; /* address of name server */ +#define nsaddr nsaddr_list[0] /* for backward compatibility */ + char *dnsrch[MAXDNSRCH + 1]; /* components of domain to search */ +#ifdef __UCLIBC_HAS_COMPAT_RES_STATE__ + /* googling for "_res.defdname" says it's still sometimes used. + * Pity. It's huge, I want to move it to EXTRA_COMPAT... */ char defdname[256]; /* default domain (deprecated) */ - u_long pfcode; /* RES_PRF_ flags - see below. */ - unsigned ndots:4; /* threshold for initial abs. query */ - unsigned nsort:4; /* number of elements in sort_list[] */ - char unused[3]; +#endif + u_int8_t nscount; /* (was: int) number of name servers */ + u_int8_t ndots; /* (was: unsigned:4) threshold for initial abs. query */ +#ifdef __UCLIBC_HAS_COMPAT_RES_STATE__ + u_int8_t nsort; /* (was: unsigned:4) number of elements in sort_list[] */ + u_int16_t pfcode; /* (was: ulong) RES_PRF_ flags. Used by dig. */ + unsigned short id; /* current message id */ + int res_h_errno; /* last one set for this context */ struct { struct in_addr addr; u_int32_t mask; } sort_list[MAXRESOLVSORT]; - res_send_qhook qhook; /* query hook */ - res_send_rhook rhook; /* response hook */ - int res_h_errno; /* last one set for this context */ - int _vcsock; /* PRIVATE: for res_send VC i/o */ - u_int _flags; /* PRIVATE: see below */ +#endif + +#ifdef __UCLIBC_HAS_IPV6__ + /* I assume that the intention is to store all + * DNS servers' addresses here, and duplicate in nsaddr_list[] + * those which have IPv4 address. In the case of IPv4 address + * _u._ext.nsaddrs[x] will point to some nsaddr_list[y], + * otherwise it will point into malloc'ed sockaddr_in6. + * nscount is the number of IPv4 addresses and _u._ext.nscount + * is the number of addresses of all kinds. + * + * If this differs from established usage and you need + * to change this, please describe how it is supposed to work. + */ union { - char pad[52]; /* On an i386 this means 512b total. */ struct { - u_int16_t nscount; -#if 0 - u_int16_t nsmap[MAXNS]; -#else - u_int16_t nstimes[MAXNS]; /* ms. */ -#endif + struct sockaddr_in6 *nsaddrs[MAXNS]; + u_int8_t nscount; /* (was: u_int16_t) */ +#ifdef __UCLIBC_HAS_COMPAT_RES_STATE__ + /* rather obscure, and differs in BSD and glibc */ + u_int16_t nstimes[MAXNS]; int nssocks[MAXNS]; u_int16_t nscount6; u_int16_t nsinit; - struct sockaddr_in6 *nsaddrs[MAXNS]; -#if 0 -#ifdef _LIBC - unsigned long long int initstamp - __attribute__((packed)); -#else - unsigned int _initstamp[2]; -#endif + /* glibc also has: */ + /*u_int16_t nsmap[MAXNS];*/ + /*unsigned long long initstamp;*/ #endif } _ext; } _u; +#endif + +#ifdef __UCLIBC_HAS_EXTRA_COMPAT_RES_STATE__ + /* Truly obscure stuff. + * Googling for "_res.XXX" for these members + * turned up basically empty */ + res_send_qhook qhook; /* query hook */ + res_send_rhook rhook; /* response hook */ + int _vcsock; /* PRIVATE: for res_send VC i/o */ + unsigned _flags; /* PRIVATE: see below */ +#endif }; typedef struct __res_state *res_state; @@ -196,6 +227,7 @@ struct res_sym { /* * Resolver options (keep these in synch with res_debug.c, please) + * (which of these do we really implement??) */ #define RES_INIT 0x00000001 /* address initialized */ #define RES_DEBUG 0x00000002 /* print debug messages */ @@ -247,10 +279,14 @@ struct res_sym { /* 0x00008000 */ /* Things involving an internal (static) resolver context. */ +#if 0 __BEGIN_DECLS extern struct __res_state *__res_state(void) __attribute__ ((__const__)); __END_DECLS #define _res (*__res_state()) +#else +extern struct __res_state _res; +#endif #define fp_nquery __fp_nquery #define fp_query __fp_query @@ -274,12 +310,15 @@ void p_query (const u_char *) __THROW; void res_close (void) __THROW; #endif int res_init (void) __THROW; +libc_hidden_proto(res_init) int res_isourserver (const struct sockaddr_in *) __THROW; int res_mkquery (int, const char *, int, int, const u_char *, int, const u_char *, u_char *, int) __THROW; int res_query (const char *, int, int, u_char *, int) __THROW; +libc_hidden_proto(res_query) int res_querydomain (const char *, const char *, int, int, u_char *, int) __THROW; +libc_hidden_proto(res_querydomain) int res_search (const char *, int, int, u_char *, int) __THROW; int res_send (const u_char *, int, u_char *, int) __THROW; __END_DECLS @@ -386,7 +425,6 @@ int res_nsend (res_state, const u_char *, int, u_char *, int) __THROW; void res_nclose (res_state) __THROW; __END_DECLS - # if _LIBC # ifdef __UCLIBC_HAS_THREADS__ # if defined __UCLIBC_HAS_THREADS_NATIVE__ \ @@ -404,5 +442,4 @@ extern __thread struct __res_state *__resp attribute_tls_model_ie; # endif /* __UCLIBC_HAS_THREADS_NATIVE__ */ # endif /* __UCLIBC_HAS_THREADS__ */ # endif /* _LIBC */ - #endif /* !_RESOLV_H_ */ diff --git a/libc/inet/resolv.c b/libc/inet/resolv.c index 86f189a5f..e5b2622d0 100644 --- a/libc/inet/resolv.c +++ b/libc/inet/resolv.c @@ -1254,7 +1254,7 @@ void res_close(void) which can have an alias. */ struct __res_state _res __attribute__((section (".bss"))); #else -struct __res_state _res __attribute__((section (".bss"))) attribute_hidden; +struct __res_state _res __attribute__((section (".bss"))) ;//attribute_hidden; # if defined __UCLIBC_HAS_THREADS_NATIVE__ # undef __resp @@ -1275,7 +1275,7 @@ struct __res_state *__resp = &_res; #endif #ifdef L_res_state -# if defined __UCLIBC_HAS_THREADS__ +# if defined __UCLIBC_HAS_THREADS_NATIVE__ struct __res_state * __res_state (void) { diff --git a/libc/misc/elf/Makefile.in b/libc/misc/elf/Makefile.in index c97d29929..4c5d9c8b7 100644 --- a/libc/misc/elf/Makefile.in +++ b/libc/misc/elf/Makefile.in @@ -5,7 +5,8 @@ # libc_a_CSRC = dl-support.c dl-core.c dl-iterate-phdr.c -CFLAGS-dl-iterate-phdr.c=-D_GNU_SOURCE +CFLAGS-dl-iterate-phdr.c=-D_GNU_SOURCE -I$(top_srcdir)ldso/ldso/$(TARGET_ARCH) -I$(top_srcdir)ldso/include +CFLAGS-dl-core.c=-I$(top_srcdir)ldso/ldso/$(TARGET_ARCH) -I$(top_srcdir)ldso/include MISC_ELF_OUT:=$(top_builddir)libc/misc/elf MISC_ELF_OBJ:=$(patsubst %.c,$(MISC_ELF_OUT)/%.o,$(libc_a_CSRC)) diff --git a/libc/misc/elf/dl-support.c b/libc/misc/elf/dl-support.c index 2f6682706..ce05f348a 100644 --- a/libc/misc/elf/dl-support.c +++ b/libc/misc/elf/dl-support.c @@ -11,14 +11,21 @@ * */ +#if USE_TLS #include <assert.h> #include <tls.h> -#include <link.h> #include <ldsodefs.h> #include <string.h> +#endif +#include <link.h> +#include <elf.h> + +#if USE_TLS void (*_dl_init_static_tls) (struct link_map *) = &_dl_nothread_init_static_tls; +#endif + ElfW(Phdr) *_dl_phdr; size_t _dl_phnum; @@ -33,6 +40,7 @@ _dl_aux_init (ElfW(auxv_t) *av) _dl_phnum = (size_t) av[AT_PHNUM].a_un.a_val; } +#if USE_TLS /* Initialize static TLS area and DTV for current (only) thread. libpthread implementations should provide their own hook to handle all threads. */ @@ -57,3 +65,6 @@ _dl_nothread_init_static_tls (struct link_map *map) memset (mempcpy (dest, map->l_tls_initimage, map->l_tls_initimage_size), '\0', map->l_tls_blocksize - map->l_tls_initimage_size); } + +#endif + diff --git a/libc/misc/internals/__uClibc_main.c b/libc/misc/internals/__uClibc_main.c index a1e02c4e4..ab6adb130 100644 --- a/libc/misc/internals/__uClibc_main.c +++ b/libc/misc/internals/__uClibc_main.c @@ -51,10 +51,6 @@ libc_hidden_proto(geteuid) libc_hidden_proto(fstat) /* libc_hidden_proto(abort) */ -extern __typeof(open) __libc_open; -libc_hidden_proto(__libc_open) -extern __typeof(fcntl) __libc_fcntl; -libc_hidden_proto(__libc_fcntl) #endif #ifndef SHARED @@ -150,10 +146,10 @@ size_t __pagesize = 0; static void __check_one_fd(int fd, int mode) { /* Check if the specified fd is already open */ - if (__libc_fcntl(fd, F_GETFD) == -1) + if (fcntl(fd, F_GETFD) == -1) { /* The descriptor is probably not open, so try to use /dev/null */ - int nullfd = __libc_open(_PATH_DEVNULL, mode); + int nullfd = open(_PATH_DEVNULL, mode); /* /dev/null is major=1 minor=3. Make absolutely certain * that is in fact the device that we have opened and not * some other wierd file... */ diff --git a/libc/misc/internals/errno.c b/libc/misc/internals/errno.c index 23b2bb375..a89b5addf 100644 --- a/libc/misc/internals/errno.c +++ b/libc/misc/internals/errno.c @@ -19,18 +19,20 @@ extern __thread int __libc_h_errno __attribute__ ((alias ("h_errno"))); #define h_errno __libc_h_errno #else -extern int errno; -extern int h_errno; - +#include "internal_errno.h" #if 0 /* Unfortunately, this doesn't work... */ int h_errno __attribute__ ((section (".bss"))) = 0; int errno __attribute__ ((section (".bss"))) = 0; #else -int _errno = 0; -int _h_errno = 0; +int errno = 0; +int h_errno = 0; #endif -weak_alias(_errno, errno) -weak_alias(_h_errno, h_errno) +#ifdef __UCLIBC_HAS_THREADS__ +libc_hidden_def(errno) +weak_alias(errno, _errno) +libc_hidden_def(h_errno) +weak_alias(h_errno, _h_errno) +#endif #endif diff --git a/libc/misc/utmp/utent.c b/libc/misc/utmp/utent.c index 3752a68d4..11908b667 100644 --- a/libc/misc/utmp/utent.c +++ b/libc/misc/utmp/utent.c @@ -210,11 +210,7 @@ struct utmp *pututline (const struct utmp *utmp_entry) lseek(static_fd, (off_t) - sizeof(struct utmp), SEEK_CUR); else lseek(static_fd, (off_t) 0, SEEK_END); -#ifdef __UCLIBC_HAS_THREADS_NATIVE__ if (write(static_fd, utmp_entry, sizeof(struct utmp)) != sizeof(struct utmp)) -#else - if (write_not_cancel(static_fd, utmp_entry, sizeof(struct utmp)) != sizeof(struct utmp)) -#endif utmp_entry = NULL; __UCLIBC_MUTEX_UNLOCK(utmplock); diff --git a/libc/sysdeps/linux/common/__syscall_rt_sigaction.c b/libc/sysdeps/linux/common/__syscall_rt_sigaction.c index 6fb416039..c3246b1bf 100644 --- a/libc/sysdeps/linux/common/__syscall_rt_sigaction.c +++ b/libc/sysdeps/linux/common/__syscall_rt_sigaction.c @@ -13,8 +13,8 @@ #include <signal.h> #include <bits/kernel_sigaction.h> -#define __NR___rt_sigaction __NR_rt_sigaction -_syscall4(int, __rt_sigaction, int, signum, - const struct kernel_sigaction *, act, struct kernel_sigaction *, oldact, +#define __NR___syscall_rt_sigaction __NR_rt_sigaction +_syscall4(int, __syscall_rt_sigaction, int, signum, + const struct sigaction *, act, struct sigaction *, oldact, size_t, size) #endif diff --git a/libc/sysdeps/linux/common/creat.c b/libc/sysdeps/linux/common/creat.c deleted file mode 100644 index 429b4824c..000000000 --- a/libc/sysdeps/linux/common/creat.c +++ /dev/null @@ -1,16 +0,0 @@ -/* vi: set sw=4 ts=4: */ -/* - * open() for uClibc - * - * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> - * - * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. - */ -#include <fcntl.h> - -extern int __libc_open(const char *file, int flags, ...); - -int creat(const char *file, mode_t mode) -{ - return __libc_open(file, O_WRONLY | O_CREAT | O_TRUNC, mode); -} diff --git a/libc/sysdeps/linux/common/open64.c b/libc/sysdeps/linux/common/open64.c index 7a68b4cd9..403e91a46 100644 --- a/libc/sysdeps/linux/common/open64.c +++ b/libc/sysdeps/linux/common/open64.c @@ -44,7 +44,7 @@ int open64 (const char *file, int oflag, ...) return result; #else - return __libc_open(file, oflag | O_LARGEFILE, mode); + return open(file, oflag | O_LARGEFILE, mode); #endif } libc_hidden_def(open64) diff --git a/libc/sysdeps/linux/i386/bits/kernel_types.h b/libc/sysdeps/linux/i386/bits/kernel_types.h index 6609dd312..8641a48c0 100644 --- a/libc/sysdeps/linux/i386/bits/kernel_types.h +++ b/libc/sysdeps/linux/i386/bits/kernel_types.h @@ -7,10 +7,14 @@ /* a hack for compiling a 32 bit user space with 64 bit * kernel on x86_64 */ -#if !defined(__ARCH_I386_POSIX_TYPES_H) && !defined(_ASM_X86_64_POSIX_TYPES_H) +#if !defined(__ARCH_I386_POSIX_TYPES_H) && \ + !defined(_ASM_X86_64_POSIX_TYPES_H) && \ + !defined(_ASM_X86_POSIX_TYPES_32_H) && \ + !defined(_ASM_X86_POSIX_TYPES_64_H) #define _ASM_X86_64_POSIX_TYPES_H #define __ARCH_I386_POSIX_TYPES_H - +#define _ASM_X86_POSIX_TYPES_32_H +#define _ASM_X86_POSIX_TYPES_64_H typedef unsigned short __kernel_dev_t; typedef unsigned long __kernel_ino_t; typedef unsigned short __kernel_mode_t; diff --git a/librt/Makefile.in b/librt/Makefile.in index d67960083..4db0fbce8 100644 --- a/librt/Makefile.in +++ b/librt/Makefile.in @@ -7,12 +7,7 @@ CFLAGS-librt := -DNOT_IN_libc -DIS_IN_librt $(SSP_ALL_CFLAGS) -ifeq ($(UCLIBC_HAS_THREADS_NATIVE),y) -LDFLAGS-librt.so := $(LDFLAGS) $(top_builddir)lib/libdl.so \ - $(top_builddir)lib/libpthread.so -else LDFLAGS-librt.so := $(LDFLAGS) -endif LIBS-librt.so := $(LIBS) @@ -30,8 +25,9 @@ librt_SSRC := $(wildcard $(librt_DIR)/*.S) librt_OBJ := $(patsubst %.c,$(librt_OUT)/%.o,$(librt_CSRC)) librt_OBJ += $(patsubst $(librt_DIR)/%.S,$(librt_OUT)/%.o,$(librt_SSRC)) else -librt_SRC := $(filter-out clock_nanosleep.c clock_getcpuclockid.c, \ +librt_CSRC := $(filter-out clock_nanosleep.c clock_getcpuclockid.c, \ $(notdir $(wildcard $(librt_DIR)/*.c))) + librt_OBJ := $(patsubst $(librt_DIR)/%.c,$(librt_OUT)/%.o,$(librt_SRC)) endif @@ -49,7 +45,6 @@ lib-a-y += $(top_builddir)lib/librt.a lib-so-y += $(top_builddir)lib/librt.so endif - ifeq ($(DOPIC)$(UCLIBC_HAS_THREADS_NATIVE),yn) $(top_builddir)lib/librt.so: $(top_builddir)lib/librt.a $(libc.dpend) else |