diff options
| -rw-r--r-- | ChangeLog | 94 | ||||
| -rw-r--r-- | Make-dist | 2 | ||||
| -rw-r--r-- | NOTES | 36 | ||||
| -rw-r--r-- | ctype/ctype.h | 8 | ||||
| -rw-r--r-- | grp/fgetgrent_r.c | 43 | ||||
| -rw-r--r-- | inet/gethstent_r.c | 26 | ||||
| -rw-r--r-- | inet/getnetgrent_r.c | 155 | ||||
| -rw-r--r-- | inet/netgroup.h | 29 | ||||
| -rw-r--r-- | manual/creature.texi | 6 | ||||
| -rw-r--r-- | manual/libc.texinfo | 2 | ||||
| -rw-r--r-- | nss/getXXbyYY_r.c | 34 | ||||
| -rw-r--r-- | nss/getXXent_r.c | 88 | ||||
| -rw-r--r-- | nss/nss_files/files-XXX.c | 60 | ||||
| -rw-r--r-- | nss/nss_files/files-netgrp.c | 114 | ||||
| -rw-r--r-- | nss/nss_files/files-parse.c | 34 | ||||
| -rw-r--r-- | nss/nss_files/files-spwd.c | 3 | ||||
| -rw-r--r-- | nss/nsswitch.c | 34 | ||||
| -rw-r--r-- | pwd/fgetpwent_r.c | 60 | ||||
| -rwxr-xr-x | rellns-sh | 6 | ||||
| -rw-r--r-- | shadow/sgetspent_r.c | 57 | ||||
| -rw-r--r-- | signal/signal.h | 4 | ||||
| -rw-r--r-- | stdlib/test-canon.c | 2 | ||||
| -rw-r--r-- | sysdeps/posix/fpathconf.c | 18 | ||||
| -rw-r--r-- | sysdeps/stub/setenv.c | 2 | ||||
| -rw-r--r-- | sysdeps/unix/sysv/linux/Dist | 1 | ||||
| -rw-r--r-- | sysdeps/unix/sysv/linux/sys/mtio.h | 32 |
26 files changed, 622 insertions, 328 deletions
@@ -1,3 +1,96 @@ +Sun Nov 10 02:37:15 1996 Ulrich Drepper <drepper@cygnus.com> + + * inet/gethstent_r.c: Update copyright. + * nss/getXXbyYY_r.c: Likewise. + * nss/nsswitch.c: Likewise. + * nss/getXXent_r.c: Likewise. + * nss/nss_files/files-XXX.c: Likewise. + * nss/nss_files/files-netgroup.c: Likewise. + * nss/nss_files/files-parse.c: Likewise. + + * nss/getXXent_r.c: Change implementation. It's not necessary to + call all setXXent functions. Just find first available and + when necessary let getXXent_r call the others. + + * nss/nss_files/files-XXX.c: Make really reentrant. Now calls + of getXXent and getXXbyYY can be mixed. The cursor for traversing + the database with getXXent will be remembered. + + * stdlib/test-canon.c (cwd): Change size to PATH_MAX. + +Sat Nov 9 15:34:48 1996 Ulrich Drepper <drepper@cygnus.com> + + * sysdeps/unix/sysv/linux/Dist: Add sys/mtio.h. + * sysdeps/unix/sysv/linux/sys/mtio.h: New file. + + * signal/signal.h [__USE_BSD]: Add prototype for siggetmask. + +Fri Nov 8 13:29:30 1996 Ulrich Drepper <drepper@cygnus.com> + + * ctype/ctype.h (__isascii): Don't test for seventh bit not to be + set. Instead for none beside the first seven bits to be set. + X/Open allows the argument to be an `int' value. + Reported by Alain Williams <addw@phcomp.co.uk>. + (toascii, isascii): Define macro also when __USE_XOPEN. + + * sysdeps/posix/fpathconf.c: Use fstatfs to compute NAME_MAX, not + PATH_MAX. + +Thu Nov 7 03:04:29 1996 Ulrich Drepper <drepper@cygnus.com> + + * nss/getXXXent_r.c (SETFUNC_NAME): Reset `nip' after loop to + NULL so that GETFUNC will see first entry. + (ENDFUNC_NAME): Likewise. + + Rewrite Netgroups implementation to avoid global data. + * inet/netgroup.h: Add definition of name_list and struct + __netgrent. + Add prototypes for internal netgroup functions. + * nss/nss_files/files-netgroup.c (_nss_files_setnetgrent): Take + extra argument and use the included data instead of global vars. + (_nss_files_endnetgrent): Likewise. + (_nss_netgroup_parseline): Change to be static and use data + included in the RESULT structure. + * inet/getnetgrent_r.c (startp): Move into setup function. + (known_groups, needed_groups): new part of the __netgrent sruct. + (freememory): Take extra argument and use included data. + (__internal_endnetgrent): Likewise. + (internal_setnetgrent): Renamed to __internal_setnetgrent_reuse + and take extra argument. + (__internal_setnetgrent): New function. Call + __internal_setnetgrent_reuse after calling free_memory. + (setnetgrent): Only call __internal_setnetgrent. + (__getnetgrent_r): Split into two functions. __getnetgrent_r + calls __internal_getnetgrent after locking. + (innetgr): Use dynamic data only. I.e., innetgr now is fully + reentrant. + +Thu Nov 7 00:15:14 1996 Ulrich Drepper <drepper@cygnus.com> + + * sysdeps/stub/setenv.c: Correct typo: unseenv -> unsetenv. + Reported by Joshua Cowan <jcowan@jcowan.reslife.okstate.edu>. + +Wed Nov 6 13:13:37 1996 Ulrich Drepper <drepper@cygnus.com> + + * manual/creature.texi: Document that _GNU_SOURCE is no longer the + default when no *_SOURCE macro is given. + Reported by Karsten Weiss <karsten@addx.au.s.shuttle.de>. + * NOTES: remade from manual/creature.texi. + * manual/libc.texinfo: Add back line about GPL translation which + somehow got lost. + + * Make-dist (dist.tar): Depend on README being updated. + + * rellns-sh: Correct thinko in removing leading /. + Reported by Andreas Jaeger <aj@arthur.pfalz.de>. + + * pwd/fgetpwent_r.c: Recognize lines containing only names starting + with `+' or `-' in parser. + * grp/fgetgrent_r.c: Likewise. + * shadow/sgetspent_r.c: Likewise. + * nss/nss_files/files-spwd.c: Don't accept entries starting with + `+' or `-'. + Wed Nov 6 04:30:26 1996 Ulrich Drepper <drepper@cygnus.com> * sysdeps/unix/sysv/linux/syscalls.list: Add weak alias llseek for @@ -19,6 +112,7 @@ Tue Nov 5 23:38:28 1996 Ulrich Drepper <drepper@cygnus.com> if __USE_XOPEN_EXTENDED is defined. * io/Makefile (routines): Add lchown. + * sysdeps/stub/lchown.c: New file. * io/sys/poll.h: Add definition of POLLWRNORM. @@ -191,7 +191,7 @@ configure: configure.in aclocal.m4; $(autoconf-it) dist: $(tardir).tar.gz subdir_dist: dist.tar -dist.tar: $(tardir) $(+tsrcs) +dist.tar: README $(tardir) $(+tsrcs) tar chvf $@ $(addprefix $(tardir)/,$(filter-out $(tardir),$^)) $(tardir).tar: dist.tar subdir_dist @@ -53,12 +53,26 @@ self-contained way. - Macro: _SVID_SOURCE If you define this macro, functionality derived from SVID is - included as well as the ANSI C, POSIX.1, and POSIX.2 material. + included as well as the ANSI C, POSIX.1, POSIX.2, and X/Open + material. + + - Macro: _XOPEN_SOURCE + If you define these macro, functionality described in the X/Open + Portability Guide is included. This is an superset of the POSIX.1 + and POSIX.2 functionality and in fact `_POSIX_SOURCE' and + `_POSIX_C_SOURCE' get automatically be defined. + + But as the great unifaction of all Unices there is also + functionality only available in BSD and SVID is included. + + If the macro `_XOPEN_SOURCE_EXTENDED' is also defined, even more + functionality is available. The extra functions will make all + functions available which are necessary for the X/Open Unix brand. - Macro: _GNU_SOURCE If you define this macro, everything is included: ANSI C, POSIX.1, - POSIX.2, BSD, SVID, and GNU extensions. In the cases where POSIX.1 - conflicts with BSD, the POSIX definitions take precedence. + POSIX.2, BSD, SVID, X/Open, and GNU extensions. In the cases where + POSIX.1 conflicts with BSD, the POSIX definitions take precedence. If you want to get the full effect of `_GNU_SOURCE' but make the BSD definitions take precedence over the POSIX definitions, use @@ -73,9 +87,23 @@ self-contained way. compiler or linker. *Note:* If you forget to do this, you may get very strange errors at run time. + - Macro: _REENTRANT,_THREAD_SAFE + If you define one this macro, reentrant versions of several + functions get declared. Some of the functions are specified in + POSIX.1c but many others are only available on a few other systems + or are unique to GNU libc. The problem is that the + standardization of the thread safe C library interface still is + behind. + + Unlike on some other systems no special version of the C library + must be used for linking. There is only one version but while + compiling this it must have been specified to compile as thread + safe. + We recommend you use `_GNU_SOURCE' in new programs. If you don't specify the `-ansi' option to GCC and don't define any of these macros -explicitly, the effect is the same as defining `_GNU_SOURCE'. +explicitly, the effect is the same as defining `_POSIX_C_SOURCE' to 2 +and `_POSIX_SOURCE', `_SVID_SOURCE', and `_BSD_SOURCE' to 1. When you define a feature test macro to request a larger class of features, it is harmless to define in addition a feature test macro for diff --git a/ctype/ctype.h b/ctype/ctype.h index f4048b3dc7..64ca26e04f 100644 --- a/ctype/ctype.h +++ b/ctype/ctype.h @@ -78,8 +78,8 @@ extern __const int *__ctype_toupper; /* Case conversions. */ #define __isctype(c, type) \ (__ctype_b[(int) (c)] & (unsigned short int) type) -#define __isascii(c) (((c) & (1 << 7)) == 0) /* If high bit is set. */ -#define __toascii(c) ((c) & 0x7f) /* Mask off high bit. */ +#define __isascii(c) (((c) & ~0x7f) == 0) /* If C is a 7 bit value. */ +#define __toascii(c) ((c) & 0x7f) /* Mask off high bits. */ #define __tolower(c) ((int) __ctype_tolower[(int) (c)]) #define __toupper(c) ((int) __ctype_toupper[(int) (c)]) @@ -126,7 +126,7 @@ extern int toascii __P ((int __c)); #endif /* Use SVID or use misc. */ -#if defined(__USE_SVID) || defined(__USE_XOPEN) +#if defined(__USE_SVID) || defined(__USE_MISC) || defined(__USE_XOPEN) /* These are the same as `toupper' and `tolower'. */ __exctype (_toupper); __exctype (_tolower); @@ -152,7 +152,7 @@ __exctype (_tolower); #define tolower(c) __tolower(c) #define toupper(c) __toupper(c) -#if defined(__USE_SVID) || defined(__USE_MISC) +#if defined(__USE_SVID) || defined(__USE_MISC) || defined(__USE_XOPEN) #define isascii(c) __isascii(c) #define toascii(c) __toascii(c) #endif diff --git a/grp/fgetgrent_r.c b/grp/fgetgrent_r.c index e9a2c25a5a..dd74cfcd70 100644 --- a/grp/fgetgrent_r.c +++ b/grp/fgetgrent_r.c @@ -1,20 +1,20 @@ /* Copyright (C) 1991, 1996 Free Software Foundation, Inc. -This file is part of the GNU C Library. + 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. + 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. -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. + 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. -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., 675 Mass Ave, -Cambridge, MA 02139, USA. */ + 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. */ #include <ctype.h> #include <grp.h> @@ -33,11 +33,20 @@ struct grent_data {}; LINE_PARSER (, STRING_FIELD (result->gr_name, ISCOLON, 0); - STRING_FIELD (result->gr_passwd, ISCOLON, 0); - if (result->gr_name[0] == '+' || result->gr_name[0] == '-') - INT_FIELD_MAYBE_NULL (result->gr_gid, ISCOLON, 0, 10, , 0) + if (line[0] == '\0' + && (result->gr_name[0] == '+' || result->gr_name[0] == '-')) + { + result->gr_passwd = NULL; + result->gr_gid = 0; + } else - INT_FIELD (result->gr_gid, ISCOLON, 0, 10,) + { + STRING_FIELD (result->gr_passwd, ISCOLON, 0); + if (result->gr_name[0] == '+' || result->gr_name[0] == '-') + INT_FIELD_MAYBE_NULL (result->gr_gid, ISCOLON, 0, 10, , 0) + else + INT_FIELD (result->gr_gid, ISCOLON, 0, 10,) + } ) diff --git a/inet/gethstent_r.c b/inet/gethstent_r.c index f07601dfad..2c9f151a12 100644 --- a/inet/gethstent_r.c +++ b/inet/gethstent_r.c @@ -1,20 +1,20 @@ /* Copyright (C) 1996 Free Software Foundation, Inc. -This file is part of the GNU C Library. + 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. + 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. -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. + 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. -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 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. */ #include <netdb.h> diff --git a/inet/getnetgrent_r.c b/inet/getnetgrent_r.c index 7288dbeb4c..1848ad7f35 100644 --- a/inet/getnetgrent_r.c +++ b/inet/getnetgrent_r.c @@ -18,6 +18,7 @@ Boston, MA 02111-1307, USA. */ #include <libc-lock.h> #include <netdb.h> +#include <string.h> #include "netgroup.h" #include "nsswitch.h" @@ -28,18 +29,10 @@ __libc_lock_define_initialized (static, lock) /* This handle for the NSS data base is shared between all set/get/endXXXent functions. */ static service_user *nip; -/* Remember the first service_entry, it's always the same. */ -static service_user *startp; -/* A netgroup can consist of names of other netgroups. We have to - track which netgroups were read and which still have to be read. */ -struct name_list -{ - const char *name; - struct name_list *next; -}; -struct name_list *known_groups; -struct name_list *needed_groups; +/* The whole information for the set/get/endnetgrent functions are + kept in this structure. */ +static struct __netgrent dataset; /* The lookup function for the first entry of this service. */ @@ -52,7 +45,10 @@ extern int __nss_netgroup_lookup (service_user **nip, const char *name, static enum nss_status setup (void **fctp, const char *func_name, int all) { + /* Remember the first service_entry, it's always the same. */ + static service_user *startp = NULL; int no_more; + if (startp == NULL) { no_more = __nss_netgroup_lookup (&nip, func_name, fctp); @@ -74,29 +70,29 @@ setup (void **fctp, const char *func_name, int all) /* Free used memory. */ static void -free_memory (void) +free_memory (struct __netgrent *data) { - while (known_groups != NULL) + while (data->known_groups != NULL) { - struct name_list *tmp = known_groups; - known_groups = known_groups->next; + struct name_list *tmp = data->known_groups; + data->known_groups = data->known_groups->next; free (tmp->name); free (tmp); } - while (needed_groups != NULL) + while (data->needed_groups != NULL) { - struct name_list *tmp = needed_groups; - needed_groups = needed_groups->next; + struct name_list *tmp = data->needed_groups; + data->needed_groups = data->needed_groups->next; free (tmp->name); free (tmp); } } static int -internal_setnetgrent (const char *group) +__internal_setnetgrent_reuse (const char *group, struct __netgrent *datap) { - enum nss_status (*fct) (const char *); + enum nss_status (*fct) (const char *, struct __netgrent *); enum nss_status status = NSS_STATUS_UNAVAIL; struct name_list *new_elem; int no_more; @@ -106,7 +102,7 @@ internal_setnetgrent (const char *group) while (! no_more) { /* Ignore status, we force check in `__nss_next'. */ - status = (*fct) (group); + status = (*fct) (group, datap); no_more = __nss_next (&nip, "setnetgrent", (void **) &fct, status, 0); } @@ -121,24 +117,30 @@ internal_setnetgrent (const char *group) } else { - new_elem->next = known_groups; - known_groups = new_elem; + new_elem->next = datap->known_groups; + datap->known_groups = new_elem; } return status == NSS_STATUS_SUCCESS; } int +__internal_setnetgrent (const char *group, struct __netgrent *datap) +{ + /* Free list of all netgroup names from last run. */ + free_memory (datap); + + return __internal_setnetgrent_reuse (group, datap); +} + +int setnetgrent (const char *group) { int result; __libc_lock_lock (lock); - /* Free list of all netgroup names from last run. */ - free_memory (); - - result = internal_setnetgrent (group); + result = __internal_setnetgrent (group, &dataset); __libc_lock_unlock (lock); @@ -147,14 +149,12 @@ setnetgrent (const char *group) void -endnetgrent (void) +__internal_endnetgrent (struct __netgrent *datap) { service_user *old_nip; - enum nss_status (*fct) (void); + enum nss_status (*fct) (struct __netgrent *); int no_more; - __libc_lock_lock (lock); - /* Remember which was the last used service. */ old_nip = nip; @@ -163,66 +163,75 @@ endnetgrent (void) while (! no_more) { /* Ignore status, we force check in `__nss_next'. */ - (void) (*fct) (); + (void) (*fct) (datap); no_more = (nip == old_nip || __nss_next (&nip, "endnetgrent", (void **) &fct, 0, 1)); } /* Now free list of all netgroup names from last run. */ - free_memory (); + free_memory (datap); +} + + +void +endnetgrent (void) +{ + __libc_lock_lock (lock); + + __internal_endnetgrent (&dataset); __libc_lock_unlock (lock); } int -__getnetgrent_r (char **hostp, char **userp, char **domainp, - char *buffer, size_t buflen) +__internal_getnetgrent (char **hostp, char **userp, char **domainp, + struct __netgrent *datap, + char *buffer, size_t buflen) { enum nss_status (*fct) (struct __netgrent *, char *, int); - struct __netgrent result; int no_more; /* Initialize status to return if no more functions are found. */ enum nss_status status = NSS_STATUS_NOTFOUND; - __libc_lock_lock (lock); - /* Run through available functions, starting with the same function last run. We will repeat each function as long as it succeeds, and then go on to the next service action. */ no_more = setup ((void **) &fct, "getnetgrent_r", 0); while (! no_more) { |
