update from main archive 961220

Sat Dec 21 04:14:16 1996  Ulrich Drepper  <drepper@cygnus.com>

	* sysdeps/unix/common/pause.c: Add missing second argument in
	call to __sigpause.
	Reported by a sun <asun@zoology.washington.edu>.

	* locale/weight.h: Correct handling of collation elements.
	Reported by Keld Simonsen <keld@dkuug.dk>.

	* manual/time.texi: Document ^ flag and %P format.

	* new-malloc/malloc.c: Update from Wolfram Gloger.

	* nss/nss.h: Reformat copyright.
	* posix/sched.h: Likewise.
	* sysdeps/i386/fpu_control.h: Likewise.
	* sysdeps/unix/sysv/linux/fcntlbits.h: Likewise.
	* sysdeps/unix/sysv/linux/ioctls.h: Likewise.
	* sysdeps/unix/sysv/linux/sigcontext.h: Likewise.
	* sysdeps/unix/sysv/linux/utsnamelen.h: Likewise.
	* sysdeps/unix/sysv/linux/sys/acct.h: Likewise.
	* sysvips/sys/msg.h: Likewise.

	* stdio-common/Makefile (routines): Remove fcloseall.
	* stdio-common/fcloseall.c: Removed.

	* stdlib/Makefile (distribute): Add abort-instr.h.
	* sysdeps/generic/abort-instr.h: New file.
	* sysdeps/i386/abort-instr.h: New file.
	* sysdeps/generic/abort.c: Use lock and stage counter to prevent
	any form of loop.

	* sysdeps/unix/sysv/linux/timebits.h: Define CLK_TCK as 100.
	* sysdeps/unix/sysv/linux/alpha/timebits.h: Define CLOCKS_PER_SEC
	as 1000000.  Define CLK_TCK as 1024.
	* time/time.c (CLK_TCK): Define only if not already set.

	* time/strftime.c: Don't use `isdigit' when computing field width
	from string since the locale might have more than one digit
	block.

Fri Dec 20 12:38:14 1996  Darrel Hankerson  <hankedr@mail.auburn.edu>

	* posix/getopt.c (in -W option handling): Return when optind == argc.

Thu Dec 19 14:24:50 1996  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* nis/nss_nis/nis-alias.c (_nss_nis_parse_aliasent): Add const to
	type of KEY.

	* nis/nss_compat/compat-grp.c: Include the declaration of the file
	parser.
	* nis/nss_compat/compat-pwd.c: Likewise.
	* nis/nss_compat/compat-spwd.c: Likewise.
	* nis/nss_nis/nis-ethers.c: Likewise.
	* nis/nss_nis/nis-grp.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-spwd.c: Likewise.

	* nis/nss_compat/compat-grp.c (getgrent_next_nis,
 	getgrent_next_file): Pass the correct type for the buffer to the
 	parser function.
	* nis/nss_compat/compat-pwd.c (getpwent_next_netgr,
	getpwent_next_nis, getpwent_next_file): Likewise.
	* nis/nss_compat/compat-spwd.c (getspent_next_netgr,
	getspent_next_nis, getspent_next_file): Likewise.
	* nis/nss_nis/nis-ethers.c (internal_nis_getetherent_r,
	_nss_nis_getethernam_r, _nss_nis_getetherbyaddr_r): Likewise.
	* nis/nss_nis/nis-grp.c (internal_nis_getgrent_r,
	_nss_nis_getgrnam_r, _nss_nis_getgrgid_r): Likewise.
	* nis/nss_nis/nis-network.c (internal_nis_getnetent_r,
	_nss_nis_getnetbyname_r, _nss_nis_getnetbyaddr_r): Likewise.
	* nis/nss_nis/nis-proto.c (internal_nis_getprotoent_r,
	_nss_nis_getprotobyname_r, _nss_nis_getprotobynumber_r): Likewise.
	* nis/nss_nis/nis-pwd.c (internal_nis_getpwent_r,
	_nss_nis_getpwnam_r, _nss_nis_getpwuid_r): Likewise.
	* nis/nss_nis/nis-rpc.c (internal_nis_getrpcent_r,
	_nss_nis_getrpcbynumber_r): Likewise.
	* nis/nss_nis/nis-spwd.c (internal_nis_getspent_r,
	_nss_nis_getspnam_r): Likewise.

Thu Dec 19 13:37:16 1996  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* sysdeps/unix/sysv/linux/m68k/setjmp.c: New file.
This commit is contained in:
Ulrich Drepper 1996-12-21 04:13:58 +00:00
parent 6d52618b15
commit 7e3be507ee
38 changed files with 746 additions and 359 deletions

View File

@ -1,3 +1,91 @@
Sat Dec 21 04:14:16 1996 Ulrich Drepper <drepper@cygnus.com>
* sysdeps/unix/common/pause.c: Add missing second argument in
call to __sigpause.
Reported by a sun <asun@zoology.washington.edu>.
* locale/weight.h: Correct handling of collation elements.
Reported by Keld Simonsen <keld@dkuug.dk>.
* manual/time.texi: Document ^ flag and %P format.
* new-malloc/malloc.c: Update from Wolfram Gloger.
* nss/nss.h: Reformat copyright.
* posix/sched.h: Likewise.
* sysdeps/i386/fpu_control.h: Likewise.
* sysdeps/unix/sysv/linux/fcntlbits.h: Likewise.
* sysdeps/unix/sysv/linux/ioctls.h: Likewise.
* sysdeps/unix/sysv/linux/sigcontext.h: Likewise.
* sysdeps/unix/sysv/linux/utsnamelen.h: Likewise.
* sysdeps/unix/sysv/linux/sys/acct.h: Likewise.
* sysvips/sys/msg.h: Likewise.
* stdio-common/Makefile (routines): Remove fcloseall.
* stdio-common/fcloseall.c: Removed.
* stdlib/Makefile (distribute): Add abort-instr.h.
* sysdeps/generic/abort-instr.h: New file.
* sysdeps/i386/abort-instr.h: New file.
* sysdeps/generic/abort.c: Use lock and stage counter to prevent
any form of loop.
* sysdeps/unix/sysv/linux/timebits.h: Define CLK_TCK as 100.
* sysdeps/unix/sysv/linux/alpha/timebits.h: Define CLOCKS_PER_SEC
as 1000000. Define CLK_TCK as 1024.
* time/time.c (CLK_TCK): Define only if not already set.
* time/strftime.c: Don't use `isdigit' when computing field width
from string since the locale might have more than one digit
block.
Fri Dec 20 12:38:14 1996 Darrel Hankerson <hankedr@mail.auburn.edu>
* posix/getopt.c (in -W option handling): Return when optind == argc.
Thu Dec 19 14:24:50 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* nis/nss_nis/nis-alias.c (_nss_nis_parse_aliasent): Add const to
type of KEY.
* nis/nss_compat/compat-grp.c: Include the declaration of the file
parser.
* nis/nss_compat/compat-pwd.c: Likewise.
* nis/nss_compat/compat-spwd.c: Likewise.
* nis/nss_nis/nis-ethers.c: Likewise.
* nis/nss_nis/nis-grp.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-spwd.c: Likewise.
* nis/nss_compat/compat-grp.c (getgrent_next_nis,
getgrent_next_file): Pass the correct type for the buffer to the
parser function.
* nis/nss_compat/compat-pwd.c (getpwent_next_netgr,
getpwent_next_nis, getpwent_next_file): Likewise.
* nis/nss_compat/compat-spwd.c (getspent_next_netgr,
getspent_next_nis, getspent_next_file): Likewise.
* nis/nss_nis/nis-ethers.c (internal_nis_getetherent_r,
_nss_nis_getethernam_r, _nss_nis_getetherbyaddr_r): Likewise.
* nis/nss_nis/nis-grp.c (internal_nis_getgrent_r,
_nss_nis_getgrnam_r, _nss_nis_getgrgid_r): Likewise.
* nis/nss_nis/nis-network.c (internal_nis_getnetent_r,
_nss_nis_getnetbyname_r, _nss_nis_getnetbyaddr_r): Likewise.
* nis/nss_nis/nis-proto.c (internal_nis_getprotoent_r,
_nss_nis_getprotobyname_r, _nss_nis_getprotobynumber_r): Likewise.
* nis/nss_nis/nis-pwd.c (internal_nis_getpwent_r,
_nss_nis_getpwnam_r, _nss_nis_getpwuid_r): Likewise.
* nis/nss_nis/nis-rpc.c (internal_nis_getrpcent_r,
_nss_nis_getrpcbynumber_r): Likewise.
* nis/nss_nis/nis-spwd.c (internal_nis_getspent_r,
_nss_nis_getspnam_r): Likewise.
Thu Dec 19 13:37:16 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* sysdeps/unix/sysv/linux/m68k/setjmp.c: New file.
Thu Dec 19 23:28:33 1996 Ulrich Drepper <drepper@cygnus.com> Thu Dec 19 23:28:33 1996 Ulrich Drepper <drepper@cygnus.com>
* resolv/resolv.h: Update from BIND 4.9.5-P1. * resolv/resolv.h: Update from BIND 4.9.5-P1.

View File

@ -1,4 +1,4 @@
/* interp - add information about dynamic loader to shared library obejcts. /* interp - add information about dynamic loader to shared library objects.
Copyright (C) 1996 Free Software Foundation, Inc. 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.

View File

@ -118,7 +118,7 @@ get_weight (const STRING_TYPE **str, weight_t *result)
/* This is a comparison between a u_int32_t array (aka wchar_t) and /* This is a comparison between a u_int32_t array (aka wchar_t) and
an 8-bit string. */ an 8-bit string. */
for (idx = 0; __collate_extra[slot + 2 + idx] != 0; ++idx) for (idx = 0; __collate_extra[slot + 2 + idx] != 0; ++idx)
if (__collate_extra[slot + 2 + idx] != (u_int32_t) str[idx]) if (__collate_extra[slot + 2 + idx] != (u_int32_t) (*str)[idx])
break; break;
/* When the loop finished with all character of the collation /* When the loop finished with all character of the collation
@ -127,6 +127,7 @@ get_weight (const STRING_TYPE **str, weight_t *result)
{ {
size_t cnt; size_t cnt;
*str += idx;
idx += slot + 3; idx += slot + 3;
for (cnt = 0; cnt < collate_nrules; ++cnt) for (cnt = 0; cnt < collate_nrules; ++cnt)
{ {

View File

@ -179,7 +179,7 @@
Define to enable debugging. Adds fairly extensive assertion-based Define to enable debugging. Adds fairly extensive assertion-based
checking to help track down memory errors, but noticeably slows down checking to help track down memory errors, but noticeably slows down
execution. execution.
MALLOC_HOOKS (default: NOT defined) MALLOC_HOOKS (default: NOT defined)
Define to enable support run-time replacement of the allocation Define to enable support run-time replacement of the allocation
functions through user-defined `hooks'. functions through user-defined `hooks'.
REALLOC_ZERO_BYTES_FREES (default: NOT defined) REALLOC_ZERO_BYTES_FREES (default: NOT defined)
@ -298,7 +298,7 @@
#if __STD_C #if __STD_C
# include <stddef.h> /* for size_t */ # include <stddef.h> /* for size_t */
# if defined(_LIBC) || defined(MALLOC_HOOKS) # if defined(_LIBC) || defined(MALLOC_HOOKS)
# include <stdlib.h> /* for getenv() */ # include <stdlib.h> /* for getenv(), abort() */
# endif # endif
#else #else
# include <sys/types.h> # include <sys/types.h>
@ -315,13 +315,6 @@ extern "C" {
#include <stdio.h> /* needed for malloc_stats */ #include <stdio.h> /* needed for malloc_stats */
/* We must not pollute the name space in the GNU libc. */
#ifdef _LIBC
#define malloc_stats __malloc_stats
#define malloc_usable_size __malloc_usable_size
#define malloc_trim __malloc_trim
#endif
/* /*
Compile-time options Compile-time options
@ -878,6 +871,9 @@ extern Void_t* sbrk();
#define pvALLOc __libc_pvalloc #define pvALLOc __libc_pvalloc
#define mALLINFo __libc_mallinfo #define mALLINFo __libc_mallinfo
#define mALLOPt __libc_mallopt #define mALLOPt __libc_mallopt
#define mALLOC_STATs __malloc_stats
#define mALLOC_USABLE_SIZe __malloc_usable_size
#define mALLOC_TRIm __malloc_trim
#else #else
@ -890,6 +886,9 @@ extern Void_t* sbrk();
#define pvALLOc pvalloc #define pvALLOc pvalloc
#define mALLINFo mallinfo #define mALLINFo mallinfo
#define mALLOPt mallopt #define mALLOPt mallopt
#define mALLOC_STATs malloc_stats
#define mALLOC_USABLE_SIZe malloc_usable_size
#define mALLOC_TRIm malloc_trim
#endif #endif
@ -908,12 +907,9 @@ Void_t* vALLOc(size_t);
Void_t* pvALLOc(size_t); Void_t* pvALLOc(size_t);
Void_t* cALLOc(size_t, size_t); Void_t* cALLOc(size_t, size_t);
void cfree(Void_t*); void cfree(Void_t*);
int __malloc_trim(size_t); int mALLOC_TRIm(size_t);
int malloc_trim(size_t); size_t mALLOC_USABLE_SIZe(Void_t*);
size_t __malloc_usable_size(Void_t*); void mALLOC_STATs(void);
size_t malloc_usable_size(Void_t*);
void __malloc_stats(void);
void malloc_stats(void);
int mALLOPt(int, int); int mALLOPt(int, int);
struct mallinfo mALLINFo(void); struct mallinfo mALLINFo(void);
#else #else
@ -928,12 +924,9 @@ Void_t* vALLOc();
Void_t* pvALLOc(); Void_t* pvALLOc();
Void_t* cALLOc(); Void_t* cALLOc();
void cfree(); void cfree();
int __malloc_trim(); int mALLOC_TRIm();
int malloc_trim(); size_t mALLOC_USABLE_SIZe();
size_t _malloc_usable_size(); void mALLOC_STATs();
size_t malloc_usable_size();
void __malloc_stats();
void malloc_stats();
int mALLOPt(); int mALLOPt();
struct mallinfo mALLINFo(); struct mallinfo mALLINFo();
#endif #endif
@ -1166,9 +1159,9 @@ typedef struct _heap_info {
static void chunk_free(arena *ar_ptr, mchunkptr p); static void chunk_free(arena *ar_ptr, mchunkptr p);
static mchunkptr chunk_alloc(arena *ar_ptr, INTERNAL_SIZE_T size); static mchunkptr chunk_alloc(arena *ar_ptr, INTERNAL_SIZE_T size);
static mchunkptr chunk_realloc(arena *ar_ptr, mchunkptr oldp, static mchunkptr chunk_realloc(arena *ar_ptr, mchunkptr oldp,
INTERNAL_SIZE_T oldsize, INTERNAL_SIZE_T nb); INTERNAL_SIZE_T oldsize, INTERNAL_SIZE_T nb);
static mchunkptr chunk_align(arena *ar_ptr, INTERNAL_SIZE_T nb, static mchunkptr chunk_align(arena *ar_ptr, INTERNAL_SIZE_T nb,
size_t alignment); size_t alignment);
static int main_trim(size_t pad); static int main_trim(size_t pad);
#ifndef NO_THREADS #ifndef NO_THREADS
static int heap_trim(heap_info *heap, size_t pad); static int heap_trim(heap_info *heap, size_t pad);
@ -1178,6 +1171,8 @@ static Void_t* malloc_check(size_t sz);
static void free_check(Void_t* mem); static void free_check(Void_t* mem);
static Void_t* realloc_check(Void_t* oldmem, size_t bytes); static Void_t* realloc_check(Void_t* oldmem, size_t bytes);
static Void_t* memalign_check(size_t alignment, size_t bytes); static Void_t* memalign_check(size_t alignment, size_t bytes);
static Void_t* malloc_starter(size_t sz);
static void free_starter(Void_t* mem);
#endif #endif
#else #else
@ -1195,6 +1190,8 @@ static Void_t* malloc_check();
static void free_check(); static void free_check();
static Void_t* realloc_check(); static Void_t* realloc_check();
static Void_t* memalign_check(); static Void_t* memalign_check();
static Void_t* malloc_starter();
static void free_starter();
#endif #endif
#endif #endif
@ -1434,7 +1431,7 @@ static arena main_arena = {
IAV(112), IAV(113), IAV(114), IAV(115), IAV(116), IAV(117), IAV(118), IAV(119), IAV(112), IAV(113), IAV(114), IAV(115), IAV(116), IAV(117), IAV(118), IAV(119),
IAV(120), IAV(121), IAV(122), IAV(123), IAV(124), IAV(125), IAV(126), IAV(127) IAV(120), IAV(121), IAV(122), IAV(123), IAV(124), IAV(125), IAV(126), IAV(127)
}, },
NULL, /* next */ &main_arena, /* next */
0, /* size */ 0, /* size */
#if THREAD_STATS #if THREAD_STATS
0, 0, 0, /* stat_lock_direct, stat_lock_loop, stat_lock_wait */ 0, 0, 0, /* stat_lock_direct, stat_lock_loop, stat_lock_wait */
@ -1489,8 +1486,9 @@ static unsigned long max_mmapped_mem = 0;
/* Already initialized? */
int __malloc_initialized; /* Already initialized? */
int __malloc_initialized = 0;
/* Initialization routine. */ /* Initialization routine. */
@ -1507,11 +1505,22 @@ ptmalloc_init __MALLOC_P((void))
#endif #endif
{ {
#if defined(_LIBC) || defined(MALLOC_HOOKS) #if defined(_LIBC) || defined(MALLOC_HOOKS)
__malloc_ptr_t (*save_malloc_hook) __MALLOC_P ((size_t __size));
void (*save_free_hook) __MALLOC_P ((__malloc_ptr_t __ptr));
const char* s; const char* s;
#endif #endif
if(__malloc_initialized) return; if(__malloc_initialized) return;
__malloc_initialized = 1; __malloc_initialized = 1;
#if defined(_LIBC) || defined(MALLOC_HOOKS)
/* With some threads implementations, creating thread-specific data
or initializing a mutex may call malloc() itself. Provide a
simple starter version (realloc() won't work). */
save_malloc_hook = __malloc_hook;
save_free_hook = __free_hook;
__malloc_hook = malloc_starter;
__free_hook = free_starter;
#endif
#if defined(_LIBC) #if defined(_LIBC)
/* Initialize the pthreads interface. */ /* Initialize the pthreads interface. */
if (__pthread_initialize != NULL) if (__pthread_initialize != NULL)
@ -1525,6 +1534,8 @@ ptmalloc_init __MALLOC_P((void))
#endif #endif
#if defined(_LIBC) || defined(MALLOC_HOOKS) #if defined(_LIBC) || defined(MALLOC_HOOKS)
s = getenv("MALLOC_CHECK_"); s = getenv("MALLOC_CHECK_");
__malloc_hook = save_malloc_hook;
__free_hook = save_free_hook;
if(s) { if(s) {
if(s[0]) mallopt(M_CHECK_ACTION, (int)(s[0] - '0')); if(s[0]) mallopt(M_CHECK_ACTION, (int)(s[0] - '0'));
malloc_check_init(); malloc_check_init();
@ -1598,7 +1609,8 @@ malloc_check_init()
__free_hook = free_check; __free_hook = free_check;
__realloc_hook = realloc_check; __realloc_hook = realloc_check;
__memalign_hook = memalign_check; __memalign_hook = memalign_check;
fprintf(stderr, "Using debugging hooks\n"); if(check_action == 1)
fprintf(stderr, "malloc: using debugging hooks\n");
} }
#endif #endif
@ -1821,17 +1833,16 @@ grow_heap(h, diff) heap_info *h; long diff;
/* arena_get() acquires an arena and locks the corresponding mutex. /* arena_get() acquires an arena and locks the corresponding mutex.
First, try the one last locked successfully by this thread. (This First, try the one last locked successfully by this thread. (This
is the common case and handled with a macro for speed.) Then, loop is the common case and handled with a macro for speed.) Then, loop
over the singly linked list of arenas. If no arena is readily once over the circularly linked list of arenas. If no arena is
available, create a new one. */ readily available, create a new one. */
#define arena_get(ptr, size) do { \ #define arena_get(ptr, size) do { \
Void_t *vptr = NULL; \ Void_t *vptr = NULL; \
ptr = (arena *)tsd_getspecific(arena_key, vptr); \ ptr = (arena *)tsd_getspecific(arena_key, vptr); \
if(ptr && !mutex_trylock(&ptr->mutex)) { \ if(ptr && !mutex_trylock(&ptr->mutex)) { \
THREAD_STAT(++(ptr->stat_lock_direct)); \ THREAD_STAT(++(ptr->stat_lock_direct)); \
} else { \ } else \
ptr = arena_get2(ptr, (size)); \ ptr = arena_get2(ptr, (size)); \
} \
} while(0) } while(0)
static arena * static arena *
@ -1847,17 +1858,27 @@ arena_get2(a_tsd, size) arena *a_tsd; size_t size;
int i; int i;
unsigned long misalign; unsigned long misalign;
/* Check the singly-linked list for unlocked arenas. */ if(!a_tsd)
if(a_tsd) { a = a_tsd = &main_arena;
for(a = a_tsd->next; a; a = a->next) { else {
if(!mutex_trylock(&a->mutex)) a = a_tsd->next;
goto done; if(!a) {
/* This can only happen while initializing the new arena. */
(void)mutex_lock(&main_arena.mutex);
THREAD_STAT(++(main_arena.stat_lock_wait));
return &main_arena;
} }
} }
for(a = &main_arena; a != a_tsd; a = a->next) {
if(!mutex_trylock(&a->mutex)) /* Check the global, circularly linked list for available arenas. */
goto done; do {
} if(!mutex_trylock(&a->mutex)) {
THREAD_STAT(++(a->stat_lock_loop));
tsd_setspecific(arena_key, (Void_t *)a);
return a;
}
a = a->next;
} while(a != a_tsd);
/* Nothing immediately available, so generate a new arena. */ /* Nothing immediately available, so generate a new arena. */
h = new_heap(size + (sizeof(*h) + sizeof(*a) + MALLOC_ALIGNMENT)); h = new_heap(size + (sizeof(*h) + sizeof(*a) + MALLOC_ALIGNMENT));
@ -1866,7 +1887,9 @@ arena_get2(a_tsd, size) arena *a_tsd; size_t size;
a = h->ar_ptr = (arena *)(h+1); a = h->ar_ptr = (arena *)(h+1);
for(i=0; i<NAV; i++) for(i=0; i<NAV; i++)
init_bin(a, i); init_bin(a, i);
a->next = NULL;
a->size = h->size; a->size = h->size;
tsd_setspecific(arena_key, (Void_t *)a);
mutex_init(&a->mutex); mutex_init(&a->mutex);
i = mutex_lock(&a->mutex); /* remember result */ i = mutex_lock(&a->mutex); /* remember result */
@ -1887,9 +1910,7 @@ arena_get2(a_tsd, size) arena *a_tsd; size_t size;
if(i) /* locking failed; keep arena for further attempts later */ if(i) /* locking failed; keep arena for further attempts later */
return 0; return 0;
done:
THREAD_STAT(++(a->stat_lock_loop)); THREAD_STAT(++(a->stat_lock_loop));
tsd_setspecific(arena_key, (Void_t *)a);
return a; return a;
} }
@ -2890,7 +2911,7 @@ Void_t* rEALLOc(oldmem, bytes) Void_t* oldmem; size_t bytes;
static mchunkptr static mchunkptr
#if __STD_C #if __STD_C
chunk_realloc(arena* ar_ptr, mchunkptr oldp, INTERNAL_SIZE_T oldsize, chunk_realloc(arena* ar_ptr, mchunkptr oldp, INTERNAL_SIZE_T oldsize,
INTERNAL_SIZE_T nb) INTERNAL_SIZE_T nb)
#else #else
chunk_realloc(ar_ptr, oldp, oldsize, nb) chunk_realloc(ar_ptr, oldp, oldsize, nb)
arena* ar_ptr; mchunkptr oldp; INTERNAL_SIZE_T oldsize, nb; arena* ar_ptr; mchunkptr oldp; INTERNAL_SIZE_T oldsize, nb;
@ -3339,9 +3360,9 @@ void cfree(mem) Void_t *mem;
*/ */
#if __STD_C #if __STD_C
int malloc_trim(size_t pad) int mALLOC_TRIm(size_t pad)
#else #else
int malloc_trim(pad) size_t pad; int mALLOC_TRIm(pad) size_t pad;
#endif #endif
{ {
int res; int res;
@ -3475,9 +3496,9 @@ heap_trim(heap, pad) heap_info *heap; size_t pad;
*/ */
#if __STD_C #if __STD_C
size_t malloc_usable_size(Void_t* mem) size_t mALLOC_USABLE_SIZe(Void_t* mem)
#else #else
size_t malloc_usable_size(mem) Void_t* mem; size_t mALLOC_USABLE_SIZe(mem) Void_t* mem;
#endif #endif
{ {
mchunkptr p; mchunkptr p;
@ -3603,7 +3624,7 @@ dump_heap(heap) heap_info *heap;
*/ */
void malloc_stats() void mALLOC_STATs()
{ {
int i; int i;
arena *ar_ptr; arena *ar_ptr;
@ -3613,7 +3634,7 @@ void malloc_stats()
long stat_lock_direct = 0, stat_lock_loop = 0, stat_lock_wait = 0; long stat_lock_direct = 0, stat_lock_loop = 0, stat_lock_wait = 0;
#endif #endif
for(i=0, ar_ptr = &main_arena; ar_ptr; ar_ptr = ar_ptr->next, i++) { for(i=0, ar_ptr = &main_arena;; i++) {
malloc_update_mallinfo(ar_ptr, &mi); malloc_update_mallinfo(ar_ptr, &mi);
fprintf(stderr, "Arena %d:\n", i); fprintf(stderr, "Arena %d:\n", i);
fprintf(stderr, "system bytes = %10u\n", (unsigned int)mi.arena); fprintf(stderr, "system bytes = %10u\n", (unsigned int)mi.arena);
@ -3627,10 +3648,14 @@ void malloc_stats()
#endif #endif
#if !defined(NO_THREADS) && MALLOC_DEBUG > 1 #if !defined(NO_THREADS) && MALLOC_DEBUG > 1
if(ar_ptr != &main_arena) { if(ar_ptr != &main_arena) {
(void)mutex_lock(&ar_ptr->mutex);
heap_info *heap = heap_for_ptr(top(ar_ptr)); heap_info *heap = heap_for_ptr(top(ar_ptr));
while(heap) { dump_heap(heap); heap = heap->prev; } while(heap) { dump_heap(heap); heap = heap->prev; }
(void)mutex_unlock(&ar_ptr->mutex);
} }
#endif #endif
ar_ptr = ar_ptr->next;
if(ar_ptr == &main_arena) break;
} }
fprintf(stderr, "Total (incl. mmap):\n"); fprintf(stderr, "Total (incl. mmap):\n");
fprintf(stderr, "system bytes = %10u\n", system_b); fprintf(stderr, "system bytes = %10u\n", system_b);
@ -3713,26 +3738,7 @@ int mALLOPt(param_number, value) int param_number; int value;
return 0; return 0;
} }
} }
#ifdef _LIBC
weak_alias (__libc_calloc, __calloc) weak_alias (__libc_calloc, calloc)
weak_alias (__libc_free, __cfree) weak_alias (__libc_free, cfree)
weak_alias (__libc_free, __free) weak_alias (__libc_free, free)
weak_alias (__libc_malloc, __malloc) weak_alias (__libc_malloc, malloc)
weak_alias (__libc_memalign, __memalign) weak_alias (__libc_memalign, memalign)
weak_alias (__libc_realloc, __realloc) weak_alias (__libc_realloc, realloc)
weak_alias (__libc_valloc, __valloc) weak_alias (__libc_valloc, valloc)
weak_alias (__libc_pvalloc, __pvalloc) weak_alias (__libc_pvalloc, pvalloc)
weak_alias (__libc_mallinfo, __mallinfo) weak_alias (__libc_mallinfo, mallinfo)
weak_alias (__libc_mallopt, __mallopt) weak_alias (__libc_mallopt, mallopt)
#undef malloc_stats
weak_alias (__malloc_stats, malloc_stats)
#undef malloc_usable_size
weak_alias (__malloc_usable_size, malloc_usable_size)
#undef malloc_trim
weak_alias (__malloc_trim, malloc_trim)
#endif
#if defined(_LIBC) || defined(MALLOC_HOOKS) #if defined(_LIBC) || defined(MALLOC_HOOKS)
@ -3741,7 +3747,7 @@ weak_alias (__malloc_trim, malloc_trim)
byte per chunk; still this will catch most cases of double frees or byte per chunk; still this will catch most cases of double frees or
overruns. */ overruns. */
#define MAGICBYTE ((char)0xd7) #define MAGICBYTE(p) ( ( ((unsigned)p >> 3) ^ ((unsigned)p >> 11)) & 0xFF )
/* Convert a pointer to be free()d or realloc()ed to a valid chunk /* Convert a pointer to be free()d or realloc()ed to a valid chunk
pointer. If the provided pointer is not valid, return NULL. The pointer. If the provided pointer is not valid, return NULL. The
@ -3760,29 +3766,35 @@ mem2chunk_check(mem) Void_t* mem;
p = mem2chunk(mem); p = mem2chunk(mem);
if(!aligned_OK(p)) return NULL; if(!aligned_OK(p)) return NULL;
if( (char*)p>=sbrk_base && (char*)p<(sbrk_base+sbrked_mem) ) { if( (char*)p>=sbrk_base && (char*)p<(sbrk_base+sbrked_mem) ) {
/* Must be a chunk in conventional memory. */ /* Must be a chunk in conventional heap memory. */
if(chunk_is_mmapped(p) || if(chunk_is_mmapped(p) ||
( (sz = chunksize(p)), ((char*)p + sz)>=(sbrk_base+sbrked_mem) ) || ( (sz = chunksize(p)), ((char*)p + sz)>=(sbrk_base+sbrked_mem) ) ||
sz<MINSIZE || sz&MALLOC_ALIGN_MASK || !inuse(p) ) return NULL; sz<MINSIZE || sz&MALLOC_ALIGN_MASK || !inuse(p) ||
if(*((char*)p + sz + (SIZE_SZ-1)) != MAGICBYTE) return NULL; ( !prev_inuse(p) && (p->prev_size&MALLOC_ALIGN_MASK ||
*((char*)p + sz + (SIZE_SZ-1)) = 0; (long)prev_chunk(p)<(long)sbrk_base ||
next_chunk(prev_chunk(p))!=p) ))
return NULL;
if(*((unsigned char*)p + sz + (SIZE_SZ-1)) != MAGICBYTE(p))
return NULL;
*((unsigned char*)p + sz + (SIZE_SZ-1)) ^= 0xFF;
} else { } else {
unsigned long offset, page_mask = malloc_getpagesize-1; unsigned long offset, page_mask = malloc_getpagesize-1;
/* mmap()ed chunks have MALLOC_ALIGNMENT or higher power-of two /* mmap()ed chunks have MALLOC_ALIGNMENT or higher power-of-two
alignment relative to the beginning of a page. Check this alignment relative to the beginning of a page. Check this
first. */ first. */
offset = (unsigned long)mem & page_mask; offset = (unsigned long)mem & page_mask;
if((offset!=MALLOC_ALIGNMENT && offset!=0 && offset!=0x10 && if((offset!=MALLOC_ALIGNMENT && offset!=0 && offset!=0x10 &&
offset!=0x20 && offset!=0x40 && offset!=0x80 && offset!=0x100 && offset!=0x20 && offset!=0x40 && offset!=0x80 && offset!=0x100 &&
offset!=0x200 && offset!=0x400 && offset!=0x800 && offset!=0x1000 && offset!=0x200 && offset!=0x400 && offset!=0x800 && offset!=0x1000 &&
offset<0x2000) || offset<0x2000) ||
!chunk_is_mmapped(p) || (p->size & PREV_INUSE) || !chunk_is_mmapped(p) || (p->size & PREV_INUSE) ||
( (((unsigned long)p - p->prev_size) & page_mask) != 0 ) || ( (((unsigned long)p - p->prev_size) & page_mask) != 0 ) ||
( (sz = chunksize(p)), ((p->prev_size + sz) & page_mask) != 0 ) ) ( (sz = chunksize(p)), ((p->prev_size + sz) & page_mask) != 0 ) )
return NULL; return NULL;
if(*((char*)p + sz - 1) != MAGICBYTE) return NULL; if(*((unsigned char*)p + sz - 1) != MAGICBYTE(p))
*((char*)p + sz - 1) = 0; return NULL;
*((unsigned char*)p + sz - 1) ^= 0xFF;
} }
return p; return p;
} }
@ -3806,7 +3818,7 @@ malloc_check(sz) size_t sz;
--nb; --nb;
else else
nb += SIZE_SZ - 1; nb += SIZE_SZ - 1;
*((char*)victim + nb) = MAGICBYTE; *((unsigned char*)victim + nb) = MAGICBYTE(victim);
return chunk2mem(victim); return chunk2mem(victim);
} }
@ -3820,8 +3832,10 @@ free_check(mem) Void_t* mem;
mchunkptr p; mchunkptr p;
if(!mem) return; if(!mem) return;
(void)mutex_lock(&main_arena.mutex);
p = mem2chunk_check(mem); p = mem2chunk_check(mem);
if(!p) { if(!p) {
(void)mutex_unlock(&main_arena.mutex);
switch(check_action) { switch(check_action) {
case 1: case 1:
fprintf(stderr, "free(): invalid pointer %lx!\n", (long)(mem)); fprintf(stderr, "free(): invalid pointer %lx!\n", (long)(mem));
@ -3833,11 +3847,14 @@ free_check(mem) Void_t* mem;
} }
#if HAVE_MMAP #if HAVE_MMAP
if (chunk_is_mmapped(p)) { if (chunk_is_mmapped(p)) {
(void)mutex_unlock(&main_arena.mutex);
munmap_chunk(p); munmap_chunk(p);
return; return;
} }
#endif #endif
(void)mutex_lock(&main_arena.mutex); #if 0 /* Erase freed memory. */
memset(mem, 0, chunksize(p) - (SIZE_SZ+1));
#endif
chunk_free(&main_arena, p); chunk_free(&main_arena, p);
(void)mutex_unlock(&main_arena.mutex); (void)mutex_unlock(&main_arena.mutex);
} }
@ -3853,8 +3870,10 @@ realloc_check(oldmem, bytes) Void_t* oldmem; size_t bytes;
INTERNAL_SIZE_T nb, oldsize; INTERNAL_SIZE_T nb, oldsize;
if (oldmem == 0) return malloc_check(bytes); if (oldmem == 0) return malloc_check(bytes);
(void)mutex_lock(&main_arena.mutex);
oldp = mem2chunk_check(oldmem); oldp = mem2chunk_check(oldmem);
if(!oldp) { if(!oldp) {
(void)mutex_unlock(&main_arena.mutex);
switch(check_action) { switch(check_action) {
case 1: case 1:
fprintf(stderr, "realloc(): invalid pointer %lx!\n", (long)(oldmem)); fprintf(stderr, "realloc(): invalid pointer %lx!\n", (long)(oldmem));
@ -3868,7 +3887,6 @@ realloc_check(oldmem, bytes) Void_t* oldmem; size_t bytes;
nb = request2size(bytes+1); nb = request2size(bytes+1);
(void)mutex_lock(&main_arena.mutex);
#if HAVE_MMAP #if HAVE_MMAP
if (chunk_is_mmapped(oldp)) { if (chunk_is_mmapped(oldp)) {
#if HAVE_MREMAP #if HAVE_MREMAP
@ -3878,19 +3896,31 @@ realloc_check(oldmem, bytes) Void_t* oldmem; size_t bytes;
/* Note the extra SIZE_SZ overhead. */ /* Note the extra SIZE_SZ overhead. */
if(oldsize - SIZE_SZ >= nb) newp = oldp; /* do nothing */ if(oldsize - SIZE_SZ >= nb) newp = oldp; /* do nothing */
else { else {
/* Must alloc, copy, free. */ /* Must alloc, copy, free. */
newp = chunk_alloc(&main_arena, nb); newp = chunk_alloc(&main_arena, nb);
if (newp) { if (newp) {
MALLOC_COPY(chunk2mem(newp), oldmem, oldsize - 2*SIZE_SZ); MALLOC_COPY(chunk2mem(newp), oldmem, oldsize - 2*SIZE_SZ);
munmap_chunk(oldp); munmap_chunk(oldp);
} }
} }
#if HAVE_MREMAP #if HAVE_MREMAP
} }
#endif #endif
} else } else {
#endif /* HAVE_MMAP */ #endif /* HAVE_MMAP */
newp = chunk_realloc(&main_arena, oldp, oldsize, nb); newp = chunk_realloc(&main_arena, oldp, oldsize, nb);
#if 0 /* Erase freed memory. */
nb = chunksize(newp);
if(oldp<newp || oldp>=chunk_at_offset(newp, nb)) {
memset((char*)oldmem + 2*sizeof(mbinptr), 0,
oldsize - (2*sizeof(mbinptr)+2*SIZE_SZ+1));
} else if(nb > oldsize+SIZE_SZ) {
memset((char*)chunk2mem(newp) + oldsize, 0, nb - (oldsize+SIZE_SZ));
}
#endif
#if HAVE_MMAP
}
#endif
(void)mutex_unlock(&main_arena.mutex); (void)mutex_unlock(&main_arena.mutex);
if(!newp) return NULL; if(!newp) return NULL;
@ -3899,7 +3929,7 @@ realloc_check(oldmem, bytes) Void_t* oldmem; size_t bytes;
--nb; --nb;
else else
nb += SIZE_SZ - 1; nb += SIZE_SZ - 1;
*((char*)newp + nb) = MAGICBYTE; *((unsigned char*)newp + nb) = MAGICBYTE(newp);
return chunk2mem(newp); return chunk2mem(newp);
} }
@ -3926,12 +3956,66 @@ memalign_check(alignment, bytes) size_t alignment; size_t bytes;
--nb; --nb;
else else
nb += SIZE_SZ - 1; nb += SIZE_SZ - 1;
*((char*)p + nb) = MAGICBYTE; *((unsigned char*)p + nb) = MAGICBYTE(p);
return chunk2mem(p); return chunk2mem(p);
} }
/* The following hooks are used when the global initialization in
ptmalloc_init() hasn't completed yet. */
static Void_t*
#if __STD_C
malloc_starter(size_t sz)
#else
malloc_starter(sz) size_t sz;
#endif
{
mchunkptr victim = chunk_alloc(&main_arena, request2size(sz));
return victim ? chunk2mem(victim) : 0;
}
static void
#if __STD_C
free_starter(Void_t* mem)
#else
free_starter(mem) Void_t* mem;
#endif
{
mchunkptr p;
if(!mem) return;
p = mem2chunk(mem);
#if HAVE_MMAP
if (chunk_is_mmapped(p)) {
munmap_chunk(p);
return;
}
#endif
chunk_free(&main_arena, p);
}
#endif /* defined(_LIBC) || defined(MALLOC_HOOKS) */ #endif /* defined(_LIBC) || defined(MALLOC_HOOKS) */
#ifdef _LIBC
weak_alias (__libc_calloc, __calloc) weak_alias (__libc_calloc, calloc)
weak_alias (__libc_free, __cfree) weak_alias (__libc_free, cfree)
weak_alias (__libc_free, __free) weak_alias (__libc_free, free)
weak_alias (__libc_malloc, __malloc) weak_alias (__libc_malloc, malloc)
weak_alias (__libc_memalign, __memalign) weak_alias (__libc_memalign, memalign)
weak_alias (__libc_realloc, __realloc) weak_alias (__libc_realloc, realloc)
weak_alias (__libc_valloc, __valloc) weak_alias (__libc_valloc, valloc)
weak_alias (__libc_pvalloc, __pvalloc) weak_alias (__libc_pvalloc, pvalloc)
weak_alias (__libc_mallinfo, __mallinfo) weak_alias (__libc_mallinfo, mallinfo)
weak_alias (__libc_mallopt, __mallopt) weak_alias (__libc_mallopt, mallopt)
weak_alias (__malloc_stats, malloc_stats)
weak_alias (__malloc_usable_size, malloc_usable_size)
weak_alias (__malloc_trim, malloc_trim)
#endif
/* /*
History: History:

View File

@ -640,8 +640,12 @@ The number is padded with spaces.
The number is not padded at all. The number is not padded at all.
@item 0 @item 0
The number is padded with zeros even if the format spefies padding The number is padded with zeros even if the format specifies padding
with spaces. with spaces.
@item ^
The output uses uppercase characters, but only if this is possible
(@pxref{Case Conversion}).
@end table @end table
The default action is to pad the number with zeros to keep it a constant The default action is to pad the number with zeros to keep it a constant
@ -774,6 +778,17 @@ Either @samp{AM} or @samp{PM}, according to the given time value; or the
corresponding strings for the current locale. Noon is treated as corresponding strings for the current locale. Noon is treated as
@samp{PM} and midnight as @samp{AM}. @samp{PM} and midnight as @samp{AM}.
@ignore
We currently have a problem with makeinfo. Write @samp{AM} and @samp{am}
both results in `am'. I.e., the difference in case is not visible anymore.
@end ignore
@item %P
Either @samp{am} or @samp{pm}, according to the given time value; or the
corresponding strings for the current locale, printed in lowercase
characters. Noon is treated as @samp{pm} and midnight as @samp{am}.
This format is a GNU extension.
@item %r @item %r
The complete time using the AM/PM format of the current locale. The complete time using the AM/PM format of the current locale.

View File

@ -26,6 +26,12 @@
#include <rpcsvc/yp.h> #include <rpcsvc/yp.h>
#include <rpcsvc/ypclnt.h> #include <rpcsvc/ypclnt.h>
/* Get the declaration of the parser function. */
#define ENTNAME grent
#define STRUCTURE group
#define EXTERN_PARSER
#include "../../nss/nss_files/files-parse.c"
/* Structure for remembering -@netgroup and -user members ... */ /* Structure for remembering -@netgroup and -user members ... */
#define BLACKLIST_INITIAL_SIZE 512 #define BLACKLIST_INITIAL_SIZE 512
#define BLACKLIST_INCREMENT 256 #define BLACKLIST_INCREMENT 256
@ -146,6 +152,7 @@ static enum nss_status
getgrent_next_nis (struct group *result, ent_t *ent, char *buffer, getgrent_next_nis (struct group *result, ent_t *ent, char *buffer,
size_t buflen) size_t buflen)
{ {
struct parser_data *data = (void *) buffer;
char *domain; char *domain;
char *outkey, *outval; char *outkey, *outval;
int outkeylen, outvallen; int outkeylen, outvallen;
@ -196,7 +203,7 @@ getgrent_next_nis (struct group *result, ent_t *ent, char *buffer,
while (isspace (*p)) while (isspace (*p))
++p; ++p;
} }
while (!_nss_files_parse_grent (p, result, buffer, buflen)); while (!_nss_files_parse_grent (p, result, data, buflen));
if (!in_blacklist (result->gr_name, strlen (result->gr_name), ent)) if (!in_blacklist (result->gr_name, strlen (result->gr_name), ent))
return NSS_STATUS_SUCCESS; return NSS_STATUS_SUCCESS;
@ -209,6 +216,7 @@ static enum nss_status
getgrent_next_file (struct group *result, ent_t *ent, getgrent_next_file (struct group *result, ent_t *ent,
char *buffer, size_t buflen) char *buffer, size_t buflen)
{ {
struct parser_data *data = (void *) buffer;
while (1) while (1)
{ {
char *p; char *p;
@ -230,7 +238,7 @@ getgrent_next_file (struct group *result, ent_t *ent,
while (*p == '\0' || *p == '#' || while (*p == '\0' || *p == '#' ||
/* Parse the line. If it is invalid, loop to /* Parse the line. If it is invalid, loop to
get the next line of the file to parse. */ get the next line of the file to parse. */
!_nss_files_parse_grent (p, result, buffer, buflen)); !_nss_files_parse_grent (p, result, data, buflen));
if (result->gr_name[0] != '+' && result->gr_name[0] != '-') if (result->gr_name[0] != '+' && result->gr_name[0] != '-')
/* This is a real entry. */ /* This is a real entry. */
@ -266,7 +274,7 @@ getgrent_next_file (struct group *result, ent_t *ent,
while (isspace (*p)) while (isspace (*p))
p++; p++;
free (outval); free (outval);
if (_nss_files_parse_grent (p, result, buffer, buflen)) if (_nss_files_parse_grent (p, result, data, buflen))
/* We found the entry. */ /* We found the entry. */
break; break;
} }

View File

@ -29,6 +29,12 @@
#include "netgroup.h" #include "netgroup.h"
/* Get the declaration of the parser function. */
#define ENTNAME pwent
#define STRUCTURE passwd
#define EXTERN_PARSER
#include "../../nss/nss_files/files-parse.c"
/* Structure for remembering -@netgroup and -user members ... */ /* Structure for remembering -@netgroup and -user members ... */
#define BLACKLIST_INITIAL_SIZE 512 #define BLACKLIST_INITIAL_SIZE 512
#define BLACKLIST_INCREMENT 256 #define BLACKLIST_INCREMENT 256
@ -269,6 +275,7 @@ static enum nss_status
getpwent_next_netgr (struct passwd *result, ent_t *ent, char *group, getpwent_next_netgr (struct passwd *result, ent_t *ent, char *group,
char *buffer, size_t buflen) char *buffer, size_t buflen)
{ {
struct parser_data *data = (void *) buffer;
char *ypdomain, *host, *user, *domain, *outval, *p, *p2; char *ypdomain, *host, *user, *domain, *outval, *p, *p2;
int status, outvallen; int status, outvallen;
size_t p2len; size_t p2len;
@ -290,8 +297,8 @@ getpwent_next_netgr (struct passwd *result, ent_t *ent, char *group,
while (1) while (1)
{ {
status = __internal_getnetgrent (&host, &user, &domain, &ent->netgrdata, status = __internal_getnetgrent_r (&host, &user, &domain,
buffer, buflen); &ent->netgrdata, buffer, buflen);
if (status != 1) if (status != 1)
{ {
__internal_endnetgrent (&ent->netgrdata); __internal_endnetgrent (&ent->netgrdata);
@ -323,7 +330,7 @@ getpwent_next_netgr (struct passwd *result, ent_t *ent, char *group,
while (isspace (*p)) while (isspace (*p))
p++; p++;
free (outval); free (outval);
if (_nss_files_parse_pwent (p, result, buffer, buflen)) if (_nss_files_parse_pwent (p, result, data, buflen))
{ {
copy_pwd_changes (result, &ent->pwd, p2, p2len); copy_pwd_changes (result, &ent->pwd, p2, p2len);
break; break;
@ -337,6 +344,7 @@ static enum nss_status
getpwent_next_nis (struct passwd *result, ent_t *ent, char *buffer, getpwent_next_nis (struct passwd *result, ent_t *ent, char *buffer,
size_t buflen) size_t buflen)
{ {
struct parser_data *data = (void *) buffer;
char *domain, *outkey, *outval, *p, *p2; char *domain, *outkey, *outval, *p, *p2;
int outkeylen, outvallen; int outkeylen, outvallen;
size_t p2len; size_t p2len;
@ -397,7 +405,7 @@ getpwent_next_nis (struct passwd *result, ent_t *ent, char *buffer,
while (isspace (*p)) while (isspace (*p))
++p; ++p;
} }
while (!_nss_files_parse_pwent (p, result, buffer, buflen)); while (!_nss_files_parse_pwent (p, result, data, buflen));
copy_pwd_changes (result, &ent->pwd, p2, p2len); copy_pwd_changes (result, &ent->pwd, p2, p2len);
@ -412,6 +420,7 @@ static enum nss_status
getpwent_next_file (struct passwd *result, ent_t *ent, getpwent_next_file (struct passwd *result, ent_t *ent,
char *buffer, size_t buflen) char *buffer, size_t buflen)
{ {
struct parser_data *data = (void *) buffer;
while (1) while (1)
{ {
char *p, *p2; char *p, *p2;
@ -433,7 +442,7 @@ getpwent_next_file (struct passwd *result, ent_t *ent,
while (*p == '\0' || *p == '#' || /* Ignore empty and comment lines. */ while (*p == '\0' || *p == '#' || /* Ignore empty and comment lines. */
/* Parse the line. If it is invalid, loop to /* Parse the line. If it is invalid, loop to
get the next line of the file to parse. */ get the next line of the file to parse. */
!_nss_files_parse_pwent (p, result, buffer, buflen)); !_nss_files_parse_pwent (p, result, data, buflen));
if (result->pw_name[0] != '+' && result->pw_name[0] != '-') if (result->pw_name[0] != '+' && result->pw_name[0] != '-')
/* This is a real entry. */ /* This is a real entry. */
@ -516,7 +525,7 @@ getpwent_next_file (struct passwd *result, ent_t *ent,
while (isspace (*p)) while (isspace (*p))
p++; p++;
free (outval); free (outval);
if (_nss_files_parse_pwent (p, result, buffer, buflen)) if (_nss_files_parse_pwent (p, result, data, buflen))
{ {
copy_pwd_changes (result, &pwd, p2, p2len); copy_pwd_changes (result, &pwd, p2, p2len);
give_pwd_free (&pwd); give_pwd_free (&pwd);

View File

@ -27,6 +27,12 @@
#include <rpcsvc/yp.h> #include <rpcsvc/yp.h>
#include <rpcsvc/ypclnt.h> #include <rpcsvc/ypclnt.h>
/* Get the declaration of the parser function. */
#define ENTNAME spent
#define STRUCTURE spwd
#define EXTERN_PARSER
#include "../../nss/nss_files/files-parse.c"
/* Structure for remembering -@netgroup and -user members ... */ /* Structure for remembering -@netgroup and -user members ... */
#define BLACKLIST_INITIAL_SIZE 512 #define BLACKLIST_INITIAL_SIZE 512
#define BLACKLIST_INCREMENT 256 #define BLACKLIST_INCREMENT 256
@ -212,6 +218,7 @@ static enum nss_status
getspent_next_netgr (struct spwd *result, ent_t *ent, char *group, getspent_next_netgr (struct spwd *result, ent_t *ent, char *group,
char *buffer, size_t buflen) char *buffer, size_t buflen)
{ {
struct parser_data *data = (void *) buffer;
char *ypdomain, *host, *user, *domain, *outval, *p, *p2; char *ypdomain, *host, *user, *domain, *outval, *p, *p2;
int status, outvallen; int status, outvallen;
size_t p2len; size_t p2len;
@ -263,7 +270,7 @@ getspent_next_netgr (struct spwd *result, ent_t *ent, char *group,
while (isspace (*p)) while (isspace (*p))
p++; p++;
free (outval); free (outval);
if (_nss_files_parse_spent (p, result, buffer, buflen)) if (_nss_files_parse_spent (p, result, data, buflen))
{ {
copy_spwd_changes (result, &ent->pwd, p2, p2len); copy_spwd_changes (result, &ent->pwd, p2, p2len);
break; break;
@ -277,6 +284,7 @@ static enum nss_status
getspent_next_nis (struct spwd *result, ent_t *ent, getspent_next_nis (struct spwd *result, ent_t *ent,
char *buffer, size_t buflen) char *buffer, size_t buflen)
{ {
struct parser_data *data = (void *) buffer;
char *domain, *outkey, *outval, *p, *p2; char *domain, *outkey, *outval, *p, *p2;
int outkeylen, outvallen; int outkeylen, outvallen;
size_t p2len; size_t p2len;
@ -337,7 +345,7 @@ getspent_next_nis (struct spwd *result, ent_t *ent,
while (isspace (*p)) while (isspace (*p))
++p; ++p;
} }
while (!_nss_files_parse_spent (p, result, buffer, buflen)); while (!_nss_files_parse_spent (p, result, data, buflen));
copy_spwd_changes (result, &ent->pwd, p2, p2len); copy_spwd_changes (result, &ent->pwd, p2, p2len);
@ -352,6 +360,7 @@ static enum nss_status
getspent_next_file (struct spwd *result, ent_t *ent, getspent_next_file (struct spwd *result, ent_t *ent,
char *buffer, size_t buflen) char *buffer, size_t buflen)
{ {
struct parser_data *data = (void *) buffer;
while (1) while (1)
{ {
char *p, *p2; char *p, *p2;
@ -373,7 +382,7 @@ getspent_next_file (struct spwd *result, ent_t *ent,
while (*p == '\0' || *p == '#' || /* Ignore empty and comment lines. */ while (*p == '\0' || *p == '#' || /* Ignore empty and comment lines. */
/* Parse the line. If it is invalid, loop to /* Parse the line. If it is invalid, loop to
get the next line of the file to parse. */ get the next line of the file to parse. */
!_nss_files_parse_spent (p, result, buffer, buflen)); !_nss_files_parse_spent (p, result, data, buflen));
if (result->sp_namp[0] != '+' && result->sp_namp[0] != '-') if (result->sp_namp[0] != '+' && result->sp_namp[0] != '-')
/* This is a real entry. */ /* This is a real entry. */
@ -456,7 +465,7 @@ getspent_next_file (struct spwd *result, ent_t *ent,
while (isspace (*p)) while (isspace (*p))
p++; p++;
free (outval); free (outval);
if (_nss_files_parse_spent (p, result, buffer, buflen)) if (_nss_files_parse_spent (p, result, data, buflen))
{ {
copy_spwd_changes (result, &pwd, p2, p2len); copy_spwd_changes (result, &pwd, p2, p2len);
give_spwd_free (&pwd); give_spwd_free (&pwd);

View File

@ -35,7 +35,7 @@ static char *oldkey = NULL;
static int oldkeylen = 0; static int oldkeylen = 0;
static int static int
_nss_nis_parse_aliasent (char *key, char *alias, struct aliasent *result, _nss_nis_parse_aliasent (const char *key, char *alias, struct aliasent *result,
char *buffer, size_t buflen) char *buffer, size_t buflen)
{ {
char *first_unused = buffer + strlen (alias) + 1; char *first_unused = buffer + strlen (alias) + 1;

View File

@ -33,10 +33,16 @@ __libc_lock_define_initialized (static, lock)
struct ether struct ether
{ {
char *e_name; const char *e_name;
struct ether_addr e_addr; struct ether_addr e_addr;
}; };
/* Get the declaration of the parser function. */
#define ENTNAME etherent
#define STRUCTURE ether
#define EXTERN_PARSER
#include "../nss/nss_files/files-parse.c"
static bool_t new_start = 1; static bool_t new_start = 1;
static char *oldkey = NULL; static char *oldkey = NULL;
static int oldkeylen = 0; static int oldkeylen = 0;
@ -80,6 +86,7 @@ _nss_nis_endetherent (void)
static enum nss_status static enum nss_status
internal_nis_getetherent_r (struct ether *eth, char *buffer, size_t buflen) internal_nis_getetherent_r (struct ether *eth, char *buffer, size_t buflen)
{ {
struct parser_data *data = (void *) buffer;
char *domain, *result, *outkey; char *domain, *result, *outkey;
int len, keylen, parse_res; int len, keylen, parse_res;
@ -120,7 +127,7 @@ internal_nis_getetherent_r (struct ether *eth, char *buffer, size_t buflen)
++p; ++p;
free (result); free (result);
parse_res = _nss_files_parse_etherent (p, eth, buffer, buflen); parse_res = _nss_files_parse_etherent (p, eth, data, buflen);
if (!parse_res && errno == ERANGE) if (!parse_res && errno == ERANGE)
return NSS_STATUS_TRYAGAIN; return NSS_STATUS_TRYAGAIN;
@ -152,6 +159,7 @@ enum nss_status
_nss_nis_getethernam_r (const char *name, struct ether *eth, _nss_nis_getethernam_r (const char *name, struct ether *eth,
char *buffer, size_t buflen) char *buffer, size_t buflen)
{ {
struct parser_data *data = (void *) buffer;
enum nss_status retval; enum nss_status retval;
char *domain, *result, *p; char *domain, *result, *p;
int len, parse_res; int len, parse_res;
@ -188,7 +196,7 @@ _nss_nis_getethernam_r (const char *name, struct ether *eth,
++p; ++p;
free (result); free (result);
parse_res = _nss_files_parse_etherent (p, eth, buffer, buflen); parse_res = _nss_files_parse_etherent (p, eth, data, buflen);
if (!parse_res) if (!parse_res)
{ {
@ -205,6 +213,7 @@ enum nss_status
_nss_nis_getetherbyaddr_r (struct ether_addr *addr, struct ether *eth, _nss_nis_getetherbyaddr_r (struct ether_addr *addr, struct ether *eth,
char *buffer, size_t buflen) char *buffer, size_t buflen)
{ {
struct parser_data *data = (void *) buffer;
enum nss_status retval; enum nss_status retval;
char *domain, *result, *p; char *domain, *result, *p;
int len, nlen, parse_res; int len, nlen, parse_res;
@ -250,7 +259,7 @@ _nss_nis_getetherbyaddr_r (struct ether_addr *addr, struct ether *eth,
++p; ++p;
free (result); free (result);
parse_res = _nss_files_parse_etherent (p, eth, buffer, buflen); parse_res = _nss_files_parse_etherent (p, eth, data, buflen);
if (!parse_res) if (!parse_res)
{ {

View File

@ -28,6 +28,12 @@
#include "nss-nis.h" #include "nss-nis.h"
/* Get the declaration of the parser function. */
#define ENTNAME grent
#define STRUCTURE group
#define EXTERN_PARSER
#include "../nss/nss_files/files-parse.c"
/* Protect global state against multiple changers */ /* Protect global state against multiple changers */
__libc_lock_define_initialized (static, lock) __libc_lock_define_initialized (static, lock)
@ -74,6 +80,7 @@ _nss_nis_endgrent (void)
static enum nss_status static enum nss_status
internal_nis_getgrent_r (struct group *grp, char *buffer, size_t buflen) internal_nis_getgrent_r (struct group *grp, char *buffer, size_t buflen)
{ {
struct parser_data *data = (void *) buffer;
char *domain, *result, *outkey; char *domain, *result, *outkey;
int len, keylen, parse_res; int len, keylen, parse_res;
@ -114,7 +121,7 @@ internal_nis_getgrent_r (struct group *grp, char *buffer, size_t buflen)
++p; ++p;
free (result); free (result);
parse_res = _nss_files_parse_grent (p, grp, buffer, buflen); parse_res = _nss_files_parse_grent (p, grp, data, buflen);
if (!parse_res && errno == ERANGE) if (!parse_res && errno == ERANGE)
return NSS_STATUS_TRYAGAIN; return NSS_STATUS_TRYAGAIN;
@ -146,6 +153,7 @@ enum nss_status
_nss_nis_getgrnam_r (const char *name, struct group *grp, _nss_nis_getgrnam_r (const char *name, struct group *grp,
char *buffer, size_t buflen) char *buffer, size_t buflen)
{ {
struct parser_data *data = (void *) buffer;
enum nss_status retval; enum nss_status retval;
char *domain, *result, *p; char *domain, *result, *p;
int len, parse_res; int len, parse_res;
@ -182,7 +190,7 @@ _nss_nis_getgrnam_r (const char *name, struct group *grp,
++p; ++p;
free (result); free (result);
parse_res = _nss_files_parse_grent (p, grp, buffer, buflen); parse_res = _nss_files_parse_grent (p, grp, data, buflen);
if (!parse_res) if (!parse_res)
{ {
@ -199,6 +207,7 @@ enum nss_status
_nss_nis_getgrgid_r (gid_t gid, struct group *grp, _nss_nis_getgrgid_r (gid_t gid, struct group *grp,
char *buffer, size_t buflen) char *buffer, size_t buflen)
{ {
struct parser_data *data = (void *) buffer;
enum nss_status retval; enum nss_status retval;
char *domain, *result, *p; char *domain, *result, *p;
int len, nlen, parse_res; int len, nlen, parse_res;
@ -232,7 +241,7 @@ _nss_nis_getgrgid_r (gid_t gid, struct group *grp,
++p; ++p;
free (result); free (result);
parse_res = _nss_files_parse_grent (p, grp, buffer, buflen); parse_res = _nss_files_parse_grent (p, grp, data, buflen);
if (!parse_res) if (!parse_res)
{ {

View File

@ -30,6 +30,11 @@
#include "nss-nis.h" #include "nss-nis.h"
/* Get the declaration of the parser function. */
#define ENTNAME netent
#define EXTERN_PARSER
#include "../nss/nss_files/files-parse.c"
__libc_lock_define_initialized (static, lock) __libc_lock_define_initialized (static, lock)
static bool_t new_start = 1; static bool_t new_start = 1;
@ -76,6 +81,7 @@ static enum nss_status
internal_nis_getnetent_r (struct netent *net, char *buffer, size_t buflen, internal_nis_getnetent_r (struct netent *net, char *buffer, size_t buflen,
int *herrnop) int *herrnop)
{ {
struct parser_data *data = (void *) buffer;
char *domain, *result, *outkey; char *domain, *result, *outkey;
int len, keylen, parse_res; int len, keylen, parse_res;
@ -120,7 +126,7 @@ internal_nis_getnetent_r (struct netent *net, char *buffer, size_t buflen,
++p; ++p;
free (result); free (result);
parse_res = _nss_files_parse_netent (p, net, buffer, buflen); parse_res = _nss_files_parse_netent (p, net, data, buflen);
if (!parse_res && errno == ERANGE) if (!parse_res && errno == ERANGE)
{ {
*herrnop = NETDB_INTERNAL; *herrnop = NETDB_INTERNAL;
@ -157,6 +163,7 @@ _nss_nis_getnetbyname_r (const char *name, struct netent *net,
char *buffer, size_t buflen, int *herrnop) char *buffer, size_t buflen, int *herrnop)
{ {
enum nss_status retval; enum nss_status retval;
struct parser_data *data = (void *) buffer;
char *domain, *result, *p; char *domain, *result, *p;
int len, parse_res; int len, parse_res;
@ -197,7 +204,7 @@ _nss_nis_getnetbyname_r (const char *name, struct netent *net,
++p; ++p;
free (result); free (result);
parse_res = _nss_files_parse_netent (p, net, buffer, buflen); parse_res = _nss_files_parse_netent (p, net, data, buflen);
if (!parse_res) if (!parse_res)
{ {
@ -215,6 +222,7 @@ enum nss_status
_nss_nis_getnetbyaddr_r (unsigned long addr, int type, struct netent *net, _nss_nis_getnetbyaddr_r (unsigned long addr, int type, struct netent *net,
char *buffer, size_t buflen, int *herrnop) char *buffer, size_t buflen, int *herrnop)
{ {
struct parser_data *data = (void *) buffer;
char *domain; char *domain;
char *result; char *result;
int len; int len;
@ -275,7 +283,7 @@ _nss_nis_getnetbyaddr_r (unsigned long addr, int type, struct netent *net,
++p; ++p;
free (result); free (result);
parse_res = _nss_files_parse_netent (p, net, buffer, buflen); parse_res = _nss_files_parse_netent (p, net, data, buflen);
if (!parse_res) if (!parse_res)

View File

@ -28,6 +28,11 @@
#include "nss-nis.h" #include "nss-nis.h"
/* Get the declaration of the parser function. */
#define ENTNAME protoent
#define EXTERN_PARSER
#include "../nss/nss_files/files-parse.c"
__libc_lock_define_initialized (static, lock) __libc_lock_define_initialized (static, lock)
static bool_t new_start = 1; static bool_t new_start = 1;
@ -74,6 +79,7 @@ static enum nss_status
internal_nis_getprotoent_r (struct protoent *proto, internal_nis_getprotoent_r (struct protoent *proto,
char *buffer, size_t buflen) char *buffer, size_t buflen)
{ {
struct parser_data *data = (void *) buffer;
char *domain, *result, *outkey; char *domain, *result, *outkey;
int len, keylen, parse_res; int len, keylen, parse_res;
@ -114,7 +120,7 @@ internal_nis_getprotoent_r (struct protoent *proto,
++p; ++p;
free (result); free (result);
parse_res = _nss_files_parse_protoent (p, proto, buffer, buflen); parse_res = _nss_files_parse_protoent (p, proto, data, buflen);
if (!parse_res && errno == ERANGE) if (!parse_res && errno == ERANGE)
return NSS_STATUS_TRYAGAIN; return NSS_STATUS_TRYAGAIN;
@ -146,6 +152,7 @@ enum nss_status
_nss_nis_getprotobyname_r (const char *name, struct protoent *proto, _nss_nis_getprotobyname_r (const char *name, struct protoent *proto,
char *buffer, size_t buflen) char *buffer, size_t buflen)
{ {
struct parser_data *data = (void *) buffer;
enum nss_status retval; enum nss_status retval;
char *domain, *result, *p; char *domain, *result, *p;
int len, parse_res; int len, parse_res;
@ -182,7 +189,7 @@ _nss_nis_getprotobyname_r (const char *name, struct protoent *proto,
++p; ++p;
free (result); free (result);
parse_res = _nss_files_parse_protoent (p, proto, buffer, buflen); parse_res = _nss_files_parse_protoent (p, proto, data, buflen);
if (!parse_res) if (!parse_res)
{ {
@ -199,6 +206,7 @@ enum nss_status
_nss_nis_getprotobynumber_r (int number, struct protoent *proto, _nss_nis_getprotobynumber_r (int number, struct protoent *proto,
char *buffer, size_t buflen) char *buffer, size_t buflen)
{ {
struct parser_data *data = (void *) buffer;
enum nss_status retval; enum nss_status retval;
char *domain, *result, *p; char *domain, *result, *p;
int len, nlen, parse_res; int len, nlen, parse_res;
@ -232,7 +240,7 @@ _nss_nis_getprotobynumber_r (int number, struct protoent *proto,
++p; ++p;
free (result); free (result);
parse_res = _nss_files_parse_protoent (p, proto, buffer, buflen); parse_res = _nss_files_parse_protoent (p, proto, data, buflen);
if (!parse_res) if (!parse_res)
{ {

View File

@ -28,6 +28,12 @@
#include "nss-nis.h" #include "nss-nis.h"
/* Get the declaration of the parser function. */
#define ENTNAME pwent
#define STRUCTURE passwd
#define EXTERN_PARSER
#include "../nss/nss_files/files-parse.c"
/* Protect global state against multiple changers */ /* Protect global state against multiple changers */
__libc_lock_define_initialized (static, lock) __libc_lock_define_initialized (static, lock)
@ -74,6 +80,7 @@ _nss_nis_endpwent (void)
static enum nss_status static enum nss_status
internal_nis_getpwent_r (struct passwd *pwd, char *buffer, size_t buflen) internal_nis_getpwent_r (struct passwd *pwd, char *buffer, size_t buflen)
{ {
struct parser_data *data = (void *) buffer;
char *domain, *result, *outkey; char *domain, *result, *outkey;
int len, keylen, parse_res; int len, keylen, parse_res;
@ -114,7 +121,7 @@ internal_nis_getpwent_r (struct passwd *pwd, char *buffer, size_t buflen)
++p; ++p;
free (result); free (result);
parse_res = _nss_files_parse_pwent (p, pwd, buffer, buflen); parse_res = _nss_files_parse_pwent (p, pwd, data, buflen);
if (!parse_res && errno == ERANGE) if (!parse_res && errno == ERANGE)
return NSS_STATUS_TRYAGAIN; return NSS_STATUS_TRYAGAIN;
@ -146,6 +153,7 @@ enum nss_status
_nss_nis_getpwnam_r (const char *name, struct passwd *pwd, _nss_nis_getpwnam_r (const char *name, struct passwd *pwd,
char *buffer, size_t buflen) char *buffer, size_t buflen)
{ {
struct parser_data *data = (void *) buffer;
enum nss_status retval; enum nss_status retval;
char *domain, *result, *p; char *domain, *result, *p;
int len, parse_res; int len, parse_res;
@ -182,7 +190,7 @@ _nss_nis_getpwnam_r (const char *name, struct passwd *pwd,
++p; ++p;
free (result); free (result);
parse_res = _nss_files_parse_pwent (p, pwd, buffer, buflen); parse_res = _nss_files_parse_pwent (p, pwd, data, buflen);
if (!parse_res) if (!parse_res)
{ {
@ -199,6 +207,7 @@ enum nss_status
_nss_nis_getpwuid_r (uid_t uid, struct passwd *pwd, _nss_nis_getpwuid_r (uid_t uid, struct passwd *pwd,
char *buffer, size_t buflen) char *buffer, size_t buflen)
{ {
struct parser_data *data = (void *) buffer;
enum nss_status retval; enum nss_status retval;
char *domain, *result, *p; char *domain, *result, *p;
int len, nlen, parse_res; int len, nlen, parse_res;
@ -232,7 +241,7 @@ _nss_nis_getpwuid_r (uid_t uid, struct passwd *pwd,
++p; ++p;
free (result); free (result);
parse_res = _nss_files_parse_pwent (p, pwd, buffer, buflen); parse_res = _nss_files_parse_pwent (p, pwd, data, buflen);
if (!parse_res) if (!parse_res)
{ {

View File

@ -28,6 +28,11 @@
#include "nss-nis.h" #include "nss-nis.h"
/* Get the declaration of the parser function. */
#define ENTNAME rpcent
#define EXTERN_PARSER
#include "../nss/nss_files/files-parse.c"
__libc_lock_define_initialized (static, lock) __libc_lock_define_initialized (static, lock)
struct intern_t struct intern_t
@ -98,6 +103,7 @@ static enum nss_status
internal_nis_getrpcent_r (struct rpcent *rpc, char *buffer, size_t buflen, internal_nis_getrpcent_r (struct rpcent *rpc, char *buffer, size_t buflen,
intern_t *data) intern_t *data)
{ {
struct parser_data *pdata = (void *) buffer;
char *domain; char *domain;
char *result; char *result;
int len, parse_res; int len, parse_res;
@ -141,7 +147,7 @@ internal_nis_getrpcent_r (struct rpcent *rpc, char *buffer, size_t buflen,
++p; ++p;
free (result); free (result);
parse_res = _nss_files_parse_rpcent (p, rpc, buffer, buflen); parse_res = _nss_files_parse_rpcent (p, rpc, pdata, buflen);
if (!parse_res && errno == ERANGE) if (!parse_res && errno == ERANGE)
return NSS_STATUS_TRYAGAIN; return NSS_STATUS_TRYAGAIN;
@ -223,6 +229,7 @@ enum nss_status
_nss_nis_getrpcbynumber_r (int number, struct rpcent *rpc, _nss_nis_getrpcbynumber_r (int number, struct rpcent *rpc,
char *buffer, size_t buflen) char *buffer, size_t buflen)
{ {
struct parser_data *data = (void *) buffer;
enum nss_status retval; enum nss_status retval;
char *domain, *result, *p; char *domain, *result, *p;
int len, nlen, parse_res; int len, nlen, parse_res;
@ -256,7 +263,7 @@ _nss_nis_getrpcbynumber_r (int number, struct rpcent *rpc,
++p; ++p;
free (result); free (result);
parse_res = _nss_files_parse_rpcent (p, rpc, buffer, buflen); parse_res = _nss_files_parse_rpcent (p, rpc, data, buflen);
if (!parse_res) if (!parse_res)
{ {

View File

@ -28,6 +28,12 @@
#include "nss-nis.h" #include "nss-nis.h"
/* Get the declaration of the parser function. */
#define ENTNAME spent
#define STRUCTURE spwd
#define EXTERN_PARSER
#include "../nss/nss_files/files-parse.c"
/* Protect global state against multiple changers */ /* Protect global state against multiple changers */
__libc_lock_define_initialized (static, lock) __libc_lock_define_initialized (static, lock)
@ -74,6 +80,7 @@ _nss_nis_endspent (void)
static enum nss_status static enum nss_status
internal_nis_getspent_r (struct spwd *sp, char *buffer, size_t buflen) internal_nis_getspent_r (struct spwd *sp, char *buffer, size_t buflen)
{ {
struct parser_data *data = (void *) buffer;
char *domain, *result, *outkey; char *domain, *result, *outkey;
int len, keylen, parse_res; int len, keylen, parse_res;
@ -114,7 +121,7 @@ internal_nis_getspent_r (struct spwd *sp, char *buffer, size_t buflen)
++p; ++p;
free (result); free (result);
parse_res = _nss_files_parse_spent (p, sp, buffer, buflen); parse_res = _nss_files_parse_spent (p, sp, data, buflen);
if (!parse_res && errno == ERANGE) if (!parse_res && errno == ERANGE)
return NSS_STATUS_TRYAGAIN; return NSS_STATUS_TRYAGAIN;
@ -146,6 +153,7 @@ enum nss_status
_nss_nis_getspnam_r (const char *name, struct spwd *sp, _nss_nis_getspnam_r (const char *name, struct spwd *sp,
char *buffer, size_t buflen) char *buffer, size_t buflen)
{ {
struct parser_data *data = (void *) buffer;
enum nss_status retval; enum nss_status retval;
char *domain, *result, *p; char *domain, *result, *p;
int len, parse_res; int len, parse_res;
@ -182,7 +190,7 @@ _nss_nis_getspnam_r (const char *name, struct spwd *sp,
++p; ++p;
free (result); free (result);
parse_res = _nss_files_parse_spent (p, sp, buffer, buflen); parse_res = _nss_files_parse_spent (p, sp, data, buflen);
if (!parse_res) if (!parse_res)
{ {

View File

@ -1,20 +1,20 @@
/* Copyright (C) 1996 Free Software Foundation, Inc. /* 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 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 modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version. License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful, The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details. Library General Public License for more details.
You should have received a copy of the GNU Library General Public 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 License along with the GNU C Library; see the file COPYING.LIB. If not,
not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */ Boston, MA 02111-1307, USA. */
/* Define interface to NSS. This is meant for the interface functions /* Define interface to NSS. This is meant for the interface functions
and for implementors of new services. */ and for implementors of new services. */

View File

@ -6,23 +6,23 @@
Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 95, 1996 Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 95, 1996
Free Software Foundation, Inc. Free Software Foundation, Inc.
This file is part of the GNU C Library. Its master source is NOT part of This file is part of the GNU C Library. Its master source is NOT part of
the C library, however. The master source lives in /gd/gnu/lib. the C library, however. The master source lives in /gd/gnu/lib.
The GNU C Library is free software; you can redistribute it and/or 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 modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version. License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful, The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details. Library General Public License for more details.
You should have received a copy of the GNU Library General Public 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 License along with the GNU C Library; see the file COPYING.LIB. If not,
not, write to the Free Software Foundation, Inc., 675 Mass Ave, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Cambridge, MA 02139, USA. */ Boston, MA 02111-1307, USA. */
/* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>. /* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>.
Ditto for AIX 3.2 and <stdlib.h>. */ Ditto for AIX 3.2 and <stdlib.h>. */
@ -726,6 +726,7 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
c = ':'; c = ':';
else else
c = '?'; c = '?';
return c;
} }
else else
/* We already incremented `optind' once; /* We already incremented `optind' once;

View File

@ -1,21 +1,21 @@
/* Definitions for POSIX 1003.1b-1993 (aka POSIX.4) scheduling interface. /* Definitions for POSIX 1003.1b-1993 (aka POSIX.4) scheduling interface.
Copyright (C) 1996 Free Software Foundation, Inc. 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 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 modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version. License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful, The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details. Library General Public License for more details.
You should have received a copy of the GNU Library General Public 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 License along with the GNU C Library; see the file COPYING.LIB. If not,
not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */ Boston, MA 02111-1307, USA. */
#ifndef _SCHED_H #ifndef _SCHED_H
#define _SCHED_H 1 #define _SCHED_H 1

View File

@ -33,7 +33,7 @@ routines := \
tmpfile tmpnam tmpnam_r tempnam tempname \ tmpfile tmpnam tmpnam_r tempnam tempname \
getline getw putw \ getline getw putw \
remove rename \ remove rename \
lockfile fcloseall lockfile
aux := errlist siglist aux := errlist siglist
distribute := _itoa.h printf-parse.h distribute := _itoa.h printf-parse.h

View File

@ -1,44 +0,0 @@
/* Close all streams but make sure this isn't done more than once.
This function is called in abort().
Copyright (C) 1996 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
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 <libc-lock.h>
#include <stdio.h>
static int already_called;
__libc_lock_define_initialized (static, lock);
void
__close_all_streams (void)
{
/* We must be prepared for multi-threading on multiple calls. */
if (! __libc_lock_trylock (lock) && ! already_called)
{
/* Signal that we already did this. */
already_called = 1;
/* Do the real work. */
fclose (NULL);
/* We don't release the lock so that the `trylock' immediately
fails. */
}
}

View File

@ -44,7 +44,7 @@ routines := \
a64l l64a \ a64l l64a \
rpmatch strfmon getsubopt rpmatch strfmon getsubopt
distribute := exit.h grouping.h distribute := exit.h grouping.h abort-instr.h
tests := tst-strtol tst-strtod testmb testrand testsort testdiv \ tests := tst-strtol tst-strtod testmb testrand testsort testdiv \
test-canon test-canon

View File

@ -0,0 +1,2 @@
/* We cannot give any generic instruction to crash the program.
abort() will have to make sure it never returns. */

View File

@ -16,16 +16,26 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */ Boston, MA 02111-1307, USA. */
#include <libc-lock.h>
#include <signal.h> #include <signal.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
#include <signal.h>
/* Try to get a machine dependent instruction which will make the
program crash. This is used in case everything else fails. */
#include "abort-instr.h"
#ifndef ABORT_INSTRUCTION
/* No such instruction is available. */
# define ABORT_INSTRUCTION
#endif
/* Function to close all streams and also make sure we don't loop by /* We must avoid to run in circles. Therefore we remember how far we
calling abort while closing the streams. */ already got. */
extern void __close_all_streams (void); static int stage;
/* We should be prepared for multiple threads trying to run abort. */
__libc_lock_define_initialized_recursive (static, lock);
/* Cause an abnormal program termination with core-dump. */ /* Cause an abnormal program termination with core-dump. */
@ -35,41 +45,78 @@ abort (void)
struct sigaction act; struct sigaction act;
sigset_t sigs; sigset_t sigs;
if (__sigemptyset (&sigs) == 0 && /* First acquire the lock. */
__sigaddset (&sigs, SIGABRT) == 0) __libc_lock_lock (lock);
__sigprocmask (SIG_UNBLOCK, &sigs, (sigset_t *) NULL);
/* If there is a user handler installed use it. We don't close or /* Now it's for sure we are alone. But recursive calls are possible. */
flush streams. */
if (__sigaction (SIGABRT, NULL, &act) >= 0 /* Unlock SIGABRT. */
&& act.sa_handler != SIG_DFL) if (stage == 0)
{ {
/* Send signal to call user handler. */ ++stage;
if (__sigemptyset (&sigs) == 0 &&
__sigaddset (&sigs, SIGABRT) == 0)
__sigprocmask (SIG_UNBLOCK, &sigs, (sigset_t *) NULL);
}
/* Flush all streams. We cannot close them now because the user
might have registered a handler for SIGABRT. */
if (stage == 1)
{
++stage;
fflush (NULL);
}
/* Send signal which possibly calls a user handler. */
if (stage == 2)
{
++stage;
raise (SIGABRT); raise (SIGABRT);
}
/* It returns, so we are responsible for closing the streams. */ /* There was a handler installed. Now remove it. */
__close_all_streams (); if (stage == 3)
{
/* There was a handler installed. Now remove it. */ ++stage;
memset (&act, '\0', sizeof (struct sigaction)); memset (&act, '\0', sizeof (struct sigaction));
act.sa_handler = SIG_DFL; act.sa_handler = SIG_DFL;
__sigfillset (&act.sa_mask); __sigfillset (&act.sa_mask);
act.sa_flags = 0; act.sa_flags = 0;
__sigaction (SIGABRT, &act, NULL); __sigaction (SIGABRT, &act, NULL);
} }
else
/* No handler installed so the next `raise' will hopefully /* Now close the streams which also flushes the output the user
terminate the process. Therefore we must close the streams. */ defined handler might has produced. */
__close_all_streams (); if (stage == 4)
{
++stage;
fclose (NULL);
}
/* Try again. */ /* Try again. */
raise (SIGABRT); if (stage == 5)
{
++stage;
raise (SIGABRT);
}
/* If we can't signal ourselves, exit. */ /* Now try to abort using the system specific command. */
_exit (127); if (stage == 6)
{
++stage;
ABORT_INSTRUCTION;
}
/* If even this fails make sure we never return. */ /* If we can't signal ourselves and the abort instruction failed, exit. */
if (stage == 7)
{
++stage;
_exit (127);
}
/* If even this fails try to use the provided instruction to crash
or otherwise make sure we never return. */
while (1) while (1)
/* For ever and ever. */ /* Try for ever and ever. */
; ABORT_INSTRUCTION;
} }

View File

@ -0,0 +1,2 @@
/* An instruction which should crash any program is `hlt'. */
#define ABORT_INSTRUCTION asm ("hlt")

View File

@ -1,22 +1,22 @@
/* FPU control word bits. i387 version. /* FPU control word bits. i387 version.
Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc. Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
Contributed by Olaf Flebbe. Contributed by Olaf Flebbe.
The GNU C Library is free software; you can redistribute it and/or 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 modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version. License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful, The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details. Library General Public License for more details.
You should have received a copy of the GNU Library General Public 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 License along with the GNU C Library; see the file COPYING.LIB. If not,
not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */ Boston, MA 02111-1307, USA. */
#ifndef _FPU_CONTROL_H #ifndef _FPU_CONTROL_H
#define _FPU_CONTROL_H 1 #define _FPU_CONTROL_H 1

View File

@ -1,20 +1,20 @@
/* Copyright (C) 1991, 1996 Free Software Foundation, Inc. /* 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 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 modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version. License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful, The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details. Library General Public License for more details.
You should have received a copy of the GNU Library General Public 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 License along with the GNU C Library; see the file COPYING.LIB. If not,
not, write to the Free Software Foundation, Inc., 675 Mass Ave, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Cambridge, MA 02139, USA. */ Boston, MA 02111-1307, USA. */
#include <signal.h> #include <signal.h>
#include <unistd.h> #include <unistd.h>
@ -26,6 +26,6 @@ Cambridge, MA 02139, USA. */
int int
__libc_pause (void) __libc_pause (void)
{ {
return __sigpause (__sigblock (0)); return __sigpause (__sigblock (0), 0);
} }
weak_alias (__libc_pause, pause) weak_alias (__libc_pause, pause)

View File

@ -33,9 +33,18 @@ struct timeval
#ifndef _TIMEBITS_H #ifndef _TIMEBITS_H
#define _TIMEBITS_H 1 # define _TIMEBITS_H 1
#include <asm/param.h> /* ISO/IEC 9899:1990 7.12.1: <time.h>
#define CLOCKS_PER_SEC HZ /* XXX names not kosher */ The macro `CLOCKS_PER_SEC' is the number per second of the value
returned by the `clock' function. */
/* CAE XSH, Issue 4, Version 2: <time.h>
The value of CLOCKS_PER_SEC is required to be 1 million on all
XSI-conformant systems. */
# define CLOCKS_PER_SEC 1000000
/* Even though CLOCKS_PER_SEC has such a strange value CLK_TCK
presents the real value for clock ticks per second for the system. */
# define CLK_TCK 1024
#endif /* timebits.h */ #endif /* timebits.h */

View File

@ -1,21 +1,21 @@
/* O_*, F_*, FD_* bit values for Linux. /* O_*, F_*, FD_* bit values for Linux.
Copyright (C) 1995, 1996 Free Software Foundation, Inc. Copyright (C) 1995, 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 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 modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version. License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful, The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details. Library General Public License for more details.
You should have received a copy of the GNU Library General Public 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 License along with the GNU C Library; see the file COPYING.LIB. If not,
not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */ Boston, MA 02111-1307, USA. */
#ifndef _FCNTLBITS_H #ifndef _FCNTLBITS_H
#define _FCNTLBITS_H 1 #define _FCNTLBITS_H 1

View File

@ -1,20 +1,20 @@
/* Copyright (C) 1996 Free Software Foundation, Inc. /* 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 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 modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version. License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful, The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details. Library General Public License for more details.
You should have received a copy of the GNU Library General Public 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 License along with the GNU C Library; see the file COPYING.LIB. If not,
not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */ Boston, MA 02111-1307, USA. */
#ifndef _IOCTLS_H #ifndef _IOCTLS_H
#define _IOCTLS_H 1 #define _IOCTLS_H 1

View File

@ -0,0 +1,83 @@
/* Copyright (C) 1991, 1992, 1994, 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., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <setjmp.h>
/* Save the current program position in ENV and return 0. */
int
__sigsetjmp (jmp_buf env, int savemask)
{
/* Save data registers D1 through D7. */
asm volatile ("movem%.l %/d1-%/d7, %0"
: : "m" (env[0].__jmpbuf[0].__dregs[0]));
/* Save return address in place of register A0. */
env[0].__jmpbuf[0].__aregs[0] = ((void **) &env)[-1];
/* Save address registers A1 through A5. */
asm volatile ("movem%.l %/a1-%/a5, %0"
: : "m" (env[0].__jmpbuf[0].__aregs[1]));
/* Save caller's FP, not our own. */
env[0].__jmpbuf[0].__fp = ((void **) &env)[-2];
/* Save caller's SP, not our own. */
env[0].__jmpbuf[0].__sp = (void *) &env;
#if defined (__HAVE_68881__) || defined (__HAVE_FPU__)
/* Save floating-point (68881) registers FP0 through FP7. */
asm volatile ("fmovem%.x %/fp0-%/fp7, %0"
: : "m" (env[0].__jmpbuf[0].__fpregs[0]));
#endif
/* Save the signal mask if requested. */
return __sigjmp_save (env, savemask);
}
/* Binary compatibility entry point. */
int
__setjmp (jmp_buf env)
{
/* Save data registers D1 through D7. */
asm volatile ("movem%.l %/d1-%/d7, %0"
: : "m" (env[0].__jmpbuf[0].__dregs[0]));
/* Save return address in place of register A0. */
env[0].__jmpbuf[0].__aregs[0] = ((void **) &env)[-1];
/* Save address registers A1 through A5. */
asm volatile ("movem%.l %/a1-%/a5, %0"
: : "m" (env[0].__jmpbuf[0].__aregs[1]));
/* Save caller's FP, not our own. */
env[0].__jmpbuf[0].__fp = ((void **) &env)[-2];
/* Save caller's SP, not our own. */
env[0].__jmpbuf[0].__sp = (void *) &env;
#if defined (__HAVE_68881__) || defined (__HAVE_FPU__)
/* Save floating-point (68881) registers FP0 through FP7. */
asm volatile ("fmovem%.x %/fp0-%/fp7, %0"
: : "m" (env[0].__jmpbuf[0].__fpregs[0]));
#endif
/* Don't save the signal mask. */
env[0].__mask_was_saved = 0;
return 0;
}

View File

@ -1,20 +1,20 @@
/* Copyright (C) 1996 Free Software Foundation, Inc. /* 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 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 modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version. License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful, The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details. Library General Public License for more details.
You should have received a copy of the GNU Library General Public 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 License along with the GNU C Library; see the file COPYING.LIB. If not,
not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */ Boston, MA 02111-1307, USA. */
#ifndef _SIGCONTEXT_H #ifndef _SIGCONTEXT_H
#define _SIGCONTEXT_H 1 #define _SIGCONTEXT_H 1

View File

@ -1,20 +1,20 @@
/* Copyright (C) 1996 Free Software Foundation, Inc. /* 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 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 modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version. License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful, The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details. Library General Public License for more details.
You should have received a copy of the GNU Library General Public 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 License along with the GNU C Library; see the file COPYING.LIB. If not,
not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */ Boston, MA 02111-1307, USA. */
#ifndef _SYS_ACCT_H #ifndef _SYS_ACCT_H

View File

@ -43,4 +43,8 @@ struct timeval
XSI-conformant systems. */ XSI-conformant systems. */
# define CLOCKS_PER_SEC 1000000 # define CLOCKS_PER_SEC 1000000
/* Even though CLOCKS_PER_SEC has such a strange value CLK_TCK
presents the real value for clock ticks per second for the system. */
# define CLK_TCK 100
#endif /* timebits.h */ #endif /* timebits.h */

View File

@ -1,19 +1,20 @@
/* Copyright (C) 1995 Free Software Foundation, Inc. /* Copyright (C) 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 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 modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version. License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful, The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details. Library General Public License for more details.
You should have received a copy of the GNU Library General Public 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 License along with the GNU C Library; see the file COPYING.LIB. If not,
not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */ Boston, MA 02111-1307, USA. */
/* Length of the entries in `struct utsname' is 65. */ /* Length of the entries in `struct utsname' is 65. */
#define _UTSNAME_LENGTH 65 #define _UTSNAME_LENGTH 65

View File

@ -1,21 +1,21 @@
/* Copyright (C) 1995 Free Software Foundation, Inc. /* Copyright (C) 1995, 1996 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995. Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
The GNU C Library is free software; you can redistribute it and/or 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 modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version. License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful, The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details. Library General Public License for more details.
You should have received a copy of the GNU Library General Public 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 License along with the GNU C Library; see the file COPYING.LIB. If not,
not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */ Boston, MA 02111-1307, USA. */
#ifndef _SYS_MSG_H #ifndef _SYS_MSG_H
#define _SYS_MSG_H #define _SYS_MSG_H
@ -37,7 +37,7 @@ __BEGIN_DECLS
/* Template for struct to be used as argument for `msgsnd' and `msgrcv'. */ /* Template for struct to be used as argument for `msgsnd' and `msgrcv'. */
struct msgbuf struct msgbuf
{ {
long mtype; /* type of received/sent message */ long int mtype; /* type of received/sent message */
char mtext[1]; /* text of the message */ char mtext[1]; /* text of the message */
}; };
@ -50,7 +50,7 @@ extern int msgget __P ((key_t __key, int __msgflg));
/* Receive message from message queue. */ /* Receive message from message queue. */
extern int msgrcv __P ((int __msqid, void *__msgp, size_t __msgsz, extern int msgrcv __P ((int __msqid, void *__msgp, size_t __msgsz,
long __msgtyp, int __msgflg)); long int __msgtyp, int __msgflg));
/* Send message to message queue. */ /* Send message to message queue. */
extern int msgsnd __P ((int __msqid, void *__msgp, size_t __msgsz, extern int msgsnd __P ((int __msqid, void *__msgp, size_t __msgsz,

View File

@ -229,6 +229,11 @@ static const char spaces[16] = " ";
# define TOUPPER(Ch) (islower (Ch) ? toupper (Ch) : (Ch)) # define TOUPPER(Ch) (islower (Ch) ? toupper (Ch) : (Ch))
# define TOLOWER(Ch) (isupper (Ch) ? tolower (Ch) : (Ch)) # define TOLOWER(Ch) (isupper (Ch) ? tolower (Ch) : (Ch))
#endif #endif
/* We don't use `isdigit' here since the locale dependent
interpretation is not what we want here. We only need to accept
the arabic digits in the ASCII range. One day there is perhaps a
more reliable way to accept other sets of digits. */
#define ISDIGIT(Ch) ((unsigned int) (Ch) - '0' <= 9)
static char *memcpy_lowcase __P ((char *dest, const char *src, size_t len)); static char *memcpy_lowcase __P ((char *dest, const char *src, size_t len));
@ -487,17 +492,19 @@ strftime (s, maxsize, format, tp)
#endif /* ! DO_MULTIBYTE */ #endif /* ! DO_MULTIBYTE */
/* Check for flags that can modify a number format. */ /* Check for flags that can modify a format. */
while (1) while (1)
{ {
switch (*++f) switch (*++f)
{ {
/* This influences the number formats. */
case '_': case '_':
case '-': case '-':
case '0': case '0':
pad = *f; pad = *f;
continue; continue;
/* This changes textual output. */
case '^': case '^':
to_uppcase = 1; to_uppcase = 1;
continue; continue;
@ -510,15 +517,16 @@ strftime (s, maxsize, format, tp)
} }
/* As a GNU extension we allow to specify the field width. */ /* As a GNU extension we allow to specify the field width. */
if (isdigit (*f)) if (ISDIGIT (*f))
{ {
width = 0; width = 0;
do do
{ {
width *= 10; width *= 10;
width += *f - '0'; width += *f - '0';
++f;
} }
while (isdigit (*++f)); while (ISDIGIT (*f));
} }
/* Check for modifiers. */ /* Check for modifiers. */

View File

@ -48,8 +48,10 @@ __BEGIN_DECLS
/* This is the obsolete POSIX.1-1988 name for the same constant. */ /* This is the obsolete POSIX.1-1988 name for the same constant. */
#ifdef __USE_POSIX #ifdef __USE_POSIX
#ifndef CLK_TCK
#define CLK_TCK CLOCKS_PER_SEC #define CLK_TCK CLOCKS_PER_SEC
#endif #endif
#endif
#endif /* <time.h> included. */ #endif /* <time.h> included. */