diff options
42 files changed, 500 insertions, 234 deletions
@@ -1,3 +1,112 @@ +Thu Dec 12 03:32:21 1996 Ulrich Drepper <drepper@cygnus.com> + + * libio/_G_config.h: Add definition of _G_int16_t, _G_int32_t, + _G_uint16_t, _G_uin32_t, _G_HAVE_BOOL, _G_HAVE_MMAP, and + _G_ARGS. + + Change libio buffer handling to allocate internal buffers using + mmap if possible. + * libio/filedoalloc.c (_IO_file_doallocate): Change call to + ALLOC_BUF. + * libio/genops.c (_IO_setb, _IO_default_finish): Change call + to FREE_BUF. + (_IO_default_doallocate): Change call to ALLOC_BUF. + * libio/libioP.h: Change definition of ALLOC_BUF and FREE_BUF + to use mmap/munmap when possible. + * libio/memstream.c: Don't use ALLOC_BUF, but directly malloc. + * libio/vasprintf.c: Likewise. + Patch by HJ Lu. + + * libio/libio.h: Define NULL as __null only for gcc-2.8 and up. + * libio/libioP.h: Likewise. + + * libio/fileops.c (_IO_file_read, _IO_file_write): Don't + restart syscall when EINTR was returned. Necessary for POSIX.1. + + * libio/strops.c (_IO_str_overflow): Add cast to prevent warning. + + * new-malloc/malloc.c (heap_trim): Correctly place parentheses to + prevent warnings. + + * nis/Makefile: Remove rules for bsd-tools which are not part + of glibc. + Patch by Thorsten Kukuk. + + * nis/ypclnt.c: Add prototype for xdr_free. + Add const to first parameter for __yp_bind. + * nis/nss_compat/compat-pwd.c (getpwent_next_netgr, getpwent_next_nis, + getpwent_next_file): Variable `p2len' must have type size_t. + * nis/nss_nis/nis-alias.c: Add casts to prevent warnings. + * nis/nss_nis/nis-ethers.c: Likewise. + * nis/nss_nis/nis-grp.c: Likewise. + * nis/nss_nis/nis-hosts.c: Likewise. + * nis/nss_nis/nis-network.c: Likewise. + * nis/nss_nis/nis-proto.c: Likewise. + * nis/nss_nis/nis-pwd.c: Likewise. + * nis/nss_nis/nis-rpc.c: Likewise. + * nis/nss_nis/nis-service.c: Likewise. + * nis/nss_nis/nis-spwd.c: Likewise. + + * nis/rpcsvc/yp_prot.h (ypreq_key): Change type of members to + `const char *'. + (ypmaplist): Change member names to `map' and `next' and provide + #defines for old names. + Patch by Thorsten Kukuk. + + * nss/nss_files/files-parse.c (parse_line, parse_list): Change + type for `datalen' parameter to size_t. + + * shsdow/lckpwdf.c: Use fcntl forlocking, not flock. + + * stdio-common/printf.c [USE_IN_LIBIO]: Provide alias _IO_printf + for printf. + * stdio-common/sscanf.c [USE_IN_LIBIO]: Provide alias _IO_sscanf + for sscanf. + Patch by HJ Lu. + + * stdio-common/tmpfile.c: Update copyright. + + * stdio-common/vfscanf.c: Correctly handle EINTR error from fgetc + function. + Don't eat white space for `C' format. + + * stdlib/tst-strtol.c [~0UL != 0xffffffff]: Fix typo in test data. + + * sysdeps/generic/abort.c: Update copyright. De-ANSI-declfy. + * sysdeps/i386/abort.c: Removed. This version does not use + signal SIGABRT. + + * sysdeps/i386/fpu/__math.h: Define __NO_MATH_INLINES if not using + gcc-2.8 or up. + Patch by HJ Lu. + + * sysdeps/posix/tempname.c: Test for error but EEXIST after open + call. If EMFILE, ENFILE, or EINTR return with error. + +Wed Dec 11 14:43:52 1996 Ulrich Drepper <drepper@cygnus.com> + + * gnu-versions.h: Set _GNU_OBSTACK_INTERFACE_VERSION back to 1. + We are compatible again. + * new-malloc/obstack.h (struct obstack): Add back alloc_failed bit + even though it is not used. + * malloc/obstack.h: Likewise. + * new-malloc/obstack.c (_obstack_begin, _obstack_begin_1): Initialize + alloc_failed bit to 0. + + * time/strftime.c: Extend for Emacs' needs. Recognize field width, + %P format and `0' modifier. + +Tue Dec 10 21:20:44 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> + + * Makerules (make-link): Don't discard exit codes of intermediate + commands. Always use rellns-sh if symbolic links are available. + +Tue Dec 10 20:09:51 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> + + * sysdeps/unix/sysv/linux/netinet/in.h: Enclose #include + <linux/in.h> in __BEGIN_DECLS/__END_DECLS to avoid linkage + conflict of ntohs etc. in <asm/byteorder.h>. + Wed Dec 11 01:04:30 1996 Ulrich Drepper <drepper@cygnus.com> Add NIS NSS implementation. @@ -601,19 +601,15 @@ $(slibdir)/%.so: $(objpfx)%.so; $(do-install-program) ifneq ($(findstring -s,$(LN_S)),) define make-link -rm -f $@.new; \ -if test '$(@D)' = '$(<D)'; then \ - (cd $(@D); $(LN_S) $(<F) $(@F).new); \ -else \ - $(SHELL) $(..)rellns-sh $< $@.new; \ -fi; \ +rm -f $@.new +$(SHELL) $(..)rellns-sh $< $@.new mv -f $@.new $@ endef else # If we have no symbolic links don't bother with rellns-sh. define make-link -rm -f $@.new; \ -$(LN_S) $< $@.new; \ +rm -f $@.new +$(LN_S) $< $@.new mv -f $@.new $@ endef endif diff --git a/gnu-versions.h b/gnu-versions.h index 6cb5c70..15b0799 100644 --- a/gnu-versions.h +++ b/gnu-versions.h @@ -44,7 +44,7 @@ remember, if any of these versions change, the libc.so major version number must change too (so avoid it)! */ -#define _GNU_OBSTACK_INTERFACE_VERSION 2 /* vs malloc/obstack.c */ +#define _GNU_OBSTACK_INTERFACE_VERSION 1 /* vs malloc/obstack.c */ #define _GNU_REGEX_INTERFACE_VERSION 1 /* vs posix/regex.c */ #define _GNU_GLOB_INTERFACE_VERSION 1 /* vs posix/glob.c */ diff --git a/libio/_G_config.h b/libio/_G_config.h index 34d77e2..5fa7300 100644 --- a/libio/_G_config.h +++ b/libio/_G_config.h @@ -16,6 +16,13 @@ #define _G_pid_t __pid_t #define _G_uid_t __uid_t +typedef int _G_int16_t __attribute__ ((__mode__ (__HI__))); +typedef int _G_int32_t __attribute__ ((__mode__ (__SI__))); +typedef unsigned int _G_uint16_t __attribute__ ((__mode__ (__HI__))); +typedef unsigned int _G_uint32_t __attribute__ ((__mode__ (__SI__))); + +#define _G_HAVE_BOOL 1 + /* These library features are always available in the GNU C library. */ #define _G_HAVE_ATEXIT 1 @@ -25,6 +32,7 @@ #define _G_va_list __gnuc_va_list #define _G_HAVE_PRINTF_FP 1 +#define _G_HAVE_MMAP 1 /* This is defined by <statbuf.h> if `st_blksize' exists. */ #define _G_HAVE_ST_BLKSIZE defined (_STATBUF_ST_BLKSIZE) @@ -37,4 +45,10 @@ #define _G_VTABLE_LABEL_HAS_LENGTH 1 +#if defined (__cplusplus) || defined (__STDC__) +#define _G_ARGS(ARGLIST) ARGLIST +#else +#define _G_ARGS(ARGLIST) () +#endif + #endif /* _G_config.h */ diff --git a/libio/filedoalloc.c b/libio/filedoalloc.c index eee489b..f36bfb3 100644 --- a/libio/filedoalloc.c +++ b/libio/filedoalloc.c @@ -98,9 +98,7 @@ DEFUN(_IO_file_doallocate, (fp), size = _IO_BUFSIZ; #endif } - p = ALLOC_BUF(size); - if (p == NULL) - return EOF; + ALLOC_BUF(p, size, EOF); _IO_setb(fp, p, p+size, 1); if (couldbetty && __isatty (fp->_fileno)) fp->_flags |= _IO_LINE_BUF; diff --git a/libio/fileops.c b/libio/fileops.c index b5026e1..3294bef 100644 --- a/libio/fileops.c +++ b/libio/fileops.c @@ -547,7 +547,7 @@ DEFUN(_IO_file_read, (fp, buf, size), for (;;) { _IO_ssize_t count = _IO_read(fp->_fileno, buf, size); -#ifdef EINTR +#if 0 && defined EINTR if (count == -1 && errno == EINTR) continue; #endif @@ -586,7 +586,7 @@ DEFUN(_IO_file_write, (f, data, n), _IO_ssize_t count = _IO_write(f->_fileno, data, to_do); if (count == EOF) { -#ifdef EINTR +#if 0 && defined EINTR if (errno == EINTR) continue; else diff --git a/libio/genops.c b/libio/genops.c index 3a58cd2..52b8fc3 100644 --- a/libio/genops.c +++ b/libio/genops.c @@ -278,7 +278,7 @@ DEFUN(_IO_setb, (f, b, eb, a), _IO_FILE *f AND char *b AND char *eb AND int a) { if (f->_IO_buf_base && !(f->_flags & _IO_USER_BUF)) - FREE_BUF(f->_IO_buf_base); + FREE_BUF(f->_IO_buf_base, _IO_blen (f)); f->_IO_buf_base = b; f->_IO_buf_end = eb; if (a) @@ -438,9 +438,9 @@ int DEFUN(_IO_default_doallocate, (fp), _IO_FILE *fp) { - char *buf = ALLOC_BUF(_IO_BUFSIZ); - if (buf == NULL) - return EOF; + char *buf; + + ALLOC_BUF(buf, _IO_BUFSIZ, EOF); _IO_setb(fp, buf, buf+_IO_BUFSIZ, 1); return 1; } @@ -487,7 +487,7 @@ DEFUN(_IO_default_finish, (fp), struct _IO_marker *mark; if (fp->_IO_buf_base && !(fp->_flags & _IO_USER_BUF)) { - FREE_BUF(fp->_IO_buf_base); + FREE_BUF(fp->_IO_buf_base, _IO_blen (fp)); fp->_IO_buf_base = fp->_IO_buf_end = NULL; } diff --git a/libio/libio.h b/libio/libio.h index acc34c0..49f1d8c 100644 --- a/libio/libio.h +++ b/libio/libio.h @@ -83,7 +83,8 @@ the executable file might be covered by the GNU General Public License. */ #define EOF (-1) #endif #ifndef NULL -#ifdef __GNUG__ +#if defined __GNUG__ && \ + (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8)) #define NULL (__null) #else #if !defined(__cplusplus) diff --git a/libio/libioP.h b/libio/libioP.h index 008f9b7..c9a639a 100644 --- a/libio/libioP.h +++ b/libio/libioP.h @@ -396,7 +396,8 @@ extern void (*_IO_cleanup_registration_needed) __P ((void)); #define EOF (-1) #endif #ifndef NULL -#ifdef __GNUG__ +#if defined __GNUG__ && \ + (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8)) #define NULL (__null) #else #if !defined(__cplusplus) @@ -407,8 +408,52 @@ extern void (*_IO_cleanup_registration_needed) __P ((void)); #endif #endif -#define FREE_BUF(_B) free(_B) -#define ALLOC_BUF(_S) (char*)malloc(_S) +#if _G_HAVE_MMAP + +#include <unistd.h> +#include <fcntl.h> +#include <sys/mman.h> +#include <sys/param.h> + +#if !defined(MAP_ANONYMOUS) && defined(MAP_ANON) +#define MAP_ANONYMOUS MAP_ANON +#endif + +#if !defined(MAP_ANONYMOUS) || !defined(EXEC_PAGESIZE) +#undef _G_HAVE_MMAP +#define _G_HAVE_MMAP 0 +#endif + +#endif /* _G_HAVE_MMAP */ + +#if _G_HAVE_MMAP + +#define ROUND_TO_PAGE(_S) \ + (((_S) + EXEC_PAGESIZE - 1) & ~(EXEC_PAGESIZE - 1)) + +#define FREE_BUF(_B, _S) \ + munmap ((_B), ROUND_TO_PAGE (_S)) +#define ALLOC_BUF(_B, _S, _R) \ + do { \ + (_B) = (char *) mmap (0, ROUND_TO_PAGE (_S), \ + PROT_READ | PROT_WRITE, \ + MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); \ + if ((_B) == (char *) -1) \ + return (_R); \ + } while (0) + +#else /* _G_HAVE_MMAP */ + +#define FREE_BUF(_B, _S) \ + free(_B) +#define ALLOC_BUF(_B, _S, _R) \ + do { \ + (_B) = (char*)malloc(_S); \ + if ((_B) == NULL) \ + return (_R); \ + } while (0) + +#endif /* _G_HAVE_MMAP */ #ifndef OS_FSTAT #define OS_FSTAT fstat diff --git a/libio/memstream.c b/libio/memstream.c index ddcce67..e3c34d0 100644 --- a/libio/memstream.c +++ b/libio/memstream.c @@ -80,7 +80,9 @@ open_memstream (bufloc, sizeloc) new_f->fp._sf._sbf._f._lock = &new_f->lock; #endif - buf = ALLOC_BUF (_IO_BUFSIZ); + buf = malloc (_IO_BUFSIZ); + if (buf == NULL) + return NULL; _IO_init (&new_f->fp._sf._sbf._f, 0); _IO_JUMPS (&new_f->fp._sf._sbf._f) = &_IO_mem_jumps; _IO_str_init_static (&new_f->fp._sf._sbf._f, buf, _IO_BUFSIZ, buf); diff --git a/libio/strops.c b/libio/strops.c index 8a6c56d..281141e 100644 --- a/libio/strops.c +++ b/libio/strops.c @@ -124,7 +124,7 @@ DEFUN(_IO_str_overflow, (fp, c), fp->_IO_read_ptr = fp->_IO_read_end; } pos = fp->_IO_write_ptr - fp->_IO_write_base; - if (pos >= _IO_blen(fp) + flush_only) + if (pos >= (_IO_size_t) (_IO_blen(fp) + flush_only)) { if (fp->_flags & _IO_USER_BUF) /* not allowed to enlarge */ return EOF; diff --git a/libio/vasprintf.c b/libio/vasprintf.c index f8dba80..0228940 100644 --- a/libio/vasprintf.c +++ b/libio/vasprintf.c @@ -42,7 +42,7 @@ _IO_vasprintf (result_ptr, format, args) _IO_lock_t lock; #endif int ret; - string = ALLOC_BUF(init_string_size); + string = malloc (init_string_size); if (string == NULL) return -1; #ifdef _IO_MTSAFE_IO @@ -52,13 +52,14 @@ _IO_vasprintf (result_ptr, format, args) _IO_JUMPS((_IO_FILE*)&sf) = &_IO_str_jumps; _IO_str_init_static ((_IO_FILE*)&sf, string, init_string_size, string); sf._sbf._f._flags &= ~_IO_USER_BUF; - sf._s._allocate_buffer = (_IO_alloc_type)malloc; - sf._s._free_buffer = (_IO_free_type)free; + sf._s._allocate_buffer = (_IO_alloc_type) malloc; + sf._s._free_buffer = (_IO_free_type) free; ret = _IO_vfprintf((_IO_FILE*)&sf, format, args); if (ret < 0) return ret; - *result_ptr = (char*)realloc(sf._sbf._f._IO_buf_base, - (sf._sbf._f._IO_write_ptr - sf._sbf._f._IO_write_base) +1); + *result_ptr = (char *) realloc (sf._sbf._f._IO_buf_base, + (sf._sbf._f._IO_write_ptr + - sf._sbf._f._IO_write_base) +1); if (*result_ptr == NULL) *result_ptr = sf._sbf._f._IO_buf_base; (*result_ptr)[sf._sbf._f._IO_write_ptr-sf._sbf._f._IO_write_base] = '\0'; diff --git a/malloc/malloc.c b/malloc/malloc.c index 3e84354..8b99da9 100644 --- a/malloc/malloc.c +++ b/malloc/malloc.c @@ -3232,7 +3232,7 @@ heap_trim(heap, pad) heap_info *heap; size_t pad; assert(p->size == (0|PREV_INUSE)); /* must be fencepost */ p = prev_chunk(p); new_size = chunksize(p) + (MINSIZE-2*SIZE_SZ); - assert(new_size>0 && new_size<(long)2*MINSIZE); + assert(new_size>0 && new_size<(long int)(2*MINSIZE)); if(!prev_inuse(p)) new_size += p->prev_size; assert(new_size>0 && new_size<HEAP_MAX_SIZE); diff --git a/malloc/obstack.c b/malloc/obstack.c index cc41478..e059b5a 100644 --- a/malloc/obstack.c +++ b/malloc/obstack.c @@ -24,7 +24,7 @@ /* NOTE BEFORE MODIFYING THIS FILE: This version number must be incremented whenever callers compiled using an old obstack.h can no longer properly call the functions in this obstack.c. */ -#define OBSTACK_INTERFACE_VERSION 2 +#define OBSTACK_INTERFACE_VERSION 1 /* Comment out all this code if we are using the GNU C Library, and are not actually compiling the library itself, and the installed library @@ -171,6 +171,7 @@ _obstack_begin (h, size, alignment, chunkfun, freefun) chunk->prev = 0; /* The initial chunk now contains no empty object. */ h->maybe_empty_object = 0; + h->alloc_failed = 0; return 1; } @@ -220,6 +221,7 @@ _obstack_begin_1 (h, size, alignment, chunkfun, freefun, arg) chunk->prev = 0; /* The initial chunk now contains no empty object. */ h->maybe_empty_object = 0; + h->alloc_failed = 0; return 1; } diff --git a/malloc/obstack.h b/malloc/obstack.h index 152fbbc..2802888 100644 --- a/malloc/obstack.h +++ b/malloc/obstack.h @@ -183,6 +183,9 @@ struct obstack /* control current object in current chunk */ chunk contains a zero-length object. This prevents freeing the chunk if we allocate a bigger chunk to replace it. */ + unsigned alloc_failed:1; /* No longer used, as we now call the failed + handler on error, but retained for binary + compatibility. */ }; /* Declare the external functions we use; they are in obstack.c. */ diff --git a/nis/Makefile b/nis/Makefile index 475ee67..a6d4d4f 100644 --- a/nis/Makefile +++ b/nis/Makefile @@ -36,12 +36,8 @@ extra-libs = libnsl $(services:%=libnss_%) # the `lib' pass, because they depend on libc.so being built already. extra-libs-others = $(extra-libs) -others = ypcat ypmatch yppoll ypset ypwhich -install-bin = ypcat ypmatch ypwhich -install-sbin = ypset yppoll - # The sources are found in the appropriate subdir. -subdir-dirs = bsd-tools $(services:%=nss_%) +subdir-dirs = $(services:%=nss_%) vpath %.c $(subdir-dirs) libnsl-routines = yp_xdr ypclnt ypupdate_xdr @@ -69,15 +65,9 @@ CFLAGS-nis-pwd.c = -Wno-strict-prototypes CFLAGS-nis-rpc.c = -Wno-strict-prototypes CFLAGS-nis-service.c = -Wno-strict-prototypes CFLAGS-nis-spwd.c = -Wno-strict-prototypes -CFLAGS-ypclnt.c = -Wno-strict-prototypes -Wno-write-strings -CFLAGS-yp_xdr.c = -Wno-strict-prototypes -CFLAGS-ypupdate_xdr.c = -Wno-strict-prototypes -CFLAGS-ypcat.c = -Wno-strict-prototypes -CFLAGS-ypmatch.c = -Wno-strict-prototypes -CFLAGS-ypwhich.c = -Wno-strict-prototypes -CFLAGS-ypset.c = -Wno-strict-prototypes -CFLAGS-yppoll.c = -Wno-strict-prototypes - +CFLAGS-ypclnt.c = -Wno-strict-prototypes -Wno-write-strings -Irpcsvc +CFLAGS-yp_xdr.c = -Wno-strict-prototypes -Irpcsvc +CFLAGS-ypupdate_xdr.c = -Wno-strict-prototypes -Irpcsvc include ../Rules diff --git a/nis/nss_compat/compat-pwd.c b/nis/nss_compat/compat-pwd.c index 503aafb..39ee2c5 100644 --- a/nis/nss_compat/compat-pwd.c +++ b/nis/nss_compat/compat-pwd.c @@ -270,7 +270,8 @@ getpwent_next_netgr (struct passwd *result, ent_t *ent, char *group, char *buffer, size_t buflen) { char *ypdomain, *host, *user, *domain, *outval, *p, *p2; - int status, outvallen, p2len; + int status, outvallen; + size_t p2len; if (yp_get_default_domain (&ypdomain) != YPERR_SUCCESS) { @@ -337,7 +338,8 @@ getpwent_next_nis (struct passwd *result, ent_t *ent, char *buffer, size_t buflen) { char *domain, *outkey, *outval, *p, *p2; - int outkeylen, outvallen, p2len; + int outkeylen, outvallen; + size_t p2len; if (yp_get_default_domain (&domain) != YPERR_SUCCESS) { @@ -413,7 +415,7 @@ getpwent_next_file (struct passwd *result, ent_t *ent, while (1) { char *p, *p2; - int p2len; + size_t p2len; do { diff --git a/nis/nss_nis/nis-alias.c b/nis/nss_nis/nis-alias.c index af83d9c..df884d6 100644 --- a/nis/nss_nis/nis-alias.c +++ b/nis/nss_nis/nis-alias.c @@ -172,7 +172,7 @@ internal_nis_getaliasent_r (struct aliasent *alias, char *buffer, return retval; } - if (len + 1 > buflen) + if ((size_t) (len + 1) > buflen) { free (result); __set_errno (ERANGE); @@ -244,7 +244,7 @@ _nss_nis_getaliasbyname_r (const char *name, struct aliasent *alias, return retval; } - if (len + 1 > buflen) + if ((size_t) (len + 1) > buflen) { free (result); __set_errno (ERANGE); diff --git a/nis/nss_nis/nis-ethers.c b/nis/nss_nis/nis-ethers.c index 2644972..ae3ba76 100644 --- a/nis/nss_nis/nis-ethers.c +++ b/nis/nss_nis/nis-ethers.c @@ -107,7 +107,7 @@ internal_nis_getetherent_r (struct ether *eth, char *buffer, size_t buflen) return retval; } - if (len + 1 > buflen) + if ((size_t) (len + 1) > buflen) { free (result); __set_errno (ERANGE); @@ -175,7 +175,7 @@ _nss_nis_getethernam_r (const char *name, struct ether *eth, return retval; } - if (len + 1 > buflen) + if ((size_t) (len + 1) > buflen) { free (result); __set_errno (ERANGE); @@ -237,7 +237,7 @@ _nss_nis_getetherbyaddr_r (struct ether_addr *addr, struct ether *eth, return retval; } - if (len + 1 > buflen) + if ((size_t) (len + 1) > buflen) { free (result); __set_errno (ERANGE); diff --git a/nis/nss_nis/nis-grp.c b/nis/nss_nis/nis-grp.c index 1bab862..72de8b3 100644 --- a/nis/nss_nis/nis-grp.c +++ b/nis/nss_nis/nis-grp.c @@ -101,7 +101,7 @@ internal_nis_getgrent_r (struct group *grp, char *buffer, size_t buflen) return retval; } - if (len + 1 > buflen) + if ((size_t) (len + 1) > buflen) { free (result); __set_errno (ERANGE); @@ -169,7 +169,7 @@ _nss_nis_getgrnam_r (const char *name, struct group *grp, return retval; } - if (len + 1 > buflen) + if ((size_t) (len + 1) > buflen) { free (result); __set_errno (ERANGE); @@ -219,7 +219,7 @@ _nss_nis_getgrgid_r (gid_t gid, struct group *grp, return retval; } - if (len + 1 > buflen) + if ((size_t) (len + 1) > buflen) { free (result); __set_errno (ERANGE); diff --git a/nis/nss_nis/nis-hosts.c b/nis/nss_nis/nis-hosts.c index 9adce18..bab7f4c 100644 --- a/nis/nss_nis/nis-hosts.c +++ b/nis/nss_nis/nis-hosts.c @@ -195,7 +195,7 @@ internal_nis_gethostent_r (struct hostent *host, char *buffer, return retval; } - if (len + 1 > linebuflen) + if ((size_t) (len + 1) > linebuflen) { free (result); *h_errnop = NETDB_INTERNAL; @@ -281,7 +281,7 @@ _nss_nis_gethostbyname_r (const char *name, struct hostent *host, return retval; } - if (len + 1 > linebuflen) + if ((size_t) (len + 1) > linebuflen) { free (result); *h_errnop = NETDB_INTERNAL; @@ -354,7 +354,7 @@ _nss_nis_gethostbyaddr_r (char *addr, int addrlen, int type, return retval; } - if (len + 1 > linebuflen) + if ((size_t) (len + 1) > linebuflen) { free (result); __set_errno (ERANGE); diff --git a/nis/nss_nis/nis-network.c b/nis/nss_nis/nis-network.c index 2795feb..e82b401 100644 --- a/nis/nss_nis/nis-network.c +++ b/nis/nss_nis/nis-network.c @@ -106,7 +106,7 @@ internal_nis_getnetent_r (struct netent *net, char *buffer, size_t buflen, return retval; } - if (len + 1 > buflen) + if ((size_t) (len + 1) > buflen) { free (result); __set_errno (ERANGE); @@ -183,7 +183,7 @@ _nss_nis_getnetbyname_r (const char *name, struct netent *net, return retval; } - if (len + 1 > buflen) + if ((size_t) (len + 1) > buflen) { free (result); __set_errno (ERANGE); @@ -261,7 +261,7 @@ _nss_nis_getnetbyaddr_r (unsigned long addr, int type, struct netent *net, } } - if (len + 1 > buflen) + if ((size_t) (len + 1) > buflen) { free (result); __set_errno (ERANGE); diff --git a/nis/nss_nis/nis-proto.c b/nis/nss_nis/nis-proto.c index f62dfb1..6feae63 100644 --- a/nis/nss_nis/nis-proto.c +++ b/nis/nss_nis/nis-proto.c @@ -101,7 +101,7 @@ internal_nis_getprotoent_r (struct protoent *proto, return retval; } - if (len + 1 > buflen) + if ((size_t) (len + 1) > buflen) { free (result); __set_errno (ERANGE); @@ -169,7 +169,7 @@ _nss_nis_getprotobyname_r (const char *name, struct protoent *proto, return retval; } - if (len + 1 > buflen) + if ((size_t) (len + 1) > buflen) { free (result); __set_errno (ERANGE); @@ -219,7 +219,7 @@ _nss_nis_getprotobynumber_r (int number, struct protoent *proto, return retval; } - if (len + 1 > buflen) + if ((size_t) (len + 1) > buflen) { free (result); __set_errno (ERANGE); diff --git a/nis/nss_nis/nis-pwd.c b/nis/nss_nis/nis-pwd.c index afcc7a4..752f703 100644 --- a/nis/nss_nis/nis-pwd.c +++ b/nis/nss_nis/nis-pwd.c @@ -101,7 +101,7 @@ internal_nis_getpwent_r (struct passwd *pwd, char *buffer, size_t buflen) return retval; } - if (len + 1 > buflen) + if ((size_t) (len + 1) > buflen) { free (result); __set_errno (ERANGE); @@ -169,7 +169,7 @@ _nss_nis_getpwnam_r (const char *name, struct passwd *pwd, return retval; } - if (len + 1 > buflen) + if ((size_t) (len + 1) > buflen) { free (result); __set_errno (ERANGE); @@ -219,7 +219,7 @@ _nss_nis_getpwuid_r (uid_t uid, struct passwd *pwd, return retval; } - if (len + 1 > buflen) + if ((size_t) (len + 1) > buflen) { free (result); __set_errno (ERANGE); diff --git a/nis/nss_nis/nis-rpc.c b/nis/nss_nis/nis-rpc.c index 91f54be..a549076 100644 --- a/nis/nss_nis/nis-rpc.c +++ b/nis/nss_nis/nis-rpc.c @@ -128,7 +128,7 @@ internal_nis_getrpcent_r (struct rpcent *rpc, char *buffer, size_t buflen, return retval; } - if (len + 1 > buflen) + if ((size_t) (len + 1) > buflen) { free (result); __set_errno (ERANGE); @@ -243,7 +243,7 @@ _nss_nis_getrpcbynumber_r (int number, struct rpcent *rpc, return retval; } - if (len + 1 > buflen) + if ((size_t) (len + 1) > buflen) { free (result); __set_errno (ERANGE); diff --git a/nis/nss_nis/nis-service.c b/nis/nss_nis/nis-service.c index 03a9fbf..6d07479 100644 --- a/nis/nss_nis/nis-service.c +++ b/nis/nss_nis/nis-service.c @@ -28,6 +28,13 @@ #include "nss-nis.h" + +/* The parser is defined in a different module. */ +extern int _nss_files_parse_servent (char *line, struct servent *result, + char *data, size_t datalen); + + + __libc_lock_define_initialized (static, lock) struct intern_t @@ -127,7 +134,7 @@ internal_nis_getservent_r (struct servent *serv, char *buffer, return retval; } - if (len + 1 > buflen) + if ((size_t) (len + 1) > buflen) { free (result); __set_errno (ERANGE); diff --git a/nis/nss_nis/nis-spwd.c b/nis/nss_nis/nis-spwd.c index 9284892..b5f8c3a 100644 --- a/nis/nss_nis/nis-spwd.c +++ b/nis/nss_nis/nis-spwd.c @@ -101,7 +101,7 @@ internal_nis_getspent_r (struct spwd *sp, char *buffer, size_t buflen) return retval; } - if (len + 1 > buflen) + if ((size_t) (len + 1) > buflen) { free (result); __set_errno (ERANGE); @@ -169,7 +169,7 @@ _nss_nis_getspnam_r (const char *name, struct spwd *sp, return retval; } - if (len + 1 > buflen) + if ((size_t) (len + 1) > buflen) { free (result); __set_errno (ERANGE); diff --git a/nis/rpcsvc/yp_prot.h b/nis/rpcsvc/yp_prot.h index 60c24a2..a52b43f 100644 --- a/nis/rpcsvc/yp_prot.h +++ b/nis/rpcsvc/yp_prot.h @@ -1,7 +1,7 @@ /* * This file contains symbols and structures defining the rpc protocol * between the NIS clients and the NIS servers. The servers - * are the NIS database servers, and the NIS binders. + * are the NIS database servers, and the NIS binders. */ #ifndef _RPCSVC_YP_PROT_H @@ -14,24 +14,24 @@ /* * The following procedures are supported by the protocol: - * + * * YPPROC_NULL() returns () takes nothing, returns nothing. This indicates * that the NIS server is alive. - * + * * YPPROC_DOMAIN (char *) returns (bool_t) TRUE. Indicates that the * responding NIS server does serve the named domain; FALSE indicates no * support. - * + * * YPPROC_DOMAIN_NONACK (char *) returns (TRUE) if the NIS server does serve * the named domain, otherwise does not return. Used in the broadcast case. - * + * * YPPROC_MATCH (struct ypreq_key) returns (struct ypresp_val). Returns the * right-hand value for a passed left-hand key, within a named map and * domain. - * + * * YPPROC_FIRST (struct ypreq_nokey) returns (struct ypresp_key_val). * Returns the first key-value pair from a named domain and map. - * + * * YPPROC_NEXT (struct ypreq_key) returns (struct ypresp_key_val). Returns * the key-value pair following a passed key-value pair within a named * domain and map. @@ -42,7 +42,7 @@ * YPPROC_CLEAR takes nothing, returns nothing. Instructs a NIS server to * close the current map, so that old versions of the disk file don't get * held open. - * + * * YPPROC_ALL (struct ypreq_nokey), returns * union switch (bool_t more) { * TRUE: (struct ypresp_key_val); @@ -89,8 +89,8 @@ struct ypmap_parms { */ struct ypreq_key { - char *domain; - char *map; + const char *domain; + const char *map; datum keydat; }; @@ -144,8 +144,10 @@ struct ypresp_order { }; struct ypmaplist { - char ypml_name[YPMAXMAP + 1]; - struct ypmaplist *ypml_next; + char map[YPMAXMAP + 1]; +#define ypml_name map + struct ypmaplist *next; +#define ypml_next next }; struct ypresp_maplist { @@ -201,7 +203,7 @@ struct ypresp_maplist { * * YPBINDPROC_SETDOM takes (struct ypbind_setdom) returns nothing */ - + /* Program and version symbols, magic numbers */ #define YPBINDPROG ((u_long)100007) diff --git a/nis/ypclnt.c b/nis/ypclnt.c index 3e05cf9..8e24ca4 100644 --- a/nis/ypclnt.c +++ b/nis/ypclnt.c @@ -42,8 +42,10 @@ static char __ypdomainname[MAXHOSTNAMELEN + 1] = "\0"; __libc_lock_define_initialized (static, ypbindlist_lock) static dom_binding *__ypbindlist = NULL; +extern void xdr_free (xdrproc_t proc, char *objp); + static int -__yp_bind (char *domain, dom_binding ** ypdb) +__yp_bind (const char *domain, dom_binding ** ypdb) { struct sockaddr_in clnt_saddr; struct ypbind_resp ypbr; diff --git a/nss/nss_files/files-parse.c b/nss/nss_files/files-parse.c index 83a80f3..2e84d76 100644 --- a/nss/nss_files/files-parse.c +++ b/nss/nss_files/files-parse.c @@ -69,7 +69,7 @@ struct parser_data /* The parser is defined in a different module. */ extern int parse_line (char *line, struct STRUCTURE *result, - struct parser_data *data, int datalen); + struct parser_data *data, size_t datalen); # define LINE_PARSER(EOLSET, BODY) /* Do nothing */ @@ -80,7 +80,7 @@ extern int parse_line (char *line, struct STRUCTURE *result, # define LINE_PARSER(EOLSET, BODY) \ parser_stclass int \ parse_line (char *line, struct STRUCTURE *result, \ - struct parser_data *data, int datalen) \ + struct parser_data *data, size_t datalen) \ { \ ENTDATA_DECL (data) \ char *p = strpbrk (line, EOLSET "\n"); \ @@ -156,7 +156,7 @@ parse_line (char *line, struct STRUCTURE *result, \ } static inline char ** -parse_list (char *line, struct parser_data *data, int datalen) +parse_list (char *line, struct parser_data *data, size_t datalen) { char *eol, **list, **p; @@ -180,7 +180,7 @@ parse_list (char *line, struct parser_data *data, int datalen) { char *elt; - if ((char *) &p[1] - (char *) data > datalen) + if ((size_t) ((char *) &p[1] - (char *) data) > datalen) { /* We cannot fit another pointer in the buffer. */ __set_errno (ERANGE); diff --git a/shadow/lckpwdf.c b/shadow/lckpwdf.c index d21a744..ffe157e 100644 --- a/shadow/lckpwdf.c +++ b/shadow/lckpwdf.c @@ -86,6 +86,7 @@ __lckpwdf () struct sigaction saved_act; /* Saved signal action. */ sigset_t new_set; /* New set of caught signals. */ struct sigaction new_act; /* New signal action. */ + struct flock fl; /* Information struct for locking. */ int result; if (lock_fd != -1) @@ -139,7 +140,10 @@ __lckpwdf () alarm (TIMEOUT); /* Try to get the lock. */ - result = flock (lock_fd, LOCK_EX); + memset (&fl, '\0', sizeof (struct flock)); + fl.l_type = F_WRLCK; + fl.l_whence = SEEK_SET; + result = fcntl (lock_fd, F_SETLKW, &fl); RETURN_CLEAR_ALARM (result); } @@ -177,5 +181,5 @@ static void noop_handler (sig) int sig; { - /* We simply return which makes the `flock' call return with an error. */ + /* We simply return which makes the `fcntl' call return with an error. */ } diff --git a/stdio-common/printf.c b/stdio-common/printf.c index edb13da..c92cd94 100644 --- a/stdio-common/printf.c +++ b/stdio-common/printf.c @@ -1,20 +1,20 @@ -/* Copyright (C) 1991, 1995 Free Software Foundation, Inc. -This file is part of the GNU C Library. +/* Copyright (C) 1991, 1995, 1996 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 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 <stdarg.h> #include <stdio.h> @@ -22,8 +22,7 @@ Cambridge, MA 02139, USA. */ /* Write formatted output to stdout from the format string FORMAT. */ /* VARARGS1 */ int -printf (format) - const char *format; +printf (const char *format, ...) { va_list arg; int done; @@ -34,3 +33,9 @@ printf (format) return done; } + +#ifdef USE_IN_LIBIO +# undef _IO_printf +/* This is for libg++. */ +strong_alias (printf, _IO_printf); +#endif diff --git a/stdio-common/sscanf.c b/stdio-common/sscanf.c index d9c31bf..c106152 100644 --- a/stdio-common/sscanf.c +++ b/stdio-common/sscanf.c @@ -1,20 +1,20 @@ -/* Copyright (C) 1991, 1995 Free Software Foundation, Inc. -This file is part of the GNU C Library. +/* Copyright (C) 1991, 1995, 1996 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 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 <stdarg.h> #include <stdio.h> @@ -35,3 +35,9 @@ sscanf (s, format) return done; } + +#ifdef USE_IN_LIBIO +# undef _IO_sscanf +/* This is for libg++. */ +strong_alias (sscanf, _IO_sscanf) +#endif diff --git a/stdio-common/tmpfile.c b/stdio-common/tmpfile.c index 924df9b..2cc03d6 100644 --- a/stdio-common/tmpfile.c +++ b/stdio-common/tmpfile.c @@ -1,20 +1,20 @@ /* Copyright (C) 1991, 1993, 1996 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 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. - -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. */ + 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 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. */ #include <stdio.h> diff --git a/stdio-common/vfscanf.c b/stdio-common/vfscanf.c index 7985602..71945bb 100644 --- a/stdio-common/vfscanf.c +++ b/stdio-common/vfscanf.c @@ -82,11 +82,16 @@ { \ /* Check file argument for consistence. */ \ CHECK_FILE (s, EOF); \ - if (s->_flags & _IO_NO_READS || format == NULL) \ - { \ - MAYBE_SET_EINVAL; \ - return EOF; \ - } \ + if (s->_flags & _IO_NO_READS) \ + { \ + __set_errno (EBADF); \ + return EOF; \ + } \ + else if (format == NULL) \ + { \ + MAYBE_SET_EINVAL; \ + return EOF; \ + } \ } while (0) # define LOCK_STREAM(S) \ __libc_cleanup_region_start ((void (*) (void *)) &_IO_funlockfile, (S)); \ @@ -117,7 +122,12 @@ do \ { \ /* Check file argument for consistence. */ \ - if (!__validfp (s) || !s->__mode.__read || format == NULL) \ + if (!__validfp (s) || !s->__mode.__read) \ + { \ + __set_errno (EBADF); \ + return EOF; \ + } \ + else if (format == NULL) \ { \ __set_errno (EINVAL); \ return EOF; \ @@ -159,7 +169,7 @@ __vfscanf (FILE *s, const char *format, va_list argptr) register unsigned char fc; /* Current character of the format. */ register size_t done = 0; /* Assignments done. */ register size_t read_in = 0; /* Chars read in. */ - register int c; /* Last char read. */ + register int c = 0; /* Last char read. */ register int width; /* Maximum field width. */ register int flags; /* Modifiers for current format element. */ @@ -296,7 +306,8 @@ __vfscanf (FILE *s, const char *format, va_list argptr) if (skip_space) { while (isspace (c)) - (void) inchar (); + if (inchar () == EOF && errno == EINTR) + conv_error (); skip_space = 0; } @@ -409,13 +420,18 @@ __vfscanf (FILE *s, const char *format, va_list argptr) if (*f == '\0') conv_error (); + /* We must take care for EINTR errors. */ + if (c == EOF && errno == EINTR) + input_error (); + /* Find the conversion specifier. */ fc = *f++; - if (skip_space || (fc != '[' && fc != 'c' && fc != 'n')) + if (skip_space || (fc != '[' && fc != 'c' && fc != 'C' && fc != 'n')) { /* Eat whitespace. */ do - (void) inchar (); + if (inchar () == EOF && errno == EINTR) + input_error (); while (isspace (c)); ungetc (c, s); skip_space = 0; diff --git a/stdlib/tst-strtol.c b/stdlib/tst-strtol.c index 620181b..1566364 100644 --- a/stdlib/tst-strtol.c +++ b/stdlib/tst-strtol.c @@ -65,7 +65,7 @@ static const struct ltest tests[] = { "0xffffffffg", 0xffffffff, 0, 'g', 0 }, { "0xffffffffffffffffg", 0xffffffffffffffff, 0, 'g', 0 }, { "0xf1f2f3f4f5f6f7f8f9", 0xffffffffffffffff, 0, 0, ERANGE }, - { "-0x123456789abcdef01", 0, 0, 0, EINVA{ }, + { "-0x123456789abcdef01", 0, 0, 0, EINVAL }, { "-0xfedcba987654321", 0, 0, 0, EINVAL }, { NULL, 0, 0, 0, 0 }, #endif diff --git a/sysdeps/generic/abort.c b/sysdeps/generic/abort.c index 1a27c49..8eb45b3 100644 --- a/sysdeps/generic/abort.c +++ b/sysdeps/generic/abort.c @@ -1,22 +1,21 @@ -/* Copyright (C) 1991, 1993, 1995 Free Software Foundation, Inc. -This file is part of the GNU C Library. +/* Copyright (C) 1991, 1993, 1995, 1996 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 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 <ansidecl.h> #include <signal.h> #include <stdio.h> #include <stdlib.h> @@ -25,13 +24,13 @@ Cambridge, MA 02139, USA. */ /* Cause an abnormal program termination with core-dump. */ void -DEFUN_VOID(abort) +abort (void) { sigset_t sigs; - if (__sigemptyset(&sigs) == 0 && - __sigaddset(&sigs, SIGABRT) == 0) - (void) __sigprocmask(SIG_UNBLOCK, &sigs, (sigset_t *) NULL); + if (__sigemptyset (&sigs) == 0 && + __sigaddset (&sigs, SIGABRT) == 0) + __sigprocmask (SIG_UNBLOCK, &sigs, (sigset_t *) NULL); while (1) if (raise (SIGABRT)) diff --git a/sysdeps/i386/abort.c b/sysdeps/i386/abort.c deleted file mode 100644 index 28513fd..0000000 --- a/sysdeps/i386/abort.c +++ /dev/null @@ -1,28 +0,0 @@ -/* Copyright (C) 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 -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. - -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. */ - -#include <ansidecl.h> -#include <stdlib.h> - -/* Cause an abnormal program termination with core-dump. */ -void -DEFUN_VOID(abort) -{ - while (1) - asm ("hlt"); -} diff --git a/sysdeps/i386/fpu/__math.h b/sysdeps/i386/fpu/__math.h index d6b0bc6..3728d45 100644 --- a/sysdeps/i386/fpu/__math.h +++ b/sysdeps/i386/fpu/__math.h @@ -1,26 +1,33 @@ /* Inline math functions for i387. -Copyright (C) 1995, 1996 Free Software Foundation, Inc. -Contributed by John C. Bowman <bowman@ipp-garching.mpg.de> + Copyright (C) 1995, 1996 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by John C. Bowman <bowman@ipp-garching.mpg.de>, 1995. -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. */ #ifndef __MATH_H -#define __MATH_H +#define __MATH_H 1 + +#if defined __GNUG__ && \ + (__GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ <= 7)) +/* gcc 2.7.2 and 2.7.2.1 have problems with inlining `long double' + functions so we disable this now. */ +#undef __NO_MATH_INLINES +#define __NO_MATH_INLINES +#endif #ifdef __GNUC__ #ifndef __NO_MATH_INLINES diff --git a/sysdeps/posix/tempname.c b/sysdeps/posix/tempname.c index 61774a0..bb921c1 100644 --- a/sysdeps/posix/tempname.c +++ b/sysdeps/posix/tempname.c @@ -254,6 +254,22 @@ __stdio_gen_tempname (char *buf, size_t bufsize, const char *dir, (*streamptr)->__mode.__binary = 1; #endif } +#if defined EMFILE || defined ENFILE || defined EINTR + else if (0 +# ifdef EMFILE + || errno == EMFILE +# endif +# ifdef ENFILE + || errno == ENFILE +# endif +# ifdef EINTR + || errno == EINTR +# endif + ) + /* We cannot open anymore files since all descriptors are + used or because we got a signal. */ + return NULL; +#endif else continue; } diff --git a/sysdeps/unix/sysv/linux/netinet/in.h b/sysdeps/unix/sysv/linux/netinet/in.h index 86d1274..91c8883 100644 --- a/sysdeps/unix/sysv/linux/netinet/in.h +++ b/sysdeps/unix/sysv/linux/netinet/in.h @@ -22,7 +22,10 @@ #include <features.h> #include <sys/socket.h> + +__BEGIN_DECLS #include <linux/in.h> +__END_DECLS /* Standard well-known ports. The use of these constants is deprecated. Instead use the contents of the file `/etc/services' diff --git a/time/strftime.c b/time/strftime.c index 5447b3e..092739d 100644 --- a/time/strftime.c +++ b/time/strftime.c @@ -33,6 +33,7 @@ # include "../locale/localeinfo.h" #endif +#include <ctype.h> #include <sys/types.h> /* Some systems define `time_t' here. */ #ifdef TIME_WITH_SYS_TIME @@ -161,20 +162,59 @@ localtime_r (t, tp) #endif /* ! defined (_LIBC) */ -#define add(n, f) \ +static const char spaces[16] = " "; +#define add(n, f) \ do \ { \ - i += (n); \ + int _n = (n); \ + int _delta = width - _n; \ + i += _n + (_delta > 0 ? _delta : 0); \ if (i >= maxsize) \ return 0; \ else \ if (p) \ { \ + while (_delta > 0) \ + { \ + int _this = _delta > 16 ? 16 : _delta; \ + memcpy (p, spaces, _this); \ + p += _this; \ + _delta -= _this; \ + } \ f; \ - p += (n); \ + p += _n; \ } \ } while (0) -#define cpy(n, s) add ((n), memcpy((PTR) p, (PTR) (s), (n))) + +#define cpy(n, s) \ + add ((n), \ + if (to_lowcase) \ + memcpy_lowcase (p, (s), _n); \ + else \ + memcpy ((PTR) p, (PTR) (s), _n)) + + + +#ifdef _LIBC +# define TOUPPER(Ch) toupper (Ch) +# define TOLOWER(Ch) tolower (Ch) +#else +# define TOUPPER(Ch) (islower (Ch) ? toupper (Ch) : (Ch)) +# define TOLOWER(Ch) (isupper (Ch) ? tolower (Ch) : (Ch)) +#endif + +static char *memcpy_lowcase __P ((char *dest, const char *src, size_t len)); + +static char * +memcpy_lowcase (dest, src, len) + char *dest; + const char *src; + size_t len; +{ + while (len-- > 0) + dest[len] = TOLOWER (src[len]); + return dest; +} #if ! HAVE_TM_GMTOFF /* Yield the difference between *A and *B, @@ -254,7 +294,7 @@ strftime (s, maxsize, format, tp) char *s; size_t maxsize; const char *format; - register const struct tm *tp; + const struct tm *tp; { int hour12 = tp->tm_hour; #ifdef _NL_CURRENT @@ -281,9 +321,9 @@ strftime (s, maxsize, format, tp) size_t month_len = strlen (f_month); const char *zone; size_t zonelen; - register size_t i = 0; - register char *p = s; - register const char *f; + size_t i = 0; + char *p = s; + const char *f; zone = 0; #if HAVE_TM_ZONE @@ -315,6 +355,8 @@ strftime (s, maxsize, format, tp) char buf[1 + (sizeof (int) < sizeof (time_t) ? INT_STRLEN_BOUND (time_t) : INT_STRLEN_BOUND (int))]; + int width = -1; + int to_lowcase = 0; #if DO_MULTIBYTE @@ -391,18 +433,35 @@ strftime (s, maxsize, format, tp) /* Check for flags that can modify a number format. */ ++f; - switch (*f) + while (1) { - case '_': - case '-': - pad = *f++; - break; + switch (*f) + { + case '_': + case '-': + case '0': + pad = *f++; + break; - default: - pad = 0; + default: + pad = 0; + break; + } break; } + /* As a GNU extension we allow to specify the field width. */ + if (isdigit (*f)) + { + width = 0; + do + { + width *= 10; + width += *f - '0'; + } + while (isdigit (*++f)); + } + /* Check for modifiers. */ switch (*f) { @@ -468,10 +527,10 @@ strftime (s, maxsize, format, tp) subformat: { - size_t len = strftime (p, maxsize - i, subfmt, tp); + size_t len = strftime (NULL, maxsize - i, subfmt, tp); if (len == 0 && *subfmt) return 0; - add (len, ;); + add (len, strftime (p, maxsize - i, subfmt, tp)); } break; @@ -527,8 +586,9 @@ strftime (s, maxsize, format, tp) jump to one of these two labels. */ do_number_spacepad: - /* Force `_' flag. */ - pad = '_'; + /* Force `_' flag unless overwritten by `0' flag. */ + if (pad != '0') + pad = '_'; do_number: /* Format the number according to the MODIFIER flag. */ @@ -638,6 +698,10 @@ strftime (s, maxsize, format, tp) add (1, *p = '\n'); break; + case 'P': + to_lowcase = 1; + /* FALLTHROUGH */ + case 'p': cpy (ap_len, ampm); break; |