update from main archive 970127

1997-01-28 04:23  Ulrich Drepper  <drepper@cygnus.com>
	* version.h (VERSION): Bump to 2.0.1.
	* posix/getopt.c: Handle another problem introduced by the
	nonoption_flags array.  We must be able to work with reordered
	argv arrays.  Reported by Andreas Schwab.
1997-01-28 02:38  Ulrich Drepper  <drepper@cygnus.com>
	* sysdeps/unix/sysv/linux/i386/clone.S: Correct handling of new
1997-01-27 17:34  Thorsten Kukuk <kukuk@weber.uni-paderborn.de>
	* nis/rpcsvc/yp_prot.h: Correct definitions and types in file so
	that it works with yp.h.
1997-01-27 13:28  Ulrich Drepper  <drepper@cygnus.com>
	* malloc/malloc.h (__malloc_initialized) [_LIBC]: Define as
	__libc_malloc_initialized so that this variable is not shared with
	other users of GNU malloc.
	Suggested by Martin von Loewis <martin@mira.isdn.cs.tu-berlin.de>.
	* mcheck.h: Correct typo.  Use malloc/ instead of new-malloc/.
	* sysdeps/i386/Makefile (CFLAGS-dl-load.c, CFLAGS-dl-reloc.c): New
	variables to prevent warnings.
	* sysdeps/i386/dl-machine.h (fixup): Add prototype and declare
	using attribute regparm.
	(ELF_MACHINE_RUNTIME_TRAMPOLINE): Rewrite so that no register
	is changed by the resolver code.
1997-01-14 14:20  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
	* malloc/malloc.c (weak_variable): Define.
	(__malloc_initialize_hook, __free_hook, __malloc_hook, __realloc_hook,
	__memalign_hook): Make them weak definitions.
1997-01-26 11:35  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
	* sysdeps/unix/sysv/linux/getdents.c: Don't write beyond buffer
	limits, correctly take structure padding into account, use correct
	offset when resetting the stream, change heuristic to assume an
	average name length of 14 characters.
1997-01-25 18:06  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
	* sysdeps/unix/sysv/linux/alpha/termbits.h: Protect against multiple
	inclusion.
See ChangeLog.6 for earlier changes.
This commit is contained in:
Ulrich Drepper 1997-01-28 03:59:29 +00:00
parent bdf289b222
commit 831372e7c1
15 changed files with 10839 additions and 10719 deletions

10620
ChangeLog

File diff suppressed because it is too large Load Diff

10547
ChangeLog.6 Normal file

File diff suppressed because it is too large Load Diff

View File

@ -106,11 +106,11 @@ From: ${USER}
To: ${BUGADDR} To: ${BUGADDR}
Subject: [50 character or so descriptive subject here (for reference)] Subject: [50 character or so descriptive subject here (for reference)]
>Submitter-Id: <submitter ID> >Submitter-Id: net
>Originator: ${ORIGINATOR} >Originator: ${ORIGINATOR}
>Organization: >Organization:
${ORGANIZATION- $ORGANIZATION_C} ${ORGANIZATION- $ORGANIZATION_C}
>Confidential: no (the GNU PR database is public) >Confidential: no
>Synopsis: $SYNOPSIS_C >Synopsis: $SYNOPSIS_C
>Severity: $SEVERITY_C >Severity: $SEVERITY_C
>Priority: $PRIORITY_C >Priority: $PRIORITY_C

View File

@ -50,4 +50,5 @@ $(objpfx)libmcheck.a: $(objpfx)mcheck-init.o
lib: $(objpfx)libmcheck.a lib: $(objpfx)libmcheck.a
CPPFLAGS-malloc.o += -DMALLOC_DEBUG # Uncomment this for test releases. For public releases it is too expensive.
#CPPFLAGS-malloc.o += -DMALLOC_DEBUG

View File

@ -647,7 +647,7 @@ do { \
might set to a value close to the average size of a process might set to a value close to the average size of a process
(program) running on your system. Releasing this much memory (program) running on your system. Releasing this much memory
would allow such a process to run in memory. Generally, it's would allow such a process to run in memory. Generally, it's
worth it to tune for trimming rather tham memory mapping when a worth it to tune for trimming rather than memory mapping when a
program undergoes phases where several large chunks are program undergoes phases where several large chunks are
allocated and released in ways that can reuse each other's allocated and released in ways that can reuse each other's
storage, perhaps mixed with phases where there are no such storage, perhaps mixed with phases where there are no such
@ -1486,6 +1486,13 @@ static unsigned long max_mmapped_mem = 0;
#ifndef _LIBC
#define weak_variable
#else
/* In GNU libc we want the hook variables to be weak definitions to
avoid a problem with Emacs. */
#define weak_variable weak_function
#endif
/* Already initialized? */ /* Already initialized? */
int __malloc_initialized = 0; int __malloc_initialized = 0;
@ -1533,12 +1540,20 @@ ptmalloc_init __MALLOC_P((void))
tsd_setspecific(arena_key, (Void_t *)&main_arena); tsd_setspecific(arena_key, (Void_t *)&main_arena);
#endif #endif
#if defined(_LIBC) || defined(MALLOC_HOOKS) #if defined(_LIBC) || defined(MALLOC_HOOKS)
if((s = getenv("MALLOC_TRIM_THRESHOLD_")))
mALLOPt(M_TRIM_THRESHOLD, atoi(s));
if((s = getenv("MALLOC_TOP_PAD_")))
mALLOPt(M_TOP_PAD, atoi(s));
if((s = getenv("MALLOC_MMAP_THRESHOLD_")))
mALLOPt(M_MMAP_THRESHOLD, atoi(s));
if((s = getenv("MALLOC_MMAP_MAX_")))
mALLOPt(M_MMAP_MAX, atoi(s));
s = getenv("MALLOC_CHECK_"); s = getenv("MALLOC_CHECK_");
__malloc_hook = save_malloc_hook; __malloc_hook = save_malloc_hook;
__free_hook = save_free_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();
} }
if(__malloc_initialize_hook != NULL) if(__malloc_initialize_hook != NULL)
(*__malloc_initialize_hook)(); (*__malloc_initialize_hook)();
@ -1592,18 +1607,18 @@ memalign_hook_ini(sz, alignment) size_t sz; size_t alignment;
return mEMALIGn(sz, alignment); return mEMALIGn(sz, alignment);
} }
void (*__malloc_initialize_hook) __MALLOC_P ((void)) = NULL; void weak_variable (*__malloc_initialize_hook) __MALLOC_P ((void)) = NULL;
void (*__free_hook) __MALLOC_P ((__malloc_ptr_t __ptr)) = NULL; void weak_variable (*__free_hook) __MALLOC_P ((__malloc_ptr_t __ptr)) = NULL;
__malloc_ptr_t (*__malloc_hook) __malloc_ptr_t weak_variable (*__malloc_hook)
__MALLOC_P ((size_t __size)) = malloc_hook_ini; __MALLOC_P ((size_t __size)) = malloc_hook_ini;
__malloc_ptr_t (*__realloc_hook) __malloc_ptr_t weak_variable (*__realloc_hook)
__MALLOC_P ((__malloc_ptr_t __ptr, size_t __size)) = realloc_hook_ini; __MALLOC_P ((__malloc_ptr_t __ptr, size_t __size)) = realloc_hook_ini;
__malloc_ptr_t (*__memalign_hook) __malloc_ptr_t weak_variable (*__memalign_hook)
__MALLOC_P ((size_t __size, size_t __alignment)) = memalign_hook_ini; __MALLOC_P ((size_t __size, size_t __alignment)) = memalign_hook_ini;
/* Activate a standard set of debugging hooks. */ /* Activate a standard set of debugging hooks. */
void void
malloc_check_init() __malloc_check_init()
{ {
__malloc_hook = malloc_check; __malloc_hook = malloc_check;
__free_hook = free_check; __free_hook = free_check;
@ -3265,10 +3280,12 @@ Void_t* cALLOc(n, elem_size) size_t n; size_t elem_size;
if (__malloc_hook != NULL) { if (__malloc_hook != NULL) {
sz = n * elem_size; sz = n * elem_size;
mem = (*__malloc_hook)(sz); mem = (*__malloc_hook)(sz);
if(mem == 0)
return 0;
#ifdef HAVE_MEMCPY #ifdef HAVE_MEMCPY
memset(mem, 0, sz); memset(mem, 0, sz);
#else #else
while(sz > 0) mem[--sz] = 0; /* rather inefficient */ while(sz > 0) ((char*)mem)[--sz] = 0; /* rather inefficient */
#endif #endif
return mem; return mem;
} }

View File

@ -1,5 +1,5 @@
/* Prototypes and definition for malloc implementation. /* Prototypes and definition for malloc implementation.
Copyright (C) 1996 Free Software Foundation, Inc. Copyright (C) 1996, 1997 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
@ -74,6 +74,11 @@ extern "C" {
#endif #endif
/* Nonzero if the malloc is already initialized. */ /* Nonzero if the malloc is already initialized. */
#ifdef _LIBC
/* In the GNU libc we rename the global variable
`__malloc_initialized' to `__libc_malloc_initialized'. */
#define __malloc_initialized __libc_malloc_initialized
#endif
extern int __malloc_initialized; extern int __malloc_initialized;
/* Initialize global configuration. Not needed with GNU libc. */ /* Initialize global configuration. Not needed with GNU libc. */
@ -178,7 +183,7 @@ extern __malloc_ptr_t (*__memalign_hook) __MALLOC_P ((size_t __size,
size_t __alignment)); size_t __alignment));
/* Activate a standard set of debugging hooks. */ /* Activate a standard set of debugging hooks. */
extern void malloc_check_init __MALLOC_P ((void)); extern void __malloc_check_init __MALLOC_P ((void));
#endif #endif

View File

@ -1,5 +1 @@
#ifdef USE_NEW_MALLOC #include <malloc/mcheck.h>
# include <new-malloc/mcheck.h>
#else
# include <malloc/malloc.h>
#endif

View File

@ -61,26 +61,28 @@
#define YPPROG ((u_long)100004) #define YPPROG ((u_long)100004)
#define YPVERS ((u_long)2) #define YPVERS ((u_long)2)
#define YPVERS_ORIG ((u_long)1) #define YPVERS_ORIG ((u_long)1)
#define YPMAXRECORD ((u_long)1024) #define YPMAXRECORD 1024
#define YPMAXDOMAIN ((u_long)256) #define YPMAXDOMAIN 64 /* XXX orig. yp_prot.h defines ((u_long)256) */
#define YPMAXMAP ((u_long)64) #define YPMAXMAP 64
#define YPMAXPEER ((u_long)256) #define YPMAXPEER 64 /* XXX orig. yp_prot.h defines ((u_long)256) */
/* byte size of a large NIS packet */ /* byte size of a large NIS packet */
#define YPMSGSZ 1600 #define YPMSGSZ 1600
#ifndef DATUM
typedef struct { typedef struct {
char *dptr; u_int keydat_len;
int dsize; char *keydat_val;
} datum; } keydat;
#define DATUM
#endif typedef struct {
u_int valdat_len;
char *valdat_val;
} valdat;
struct ypmap_parms { struct ypmap_parms {
char *domain; /* Null string means not available */ char *domain; /* Null string means not available */
char *map; /* Null string means not available */ char *map; /* Null string means not available */
unsigned long int ordernum; /* 0 means not available */ unsigned int ordernum; /* 0 means not available */
char *owner; /* Null string means not available */ char *owner; /* Null string means not available */
}; };
@ -91,7 +93,7 @@ struct ypmap_parms {
struct ypreq_key { struct ypreq_key {
const char *domain; const char *domain;
const char *map; const char *map;
datum keydat; keydat keydat;
}; };
struct ypreq_nokey { struct ypreq_nokey {
@ -101,16 +103,9 @@ struct ypreq_nokey {
struct ypreq_xfr { struct ypreq_xfr {
struct ypmap_parms map_parms; struct ypmap_parms map_parms;
unsigned long transid; u_int transid;
unsigned long proto; u_int proto;
unsigned short port; u_int port;
};
struct ypreq_newxfr {
struct ypmap_parms map_parms;
unsigned long transid;
unsigned long proto;
char *name;
}; };
#define ypxfr_domain map_parms.domain #define ypxfr_domain map_parms.domain
@ -118,40 +113,70 @@ struct ypreq_newxfr {
#define ypxfr_ordernum map_parms.ordernum #define ypxfr_ordernum map_parms.ordernum
#define ypxfr_owner map_parms.owner #define ypxfr_owner map_parms.owner
/* Return status values */
enum ypstat {
YP_TRUE = 1, /* General purpose success code */
#define YP_TRUE YP_TRUE
YP_NOMORE = 2, /* No more entries in map */
#define YP_NOMORE YP_NOMORE
YP_FALSE = 0, /* General purpose failure code */
#define YP_FALSE YP_FALSE
YP_NOMAP = -1, /* No such map in domain */
#define YP_NOMAP YP_NOMAP
YP_NODOM = -2, /* Domain not supported */
#define YP_NODOM YP_NODOM
YP_NOKEY = -3, /* No such key in map */
#define YP_NOKEY YP_NOKEY
YP_BADOP = -4, /* Invalid operation */
#define YP_BADOP YP_BADOP
YP_BADDB = -5, /* Server data base is bad */
#define YP_BADDB YP_BADDB
YP_YPERR = -6, /* NIS server error */
#define YP_YPERR YP_YPERR
YP_BADARGS = -7, /* Request arguments bad */
#define YP_BADARGS YP_BADARGS
YP_VERS = -8, /* NIS server version mismatch - server can't supply
requested service. */
#define YP_VERS YP_VERS
};
/* /*
* Response parameter structures * Response parameter structures
*/ */
typedef enum ypstat ypstat;
struct ypresp_val { struct ypresp_val {
long unsigned status; ypstat status;
datum valdat; valdat valdat;
}; };
struct ypresp_key_val { struct ypresp_key_val {
long unsigned status; ypstat status;
datum keydat; keydat keydat;
datum valdat; valdat valdat;
}; };
struct ypresp_master { struct ypresp_master {
long unsigned status; ypstat status;
char *master; char *master;
}; };
struct ypresp_order { struct ypresp_order {
long unsigned status; ypstat status;
unsigned long int ordernum; u_int ordernum;
}; };
struct ypmaplist { struct ypmaplist {
char map[YPMAXMAP + 1]; char *map;
#define ypml_name map #define ypml_name map
struct ypmaplist *next; struct ypmaplist *next;
#define ypml_next next #define ypml_next next
}; };
struct ypresp_maplist { struct ypresp_maplist {
long unsigned status; ypstat status;
struct ypmaplist *list; struct ypmaplist *list;
}; };
@ -175,20 +200,6 @@ struct ypresp_maplist {
#define YPPROC_MAPLIST ((u_long)11) #define YPPROC_MAPLIST ((u_long)11)
#define YPPROC_NEWXFR ((u_long)12) #define YPPROC_NEWXFR ((u_long)12)
/* Return status values */
#define YP_TRUE ((long)1) /* General purpose success code */
#define YP_NOMORE ((long)2) /* No more entries in map */
#define YP_FALSE ((long)0) /* General purpose failure code */
#define YP_NOMAP ((long)-1) /* No such map in domain */
#define YP_NODOM ((long)-2) /* Domain not supported */
#define YP_NOKEY ((long)-3) /* No such key in map */
#define YP_BADOP ((long)-4) /* Invalid operation */
#define YP_BADDB ((long)-5) /* Server data base is bad */
#define YP_YPERR ((long)-6) /* NIS server error */
#define YP_BADARGS ((long)-7) /* Request arguments bad */
#define YP_VERS ((long)-8) /* NIS server version mismatch - server
* can't supply requested service. */
/* /*
* Protocol between clients and NIS binder servers * Protocol between clients and NIS binder servers
*/ */
@ -230,7 +241,7 @@ struct ypbind_binding {
struct ypbind_resp { struct ypbind_resp {
enum ypbind_resptype ypbind_status; enum ypbind_resptype ypbind_status;
union { union {
unsigned long ypbind_error; u_int ypbind_error;
struct ypbind_binding ypbind_bindinfo; struct ypbind_binding ypbind_bindinfo;
} ypbind_respbody; } ypbind_respbody;
}; };
@ -246,9 +257,9 @@ struct ypbind_resp {
* Request data structure for ypbind "Set domain" procedure. * Request data structure for ypbind "Set domain" procedure.
*/ */
struct ypbind_setdom { struct ypbind_setdom {
char ypsetdom_domain[YPMAXDOMAIN + 1]; char *ypsetdom_domain;
struct ypbind_binding ypsetdom_binding; struct ypbind_binding ypsetdom_binding;
unsigned short ypsetdom_vers; u_int ypsetdom_vers;
}; };
#define ypsetdom_addr ypsetdom_binding.ypbind_binding_addr #define ypsetdom_addr ypsetdom_binding.ypbind_binding_addr
#define ypsetdom_port ypsetdom_binding.ypbind_binding_port #define ypsetdom_port ypsetdom_binding.ypbind_binding_port
@ -259,7 +270,7 @@ struct ypbind_setdom {
* is supplied to ypxfr as a command-line parameter when it * is supplied to ypxfr as a command-line parameter when it
* is activated by ypserv. * is activated by ypserv.
*/ */
#define YPPUSHVERS ((u_long) 1) #define YPPUSHVERS ((u_long)1)
#define YPPUSHVERS_ORIG ((u_long)1) #define YPPUSHVERS_ORIG ((u_long)1)
/* Procedure symbols */ /* Procedure symbols */
@ -268,31 +279,49 @@ struct ypbind_setdom {
#define YPPUSHPROC_XFRRESP ((u_long)1) #define YPPUSHPROC_XFRRESP ((u_long)1)
struct yppushresp_xfr { struct yppushresp_xfr {
unsigned long transid; u_int transid;
unsigned long status; yppush_status status;
}; };
/* Status values for yppushresp_xfr.status */ /* Status values for yppushresp_xfr.status */
#define YPPUSH_SUCC ((long)1) /* Success */ enum yppush_status {
#define YPPUSH_AGE ((long)2) /* Master's version not newer */ YPPUSH_SUCC = 1, /* Success */
#define YPPUSH_NOMAP ((long)-1) /* Can't find server for map */ #define YPPUSH_SUCC YPPUSH_SUCC
#define YPPUSH_NODOM ((long)-2) /* Domain not supported */ YPPUSH_AGE = 2, /* Master's version not newer */
#define YPPUSH_RSRC ((long)-3) /* Local resouce alloc failure */ #define YPPUSH_AGE YPPUSH_AGE
#define YPPUSH_RPC ((long)-4) /* RPC failure talking to server */ YPPUSH_NOMAP = -1, /* Can't find server for map */
#define YPPUSH_MADDR ((long)-5) /* Can't get master address */ #define YPPUSH_NOMAP YPPUSH_NOMAP
#define YPPUSH_YPERR ((long)-6) /* NIS server/map db error */ YPPUSH_NODOM = -2, /* Domain not supported */
#define YPPUSH_BADARGS ((long)-7) /* Request arguments bad */ #define YPPUSH_NODOM YPPUSH_NODOM
#define YPPUSH_DBM ((long)-8) /* Local dbm operation failed */ YPPUSH_RSRC = -3, /* Local resouce alloc failure */
#define YPPUSH_FILE ((long)-9) /* Local file I/O operation failed */ #define YPPUSH_RSRC YPPUSH_RSRC
#define YPPUSH_SKEW ((long)-10) /* Map version skew during transfer */ YPPUSH_RPC = -4, /* RPC failure talking to server */
#define YPPUSH_CLEAR ((long)-11) /* Can't send "Clear" req to local #define YPPUSH_RPC YPPUSH_RPC
* ypserv */ YPPUSH_MADDR = -5, /* Can't get master address */
#define YPPUSH_FORCE ((long)-12) /* No local order number in map - #define YPPUSH_MADDR YPPUSH_MADDR
* use -f flag. */ YPPUSH_YPERR = -6, /* NIS server/map db error */
#define YPPUSH_XFRERR ((long)-13) /* ypxfr error */ #define YPPUSH_YPERR YPPUSH_YPERR
#define YPPUSH_REFUSED ((long)-14) /* Transfer request refused by ypserv */ YPPUSH_BADARGS = -7, /* Request arguments bad */
#define YPPUSH_NOALIAS ((long)-15) /* Alias not found for map or domain */ #define YPPUSH_BADARGS YPPUSH_BADARGS
YPPUSH_DBM = -8, /* Local dbm operation failed */
#define YPPUSH_DBM YPPUSH_DBM
YPPUSH_FILE = -9, /* Local file I/O operation failed */
#define YPPUSH_FILE YPPUSH_FILE
YPPUSH_SKEW = -10, /* Map version skew during transfer */
#define YPPUSH_SKEW YPPUSH_SKEW
YPPUSH_CLEAR = -11, /* Can't send "Clear" req to local ypserv */
#define YPPUSH_CLEAR YPPUSH_CLEAR
YPPUSH_FORCE = -12, /* No local order number in map - use -f flag*/
#define YPPUSH_FORCE YPPUSH_FORCE
YPPUSH_XFRERR = -13, /* ypxfr error */
#define YPPUSH_XFRERR YPPUSH_XFRERR
YPPUSH_REFUSED = -14, /* Transfer request refused by ypserv */
#define YPPUSH_REFUSED YPPUSH_REFUSED
YPPUSH_NOALIAS = -15 /* Alias not found for map or domain */
#define YPPUSH_NOALIAS YPPUSH_NOALIAS
};
typedef enum yppush_status yppush_status;
struct ypresp_all { struct ypresp_all {
bool_t more; bool_t more;
@ -303,33 +332,24 @@ struct ypresp_all {
__BEGIN_DECLS __BEGIN_DECLS
extern bool_t xdr_datum __P ((XDR *__xdrs, datum * __objp));
extern bool_t xdr_ypdomain_wrap_string __P ((XDR *__xdrs, char ** __objp));
extern bool_t xdr_ypmap_wrap_string __P ((XDR *__xdrs, char ** __objp));
extern bool_t xdr_ypreq_key __P ((XDR *__xdrs, struct ypreq_key * __objp)); extern bool_t xdr_ypreq_key __P ((XDR *__xdrs, struct ypreq_key * __objp));
extern bool_t xdr_ypreq_nokey __P ((XDR *__xdrs, struct ypreq_nokey * __objp)); extern bool_t xdr_ypreq_nokey __P ((XDR *__xdrs, struct ypreq_nokey * __objp));
extern bool_t xdr_ypreq_xfr __P ((XDR *__xdrs, struct ypreq_xfr * __objp)); extern bool_t xdr_ypreq_xfr __P ((XDR *__xdrs, struct ypreq_xfr * __objp));
extern bool_t xdr_ypreq_newxfr __P ((XDR *__xdrs, struct ypreq_newxfr * __objp));
extern bool_t xdr_ypresp_val __P ((XDR *__xdrs, struct ypresp_val * __objp)); extern bool_t xdr_ypresp_val __P ((XDR *__xdrs, struct ypresp_val * __objp));
extern bool_t xdr_ypresp_key_val __P ((XDR *__xdrs, struct ypresp_key_val * __objp)); extern bool_t xdr_ypresp_key_val __P ((XDR *__xdrs, struct ypresp_key_val * __objp));
extern bool_t xdr_ypbind_resp __P ((XDR *__xdrs, struct ypbind_resp * __objp)); extern bool_t xdr_ypbind_resp __P ((XDR *__xdrs, struct ypbind_resp * __objp));
extern bool_t xdr_ypbind_setdom __P ((XDR *__xdrs, struct ypbind_setdom * __objp)); extern bool_t xdr_ypbind_setdom __P ((XDR *__xdrs, struct ypbind_setdom * __objp));
extern bool_t xdr_ypmap_parms __P ((XDR *__xdrs, struct ypmap_parms * __objp)); extern bool_t xdr_ypmap_parms __P ((XDR *__xdrs, struct ypmap_parms * __objp));
extern bool_t xdr_ypowner_wrap_string __P ((XDR *__xdrs, char ** __objp));
extern bool_t xdr_yppushresp_xfr __P ((XDR *__xdrs, struct yppushresp_xfr * __objp)); extern bool_t xdr_yppushresp_xfr __P ((XDR *__xdrs, struct yppushresp_xfr * __objp));
extern bool_t xdr_ypresp_order __P ((XDR *__xdrs, struct ypresp_order * __objp)); extern bool_t xdr_ypresp_order __P ((XDR *__xdrs, struct ypresp_order * __objp));
extern bool_t xdr_ypresp_master __P ((XDR *__xdrs, struct ypresp_master * __objp)); extern bool_t xdr_ypresp_master __P ((XDR *__xdrs, struct ypresp_master * __objp));
extern bool_t xdr_ypall __P ((XDR *__xdrs, struct ypall_callback * __objp)); extern bool_t xdr_ypall __P ((XDR *__xdrs, struct ypall_callback * __objp));
extern bool_t xdr_ypresp_maplist __P ((XDR *__xdrs, struct ypresp_maplist * __objp)); extern bool_t xdr_ypresp_maplist __P ((XDR *__xdrs, struct ypresp_maplist * __objp));
extern bool_t xdr_domainname_ypbind __P ((XDR *__xdrs, char * __objp));
extern bool_t xdr_ypbind_binding __P ((XDR *__xdrs, struct ypbind_binding * __objp)); extern bool_t xdr_ypbind_binding __P ((XDR *__xdrs, struct ypbind_binding * __objp));
extern bool_t xdr_ypbind_resptype __P ((XDR *__xdrs, enum ypbind_resptype * __objp)); extern bool_t xdr_ypbind_resptype __P ((XDR *__xdrs, enum ypbind_resptype * __objp));
extern bool_t xdr_ypstat __P ((XDR *__xdrs, enum ypbind_resptype * __objp)); extern bool_t xdr_ypstat __P ((XDR *__xdrs, enum ypbind_resptype * __objp));
extern bool_t xdr_ypresp_all __P ((XDR *__xdrs, struct ypresp_all * __objp)); extern bool_t xdr_ypresp_all __P ((XDR *__xdrs, struct ypresp_all * __objp));
extern bool_t xdr_ypresp_all_seq __P ((XDR *__xdrs, u_long * __objp)); extern bool_t xdr_domainname __P ((XDR *__xdrs, char ** __objp));
extern bool_t xdr_ypmaplist_str __P ((XDR *__xdrs, char * __objp));
extern bool_t xdr_ypmaplist __P ((XDR *__xdrs, struct ypmaplist * __objp));
__END_DECLS __END_DECLS

View File

@ -253,7 +253,8 @@ static int last_nonopt;
/* Bash 2.0 gives us an environment variable containing flags /* Bash 2.0 gives us an environment variable containing flags
indicating ARGV elements that should not be considered arguments. */ indicating ARGV elements that should not be considered arguments. */
static const char *nonoption_flags; static char *nonoption_flags;
static int nonoption_flags_max_len;
static int nonoption_flags_len; static int nonoption_flags_len;
static int original_argc; static int original_argc;
@ -272,6 +273,16 @@ store_args (int argc, char *const *argv)
original_argv = argv; original_argv = argv;
} }
text_set_element (__libc_subinit, store_args); text_set_element (__libc_subinit, store_args);
# define SWAP_FLAGS(ch1, ch2) \
if (nonoption_flags_len > 0) \
{ \
char __tmp = nonoption_flags[ch1]; \
nonoption_flags[ch1] = nonoption_flags[ch2]; \
nonoption_flags[ch2] = __tmp; \
}
#else
# define SWAP_FLAGS(ch1, ch2)
#endif #endif
/* Exchange two adjacent subsequences of ARGV. /* Exchange two adjacent subsequences of ARGV.
@ -301,6 +312,28 @@ exchange (argv)
It leaves the longer segment in the right place overall, It leaves the longer segment in the right place overall,
but it consists of two parts that need to be swapped next. */ but it consists of two parts that need to be swapped next. */
#ifdef _LIBC
/* First make sure the handling of the `nonoption_flags' string can
work normally. Our top argument must be in the range of the
string. */
if (nonoption_flags_len != 0 && top >= nonoption_flags_max_len)
{
/* We must extend the array. The user plays games with us and
presents new arguments. */
char *new_str = malloc (top + 1);
if (new_str == NULL)
nonoption_flags_len = nonoption_flags_max_len = 0;
else
{
memcpy (new_str, nonoption_flags, nonoption_flags_max_len);
memset (&new_str[nonoption_flags_max_len], '\0',
top + 1 - nonoption_flags_max_len);
nonoption_flags_max_len = top + 1;
nonoption_flags = new_str;
}
}
#endif
while (top > middle && middle > bottom) while (top > middle && middle > bottom)
{ {
if (top - middle > middle - bottom) if (top - middle > middle - bottom)
@ -315,6 +348,7 @@ exchange (argv)
tem = argv[bottom + i]; tem = argv[bottom + i];
argv[bottom + i] = argv[top - (middle - bottom) + i]; argv[bottom + i] = argv[top - (middle - bottom) + i];
argv[top - (middle - bottom) + i] = tem; argv[top - (middle - bottom) + i] = tem;
SWAP_FLAGS (bottom + i, top - (middle - bottom) + i);
} }
/* Exclude the moved bottom segment from further swapping. */ /* Exclude the moved bottom segment from further swapping. */
top -= len; top -= len;
@ -331,6 +365,7 @@ exchange (argv)
tem = argv[bottom + i]; tem = argv[bottom + i];
argv[bottom + i] = argv[middle + i]; argv[bottom + i] = argv[middle + i];
argv[middle + i] = tem; argv[middle + i] = tem;
SWAP_FLAGS (bottom + i, middle + i);
} }
/* Exclude the moved top segment from further swapping. */ /* Exclude the moved top segment from further swapping. */
bottom += len; bottom += len;
@ -389,13 +424,33 @@ _getopt_initialize (argc, argv, optstring)
command it runs, specifying which ARGV elements are the results of command it runs, specifying which ARGV elements are the results of
file name wildcard expansion and therefore should not be file name wildcard expansion and therefore should not be
considered as options. */ considered as options. */
if (nonoption_flags_max_len == 0)
{
char var[100]; char var[100];
const char *orig_str;
sprintf (var, "_%d_GNU_nonoption_argv_flags_", getpid ()); sprintf (var, "_%d_GNU_nonoption_argv_flags_", getpid ());
nonoption_flags = getenv (var); orig_str = getenv (var);
if (nonoption_flags == NULL) if (orig_str == NULL || orig_str[0] == '\0')
nonoption_flags_len = 0; nonoption_flags_max_len = -1;
else else
nonoption_flags_len = strlen (nonoption_flags); {
int len = nonoption_flags_max_len = strlen (orig_str);
if (nonoption_flags_max_len < argc)
nonoption_flags_max_len = argc;
nonoption_flags = (char *) malloc (nonoption_flags_max_len);
if (nonoption_flags == NULL)
nonoption_flags_max_len = -1;
else
{
memcpy (nonoption_flags, orig_str, len);
memset (&nonoption_flags[len], '\0',
nonoption_flags_max_len - len);
}
}
}
nonoption_flags_len = nonoption_flags_max_len;
} }
else else
nonoption_flags_len = 0; nonoption_flags_len = 0;

View File

@ -7,4 +7,6 @@ long-double-fcts = yes
ifeq ($(subdir),elf) ifeq ($(subdir),elf)
CFLAGS-rtld.c += -Wno-uninitialized CFLAGS-rtld.c += -Wno-uninitialized
CFLAGS-dl-load.c += -Wno-unused
CFLAGS-dl-reloc.c += -Wno-unused
endif endif

View File

@ -1,5 +1,5 @@
/* Machine-dependent ELF dynamic relocation inline functions. i386 version. /* Machine-dependent ELF dynamic relocation inline functions. i386 version.
Copyright (C) 1995, 1996 Free Software Foundation, Inc. Copyright (C) 1995, 1996, 1997 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
@ -70,6 +70,12 @@ elf_machine_load_address (void)
(dynamic_info)[DT_RELSZ]->d_un.d_val -= sizeof (Elf32_Rel); (dynamic_info)[DT_RELSZ]->d_un.d_val -= sizeof (Elf32_Rel);
/* We add a declaration of this function here so that in dl-runtime.c
the ELF_MACHINE_RUNTIME_TRAMPOLINE macro really can pass the parameters
in registers. */
static ElfW(Addr) fixup (struct link_map *l, ElfW(Word) reloc_offset)
__attribute__ ((regparm (2), unused));
/* Set up the loaded object described by L so its unrelocated PLT /* Set up the loaded object described by L so its unrelocated PLT
entries will jump to the on-demand fixup code in dl-runtime.c. */ entries will jump to the on-demand fixup code in dl-runtime.c. */
@ -92,15 +98,24 @@ elf_machine_runtime_setup (struct link_map *l, int lazy)
got[2] = (Elf32_Addr) &_dl_runtime_resolve; got[2] = (Elf32_Addr) &_dl_runtime_resolve;
} }
/* This code is used in dl-runtime.c to call the `fixup' function /* This code is used in dl-runtime.c to call the `fixup' function
and then redirect to the address it returns. */ and then redirect to the address it returns. */
#define ELF_MACHINE_RUNTIME_TRAMPOLINE asm ("\ #define ELF_MACHINE_RUNTIME_TRAMPOLINE asm ("\
.globl _dl_runtime_resolve .globl _dl_runtime_resolve
.type _dl_runtime_resolve, @function .type _dl_runtime_resolve, @function
_dl_runtime_resolve: _dl_runtime_resolve:
call fixup # Args pushed by PLT. pushl %eax # Preserve registers otherwise clobbered.
addl $8, %esp # Pop args. pushl %ecx
jmp *%eax # Jump to function address. pushl %edx
movl 16(%esp), %edx # Copy args pushed by PLT in register. Note
movl 12(%esp), %eax # that `fixup' takes its parameters in regs.
call fixup # Call resolver.
popl %edx # Get register content back.
popl %ecx
xchgl %eax, (%esp) # Get %eax contents end store function address.
ret $8 # Jump to function address.
.size _dl_runtime_resolve, .-_dl_runtime_resolve
"); ");
/* The PLT uses Elf32_Rel relocs. */ /* The PLT uses Elf32_Rel relocs. */
#define elf_machine_relplt elf_machine_rel #define elf_machine_relplt elf_machine_rel

View File

@ -17,6 +17,9 @@
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 _TERMBITS_H
#define _TERMBITS_H 1
typedef unsigned char cc_t; typedef unsigned char cc_t;
typedef unsigned int speed_t; typedef unsigned int speed_t;
typedef unsigned int tcflag_t; typedef unsigned int tcflag_t;
@ -186,3 +189,5 @@ struct termios
#define _IOT_termios /* Hurd ioctl type field. */ \ #define _IOT_termios /* Hurd ioctl type field. */ \
_IOT (_IOTS (cflag_t), 4, _IOTS (cc_t), NCCS, _IOTS (speed_t), 2) _IOT (_IOTS (cflag_t), 4, _IOTS (cc_t), NCCS, _IOTS (speed_t), 2)
#endif /* _TERMBITS_H */

View File

@ -49,11 +49,11 @@ struct kernel_dirent
/* The problem here is that we cannot simply read the next NBYTES /* The problem here is that we cannot simply read the next NBYTES
bytes. We need to take the additional field into account. We use bytes. We need to take the additional field into account. We use
some heuristic. Assume the directory contains names with at least some heuristic. Assuming the directory contains names with 14
3 characters we can compute a maximum number of entries which fit characters on average we can compute an estimate number of entries
in the buffer. Taking this number allows us to specify a correct which fit in the buffer. Taking this number allows us to specify a
number of bytes to read. If we should be wrong, we can reset the correct number of bytes to read. If we should be wrong, we can reset
file descriptor. */ the file descriptor. */
ssize_t ssize_t
__getdirentries (fd, buf, nbytes, basep) __getdirentries (fd, buf, nbytes, basep)
int fd; int fd;
@ -62,12 +62,16 @@ __getdirentries (fd, buf, nbytes, basep)
off_t *basep; off_t *basep;
{ {
off_t base = __lseek (fd, (off_t) 0, SEEK_CUR); off_t base = __lseek (fd, (off_t) 0, SEEK_CUR);
off_t last_offset = base;
size_t red_nbytes; size_t red_nbytes;
struct kernel_dirent *skdp, *kdp; struct kernel_dirent *skdp, *kdp;
struct dirent *dp; struct dirent *dp;
int retval; int retval;
const size_t size_diff = (offsetof (struct dirent, d_name)
- offsetof (struct kernel_dirent, d_name));
red_nbytes = nbytes - (nbytes / (offsetof (struct dirent, d_name) + 3)); red_nbytes = nbytes - ((nbytes / (offsetof (struct dirent, d_name) + 14))
* size_diff);
dp = (struct dirent *) buf; dp = (struct dirent *) buf;
skdp = kdp = __alloca (red_nbytes); skdp = kdp = __alloca (red_nbytes);
@ -76,26 +80,29 @@ __getdirentries (fd, buf, nbytes, basep)
while ((char *) kdp < (char *) skdp + retval) while ((char *) kdp < (char *) skdp + retval)
{ {
const size_t size_diff = MAX (offsetof (struct dirent, d_name) const size_t alignment = __alignof__ (struct dirent);
- offsetof (struct kernel_dirent, d_name), /* Since kdp->d_reclen is already aligned for the kernel structure
__alignof__ (struct dirent)); this may compute a value that is bigger than necessary. */
size_t new_reclen = ((kdp->d_reclen + size_diff + alignment - 1)
& ~(alignment - 1));
if ((char *) dp + new_reclen > buf + nbytes)
{
/* Our heuristic failed. We read too many entries. Reset
the stream. */
__lseek (fd, last_offset, SEEK_SET);
break;
}
last_offset = kdp->d_off;
dp->d_ino = kdp->d_ino; dp->d_ino = kdp->d_ino;
dp->d_off = kdp->d_off; dp->d_off = kdp->d_off;
dp->d_reclen = kdp->d_reclen + size_diff; dp->d_reclen = new_reclen;
dp->d_type = DT_UNKNOWN; dp->d_type = DT_UNKNOWN;
memcpy (dp->d_name, kdp->d_name, memcpy (dp->d_name, kdp->d_name,
kdp->d_reclen - offsetof (struct kernel_dirent, d_name)); kdp->d_reclen - offsetof (struct kernel_dirent, d_name));
dp = (struct dirent *) (((char *) dp) + dp->d_reclen); dp = (struct dirent *) ((char *) dp + new_reclen);
kdp = (struct kernel_dirent *) (((char *) kdp) + kdp->d_reclen); kdp = (struct kernel_dirent *) (((char *) kdp) + kdp->d_reclen);
if ((char *) dp >= buf + nbytes)
{
/* Our heuristic failed. We read too many entries. Reset
the stream. */
off_t used = ((char *) kdp - (char *) buf) - (nbytes - red_nbytes);
base = __lseek (fd, retval - used, SEEK_CUR);
}
} }
if (basep) if (basep)

View File

@ -38,7 +38,7 @@ ENTRY(__clone)
jz syscall_error jz syscall_error
/* Insert the argument onto the new stack. */ /* Insert the argument onto the new stack. */
subl $-8,%ecx subl $8,%ecx
movl 16(%esp),%eax /* no negative argument counts */ movl 16(%esp),%eax /* no negative argument counts */
movl %eax,4(%ecx) movl %eax,4(%ecx)

View File

@ -1,4 +1,4 @@
/* This file just defines the current version number of libc. */ /* This file just defines the current version number of libc. */
#define RELEASE "experimental" #define RELEASE "experimental"
#define VERSION "2.0" #define VERSION "2.0.1"