diff options
author | Ulrich Drepper <drepper@redhat.com> | 1997-08-20 03:53:21 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 1997-08-20 03:53:21 +0000 |
commit | 40a55d2054ef9d9085c4e6b0157c5d30608736fc (patch) | |
tree | 7ccdbae13abe1988c2ce9af0f936daac639ba1b5 /sysdeps/unix/sysv/linux | |
parent | ca34d7a7c77fa8dc823fd05439870e5a96610c5a (diff) | |
download | glibc-40a55d2054ef9d9085c4e6b0157c5d30608736fc.tar.gz glibc-40a55d2054ef9d9085c4e6b0157c5d30608736fc.tar.xz glibc-40a55d2054ef9d9085c4e6b0157c5d30608736fc.zip |
Update. cvs/libc-ud-970819
1997-08-20 05:30 Ulrich Drepper <drepper@cygnus.com> * catgets/catgets.c (catclose): Use __munmap instead of munmap. * catgets/gencat.c (read_input_file): Fix typo. * dirent/dirent.h: Make seekdir and telldir available for __USE_XOPEN. * elf/dl-load.c: Fix case of missing DT_RPATH in object which gets executed (e.g., when it is a static binary). * intl/bindtextdomain.c: Use strdup in glibc. Correct comment. * intl/dcgettext.c: Likewise. * intl/dgettext.c: Likewise. * intl/explodename.c: Likewise. * intl/finddomain.c: Likewise. * intl/gettext.c: Likewise. * intl/gettext.h: Likewise. * intl/hash-string.h: Likewise. * intl/l10nflist.c: Likewise. * intl/libintl.h: Likewise. * intl/loadinfo.h: Likewise. * intl/loadmsgcat.c: Likewise. * intl/localealias.c: Likewise. * intl/textdomain.c: Likewise. Unify libio sources with code in libg++. * libio/fcloseall.c: Update and reformat copyright. Protect use of weak_alias. Use _IO_* thread macros instead of __libc_*. * libio/feof.c: Likewise. * libio/feof_u.c: Likewise. * libio/ferror.c: Likewise. * libio/ferror_u.c: Likewise. * libio/fgetc.c: Likewise. * libio/filedoalloc.c: Likewise. * libio/fileno.c: Likewise. * libio/fileops.c: Likewise. * libio/fputc.c: Likewise. * libio/fputc_u.c: Likewise. * libio/freopen.c: Likewise. * libio/fseek.c: Likewise. * libio/genops.c: Likewise. * libio/getc.c: Likewise. * libio/getc_u.c: Likewise. * libio/getchar.c: Likewise. * libio/getchar_u.c: Likewise. * libio/iofclose.c: Likewise. * libio/iofdopen.c: Likewise. * libio/iofflush.c: Likewise. * libio/iofflush_u.c: Likewise. * libio/iofgetpos.c: Likewise. * libio/iofgets.c: Likewise. * libio/iofopen.c: Likewise. * libio/iofopncook.c: Likewise. * libio/iofprintf.c: Likewise. * libio/iofputs.c: Likewise. * libio/iofread.c: Likewise. * libio/iofsetpos.c: Likewise. * libio/ioftell.c: Likewise. * libio/iofwrite.c: Likewise. * libio/iogetdelim.c: Likewise. * libio/iogetline.c: Likewise. * libio/iogets.c: Likewise. * libio/iopadn.c: Likewise. * libio/iopopen.c: Likewise. * libio/ioputs.c: Likewise. * libio/ioseekoff.c: Likewise. * libio/ioseekpos.c: Likewise. * libio/iosetbuffer.c: Likewise. * libio/iosetvbuf.c: Likewise. * libio/iosprintf.c: Likewise. * libio/ioungetc.c: Likewise. * libio/iovdprintf.c: Likewise. * libio/iovsprintf.c: Likewise. * libio/iovsscanf.c: Likewise. * libio/libio.h: Likewise. * libio/libioP.h: Likewise. * libio/obprintf.c: Likewise. * libio/pclose.c: Likewise. * libio/peekc.c: Likewise. * libio/putc.c: Likewise. * libio/putchar.c: Likewise. * libio/rewind.c: Likewise. * libio/setbuf.c: Likewise. * libio/setlinebuf.c: Likewise. * libio/stdfiles.c: Likewise. * libio/stdio.c: Likewise. * libio/strfile.h: Likewise. * libio/strops.c: Likewise. * libio/vasprintf.c: Likewise. * libio/vscanf.c: Likewise. * libio/vsnprintf.c: Likewise. * manual/libc.texinfo: Add menu entries for chapter on message translation. * manual/locale.texi: Correct next entry in @node for new chapter. * manual/search.texi: Likewise for previous link. * manual/message.texi: New file. * manual/startup.texi: Document LC_ALL, LC_MESSAGES, NLSPATH, setenv, unsetenv, and clearenv. * manual/string.texi: Fix typos. Patch by Jim Meyering. * math/Makefile (test-longdouble-yes): Enable. We want long double tests now. Crusade against strcat. * nis/nss_nisplus/nisplus-publickey.c: Remove uses of strcat. * stdlib/canonicalize.c: Likewise. * posix/glob.h: Define __const if necessary. Use __const in all prototypes. * sysdeps/generic/stpcpy.c: Use K&R form to allow use in other GNU packages. * posix/wordexp.c: Completely reworked buffer handling for much better performance. Patch by Tim Waugh. * socket/sys/sochet.h (getpeername): Fix type of LEN parameter, it must be socklen_t. * sysdeps/libm-i387/e_remainder.S: Pretty print. * sysdeps/libm-i387/e_remainderf.S: Likewise. * sysdeps/libm-i387/e_remainderl.S: Pop extra value for FPU stack. * sysdeps/libm-i387/s_cexp.S: Little optimization. * sysdeps/libm-i387/s_cexpl.S: Likewise. * sysdep/libm-ieee754/s_csinhl.c: Include <fenv.h>. 1997-08-18 15:21 Ulrich Drepper <drepper@cygnus.com> * sysdeps/unix/sysv/linux/if_index.c (if_nameindex): Fix memory leak in cleanup code. 1997-08-17 Paul Eggert <eggert@twinsun.com> * tzset.c (__tzset_internal): Fix memory leak when the user specifies a TZ value that uses a default rule file. Do not assume US DST rules when the user specifies that there is no DST. 1997-08-10 19:17 Philip Blundell <Philip.Blundell@pobox.com> * inet/getnameinfo.c: Tidy up. * sysdeps/posix/getaddrinfo.c: Likewise. * sysdeps/unix/sysv/linux/if_index.c (if_nametoindex): Return 0 if using stub code. (if_indextoname): Use SIOGIFNAME ioctl if the kernel supports it. (if_nameindex): Use alloca() rather than malloc(); use SIOCGIFCOUNT ioctl if the kernel supports it. 1997-08-16 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * sysdeps/unix/sysv/linux/sys/mount.h: Remove the IS_* macros, they operate on internal kernel structures and have no place in a user header. 1997-08-16 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * Makerules (lib%.so): Depend on $(+preinit) and $(+postinit). (build-shlib): Filter them out of $^. 1997-08-15 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * elf/dl-error.c (_dl_signal_error): Fix error message. 1997-08-16 04:06 Ulrich Drepper <drepper@cygnus.com> * assert/assert.h [__USE_GNU]: Undefine assert_perror. Reported by Theodore C. Belding <Ted.Belding@umich.edu>. 1997-08-13 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * Makeconfig: Change object suffixes from *.[spgb]o to *.o[spgb] to avoid conflict with PO files. * Makerules: Likewise. * Rules: Likewise. * elf/Makefile: Likewise. * extra-lib.mk: Likewise. * gmon/Makefile: Likewise. * nis/Makefile: Likewise. * nss/Makefile: Likewise. * resolv/Makefile: Likewise. * rpm/Makefile: Likewise. * sunrpc/Makefile: Likewise. * sysdeps/sparc/elf/Makefile: Likewise. * sysdeps/sparc64/elf/Makefile: Likewise. * sysdeps/unix/sysv/linux/sparc/Makefile: Likewise. (ASFLAGS-.os): Renamed from as-FLAGS.os.
Diffstat (limited to 'sysdeps/unix/sysv/linux')
-rw-r--r-- | sysdeps/unix/sysv/linux/if_index.c | 107 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/sparc/sparc32/Makefile | 2 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/sys/mount.h | 22 |
3 files changed, 84 insertions, 47 deletions
diff --git a/sysdeps/unix/sysv/linux/if_index.c b/sysdeps/unix/sysv/linux/if_index.c index 615a81d14a..7d7fc02717 100644 --- a/sysdeps/unix/sysv/linux/if_index.c +++ b/sysdeps/unix/sysv/linux/if_index.c @@ -113,62 +113,85 @@ if_nameindex (void) int fd = opensock (); struct ifconf ifc; unsigned int rq_ifs = 4, nifs, i; + int rq_len; struct if_nameindex *idx = NULL; +#ifdef SIOCGIFCOUNT + static int siocgifcount_works = 1; +#endif if (fd < 0) return NULL; +#ifdef SIOCGIFCOUNT + /* We may be able to find out how many interfaces really exist, rather + than guessing. This ioctl is not present in kernels before version + 2.1.50. */ + if (siocgifcount_works) + { + int serrno = errno; + + if (ioctl (fd, SIOCGIFCOUNT, &nifs) < 0) + { + if (errno == EINVAL) + { + siocgifcount_works = 0; + __set_errno (serrno); + } + } + else + rq_ifs = nifs + 1; + } +#endif + ifc.ifc_buf = NULL; /* Read all the interfaces out of the kernel. */ do { - rq_ifs *= 2; - ifc.ifc_len = rq_ifs * sizeof (struct ifreq); - ifc.ifc_buf = realloc (ifc.ifc_buf, ifc.ifc_len); - if (ifc.ifc_buf == NULL) + rq_len = ifc.ifc_len = rq_ifs * sizeof (struct ifreq); + ifc.ifc_buf = alloca (ifc.ifc_len); + if ((ifc.ifc_buf == NULL) || (ioctl (fd, SIOCGIFCONF, &ifc) < 0)) { - close(fd); + close (fd); return NULL; } - if (ioctl (fd, SIOCGIFCONF, &ifc) < 0) - goto jump; + rq_ifs *= 2; } - while ((unsigned int) ifc.ifc_len == (rq_ifs * sizeof (struct ifreq))); + while (ifc.ifc_len == rq_len); nifs = ifc.ifc_len / sizeof (struct ifreq); - ifc.ifc_buf = realloc (ifc.ifc_buf, ifc.ifc_len); - idx = malloc ((nifs+1) * sizeof (struct if_nameindex)); + idx = malloc ((nifs + 1) * sizeof (struct if_nameindex)); if (idx == NULL) - goto jump; + { + close (fd); + return NULL; + } for (i = 0; i < nifs; ++i) { struct ifreq *ifr = &ifc.ifc_req[i]; - if ((idx[i].if_name = malloc (strlen (ifr->ifr_name)+1)) == NULL) - { - free (idx); - idx = NULL; - goto jump; - } - strcpy (idx[i].if_name, ifr->ifr_name); - if (ioctl (fd, SIOGIFINDEX, ifr) < 0) + idx[i].if_name = __strdup (ifr->ifr_name); + if (idx[i].if_name == NULL + || ioctl (fd, SIOGIFINDEX, ifr) < 0) { int saved_errno = errno; + unsigned int j; + + for (j = 0; j < i; ++j) + free (idx[j].if_name); free (idx); - idx = NULL; + close (fd); if (saved_errno == EINVAL) __set_errno (ENOSYS); - goto jump; + return NULL; } idx[i].if_index = ifr->ifr_ifindex; } + idx[i].if_index = 0; idx[i].if_name = NULL; -jump: - free (ifc.ifc_buf); close (fd); return idx; #endif @@ -181,10 +204,46 @@ if_indextoname (unsigned int ifindex, char *ifname) __set_errno (ENOSYS); return NULL; #else - struct if_nameindex *idx = if_nameindex (); + struct if_nameindex *idx; struct if_nameindex *p; char *result = NULL; +#ifdef SIOGIFNAME + /* We may be able to do the conversion directly, rather than searching a + list. This ioctl is not present in kernels before version 2.1.50. */ + struct ifreq ifr; + int fd; + static int siogifname_works = 1; + + if (siogifname_works) + { + int serrno = errno; + + fd = opensock (); + + if (fd < 0) + return NULL; + + ifr.ifr_ifindex = ifindex; + if (ioctl (fd, SIOGIFNAME, &ifr) < 0) + { + if (errno == EINVAL) + siogifname_works = 0; /* Don't make the same mistake twice. */ + } + else + { + close (fd); + return strncpy (ifname, ifr.ifr_name, IFNAMSIZ); + } + + close (fd); + + __set_errno (serrno); + } +#endif + + idx = if_nameindex (); + if (idx != NULL) { for (p = idx; p->if_index || p->if_name; ++p) diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/Makefile b/sysdeps/unix/sysv/linux/sparc/sparc32/Makefile index 4cbd3bd004..01a0e8310f 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc32/Makefile +++ b/sysdeps/unix/sysv/linux/sparc/sparc32/Makefile @@ -3,7 +3,7 @@ sysdep_routines += __sigtrampoline endif asm-CPPFLAGS=-D__ASSEMBLY__ -as-FLAGS-.so=-fPIC +ASFLAGS-.os=-fPIC # When I get this to work, this is the right thing ifeq ($(subdir),elf) diff --git a/sysdeps/unix/sysv/linux/sys/mount.h b/sysdeps/unix/sysv/linux/sys/mount.h index 08a2e3158f..f7d45704d2 100644 --- a/sysdeps/unix/sysv/linux/sys/mount.h +++ b/sysdeps/unix/sysv/linux/sys/mount.h @@ -57,28 +57,6 @@ __BEGIN_DECLS #define MS_MGC_MSK 0xffff0000 /* Magic flag number mask */ -/* Note that read-only etc flags are inode-specific: setting some - file-system flags just means all the inodes inherit those flags by - default. It might be possible to override it selectively if you - really wanted to with some ioctl() that is not currently - implemented. - - Exception: MS_RDONLY is always applied to the entire file system. */ -#define IS_RDONLY(inode) \ - (((inode)->i_sb) && ((inode)->i_sb->s_flags & MS_RDONLY)) -#define DO_UPDATE_ATIME(inode) \ - (!((inode)->i_flags & MS_NOATIME) && !IS_RDONLY (inode)) -#define IS_NOSUID(inode) ((inode)->i_flags & MS_NOSUID) -#define IS_NODEV(inode) ((inode)->i_flags & MS_NODEV) -#define IS_NOEXEC(inode) ((inode)->i_flags & MS_NOEXEC) -#define IS_SYNC(inode) ((inode)->i_flags & MS_SYNCHRONOUS) -#define IS_MANDLOCK(inode) ((inode)->i_flags & MS_MANDLOCK) - -#define IS_WRITABLE(inode) ((inode)->i_flags & S_WRITE) -#define IS_APPEND(inode) ((inode)->i_flags & S_APPEND) -#define IS_IMMUTABLE(inode) ((inode)->i_flags & S_IMMUTABLE) - - /* The read-only stuff doesn't really belong here, but any other place is probably as bad and I don't want to create yet another include file. */ |