From c658d255e919d40619cc2a5730d502c7777830cc Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Sat, 8 Oct 2011 15:25:08 -0700 Subject: Fix some nit warnings. --- ChangeLog | 7 +++++++ nscd/nscd_proto.h | 2 ++ nss/getent.c | 1 - sysdeps/ieee754/flt-32/s_isinf_nsf.c | 2 +- 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 57a72ca..abb83dd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2011-10-08 Roland McGrath + + * nscd/nscd_proto.h: Declare __nscd_setnetgrent. + + * nss/getent.c (netgroup_keys): Remove unused variable. + * sysdeps/ieee754/flt-32/s_isinf_nsf.c: Likewise. + 2011-10-08 Ulrich Drepper * include/math.h: Declare __isinf_ns, __isinf_nsf, __isinf_nsl. diff --git a/nscd/nscd_proto.h b/nscd/nscd_proto.h index 8aa2973..742c154 100644 --- a/nscd/nscd_proto.h +++ b/nscd/nscd_proto.h @@ -74,5 +74,7 @@ extern int __nscd_getservbyport_r (int port, const char *proto, size_t buflen, struct servent **result); extern int __nscd_innetgr (const char *netgroup, const char *host, const char *user, const char *domain); +extern int __nscd_setnetgrent (const char *group, struct __netgrent *datap); + #endif /* _NSCD_PROTO_H */ diff --git a/nss/getent.c b/nss/getent.c index b843433..7d94223 100644 --- a/nss/getent.c +++ b/nss/getent.c @@ -472,7 +472,6 @@ static int netgroup_keys (int number, char *key[]) { int result = 0; - int i; if (number == 0) { diff --git a/sysdeps/ieee754/flt-32/s_isinf_nsf.c b/sysdeps/ieee754/flt-32/s_isinf_nsf.c index bc37785..1e46e2c 100644 --- a/sysdeps/ieee754/flt-32/s_isinf_nsf.c +++ b/sysdeps/ieee754/flt-32/s_isinf_nsf.c @@ -14,7 +14,7 @@ int __isinf_nsf (float x) { - int32_t ix,t; + int32_t ix; GET_FLOAT_WORD(ix,x); return (ix & 0x7fffffff) == 0x7f800000; } -- cgit v1.1 From 506042209575f1da21e5bdd2fd32a4ef4760adea Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Sat, 8 Oct 2011 15:28:21 -0700 Subject: Conditionalize unnecessary #include. --- ChangeLog | 3 +++ sysdeps/unix/sysv/linux/x86_64/time.c | 9 +++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index abb83dd..df89ebe 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2011-10-08 Roland McGrath + * sysdeps/unix/sysv/linux/x86_64/time.c: Move #include + inside [SHARED], where it is used. + * nscd/nscd_proto.h: Declare __nscd_setnetgrent. * nss/getent.c (netgroup_keys): Remove unused variable. diff --git a/sysdeps/unix/sysv/linux/x86_64/time.c b/sysdeps/unix/sysv/linux/x86_64/time.c index c1c1a75..a613eb0 100644 --- a/sysdeps/unix/sysv/linux/x86_64/time.c +++ b/sysdeps/unix/sysv/linux/x86_64/time.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2001,02, 2003, 2011 Free Software Foundation, Inc. +/* Copyright (C) 2001,02,2003,2011 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,13 +16,11 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#ifdef SHARED #include - #define VSYSCALL_ADDR_vtime 0xffffffffff600400 - -#ifdef SHARED void *time_ifunc (void) __asm__ ("time"); void * @@ -34,7 +32,9 @@ time_ifunc (void) return _dl_vdso_vsym ("time", &linux26) ?: (void *) VSYSCALL_ADDR_vtime; } __asm (".type time, %gnu_indirect_function"); + #else + # include # include @@ -44,6 +44,7 @@ time (time_t *t) INTERNAL_SYSCALL_DECL (err); return INTERNAL_SYSCALL (time, err, 1, t); } + #endif strong_alias (time, __GI_time) -- cgit v1.1 From 110946e473b38fc3896212e416d9d7064fecd5b7 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Mon, 19 Sep 2011 11:32:27 -0700 Subject: Clean up locarchive mmap reservation code. --- ChangeLog | 3 ++ locale/programs/locarchive.c | 74 +++++++++++++++++++------------------------- 2 files changed, 35 insertions(+), 42 deletions(-) diff --git a/ChangeLog b/ChangeLog index df89ebe..e70edd1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2011-10-08 Roland McGrath + * locale/programs/locarchive.c (prepare_address_space): New function. + (create_archive, enlarge_archive, open_archive): Use it. + * sysdeps/unix/sysv/linux/x86_64/time.c: Move #include inside [SHARED], where it is used. diff --git a/locale/programs/locarchive.c b/locale/programs/locarchive.c index 770a731..5069265 100644 --- a/locale/programs/locarchive.c +++ b/locale/programs/locarchive.c @@ -74,6 +74,29 @@ static const char *locnames[] = /* Size of the reserved address space area. */ #define RESERVE_MMAP_SIZE 512 * 1024 * 1024 +/* To prepare for enlargements of the mmaped area reserve some address + space. On some machines, being a file mapping rather than an anonymous + mapping affects the address selection. So do this mapping from the + actual file, even though it's only a dummy to reserve address space. */ +static void * +prepare_address_space (int fd, size_t total, size_t *reserved, int *xflags) +{ + if (total < RESERVE_MMAP_SIZE) + { + void *p = mmap64 (NULL, RESERVE_MMAP_SIZE, PROT_NONE, MAP_SHARED, fd, 0); + if (p != MAP_FAILED) + { + *reserved = RESERVE_MMAP_SIZE; + *xflags = MAP_FIXED; + return p; + } + } + + *reserved = total; + *xflags = 0; + return NULL; +} + static void create_archive (const char *archivefname, struct locarhandle *ah) @@ -81,7 +104,6 @@ create_archive (const char *archivefname, struct locarhandle *ah) int fd; char fname[strlen (archivefname) + sizeof (".XXXXXX")]; struct locarhead head; - void *p; size_t total; strcpy (stpcpy (fname, archivefname), ".XXXXXX"); @@ -129,19 +151,9 @@ create_archive (const char *archivefname, struct locarhandle *ah) error (EXIT_FAILURE, errval, _("cannot resize archive file")); } - /* To prepare for enlargements of the mmaped area reserve some - address space. */ - size_t reserved = RESERVE_MMAP_SIZE; - int xflags = 0; - if (total < reserved - && ((p = mmap64 (NULL, reserved, PROT_NONE, MAP_PRIVATE | MAP_ANON, - -1, 0)) != MAP_FAILED)) - xflags = MAP_FIXED; - else - { - p = NULL; - reserved = total; - } + size_t reserved; + int xflags; + void *p = prepare_address_space (fd, total, &reserved, &xflags); /* Map the header and all the administration data structures. */ p = mmap64 (p, total, PROT_READ | PROT_WRITE, MAP_SHARED | xflags, fd, 0); @@ -297,7 +309,6 @@ enlarge_archive (struct locarhandle *ah, const struct locarhead *head) int fd; struct locarhead newhead; size_t total; - void *p; unsigned int cnt, loccnt; struct namehashent *oldnamehashtab; struct locarhandle new_ah; @@ -390,19 +401,9 @@ enlarge_archive (struct locarhandle *ah, const struct locarhead *head) error (EXIT_FAILURE, errval, _("cannot resize archive file")); } - /* To prepare for enlargements of the mmaped area reserve some - address space. */ - size_t reserved = RESERVE_MMAP_SIZE; - int xflags = 0; - if (total < reserved - && ((p = mmap64 (NULL, reserved, PROT_NONE, MAP_PRIVATE | MAP_ANON, - -1, 0)) != MAP_FAILED)) - xflags = MAP_FIXED; - else - { - p = NULL; - reserved = total; - } + size_t reserved; + int xflags; + void *p = prepare_address_space (fd, total, &reserved, &xflags); /* Map the header and all the administration data structures. */ p = mmap64 (p, total, PROT_READ | PROT_WRITE, MAP_SHARED | xflags, fd, 0); @@ -605,20 +606,9 @@ open_archive (struct locarhandle *ah, bool readonly) ah->fd = fd; ah->mmaped = st.st_size; - /* To prepare for enlargements of the mmaped area reserve some - address space. */ - size_t reserved = RESERVE_MMAP_SIZE; - int xflags = 0; - void *p; - if (st.st_size < reserved - && ((p = mmap64 (NULL, reserved, PROT_NONE, MAP_PRIVATE | MAP_ANON, - -1, 0)) != MAP_FAILED)) - xflags = MAP_FIXED; - else - { - p = NULL; - reserved = st.st_size; - } + size_t reserved; + int xflags; + void *p = prepare_address_space (fd, st.st_size, &reserved, &xflags); /* Map the entire file. We might need to compare the category data in the file with the newly added data. */ -- cgit v1.1