Wed Sep 20 18:02:03 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>

* locale/locale.c: Include errno.h.
	* locale/localedef.c: Likewise.

Tue Sep 19 00:02:06 1995  Roland McGrath  <roland@churchy.gnu.ai.mit.edu>

	* Makefile (distclean-1): Remove config.cache, config.log, config.h.
	(parent-mostlyclean): Remove all flavors of the parent library.

	* misc/mntent.c (getmntent): Skip multiple whitespace chars
	between fields.

	* hurd/hurdstartup.c (_hurd_startup): If RPC returns
	EXEC_STACK_ARGS flag, get args from stack.
	If args on stack but have info from RPC, relocate args on stack to make
	space for struct hurd_startup_data.

	* elf/dl-object.c: Include errno.h.
	* posix/execvp.c: Likewise.
	* dirent/scandir.c: Likewise.
	* sysdeps/posix/system.c: Likewise.
	* sysdeps/generic/setenv.c: Likewise.
	* stdlib/msort.c: Likewise.
	* stdio/memstream.c: Likewise.
	* stdio/fclose.c: Likewise.
	* stdio/getdelim.c: Likewise.
	* stdio/setvbuf.c: Likewise.
	* sysdeps/ieee754/ldexp.c: Likewise.
	* locale/locfile-parse.c: Likewise.

	* stdlib/lcong48_r.c: Don't check for null argument; let it fault.
	* stdlib/seed48_r.c: Likewise.
	* stdlib/srand48_r.c: Likewise.
	* stdlib/jrand48_r.c: Likewise.
	* stdlib/nrand48_r.c: Likewise.

	* misc/search.h: Many decls for hsearch functions.
This commit is contained in:
Roland McGrath 1995-09-21 04:01:40 +00:00
parent bf40c56f1a
commit 600927014b
25 changed files with 228 additions and 90 deletions

View File

@ -1,5 +1,42 @@
Wed Sep 20 18:02:03 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
* locale/locale.c: Include errno.h.
* locale/localedef.c: Likewise.
Tue Sep 19 00:02:06 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
* Makefile (distclean-1): Remove config.cache, config.log, config.h.
(parent-mostlyclean): Remove all flavors of the parent library.
* misc/mntent.c (getmntent): Skip multiple whitespace chars
between fields.
* hurd/hurdstartup.c (_hurd_startup): If RPC returns
EXEC_STACK_ARGS flag, get args from stack.
If args on stack but have info from RPC, relocate args on stack to make
space for struct hurd_startup_data.
Mon Sep 18 15:06:00 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
* elf/dl-object.c: Include errno.h.
* posix/execvp.c: Likewise.
* dirent/scandir.c: Likewise.
* sysdeps/posix/system.c: Likewise.
* sysdeps/generic/setenv.c: Likewise.
* stdlib/msort.c: Likewise.
* stdio/memstream.c: Likewise.
* stdio/fclose.c: Likewise.
* stdio/getdelim.c: Likewise.
* stdio/setvbuf.c: Likewise.
* sysdeps/ieee754/ldexp.c: Likewise.
* locale/locfile-parse.c: Likewise.
* stdlib/lcong48_r.c: Don't check for null argument; let it fault.
* stdlib/seed48_r.c: Likewise.
* stdlib/srand48_r.c: Likewise.
* stdlib/jrand48_r.c: Likewise.
* stdlib/nrand48_r.c: Likewise.
* Makeconfig (+gccwarn): Remove -Wbad-function-cast, which seems
to be useless.
@ -77,6 +114,7 @@ Sat Sep 16 17:47:19 1995 Ulrich Drepper <drepper@ipd.info.uni-karlsruhe.de>
* misc/efgvt_r.c: New file. Reentrant version of [efg]cvt functions.
* misc/efgcvt.c: Rewrite to use reentrant functions.
* misc/search.h: Many decls for hsearch functions.
* misc/hsearch_r.c: New file. Reentrant version of functions from
hsearch family.
* misc/hsearch.c, misc/tsearch.c: New files.

View File

@ -174,7 +174,9 @@ $(all-subdirs-targets):
# Subroutines of all cleaning targets.
parent-mostlyclean: common-mostlyclean # common-mostlyclean is in Makerules.
-rm -f $(common-objpfx)libc.a $(addprefix $(objpfx),$(install-lib))
-rm -f $(foreach o,$(object-suffixes),\
$(common-objpfx)$(patsubst %,$(libtype$o),c)) \
$(addprefix $(objpfx),$(install-lib))
parent-clean: parent-mostlyclean common-clean
-rm -f $(addprefix $(common-objpfx),$(common-generated))
-rm -f $(addprefix $(objpfx),sysd-Makefile sysd-dirs sysd-rules)
@ -200,8 +202,8 @@ realclean distclean: parent-clean
# Subroutine of distclean and realclean.
distclean-1: subdir_$(distclean-1)
-rm -f $(config-generated)
-rm -f $(addprefix $(objpfx),config.status cache.cache)
-rm -f $(addprefix $(objpfx),config.make config-name.h)
-rm -f $(addprefix $(objpfx),config.status config.cache config.log)
-rm -f $(addprefix $(objpfx),config.make config-name.h config.h)
ifdef objdir
-rm -f $(objpfx)Makefile
endif

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc.
/* Copyright (C) 1992, 1993, 1994, 1995 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
@ -19,6 +19,7 @@ Cambridge, MA 02139, USA. */
#include <ansidecl.h>
#include <dirent.h>
#include <stdlib.h>
#include <errno.h>
int
DEFUN(scandir, (dir, namelist, select, cmp),

View File

@ -21,6 +21,7 @@ Cambridge, MA 02139, USA. */
#include <assert.h>
#include <string.h>
#include <stdlib.h>
#include <errno.h>
/* List of objects currently loaded. */

View File

@ -99,13 +99,13 @@ _hurd_startup (void **argptr, void (*main) (int *data))
__mach_port_deallocate (__mach_task_self (), in_bootstrap);
}
if (err || in_bootstrap == MACH_PORT_NULL)
if (err || in_bootstrap == MACH_PORT_NULL || (data.flags & EXEC_STACK_ARGS))
{
/* Either we have no bootstrap port, or the RPC to the exec server
failed. Try to snarf the args in the canonical Mach way.
failed, or whoever started us up passed the flag saying args are
on the stack. Try to snarf the args in the canonical Mach way.
Hopefully either they will be on the stack as expected, or the
stack will be zeros so we don't crash. Set all our other
variables to have empty information. */
stack will be zeros so we don't crash. */
argcptr = (int *) argptr;
argc = argcptr[0];
@ -114,26 +114,12 @@ _hurd_startup (void **argptr, void (*main) (int *data))
envc = 0;
while (envp[envc])
++envc;
data.flags = 0;
args = env = NULL;
argslen = envlen = 0;
data.dtable = NULL;
data.dtablesize = 0;
data.portarray = NULL;
data.portarraysize = 0;
data.intarray = NULL;
data.intarraysize = 0;
}
else
argv = envp = NULL;
/* Turn the block of null-separated strings we were passed for the
arguments and environment into vectors of pointers to strings. */
if (! argv)
{
/* Turn the block of null-separated strings we were passed for the
arguments and environment into vectors of pointers to strings. */
/* Count up the arguments so we can allocate ARGV. */
argc = _hurd_split_args (args, argslen, NULL);
/* Count up the environment variables so we can allocate ENVP. */
@ -155,6 +141,41 @@ _hurd_startup (void **argptr, void (*main) (int *data))
_hurd_split_args (env, envlen, envp);
}
if (err || in_bootstrap == MACH_PORT_NULL)
{
/* Either we have no bootstrap port, or the RPC to the exec server
failed. Set all our other variables to have empty information. */
data.flags = 0;
args = env = NULL;
argslen = envlen = 0;
data.dtable = NULL;
data.dtablesize = 0;
data.portarray = NULL;
data.portarraysize = 0;
data.intarray = NULL;
data.intarraysize = 0;
}
else if ((void *) &envp[envc + 1] == argv[0])
{
/* The arguments arrived on the stack from the kernel, but our
protocol requires some space after them for a `struct
hurd_startup_data'. Move them. */
struct
{
int count;
char *argv[argc + 1];
char *envp[envc + 1];
struct hurd_startup_data data;
} *args = alloca (sizeof *args);
if ((void *) &args[1] == (void *) argcptr)
args = alloca (-((char *) &args->data - (char *) args));
memmove (args, argcptr, (char *) &args->data - (char *) args);
argcptr = (void *) args;
argv = args->argv;
envp = args->envp;
}
{
struct hurd_startup_data *d = (void *) &envp[envc + 1];

View File

@ -24,6 +24,7 @@ Cambridge, MA 02139, USA. */
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include "localedef.h"

View File

@ -24,6 +24,7 @@ Cambridge, MA 02139, USA. */
#include <string.h>
#include <unistd.h>
#include <sys/stat.h>
#include <errno.h>
#include "error.h"
#include "localedef.h"

View File

@ -15,6 +15,7 @@ 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. */
#include <errno.h>
#include <assert.h>
#include <dirent.h>
#include <fcntl.h>

View File

@ -241,13 +241,15 @@ These facilities are declared in the header file @file{time.h}.
@comment time.h
@comment ANSI
@deftp {Data Type} time_t
This is the data type used to represent calendar time. In the GNU C
library and other POSIX-compliant implementations, @code{time_t} is
equivalent to @code{long int}. When interpreted as an absolute time
This is the data type used to represent calendar time.
When interpreted as an absolute time
value, it represents the number of seconds elapsed since 00:00:00 on
January 1, 1970, Coordinated Universal Time. (This date is sometimes
referred to as the @dfn{epoch}.)
referred to as the @dfn{epoch}.) POSIX requires that this count
ignore leap seconds, but on some hosts this count includes leap seconds
if you set @code{TZ} to certain values (@pxref{TZ Variable}).
In the GNU C library, @code{time_t} is equivalent to @code{long int}.
In other systems, @code{time_t} might be either an integer or
floating-point type.
@end deftp
@ -257,7 +259,8 @@ floating-point type.
@deftypefun double difftime (time_t @var{time1}, time_t @var{time0})
The @code{difftime} function returns the number of seconds elapsed
between time @var{time1} and time @var{time0}, as a value of type
@code{double}.
@code{double}. The difference ignores leap seconds unless leap
second support is enabled.
In the GNU system, you can simply subtract @code{time_t} values. But on
other systems, the @code{time_t} data type might use some other encoding
@ -462,8 +465,8 @@ contains at least the following members, which can appear in any order:
@table @code
@item int tm_sec
This is the number of seconds after the minute, normally in the range
@code{0} to @code{59}. (The actual upper limit is @code{61}, to allow
for ``leap seconds''.)
@code{0} to @code{59}. (The actual upper limit is @code{60}, to allow
for leap seconds if leap second support is available.)
@cindex leap second
@item int tm_min
@ -508,7 +511,7 @@ also think of this as the ``number of seconds west'' of GMT. The
@code{tm_gmtoff} field is a GNU library extension.
@item const char *tm_zone
This field is the three-letter name for the time zone that was used to
This field is the name for the time zone that was used to
compute this broken-down time value. It is a GNU library extension.
@end table
@end deftp
@ -521,9 +524,9 @@ The @code{localtime} function converts the calendar time pointed to by
user's specified time zone.
The return value is a pointer to a static broken-down time structure, which
might be overwritten by subsequent calls to any of the date and time
functions. (But no other library function overwrites the contents of this
object.)
might be overwritten by subsequent calls to @code{ctime}, @code{gmtime},
or @code{localtime}. (But no other library function overwrites the contents
of this object.)
Calling @code{localtime} has one other effect: it sets the variable
@code{tzname} with information about the current time zone. @xref{Time
@ -590,7 +593,7 @@ The abbreviations for the months are: @samp{Jan}, @samp{Feb},
@samp{Sep}, @samp{Oct}, @samp{Nov}, and @samp{Dec}.
The return value points to a statically allocated string, which might be
overwritten by subsequent calls to any of the date and time functions.
overwritten by subsequent calls to @code{asctime} or @code{ctime}.
(But no other library function overwrites the contents of this
string.)
@end deftypefun
@ -870,7 +873,7 @@ community of volunteers and put in the public domain.
@comment POSIX.1
@deftypevar char * tzname [2]
The array @code{tzname} contains two strings, which are the standard
three-letter names of the pair of time zones (standard and daylight
names of the pair of time zones (standard and daylight
savings) that the user has selected. @code{tzname[0]} is the name of
the standard time zone (for example, @code{"EST"}), and @code{tzname[1]}
is the name for the time zone when daylight savings time is in use (for
@ -893,7 +896,7 @@ depend on the time zone.
@end deftypefun
The following variables are defined for compatibility with System V
Unix. These variables are set by calling @code{localtime}.
Unix. These variables are set by calling @code{tzset}.
@comment time.h
@comment SVID
@ -906,8 +909,10 @@ seconds. For example, in the U.S. Eastern time zone, the value is
@comment time.h
@comment SVID
@deftypevar int daylight
This variable has a nonzero value if the standard U.S. daylight savings
time rules apply.
This variable has a nonzero value if daylight savings time rules apply.
A nonzero value does not necessarily mean that daylight savings time is
now in effect; it means only that daylight savings time is sometimes in
effect.
@end deftypevar
@node Time Functions Example

View File

@ -53,14 +53,20 @@ getmntent (FILE *stream)
if (getline (&buf, &bufsiz, stream) < 0)
return NULL;
head = buf;
head = buf + strspn (buf, " \t");
} while (head[0] == '#'); /* Skip comment lines. */
m.mnt_fsname = strsep (&head, " \t") ?: (char *) "";
if (head)
head += strspn (head, " \t");
m.mnt_dir = strsep (&head, " \t") ?: (char *) "";
if (head)
head += strspn (head, " \t");
m.mnt_type = strsep (&head, " \t") ?: (char *) "";
if (head)
head += strspn (head, " \t");
m.mnt_opts = strsep (&head, " \t") ?: (char *) "";
switch (sscanf (head, "%d %d\n", &m.mnt_freq, &m.mnt_passno))
switch (head ? sscanf (head, " %d %d\n", &m.mnt_freq, &m.mnt_passno) : 0)
{
case 0:
m.mnt_freq = 0;

View File

@ -1,4 +1,4 @@
/* search.h -- declarations for `insque' and `remque'
/* search.h -- declarations for System V style searching functions.
Copyright (C) 1995 Free Software Foundation, Inc.
This file is part of the GNU C Library.
@ -14,16 +14,18 @@ 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. */
/* These functions are provided for compatibility with BSD. */
not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#ifndef _SEARCH_H
#define _SEARCH_H 1
#include <sys/cdefs.h>
#define __need_size_t
#define __need_NULL
#include <stddef.h>
__BEGIN_DECLS
/* Prototype structure for a linked-list data structure.
@ -41,9 +43,94 @@ struct qelem
extern void insque __P ((struct qelem *__elem, struct qelem *__prev));
/* Unlink ELEM from the doubly-linked list that it is in. */
extern void remque __P ((struct qelem *elem));
extern void remque __P ((struct qelem *__elem));
/* For use with hsearch(3). */
#ifndef __COMPAR_FN_T
#define __COMPAR_FN_T
typedef int (*__compar_fn_t) __P ((__const __ptr_t, __const __ptr_t));
#endif
/* Action which shall be performed in the call the hsearch. */
typedef enum
{
FIND,
ENTER
}
ACTION;
typedef struct entry
{
char *key;
char *data;
}
ENTRY;
/* Opaque type for internal use. */
struct _ENTRY;
/* Data type for reentrent functions. */
struct hsearch_data
{
struct _ENTRY *table;
unsigned int size;
unsigned int filled;
};
/* Family of hash table handling functions. The functions also have
reentrent counterparts ending with _r. */
extern ENTRY *hsearch __P ((ENTRY __item, ACTION __action));
extern int hcreate __P ((unsigned int __nel));
extern void hdestroy __P ((void));
extern int hsearch_r __P ((ENTRY __item, ACTION __action, ENTRY **__retval,
struct hsearch_data *__htab));
extern int hcreate_r __P ((unsigned int __nel, struct hsearch_data *htab));
extern void hdestroy_r __P ((struct hsearch_data *htab));
/* The tsearch routines are very interesting. They make many
assumptions about the compiler. It assumpts that the first field
in node must be the "key" field, which points to the datum.
Everything depends on that. */
/* For tsearch */
typedef enum
{
preorder,
postorder,
endorder,
leaf
}
VISIT;
extern void *tsearch __P ((__const void * __key, void **__rootp,
__compar_fn_t compar));
extern void *tfind __P ((__const void * __key, __const void ** __rootp,
__compar_fn_t compar));
extern void *tdelete __P ((__const void * __key, void ** __rootp,
__compar_fn_t compar));
#ifndef __ACTION_FN_T
#define __ACTION_FN_T
typedef void (*__action_fn_t) __P ((__const void *__nodep,
__const VISIT __value,
__const int __level));
#endif
extern void twalk __P ((__const void * __root, __action_fn_t action));
extern void * lfind __P ((__const void * __key, __const void * __base,
size_t * __nmemb, size_t __size,
__compar_fn_t __compar));
extern void * lsearch __P ((__const void * __key, __const void * __base,
size_t * __nmemb, size_t __size,
__compar_fn_t __compar));
__END_DECLS
#endif /* search.h */
#endif /* search.h */

View File

@ -20,6 +20,7 @@ Cambridge, MA 02139, USA. */
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
/* Execute FILE, searching in the `PATH' environment variable if it contains
no slashes, with arguments ARGV and environment from `environ'. */

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1991 Free Software Foundation, Inc.
/* Copyright (C) 1991, 1995 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
@ -21,6 +21,7 @@ Cambridge, MA 02139, USA. */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
/* Close a stream. */

View File

@ -22,6 +22,7 @@ Cambridge, MA 02139, USA. */
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include <errno.h>
/* Read up to (and including) a TERMINATOR from STREAM into *LINEPTR
(and null-terminate it). *LINEPTR is a pointer returned from malloc (or

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1991, 1992, 1994 Free Software Foundation, Inc.
/* Copyright (C) 1991, 1992, 1994, 1995 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
@ -20,6 +20,7 @@ Cambridge, MA 02139, USA. */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
struct memstream_info
{

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1991, 1993 Free Software Foundation, Inc.
/* Copyright (C) 1991, 1993, 1995 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
@ -20,6 +20,7 @@ Cambridge, MA 02139, USA. */
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
/* Make STREAM use the buffering method given in MODE.

View File

@ -25,13 +25,6 @@ jrand48_r (xsubi, buffer, result)
struct drand48_data *buffer;
long *result;
{
/* Be generous for the arguments, detect some errors. */
if (result == NULL)
{
errno = EFAULT;
return -1;
}
/* Compute next state. */
if (__drand48_iterate (xsubi, buffer) < 0)
return -1;

View File

@ -24,13 +24,6 @@ lcong48_r (param, buffer)
unsigned short int param[7];
struct drand48_data *buffer;
{
/* Be generous for the arguments, detect some errors. */
if (buffer == NULL)
{
errno = EFAULT;
return -1;
}
/* Store the given values. */
memcpy (buffer->X, &param[0], sizeof (buffer->X));
memcpy (buffer->a, &param[3], sizeof (buffer->a));

View File

@ -23,6 +23,7 @@ Cambridge, MA 02139, USA. */
#include <stdlib.h>
#include <string.h>
#include <memcopy.h>
#include <errno.h>
static void
DEFUN(msort_with_tmp, (b, n, s, cmp, t),

View File

@ -25,13 +25,6 @@ nrand48_r (xsubi, buffer, result)
struct drand48_data *buffer;
long *result;
{
/* Be generous for the arguments, detect some errors. */
if (result == NULL)
{
errno = EFAULT;
return -1;
}
/* Compute next state. */
if (__drand48_iterate (xsubi, buffer) < 0)
return -1;

View File

@ -24,13 +24,6 @@ seed48_r (seed16v, buffer)
unsigned short int seed16v[3];
struct drand48_data *buffer;
{
/* Be generous for the arguments, detect some errors. */
if (buffer == NULL)
{
errno = EFAULT;
return -1;
}
/* Save old value at a private place to be used as return value. */
memcpy (buffer->old_X, buffer->X, sizeof (buffer->X));

View File

@ -24,13 +24,6 @@ srand48_r (seedval, buffer)
long seedval;
struct drand48_data *buffer;
{
/* Be generous for the arguments, detect some errors. */
if (buffer == NULL)
{
errno = EFAULT;
return -1;
}
/* The standards say we only have 32 bits. */
if (sizeof (long) > 4)
seedval &= 0xffffffffl;

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1992 Free Software Foundation, Inc.
/* Copyright (C) 1992, 1995 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
@ -20,6 +20,7 @@ Cambridge, MA 02139, USA. */
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#ifndef HAVE_GNU_LD
#define __environ environ

View File

@ -38,6 +38,7 @@ Cambridge, MA 02139, USA. */
#include <ansidecl.h>
#include <math.h>
#include <float.h>
#include <errno.h>
#include "ieee754.h"
double

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1991, 1992, 1994 Free Software Foundation, Inc.
/* Copyright (C) 1991, 1992, 1994, 1995 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
@ -23,6 +23,7 @@ Cambridge, MA 02139, USA. */
#include <sys/wait.h>
#include <signal.h>
#include <sys/types.h>
#include <errno.h>
#ifndef HAVE_GNU_LD