diff options
author | Ulrich Drepper <drepper@redhat.com> | 2003-06-11 23:22:36 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2003-06-11 23:22:36 +0000 |
commit | 9c7ff11a5cd628ffbe31a7b2de3027ec5b030d8b (patch) | |
tree | ea5cb10211192245fd1b92b9b2f07a3d045f3548 /sysdeps | |
parent | dd9423a67a7650a9b0f50d8151e4f3797c5a14f8 (diff) | |
download | glibc-9c7ff11a5cd628ffbe31a7b2de3027ec5b030d8b.tar.gz glibc-9c7ff11a5cd628ffbe31a7b2de3027ec5b030d8b.tar.xz glibc-9c7ff11a5cd628ffbe31a7b2de3027ec5b030d8b.zip |
Update.
2003-06-11 Ulrich Drepper <drepper@redhat.com> * time/tzfile.c: Add a couple of __builtin_expect. Remove warnings gcc 3.3 shows. * argp/argp-help.c (hol_entry_short_iterate): Don't inline. * elf/dl-load.c (fillin_rpath): Likewise. (add_path): Likewise. * elf/dl-version.c (find_needed): Always inline. * elf/do-lookup.c (FCT): Don't inline. * iconv/Makefile: Extend vpath to intl subdir. (iconvconfig-modules): Add hash-string. * iconv/gconv_charset.h (strip): Don't inline. (upstr): Always inline. Move __gconv_compare_alias prototype to... * iconv/gconv_int.h: ...here. * iconv/gconv_db.c: Don't include gconv_charset.h. * iconv/gconv_conf.c (add_alias): Don't inline. (insert_module): Likewise. * iconv/gconv_simple.c (internal_ucs4_loop): Always inline. (internal_ucs4_loop_unaligned): Likewise. (internal_ucs4_loop_single): Likewise. (ucs4_internal_loop): Likewise. (ucs4_internal_loop_unaligned): Likewise. (ucs4_internal_loop_single): Likewise. (internal_ucs4le_loop): Always inline. (internal_ucs4le_loop_unaligned): Likewise. (internal_ucs4le_loop_single): Likewise. (ucs4le_internal_loop): Likewise. (ucs4le_internal_loop_unaligned): Likewise. (ucs4le_internal_loop_single): Likewise. * iconv/loop.c: Always inline the defined functions. * iconvdata/cns11642.h: Likewise. * iconvdata/cns11642l1.h: Likewise. * iconvdata/euc-kr.c: Likewise. * iconvdata/gb2312.h: Likewise. * iconvdata/jis0201.h: Likewise. * iconvdata/jis0208.h: Likewise. * iconvdata/jis0212.h: Likewise. * iconvdata/jisx0213.h: Likewise. * iconvdata/ksc5601.h: Likewise. * iconvdata/utf-7.c (base64): Don't inline. * include/libc-symbols.h (symbol_set_first_element): Add cast (symbol_set_end_p): Likewise. * include/set-hooks (RUN_HOOK): Likewise. * inet/Makefile (aux): Add ifreq. * intl/Makefile (aux): Add some entries from routines. Add hash-string. * intl/hash-string.c: New file. * intl/hash-string.h: Remove hash_string definition. Declare __hash_string. * iconv/gconv_cache.c (find_module_idx): Adjust hash_string caller. * iconv/iconvconfig.c (new_name): Likewise. * intl/dcigettext.c (_nl_find_msg): Likewise. * intl/loadmsgcat.c (_nl_load_domain): Likewise. * io/ftw.c (open_dir_stream): Always inline. (process_entry): Don't inline. * locale/findlocale.c: Include gconv_int.h. * locale/setlocale.c (new_composite_name): Don't inline. * locale/weight.h (findidx): Always inline. * locale/weightwc.h (findidx): Likewise. * locale/programs/linereader.c (lr_ignore_rest): Define here. * locale/programs/linereader.h (lr_ignore_rest): Don't define here, just declare it. (lr_getc): Always inline. (lr_ungetc): Likewise. * nss/nss_files/files-parse.c (parse_list): Likewise. * stdio-common/Makefile (aux): Add printf-parsemb and printf-parsewc. * stdio-common/_itoa.h (_itoa_word): Always inline. (_fitoa_word, _fitoa): Don't define here, only declare. * stdio-common/_itoa.c (_iftoa_word): Add here. (_fitoa): Likewise. * stdio-common/_itowa.h (_itowa_word): Always inline. * stdio-common/printf-parse.h (read_int): Don't inline. (find_spec): Don't define. Declare __find_specmb and __find_specwc. (parse_one_spec): Don't define. Declare __parse_one_specmb and __parse_one_specwc. * stdio-common/printf-parsemb.c: New file. * stdio-common/printf-parsewc.c: New file. * stdio-common/vfprintf.c: Update calls to find_spec and parse_one_spec for new names. * stdio-common/printf-prs.c: Likewise. Define DONT_NEED_READ_INT. * stdlib/Makefile (aux): Add grouping and groupingwc. * stdlib/grouping.c: New file. * stdlib/groupingwc.c: New file. * stdlib/grouping.h (correctly_grouped_prefix): Don't define here. Just prototype. * stdlib/rpmatch.c (try): Don't inline. * stdlib/strtod.c (round_and_return): Don't line. (str_to_mpn): Likewise. (__mpn_lshift_1): Always inline. Optimize only for constant count. Adjust for name change of correctly_grouped_prefix. * sysdeps/generic/strtol.c: Adjust for name change of correctly_grouped_prefix. * string/strxfrm.c (utf8_encode): Don't inline. * sysdeps/generic/dl-cache.c: Define _dl_cache_libcmp. * sysdeps/generic/dl-cache.h: Just declare _dl_cache_libcmp. * sysdeps/generic/ifreq.c: New file. * sysdeps/unix/sysv/linux/ifreq.c: New file. * sysdeps/generic/ifreq.h (__ifreq): Only declare here. * sysdeps/unix/sysv/linux/ifreq.h: Likewise. * sysdeps/generic/ldsodefs.h (_dl_name_match_p): Always inline. * sysdeps/generic/unwind-dw2-fde.c (start_fde_sort): Don't inline. (fde_split): Likewise. (fde_merge): Likewise. (end_fde_sort): Likewise. (init_object): Likewise. (binary_search_unencoded_fdes): Likewise. (binary_search_single_encoding_fdes): Likewise. (binary_search_mixed_encoding_fdes): Likewise. * sysdeps/generic/wordexp.c (w_addchar): Don't inline. * sysdeps/i386/dl-machine.c (elf_machine_runtime_setup): Always inline. * sysdeps/posix/sprofil.c (profil_count): Don't inline. * sysdeps/unix/sysv/linux/Makefile [subdir=io] (sysdep_routines): Add xstatconv. * sysdeps/unix/sysv/linux/xstatconv.h: New file. * sysdeps/unix/sysv/linux/xstatconv.c: Don't inline the function. Export them. Prepend __ to name. * sysdeps/unix/sysv/linux/Dist: Add xstatconv.h. * sysdeps/unix/sysv/linux/fxstat.c: Adjust for name change of conversion functions. * sysdeps/unix/sysv/linux/fxstat64.c: Likewise. * sysdeps/unix/sysv/linux/lxstat.c: Likewise. * sysdeps/unix/sysv/linux/lxstat64.c: Likewise. * sysdeps/unix/sysv/linux/xstat.c: Likewise. * sysdeps/unix/sysv/linux/xstat64.c: Likewise. * sysdeps/unix/sysv/linux/i386/fxstat.c: Likewise. * sysdeps/unix/sysv/linux/i386/lxstat.c: Likewise. * sysdeps/unix/sysv/linux/i386/xstat.c: Likewise. * sysdeps/unix/sysv/linux/pathconf.c (__statfs_link_max, __statfs_filesize_max, __statfs_symlinks): Define here. __ prepended to name. Change callers. * sysdeps/unix/sysv/linux/pathconf.h (__statfs_link_max, __statfs_filesize_max, __statfs_symlinks): Don't define here, just declare. * sysdeps/unix/sysv/linux/fpathconf.c: Change all callers. * time/tzfile.c (decode): Always inline. * wcsmbs/wcsnrtombs.c: Change type of inbuf to unsigned char*. Remove cast in tomb function call. * wcsmbs/wcsrtombs.c Likewise. * wcsmbs/wcstob.c: Introduce new temp variable to take pointer in tomb function call.
Diffstat (limited to 'sysdeps')
29 files changed, 468 insertions, 362 deletions
diff --git a/sysdeps/generic/dl-cache.c b/sysdeps/generic/dl-cache.c index bf2e98c543..b17c18baf9 100644 --- a/sysdeps/generic/dl-cache.c +++ b/sysdeps/generic/dl-cache.c @@ -1,5 +1,5 @@ /* Support for reading /etc/ld.so.cache files written by Linux ldconfig. - Copyright (C) 1996,1997,1998,1999,2000,2001,2002 Free Software Foundation, Inc. + Copyright (C) 1996-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 @@ -133,6 +133,45 @@ do \ while (0) +int +internal_function +_dl_cache_libcmp (const char *p1, const char *p2) +{ + while (*p1 != '\0') + { + if (*p1 >= '0' && *p1 <= '9') + { + if (*p2 >= '0' && *p2 <= '9') + { + /* Must compare this numerically. */ + int val1; + int val2; + + val1 = *p1++ - '0'; + val2 = *p2++ - '0'; + while (*p1 >= '0' && *p1 <= '9') + val1 = val1 * 10 + *p1++ - '0'; + while (*p2 >= '0' && *p2 <= '9') + val2 = val2 * 10 + *p2++ - '0'; + if (val1 != val2) + return val1 - val2; + } + else + return 1; + } + else if (*p2 >= '0' && *p2 <= '9') + return -1; + else if (*p1 != *p2) + return *p1 - *p2; + else + { + ++p1; + ++p2; + } + } + return *p1 - *p2; +} + /* Look up NAME in ld.so.cache and return the file name stored there, or null if none is found. */ diff --git a/sysdeps/generic/dl-cache.h b/sysdeps/generic/dl-cache.h index 93bf0be6f4..946e5a9713 100644 --- a/sysdeps/generic/dl-cache.h +++ b/sysdeps/generic/dl-cache.h @@ -1,5 +1,5 @@ /* Support for reading /etc/ld.so.cache files written by Linux ldconfig. - Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc. + Copyright (C) 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 @@ -97,41 +97,5 @@ struct cache_file_new (((addr) + __alignof__ (struct cache_file_new) -1) \ & (~(__alignof__ (struct cache_file_new) - 1))) -static inline int -__attribute__ ((__unused__)) -_dl_cache_libcmp (const char *p1, const char *p2) -{ - while (*p1 != '\0') - { - if (*p1 >= '0' && *p1 <= '9') - { - if (*p2 >= '0' && *p2 <= '9') - { - /* Must compare this numerically. */ - int val1; - int val2; - - val1 = *p1++ - '0'; - val2 = *p2++ - '0'; - while (*p1 >= '0' && *p1 <= '9') - val1 = val1 * 10 + *p1++ - '0'; - while (*p2 >= '0' && *p2 <= '9') - val2 = val2 * 10 + *p2++ - '0'; - if (val1 != val2) - return val1 - val2; - } - else - return 1; - } - else if (*p2 >= '0' && *p2 <= '9') - return -1; - else if (*p1 != *p2) - return *p1 - *p2; - else - { - ++p1; - ++p2; - } - } - return *p1 - *p2; -} +extern int _dl_cache_libcmp (const char *p1, const char *p2) + internal_function; diff --git a/sysdeps/generic/ifreq.c b/sysdeps/generic/ifreq.c new file mode 100644 index 0000000000..be7c03cf08 --- /dev/null +++ b/sysdeps/generic/ifreq.c @@ -0,0 +1,80 @@ +/* Copyright (C) 1999, 2002, 2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Andreas Jaeger <aj@suse.de>. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include "ifreq.h" + + +void +__ifreq (struct ifreq **ifreqs, int *num_ifs, int sockfd) +{ + int fd = sockfd; + struct ifconf ifc; + int rq_len; + int nifs; +# define RQ_IFS 4 + + if (fd < 0) + fd = __opensock (); + if (fd < 0) + { + *num_ifs = 0; + *ifreqs = NULL; + return; + } + + ifc.ifc_buf = NULL; + rq_len = RQ_IFS * sizeof (struct ifreq) / 2; /* Doubled in the loop. */ + do + { + ifc.ifc_len = rq_len *= 2; + ifc.ifc_buf = realloc (ifc.ifc_buf, ifc.ifc_len); + if (ifc.ifc_buf == NULL || __ioctl (fd, SIOCGIFCONF, &ifc) < 0) + { + if (ifc.ifc_buf) + free (ifc.ifc_buf); + + if (fd != sockfd) + __close (fd); + *num_ifs = 0; + *ifreqs = NULL; + return; + } + } + while (rq_len < sizeof (struct ifreq) + ifc.ifc_len); + + if (fd != sockfd) + __close (fd); + +#ifdef _HAVE_SA_LEN + struct ifreq *ifr = ifreqs; + nifs = 0; + while ((char *) ifr < ifc.ifc_buf + ifc.ifc_len) + { + ++nifs; + ifr = __if_nextreq (ifr); + if (ifr == NULL) + break; + } +#else + nifs = ifc.ifc_len / sizeof (struct ifreq); +#endif + + *num_ifs = nifs; + *ifreqs = realloc (ifc.ifc_buf, nifs * sizeof (struct ifreq)); +} diff --git a/sysdeps/generic/ifreq.h b/sysdeps/generic/ifreq.h index 4871c8d1d8..6e01fb463e 100644 --- a/sysdeps/generic/ifreq.h +++ b/sysdeps/generic/ifreq.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1999,2002 Free Software Foundation, Inc. +/* Copyright (C) 1999, 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Andreas Jaeger <aj@suse.de>. @@ -34,64 +34,7 @@ __if_nextreq (struct ifreq *ifr) return ifr + 1; } -static inline void -__ifreq (struct ifreq **ifreqs, int *num_ifs, int sockfd) -{ - int fd = sockfd; - struct ifconf ifc; - int rq_len; - int nifs; -# define RQ_IFS 4 - - if (fd < 0) - fd = __opensock (); - if (fd < 0) - { - *num_ifs = 0; - *ifreqs = NULL; - return; - } - - ifc.ifc_buf = NULL; - rq_len = RQ_IFS * sizeof (struct ifreq) / 2; /* Doubled in the loop. */ - do - { - ifc.ifc_len = rq_len *= 2; - ifc.ifc_buf = realloc (ifc.ifc_buf, ifc.ifc_len); - if (ifc.ifc_buf == NULL || __ioctl (fd, SIOCGIFCONF, &ifc) < 0) - { - if (ifc.ifc_buf) - free (ifc.ifc_buf); - - if (fd != sockfd) - __close (fd); - *num_ifs = 0; - *ifreqs = NULL; - return; - } - } - while (rq_len < sizeof (struct ifreq) + ifc.ifc_len); - - if (fd != sockfd) - __close (fd); - -#ifdef _HAVE_SA_LEN - struct ifreq *ifr = ifreqs; - nifs = 0; - while ((char *) ifr < ifc.ifc_buf + ifc.ifc_len) - { - ++nifs; - ifr = __if_nextreq (ifr); - if (ifr == NULL) - break; - } -#else - nifs = ifc.ifc_len / sizeof (struct ifreq); -#endif - - *num_ifs = nifs; - *ifreqs = realloc (ifc.ifc_buf, nifs * sizeof (struct ifreq)); -} +extern void __ifreq (struct ifreq **ifreqs, int *num_ifs, int sockfd); static inline void diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h index 4b75f4672e..2a3cf2bd09 100644 --- a/sysdeps/generic/ldsodefs.h +++ b/sysdeps/generic/ldsodefs.h @@ -173,7 +173,7 @@ struct libname_list /* Test whether given NAME matches any of the names of the given object. */ static __inline int -__attribute__ ((unused)) +__attribute__ ((unused, always_inline)) _dl_name_match_p (const char *__name, struct link_map *__map) { int __found = strcmp (__name, __map->l_name) == 0; diff --git a/sysdeps/generic/strtol.c b/sysdeps/generic/strtol.c index 1b267753d9..953c6c4a90 100644 --- a/sysdeps/generic/strtol.c +++ b/sysdeps/generic/strtol.c @@ -1,5 +1,5 @@ /* Convert string representation of a number into an integer value. - Copyright (C) 1991,92,94,95,96,97,98,99,2000,01,02 + Copyright (C) 1991,92,94,95,96,97,98,99,2000,2001,2002,2003 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -374,7 +374,11 @@ INTERNAL (strtol) (nptr, endptr, base, group LOCALE_PARAM) || (int) (TOUPPER (c) - L_('A') + 10) >= base)) break; - end = correctly_grouped_prefix (s, end, thousands, grouping); +# ifdef USE_WIDE_CHAR + end = __correctly_grouped_prefixwc (s, end, thousands, grouping); +# else + end = __correctly_grouped_prefixmb (s, end, thousands, grouping); +# endif } } else diff --git a/sysdeps/generic/unwind-dw2-fde.c b/sysdeps/generic/unwind-dw2-fde.c index 64c0846ccb..024ffd01c5 100644 --- a/sysdeps/generic/unwind-dw2-fde.c +++ b/sysdeps/generic/unwind-dw2-fde.c @@ -1,5 +1,6 @@ /* Subroutines needed for unwinding stack frames for exception handling. */ -/* Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. +/* Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003 + Free Software Foundation, Inc. Contributed by Jason Merrill <jason@cygnus.com>. This file is part of GCC. @@ -423,7 +424,7 @@ struct fde_accumulator struct fde_vector *erratic; }; -static inline int +static int start_fde_sort (struct fde_accumulator *accu, size_t count) { size_t size; @@ -461,7 +462,7 @@ fde_insert (struct fde_accumulator *accu, fde *this_fde) chain to determine what should be placed in the ERRATIC array, and what is the linear sequence. This overlay is safe from aliasing. */ -static inline void +static void fde_split (struct object *ob, fde_compare_t fde_compare, struct fde_vector *linear, struct fde_vector *erratic) { @@ -571,7 +572,7 @@ frame_heapsort (struct object *ob, fde_compare_t fde_compare, } /* Merge V1 and V2, both sorted, and put the result into V1. */ -static inline void +static void fde_merge (struct object *ob, fde_compare_t fde_compare, struct fde_vector *v1, struct fde_vector *v2) { @@ -598,7 +599,7 @@ fde_merge (struct object *ob, fde_compare_t fde_compare, } } -static inline void +static void end_fde_sort (struct object *ob, struct fde_accumulator *accu, size_t count) { fde_compare_t fde_compare; @@ -753,7 +754,7 @@ add_fdes (struct object *ob, struct fde_accumulator *accu, fde *this_fde) be faster. We can be called multiple times, should we have failed to allocate a sorted fde array on a previous occasion. */ -static inline void +static void init_object (struct object* ob) { struct fde_accumulator accu; @@ -876,7 +877,7 @@ linear_search_fdes (struct object *ob, fde *this_fde, void *pc) /* Binary search for an FDE containing the given PC. Here are three implementations of increasing complexity. */ -static inline fde * +static fde * binary_search_unencoded_fdes (struct object *ob, void *pc) { struct fde_vector *vec = ob->u.sort; @@ -903,7 +904,7 @@ binary_search_unencoded_fdes (struct object *ob, void *pc) return NULL; } -static inline fde * +static fde * binary_search_single_encoding_fdes (struct object *ob, void *pc) { struct fde_vector *vec = ob->u.sort; @@ -933,7 +934,7 @@ binary_search_single_encoding_fdes (struct object *ob, void *pc) return NULL; } -static inline fde * +static fde * binary_search_mixed_encoding_fdes (struct object *ob, void *pc) { struct fde_vector *vec = ob->u.sort; diff --git a/sysdeps/generic/wordexp.c b/sysdeps/generic/wordexp.c index 09f4e942d5..bb870c967d 100644 --- a/sysdeps/generic/wordexp.c +++ b/sysdeps/generic/wordexp.c @@ -1,5 +1,5 @@ /* POSIX.2 wordexp implementation. - Copyright (C) 1997,1998,1999,2000,2001,2002 Free Software Foundation, Inc. + Copyright (C) 1997-2002, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Tim Waugh <tim@cyberelk.demon.co.uk>. @@ -89,19 +89,18 @@ w_newword (size_t *actlen, size_t *maxlen) return NULL; } -static inline char * +static char * w_addchar (char *buffer, size_t *actlen, size_t *maxlen, char ch) /* (lengths exclude trailing zero) */ { - /* Add a character to the buffer, allocating room for it if needed. - */ + /* Add a character to the buffer, allocating room for it if needed. */ if (*actlen == *maxlen) { char *old_buffer = buffer; assert (buffer == NULL || *maxlen != 0); *maxlen += W_CHUNK; - buffer = realloc (buffer, 1 + *maxlen); + buffer = (char *) realloc (buffer, 1 + *maxlen); if (buffer == NULL) free (old_buffer); diff --git a/sysdeps/i386/dl-machine.h b/sysdeps/i386/dl-machine.h index 095098376d..b0c3c7f94c 100644 --- a/sysdeps/i386/dl-machine.h +++ b/sysdeps/i386/dl-machine.h @@ -95,7 +95,7 @@ elf_machine_load_address (void) /* Set up the loaded object described by L so its unrelocated PLT entries will jump to the on-demand fixup code in dl-runtime.c. */ -static inline int __attribute__ ((unused)) +static inline int __attribute__ ((unused, always_inline)) elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) { Elf32_Addr *got; diff --git a/sysdeps/posix/sprofil.c b/sysdeps/posix/sprofil.c index afb6d2f84e..84c797297a 100644 --- a/sysdeps/posix/sprofil.c +++ b/sysdeps/posix/sprofil.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2001,02 Free Software Foundation, Inc. +/* Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. Contributed by David Mosberger-Tang <davidm@hpl.hp.com>. This file is part of the GNU C Library. @@ -104,7 +104,7 @@ index_to_pc (unsigned long int n, size_t offset, unsigned int scale, return pc; } -static inline void +static void profil_count (void *pcp, int prof_uint) { struct region *region, *r = prof_info.last; diff --git a/sysdeps/unix/sysv/linux/Dist b/sysdeps/unix/sysv/linux/Dist index f9f6a1a5f8..1cd482c1ff 100644 --- a/sysdeps/unix/sysv/linux/Dist +++ b/sysdeps/unix/sysv/linux/Dist @@ -78,6 +78,7 @@ sys/ultrasound.h sys/user.h sys/vt.h xstatconv.c +xstatconv.h getdents64.c umount.S umount2.S diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile index 90671e404e..1085fe0d81 100644 --- a/sysdeps/unix/sysv/linux/Makefile +++ b/sysdeps/unix/sysv/linux/Makefile @@ -133,6 +133,10 @@ ifeq ($(subdir),nis) CFLAGS-ypclnt.c = -DUSE_BINDINGDIR=1 endif +ifeq ($(subdir),io) +sysdep_routines += xstatconv +endif + ifeq ($(subdir),elf) sysdep-rtld-routines += dl-brk dl-sbrk diff --git a/sysdeps/unix/sysv/linux/alpha/xstatconv.c b/sysdeps/unix/sysv/linux/alpha/xstatconv.c index 31fe7a52ec..1084049dbe 100644 --- a/sysdeps/unix/sysv/linux/alpha/xstatconv.c +++ b/sysdeps/unix/sysv/linux/alpha/xstatconv.c @@ -1,5 +1,5 @@ /* Convert between the kernel's `struct stat' format, and libc's. - Copyright (C) 1997 Free Software Foundation, Inc. + Copyright (C) 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,11 +17,15 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#include <errno.h> #include <string.h> +#include <sys/stat.h> +#include <xstatconv.h> -static inline int -xstat_conv (int vers, struct kernel_stat *kbuf, void *ubuf) + +int +__xstat_conv (int vers, struct kernel_stat *kbuf, void *ubuf) { switch (vers) { diff --git a/sysdeps/unix/sysv/linux/fpathconf.c b/sysdeps/unix/sysv/linux/fpathconf.c index 9eca7175cc..c1cdb1b899 100644 --- a/sysdeps/unix/sysv/linux/fpathconf.c +++ b/sysdeps/unix/sysv/linux/fpathconf.c @@ -37,13 +37,13 @@ __fpathconf (fd, name) switch (name) { case _PC_LINK_MAX: - return statfs_link_max (__fstatfs (fd, &fsbuf), &fsbuf); + return __statfs_link_max (__fstatfs (fd, &fsbuf), &fsbuf); case _PC_FILESIZEBITS: - return statfs_filesize_max (__fstatfs (fd, &fsbuf), &fsbuf); + return __statfs_filesize_max (__fstatfs (fd, &fsbuf), &fsbuf); case _PC_2_SYMLINKS: - return statfs_symlinks (__fstatfs (fd, &fsbuf), &fsbuf); + return __statfs_symlinks (__fstatfs (fd, &fsbuf), &fsbuf); default: return posix_fpathconf (fd, name); diff --git a/sysdeps/unix/sysv/linux/fxstat.c b/sysdeps/unix/sysv/linux/fxstat.c index b19450598d..6acafa261b 100644 --- a/sysdeps/unix/sysv/linux/fxstat.c +++ b/sysdeps/unix/sysv/linux/fxstat.c @@ -1,5 +1,5 @@ /* fxstat using old-style Unix fstat system call. - Copyright (C) 1991,1995-1998,2000,2002 Free Software Foundation, Inc. + Copyright (C) 1991,1995-1998,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 @@ -31,7 +31,7 @@ #include <sys/syscall.h> #include <bp-checks.h> -#include <xstatconv.c> +#include <xstatconv.h> extern int __syscall_fstat (int, struct kernel_stat *__unbounded); @@ -51,7 +51,7 @@ __fxstat (int vers, int fd, struct stat *buf) result = INLINE_SYSCALL (fstat, 2, fd, __ptrvalue (&kbuf)); if (result == 0) - result = xstat_conv (vers, &kbuf, buf); + result = __xstat_conv (vers, &kbuf, buf); return result; #endif diff --git a/sysdeps/unix/sysv/linux/fxstat64.c b/sysdeps/unix/sysv/linux/fxstat64.c index f5e16050b6..27e8ac2711 100644 --- a/sysdeps/unix/sysv/linux/fxstat64.c +++ b/sysdeps/unix/sysv/linux/fxstat64.c @@ -1,5 +1,5 @@ /* fxstat64 using old-style Unix fstat system call. - Copyright (C) 1997,1998,1999,2000,2001,2002 Free Software Foundation, Inc. + Copyright (C) 1997-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 @@ -29,7 +29,7 @@ #include "kernel-features.h" #if __ASSUME_STAT64_SYSCALL == 0 -# include <xstatconv.c> +# include <xstatconv.h> #endif extern int __syscall_fstat (int, struct kernel_stat *__unbounded); @@ -78,7 +78,7 @@ ___fxstat64 (int vers, int fd, struct stat64 *buf) # endif result = INLINE_SYSCALL (fstat, 2, fd, __ptrvalue (&kbuf)); if (result == 0) - result = xstat64_conv (vers, &kbuf, buf); + result = __xstat64_conv (vers, &kbuf, buf); return result; #endif diff --git a/sysdeps/unix/sysv/linux/i386/fxstat.c b/sysdeps/unix/sysv/linux/i386/fxstat.c index 86dbd71175..13a3bc77b7 100644 --- a/sysdeps/unix/sysv/linux/i386/fxstat.c +++ b/sysdeps/unix/sysv/linux/i386/fxstat.c @@ -1,5 +1,5 @@ /* fxstat using old-style Unix fstat system call. - Copyright (C) 1991,95,96,97,98,2000,2002 Free Software Foundation, Inc. + Copyright (C) 1991,1995-1998,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 @@ -32,7 +32,7 @@ #include "kernel-features.h" -#include <xstatconv.c> +#include <xstatconv.h> extern int __syscall_fstat (int, struct kernel_stat *__unbounded); @@ -62,7 +62,7 @@ __fxstat (int vers, int fd, struct stat *buf) result = INLINE_SYSCALL (fstat64, 2, fd, __ptrvalue (&buf64)); if (result == 0) - result = xstat32_conv (vers, &buf64, buf); + result = __xstat32_conv (vers, &buf64, buf); return result; } #else @@ -77,7 +77,7 @@ __fxstat (int vers, int fd, struct stat *buf) result = INLINE_SYSCALL (fstat64, 2, fd, __ptrvalue (&buf64)); if (result == 0) - result = xstat32_conv (vers, &buf64, buf); + result = __xstat32_conv (vers, &buf64, buf); if (result != -1 || errno != ENOSYS) return result; @@ -88,7 +88,7 @@ __fxstat (int vers, int fd, struct stat *buf) result = INLINE_SYSCALL (fstat, 2, fd, __ptrvalue (&kbuf)); if (result == 0) - result = xstat_conv (vers, &kbuf, buf); + result = __xstat_conv (vers, &kbuf, buf); return result; #endif /* __ASSUME_STAT64_SYSCALL */ diff --git a/sysdeps/unix/sysv/linux/i386/lxstat.c b/sysdeps/unix/sysv/linux/i386/lxstat.c index 0da6312fa4..adf55dc5e8 100644 --- a/sysdeps/unix/sysv/linux/i386/lxstat.c +++ b/sysdeps/unix/sysv/linux/i386/lxstat.c @@ -1,5 +1,5 @@ /* lxstat using old-style Unix lstat system call. - Copyright (C) 1991,95,96,97,98,2000,2002 Free Software Foundation, Inc. + Copyright (C) 1991,95,96,97,98,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 @@ -32,7 +32,7 @@ #include "kernel-features.h" -#include <xstatconv.c> +#include <xstatconv.h> extern int __syscall_lstat (const char *__unbounded, struct kernel_stat *__unbounded); @@ -65,7 +65,7 @@ __lxstat (int vers, const char *name, struct stat *buf) result = INLINE_SYSCALL (lstat64, 2, CHECK_STRING (name), __ptrvalue (&buf64)); if (result == 0) - result = xstat32_conv (vers, &buf64, buf); + result = __xstat32_conv (vers, &buf64, buf); return result; } #else @@ -79,7 +79,7 @@ __lxstat (int vers, const char *name, struct stat *buf) result = INLINE_SYSCALL (lstat64, 2, CHECK_STRING (name), __ptrvalue (&buf64)); if (result == 0) - result = xstat32_conv (vers, &buf64, buf); + result = __xstat32_conv (vers, &buf64, buf); if (result != -1 || errno != ENOSYS) return result; @@ -90,7 +90,7 @@ __lxstat (int vers, const char *name, struct stat *buf) result = INLINE_SYSCALL (lstat, 2, CHECK_STRING (name), __ptrvalue (&kbuf)); if (result == 0) - result = xstat_conv (vers, &kbuf, buf); + result = __xstat_conv (vers, &kbuf, buf); return result; #endif diff --git a/sysdeps/unix/sysv/linux/i386/xstat.c b/sysdeps/unix/sysv/linux/i386/xstat.c index cc383ec2fb..5442fc42b6 100644 --- a/sysdeps/unix/sysv/linux/i386/xstat.c +++ b/sysdeps/unix/sysv/linux/i386/xstat.c @@ -1,5 +1,5 @@ /* xstat using old-style Unix stat system call. - Copyright (C) 1991,95,96,97,98,2000,2002 Free Software Foundation, Inc. + Copyright (C) 1991,95,96,97,98,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 @@ -32,7 +32,7 @@ #include "kernel-features.h" -#include <xstatconv.c> +#include <xstatconv.h> extern int __syscall_stat (const char *__unbounded, struct kernel_stat *__unbounded); @@ -65,7 +65,7 @@ __xstat (int vers, const char *name, struct stat *buf) result = INLINE_SYSCALL (stat64, 2, CHECK_STRING (name), __ptrvalue (&buf64)); if (result == 0) - result = xstat32_conv (vers, &buf64, buf); + result = __xstat32_conv (vers, &buf64, buf); return result; } #else @@ -79,7 +79,7 @@ __xstat (int vers, const char *name, struct stat *buf) result = INLINE_SYSCALL (stat64, 2, CHECK_STRING (name), __ptrvalue (&buf64)); if (result == 0) - result = xstat32_conv (vers, &buf64, buf); + result = __xstat32_conv (vers, &buf64, buf); if (result != -1 || errno != ENOSYS) return result; @@ -89,7 +89,7 @@ __xstat (int vers, const char *name, struct stat *buf) # endif result = INLINE_SYSCALL (stat, 2, CHECK_STRING (name), __ptrvalue (&kbuf)); if (result == 0) - result = xstat_conv (vers, &kbuf, buf); + result = __xstat_conv (vers, &kbuf, buf); return result; #endif /* __ASSUME_STAT64_SYSCALL */ diff --git a/sysdeps/unix/sysv/linux/ifreq.c b/sysdeps/unix/sysv/linux/ifreq.c new file mode 100644 index 0000000000..ad408df070 --- /dev/null +++ b/sysdeps/unix/sysv/linux/ifreq.c @@ -0,0 +1,93 @@ +/* Copyright (C) 1999, 2002, 2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Andreas Jaeger <aj@suse.de>. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include "ifreq.h" + + +void +__ifreq (struct ifreq **ifreqs, int *num_ifs, int sockfd) +{ + int fd = sockfd; + struct ifconf ifc; + int rq_len; + int nifs; +# define RQ_IFS 4 + + if (fd < 0) + fd = __opensock (); + if (fd < 0) + { + *num_ifs = 0; + *ifreqs = NULL; + return; + } + + ifc.ifc_buf = NULL; + + /* We may be able to get the needed buffer size directly, rather than + guessing. */ + if (! old_siocgifconf) + { + ifc.ifc_buf = NULL; + ifc.ifc_len = 0; + if (__ioctl (fd, SIOCGIFCONF, &ifc) < 0 || ifc.ifc_len == 0) + { +# if __ASSUME_SIOCGIFNAME == 0 + old_siocgifconf = 1; +# endif + rq_len = RQ_IFS * sizeof (struct ifreq); + } + else + rq_len = ifc.ifc_len; + } + else + rq_len = RQ_IFS * sizeof (struct ifreq); + + /* Read all the interfaces out of the kernel. */ + while (1) + { + ifc.ifc_len = rq_len; + ifc.ifc_buf = realloc (ifc.ifc_buf, ifc.ifc_len); + if (ifc.ifc_buf == NULL || __ioctl (fd, SIOCGIFCONF, &ifc) < 0) + { + if (ifc.ifc_buf) + free (ifc.ifc_buf); + + if (fd != sockfd) + __close (fd); + + *num_ifs = 0; + *ifreqs = NULL; + return; + } + + if (!old_siocgifconf || ifc.ifc_len < rq_len) + break; + + rq_len *= 2; + } + + nifs = ifc.ifc_len / sizeof (struct ifreq); + + if (fd != sockfd) + __close (fd); + + *num_ifs = nifs; + *ifreqs = realloc (ifc.ifc_buf, nifs * sizeof (struct ifreq)); +} diff --git a/sysdeps/unix/sysv/linux/ifreq.h b/sysdeps/unix/sysv/linux/ifreq.h index f498e5c32a..9e4f6622e9 100644 --- a/sysdeps/unix/sysv/linux/ifreq.h +++ b/sysdeps/unix/sysv/linux/ifreq.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1999,2002 Free Software Foundation, Inc. +/* Copyright (C) 1999, 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Andreas Jaeger <aj@suse.de>. @@ -33,77 +33,7 @@ static int old_siocgifconf; #endif -static inline void -__ifreq (struct ifreq **ifreqs, int *num_ifs, int sockfd) -{ - int fd = sockfd; - struct ifconf ifc; - int rq_len; - int nifs; -# define RQ_IFS 4 - - if (fd < 0) - fd = __opensock (); - if (fd < 0) - { - *num_ifs = 0; - *ifreqs = NULL; - return; - } - - ifc.ifc_buf = NULL; - - /* We may be able to get the needed buffer size directly, rather than - guessing. */ - if (! old_siocgifconf) - { - ifc.ifc_buf = NULL; - ifc.ifc_len = 0; - if (__ioctl (fd, SIOCGIFCONF, &ifc) < 0 || ifc.ifc_len == 0) - { -# if __ASSUME_SIOCGIFNAME == 0 - old_siocgifconf = 1; -# endif - rq_len = RQ_IFS * sizeof (struct ifreq); - } - else - rq_len = ifc.ifc_len; - } - else - rq_len = RQ_IFS * sizeof (struct ifreq); - - /* Read all the interfaces out of the kernel. */ - while (1) - { - ifc.ifc_len = rq_len; - ifc.ifc_buf = realloc (ifc.ifc_buf, ifc.ifc_len); - if (ifc.ifc_buf == NULL || __ioctl (fd, SIOCGIFCONF, &ifc) < 0) - { - if (ifc.ifc_buf) - free (ifc.ifc_buf); - - if (fd != sockfd) - __close (fd); - - *num_ifs = 0; - *ifreqs = NULL; - return; - } - - if (!old_siocgifconf || ifc.ifc_len < rq_len) - break; - - rq_len *= 2; - } - - nifs = ifc.ifc_len / sizeof (struct ifreq); - - if (fd != sockfd) - __close (fd); - - *num_ifs = nifs; - *ifreqs = realloc (ifc.ifc_buf, nifs * sizeof (struct ifreq)); -} +extern void __ifreq (struct ifreq **ifreqs, int *num_ifs, int sockfd); static inline struct ifreq * __if_nextreq (struct ifreq *ifr) diff --git a/sysdeps/unix/sysv/linux/lxstat.c b/sysdeps/unix/sysv/linux/lxstat.c index ece1a85f30..156850330e 100644 --- a/sysdeps/unix/sysv/linux/lxstat.c +++ b/sysdeps/unix/sysv/linux/lxstat.c @@ -1,5 +1,5 @@ /* lxstat using old-style Unix lstat system call. - Copyright (C) 1991,1995-1998,2000,2002 Free Software Foundation, Inc. + Copyright (C) 1991,1995-1998,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 @@ -30,7 +30,7 @@ #include <sys/syscall.h> #include <bp-checks.h> -#include <xstatconv.c> +#include <xstatconv.h> extern int __syscall_lstat (const char *__unbounded, struct kernel_stat *__unbounded); @@ -52,7 +52,7 @@ __lxstat (int vers, const char *name, struct stat *buf) result = INLINE_SYSCALL (lstat, 2, CHECK_STRING (name), __ptrvalue (&kbuf)); if (result == 0) - result = xstat_conv (vers, &kbuf, buf); + result = __xstat_conv (vers, &kbuf, buf); return result; #endif diff --git a/sysdeps/unix/sysv/linux/lxstat64.c b/sysdeps/unix/sysv/linux/lxstat64.c index e7f488848c..58ff6fff61 100644 --- a/sysdeps/unix/sysv/linux/lxstat64.c +++ b/sysdeps/unix/sysv/linux/lxstat64.c @@ -1,5 +1,5 @@ /* lxstat64 using old-style Unix lstat system call. - Copyright (C) 1997,1998,1999,2000,2001,2002 Free Software Foundation, Inc. + Copyright (C) 1997-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 @@ -29,7 +29,7 @@ #include "kernel-features.h" #if __ASSUME_STAT64_SYSCALL == 0 -# include <xstatconv.c> +# include <xstatconv.h> #endif extern int __syscall_lstat (const char *__unbounded, @@ -79,7 +79,7 @@ ___lxstat64 (int vers, const char *name, struct stat64 *buf) # endif result = INLINE_SYSCALL (lstat, 2, CHECK_STRING (name), __ptrvalue (&kbuf)); if (result == 0) - result = xstat64_conv (vers, &kbuf, buf); + result = __xstat64_conv (vers, &kbuf, buf); return result; #endif diff --git a/sysdeps/unix/sysv/linux/pathconf.c b/sysdeps/unix/sysv/linux/pathconf.c index b4886158f3..d4159753a6 100644 --- a/sysdeps/unix/sysv/linux/pathconf.c +++ b/sysdeps/unix/sysv/linux/pathconf.c @@ -17,7 +17,10 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#include <unistd.h> +#include <errno.h> #include "pathconf.h" +#include "linux_fsinfo.h" static long int posix_pathconf (const char *file, int name); @@ -35,15 +38,143 @@ __pathconf (const char *file, int name) switch (name) { case _PC_LINK_MAX: - return statfs_link_max (__statfs (file, &fsbuf), &fsbuf); + return __statfs_link_max (__statfs (file, &fsbuf), &fsbuf); case _PC_FILESIZEBITS: - return statfs_filesize_max (__statfs (file, &fsbuf), &fsbuf); + return __statfs_filesize_max (__statfs (file, &fsbuf), &fsbuf); case _PC_2_SYMLINKS: - return statfs_symlinks (__statfs (file, &fsbuf), &fsbuf); + return __statfs_symlinks (__statfs (file, &fsbuf), &fsbuf); default: return posix_pathconf (file, name); } } + + +/* Used like: return statfs_link_max (__statfs (name, &buf), &buf); */ +long int +__statfs_link_max (int result, const struct statfs *fsbuf) +{ + if (result < 0) + { + if (errno == ENOSYS) + /* Not possible, return the default value. */ + return LINUX_LINK_MAX; + + /* Some error occured. */ + return -1; + } + + switch (fsbuf->f_type) + { + case EXT2_SUPER_MAGIC: + return EXT2_LINK_MAX; + + case MINIX_SUPER_MAGIC: + case MINIX_SUPER_MAGIC2: + return MINIX_LINK_MAX; + + case MINIX2_SUPER_MAGIC: + case MINIX2_SUPER_MAGIC2: + return MINIX2_LINK_MAX; + + case XENIX_SUPER_MAGIC: + return XENIX_LINK_MAX; + + case SYSV4_SUPER_MAGIC: + case SYSV2_SUPER_MAGIC: + return SYSV_LINK_MAX; + + case COH_SUPER_MAGIC: + return COH_LINK_MAX; + + case UFS_MAGIC: + case UFS_CIGAM: + return UFS_LINK_MAX; + + case REISERFS_SUPER_MAGIC: + return REISERFS_LINK_MAX; + + case XFS_SUPER_MAGIC: + return XFS_LINK_MAX; + + default: + return LINUX_LINK_MAX; + } +} + + +/* Used like: return statfs_filesize_max (__statfs (name, &buf), &buf); */ +long int +__statfs_filesize_max (int result, const struct statfs *fsbuf) +{ + if (result < 0) + { + if (errno == ENOSYS) + /* Not possible, return the default value. */ + return 32; + + /* Some error occured. */ + return -1; + } + + switch (fsbuf->f_type) + { + case EXT2_SUPER_MAGIC: + case UFS_MAGIC: + case UFS_CIGAM: + case REISERFS_SUPER_MAGIC: + case XFS_SUPER_MAGIC: + case SMB_SUPER_MAGIC: + case NTFS_SUPER_MAGIC: + case UDF_SUPER_MAGIC: + case JFS_SUPER_MAGIC: + return 64; + + case MSDOS_SUPER_MAGIC: + case JFFS_SUPER_MAGIC: + case JFFS2_SUPER_MAGIC: + case NCP_SUPER_MAGIC: + case ROMFS_SUPER_MAGIC: + return 32; + + default: + return 32; + } +} + + +/* Used like: return statfs_link_max (__statfs (name, &buf), &buf); */ +long int +__statfs_symlinks (int result, const struct statfs *fsbuf) +{ + if (result < 0) + { + if (errno == ENOSYS) + /* Not possible, return the default value. */ + return 1; + + /* Some error occured. */ + return -1; + } + + switch (fsbuf->f_type) + { + case ADFS_SUPER_MAGIC: + case BFS_MAGIC: + case CRAMFS_MAGIC: + case DEVPTS_SUPER_MAGIC: + case EFS_SUPER_MAGIC: + case EFS_MAGIC: + case MSDOS_SUPER_MAGIC: + case NTFS_SUPER_MAGIC: + case QNX4_SUPER_MAGIC: + case ROMFS_SUPER_MAGIC: + /* No symlink support. */ + return 0; + + default: + return 1; + } +} diff --git a/sysdeps/unix/sysv/linux/pathconf.h b/sysdeps/unix/sysv/linux/pathconf.h index 80ec8fa4e0..20e23685eb 100644 --- a/sysdeps/unix/sysv/linux/pathconf.h +++ b/sysdeps/unix/sysv/linux/pathconf.h @@ -17,135 +17,18 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include <unistd.h> #include <errno.h> +#include <unistd.h> #include <sys/statfs.h> -#include "linux_fsinfo.h" /* Used like: return statfs_link_max (__statfs (name, &buf), &buf); */ -static inline long int -statfs_link_max (int result, const struct statfs *fsbuf) -{ - if (result < 0) - { - if (errno == ENOSYS) - /* Not possible, return the default value. */ - return LINUX_LINK_MAX; - - /* Some error occured. */ - return -1; - } - - switch (fsbuf->f_type) - { - case EXT2_SUPER_MAGIC: - return EXT2_LINK_MAX; - - case MINIX_SUPER_MAGIC: - case MINIX_SUPER_MAGIC2: - return MINIX_LINK_MAX; - - case MINIX2_SUPER_MAGIC: - case MINIX2_SUPER_MAGIC2: - return MINIX2_LINK_MAX; - - case XENIX_SUPER_MAGIC: - return XENIX_LINK_MAX; - - case SYSV4_SUPER_MAGIC: - case SYSV2_SUPER_MAGIC: - return SYSV_LINK_MAX; - - case COH_SUPER_MAGIC: - return COH_LINK_MAX; - - case UFS_MAGIC: - case UFS_CIGAM: - return UFS_LINK_MAX; - - case REISERFS_SUPER_MAGIC: - return REISERFS_LINK_MAX; - - case XFS_SUPER_MAGIC: - return XFS_LINK_MAX; - - default: - return LINUX_LINK_MAX; - } -} +extern long int __statfs_link_max (int result, const struct statfs *fsbuf); /* Used like: return statfs_filesize_max (__statfs (name, &buf), &buf); */ -static inline long int -statfs_filesize_max (int result, const struct statfs *fsbuf) -{ - if (result < 0) - { - if (errno == ENOSYS) - /* Not possible, return the default value. */ - return 32; - - /* Some error occured. */ - return -1; - } - - switch (fsbuf->f_type) - { - case EXT2_SUPER_MAGIC: - case UFS_MAGIC: - case UFS_CIGAM: - case REISERFS_SUPER_MAGIC: - case XFS_SUPER_MAGIC: - case SMB_SUPER_MAGIC: - case NTFS_SUPER_MAGIC: - case UDF_SUPER_MAGIC: - case JFS_SUPER_MAGIC: - return 64; - - case MSDOS_SUPER_MAGIC: - case JFFS_SUPER_MAGIC: - case JFFS2_SUPER_MAGIC: - case NCP_SUPER_MAGIC: - case ROMFS_SUPER_MAGIC: - return 32; - - default: - return 32; - } -} +extern long int __statfs_filesize_max (int result, const struct statfs *fsbuf); /* Used like: return statfs_link_max (__statfs (name, &buf), &buf); */ -static inline long int -statfs_symlinks (int result, const struct statfs *fsbuf) -{ - if (result < 0) - { - if (errno == ENOSYS) - /* Not possible, return the default value. */ - return 1; - - /* Some error occured. */ - return -1; - } - - switch (fsbuf->f_type) - { - case ADFS_SUPER_MAGIC: - case BFS_MAGIC: - case CRAMFS_MAGIC: - case DEVPTS_SUPER_MAGIC: - case EFS_SUPER_MAGIC: - case EFS_MAGIC: - case MSDOS_SUPER_MAGIC: - case NTFS_SUPER_MAGIC: - case QNX4_SUPER_MAGIC: - case ROMFS_SUPER_MAGIC: - /* No symlink support. */ - return 0; - - default: - return 1; - } -} +extern long int __statfs_symlinks (int result, const struct statfs *fsbuf); diff --git a/sysdeps/unix/sysv/linux/xstat.c b/sysdeps/unix/sysv/linux/xstat.c index 05e170d17c..de6a57d7ac 100644 --- a/sysdeps/unix/sysv/linux/xstat.c +++ b/sysdeps/unix/sysv/linux/xstat.c @@ -1,6 +1,5 @@ /* xstat using old-style Unix stat system call. - Copyright (C) 1991, 1995, 1996, 1997, 1998, 2000, 2002 - Free Software Foundation, Inc. + Copyright (C) 1991,1995-1998,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 @@ -31,7 +30,7 @@ #include <sys/syscall.h> #include <bp-checks.h> -#include <xstatconv.c> +#include <xstatconv.h> extern int __syscall_stat (const char *__unbounded, struct kernel_stat *__unbounded); @@ -54,7 +53,7 @@ __xstat (int vers, const char *name, struct stat *buf) result = INLINE_SYSCALL (stat, 2, CHECK_STRING (name), __ptrvalue (&kbuf)); if (result == 0) - result = xstat_conv (vers, &kbuf, buf); + result = __xstat_conv (vers, &kbuf, buf); return result; #endif diff --git a/sysdeps/unix/sysv/linux/xstat64.c b/sysdeps/unix/sysv/linux/xstat64.c index 7835fc2050..803aeb3104 100644 --- a/sysdeps/unix/sysv/linux/xstat64.c +++ b/sysdeps/unix/sysv/linux/xstat64.c @@ -1,5 +1,5 @@ /* xstat64 using old-style Unix stat system call. - Copyright (C) 1991,95,96,97,98,99,2000,01,02 Free Software Foundation, Inc. + Copyright (C) 1991, 1995-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 @@ -29,7 +29,7 @@ #include "kernel-features.h" #if __ASSUME_STAT64_SYSCALL == 0 -# include <xstatconv.c> +# include <xstatconv.h> #endif extern int __syscall_stat (const char *__unbounded, @@ -82,7 +82,7 @@ ___xstat64 (int vers, const char *name, struct stat64 *buf) result = INLINE_SYSCALL (stat, 2, CHECK_STRING (name), __ptrvalue (&kbuf)); if (result == 0) - result = xstat64_conv (vers, &kbuf, buf); + result = __xstat64_conv (vers, &kbuf, buf); return result; #endif diff --git a/sysdeps/unix/sysv/linux/xstatconv.c b/sysdeps/unix/sysv/linux/xstatconv.c index 6253292e93..4e4defb489 100644 --- a/sysdeps/unix/sysv/linux/xstatconv.c +++ b/sysdeps/unix/sysv/linux/xstatconv.c @@ -1,5 +1,5 @@ /* Convert between the kernel's `struct stat' format, and libc's. - Copyright (C) 1991,1995,1996,1997,2000,2002 Free Software Foundation, Inc. + Copyright (C) 1991,1995-1997,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 @@ -17,6 +17,10 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#include <errno.h> +#include <sys/stat.h> +#include <kernel_stat.h> + #ifdef STAT_IS_KERNEL_STAT /* Dummy. */ @@ -27,8 +31,9 @@ struct kernel_stat; #include <string.h> -static inline int -xstat_conv (int vers, struct kernel_stat *kbuf, void *ubuf) +#ifndef __ASSUME_STAT64_SYSCALL +int +__xstat_conv (int vers, struct kernel_stat *kbuf, void *ubuf) { switch (vers) { @@ -97,9 +102,10 @@ xstat_conv (int vers, struct kernel_stat *kbuf, void *ubuf) return 0; } +#endif -static inline int -xstat64_conv (int vers, struct kernel_stat *kbuf, void *ubuf) +int +__xstat64_conv (int vers, struct kernel_stat *kbuf, void *ubuf) { #ifdef XSTAT_IS_XSTAT64 return xstat_conv (vers, kbuf, ubuf); @@ -172,8 +178,8 @@ xstat64_conv (int vers, struct kernel_stat *kbuf, void *ubuf) #endif } -static inline int -xstat32_conv (int vers, struct stat64 *kbuf, struct stat *buf) +int +__xstat32_conv (int vers, struct stat64 *kbuf, struct stat *buf) { switch (vers) { diff --git a/sysdeps/unix/sysv/linux/xstatconv.h b/sysdeps/unix/sysv/linux/xstatconv.h new file mode 100644 index 0000000000..cb5cda0326 --- /dev/null +++ b/sysdeps/unix/sysv/linux/xstatconv.h @@ -0,0 +1,25 @@ +/* Convert between the kernel's `struct stat' format, and libc's. + Copyright (C) 1991,1995-1997,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 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. */ + +#include "kernel-features.h" + + +extern int __xstat_conv (int vers, struct kernel_stat *kbuf, void *ubuf); +extern int __xstat64_conv (int vers, struct kernel_stat *kbuf, void *ubuf); +extern int __xstat32_conv (int vers, struct stat64 *kbuf, struct stat *buf); |