Skip to content

Commit

Permalink
update from main archive 961211
Browse files Browse the repository at this point in the history
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>.
  • Loading branch information
Ulrich Drepper committed Dec 12, 1996
1 parent 6259ec0 commit f8b87ef
Show file tree
Hide file tree
Showing 42 changed files with 500 additions and 234 deletions.
109 changes: 109 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
12 changes: 4 additions & 8 deletions Makerules
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion gnu-versions.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */

Expand Down
14 changes: 14 additions & 0 deletions libio/_G_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand All @@ -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 */
4 changes: 1 addition & 3 deletions libio/filedoalloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions libio/fileops.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions libio/genops.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}

Expand Down
3 changes: 2 additions & 1 deletion libio/libio.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
51 changes: 48 additions & 3 deletions libio/libioP.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down
4 changes: 3 additions & 1 deletion libio/memstream.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion libio/strops.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
11 changes: 6 additions & 5 deletions libio/vasprintf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion malloc/malloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 3 additions & 1 deletion malloc/obstack.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}

Expand Down
Loading

0 comments on commit f8b87ef

Please sign in to comment.