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}
Subject: [50 character or so descriptive subject here (for reference)]
>Submitter-Id: <submitter ID>
>Submitter-Id: net
>Originator: ${ORIGINATOR}
>Organization:
${ORGANIZATION- $ORGANIZATION_C}
>Confidential: no (the GNU PR database is public)
>Confidential: no
>Synopsis: $SYNOPSIS_C
>Severity: $SEVERITY_C
>Priority: $PRIORITY_C

View File

@ -50,4 +50,5 @@ $(objpfx)libmcheck.a: $(objpfx)mcheck-init.o
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
(program) running on your system. Releasing this much memory
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
allocated and released in ways that can reuse each other's
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? */
int __malloc_initialized = 0;
@ -1533,12 +1540,20 @@ ptmalloc_init __MALLOC_P((void))
tsd_setspecific(arena_key, (Void_t *)&main_arena);
#endif
#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_");
__malloc_hook = save_malloc_hook;
__free_hook = save_free_hook;
if(s) {
if(s[0]) mallopt(M_CHECK_ACTION, (int)(s[0] - '0'));
malloc_check_init();
if(s[0]) mALLOPt(M_CHECK_ACTION, (int)(s[0] - '0'));
__malloc_check_init();
}
if(__malloc_initialize_hook != NULL)
(*__malloc_initialize_hook)();
@ -1592,18 +1607,18 @@ memalign_hook_ini(sz, alignment) size_t sz; size_t alignment;
return mEMALIGn(sz, alignment);
}
void (*__malloc_initialize_hook) __MALLOC_P ((void)) = NULL;
void (*__free_hook) __MALLOC_P ((__malloc_ptr_t __ptr)) = NULL;
__malloc_ptr_t (*__malloc_hook)
void weak_variable (*__malloc_initialize_hook) __MALLOC_P ((void)) = NULL;
void weak_variable (*__free_hook) __MALLOC_P ((__malloc_ptr_t __ptr)) = NULL;
__malloc_ptr_t weak_variable (*__malloc_hook)
__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_ptr_t (*__memalign_hook)
__malloc_ptr_t weak_variable (*__memalign_hook)
__MALLOC_P ((size_t __size, size_t __alignment)) = memalign_hook_ini;
/* Activate a standard set of debugging hooks. */
void
malloc_check_init()
__malloc_check_init()
{
__malloc_hook = malloc_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) {
sz = n * elem_size;
mem = (*__malloc_hook)(sz);
if(mem == 0)
return 0;
#ifdef HAVE_MEMCPY
memset(mem, 0, sz);
#else
while(sz > 0) mem[--sz] = 0; /* rather inefficient */
while(sz > 0) ((char*)mem)[--sz] = 0; /* rather inefficient */
#endif
return mem;
}

View File

@ -1,5 +1,5 @@
/* 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.
The GNU C Library is free software; you can redistribute it and/or
@ -74,6 +74,11 @@ extern "C" {
#endif
/* 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;
/* 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));
/* Activate a standard set of debugging hooks. */
extern void malloc_check_init __MALLOC_P ((void));
extern void __malloc_check_init __MALLOC_P ((void));
#endif

View File

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

View File

@ -61,26 +61,28 @@
#define YPPROG ((u_long)100004)
#define YPVERS ((u_long)2)
#define YPVERS_ORIG ((u_long)1)
#define YPMAXRECORD ((u_long)1024)
#define YPMAXDOMAIN ((u_long)256)
#define YPMAXMAP ((u_long)64)
#define YPMAXPEER ((u_long)256)
#define YPMAXRECORD 1024
#define YPMAXDOMAIN 64 /* XXX orig. yp_prot.h defines ((u_long)256) */
#define YPMAXMAP 64
#define YPMAXPEER 64 /* XXX orig. yp_prot.h defines ((u_long)256) */
/* byte size of a large NIS packet */
#define YPMSGSZ 1600
#ifndef DATUM
typedef struct {
char *dptr;
int dsize;
} datum;
#define DATUM
#endif
u_int keydat_len;
char *keydat_val;
} keydat;
typedef struct {
u_int valdat_len;
char *valdat_val;
} valdat;
struct ypmap_parms {
char *domain; /* 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 */
};
@ -91,7 +93,7 @@ struct ypmap_parms {
struct ypreq_key {
const char *domain;
const char *map;
datum keydat;
keydat keydat;
};
struct ypreq_nokey {
@ -101,16 +103,9 @@ struct ypreq_nokey {
struct ypreq_xfr {
struct ypmap_parms map_parms;
unsigned long transid;
unsigned long proto;
unsigned short port;
};
struct ypreq_newxfr {
struct ypmap_parms map_parms;
unsigned long transid;
unsigned long proto;
char *name;
u_int transid;
u_int proto;
u_int port;
};
#define ypxfr_domain map_parms.domain
@ -118,40 +113,70 @@ struct ypreq_newxfr {
#define ypxfr_ordernum map_parms.ordernum
#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
*/
typedef enum ypstat ypstat;
struct ypresp_val {
long unsigned status;
datum valdat;
ypstat status;
valdat valdat;
};
struct ypresp_key_val {
long unsigned status;
datum keydat;
datum valdat;
ypstat status;
keydat keydat;
valdat valdat;
};
struct ypresp_master {
long unsigned status;
ypstat status;
char *master;
};
struct ypresp_order {
long unsigned status;
unsigned long int ordernum;
ypstat status;
u_int ordernum;
};
struct ypmaplist {
char map[YPMAXMAP + 1];
char *map;
#define ypml_name map
struct ypmaplist *next;
#define ypml_next next
};
struct ypresp_maplist {
long unsigned status;
ypstat status;
struct ypmaplist *list;
};
@ -175,20 +200,6 @@ struct ypresp_maplist {
#define YPPROC_MAPLIST ((u_long)11)
#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
*/
@ -230,7 +241,7 @@ struct ypbind_binding {
struct ypbind_resp {
enum ypbind_resptype ypbind_status;
union {
unsigned long ypbind_error;
u_int ypbind_error;
struct ypbind_binding ypbind_bindinfo;
} ypbind_respbody;
};
@ -246,9 +257,9 @@ struct ypbind_resp {
* Request data structure for ypbind "Set domain" procedure.
*/
struct ypbind_setdom {
char ypsetdom_domain[YPMAXDOMAIN + 1];
char *ypsetdom_domain;
struct ypbind_binding ypsetdom_binding;
unsigned short ypsetdom_vers;
u_int ypsetdom_vers;
};
#define ypsetdom_addr ypsetdom_binding.ypbind_binding_addr
#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 activated by ypserv.
*/
#define YPPUSHVERS ((u_long) 1)
#define YPPUSHVERS ((u_long)1)
#define YPPUSHVERS_ORIG ((u_long)1)
/* Procedure symbols */
@ -268,31 +279,49 @@ struct ypbind_setdom {
#define YPPUSHPROC_XFRRESP ((u_long)1)
struct yppushresp_xfr {
unsigned long transid;
unsigned long status;
u_int transid;
yppush_status status;
};
/* Status values for yppushresp_xfr.status */
#define YPPUSH_SUCC ((long)1) /* Success */
#define YPPUSH_AGE ((long)2) /* Master's version not newer */
#define YPPUSH_NOMAP ((long)-1) /* Can't find server for map */
#define YPPUSH_NODOM ((long)-2) /* Domain not supported */
#define YPPUSH_RSRC ((long)-3) /* Local resouce alloc failure */
#define YPPUSH_RPC ((long)-4) /* RPC failure talking to server */
#define YPPUSH_MADDR ((long)-5) /* Can't get master address */
#define YPPUSH_YPERR ((long)-6) /* NIS server/map db error */
#define YPPUSH_BADARGS ((long)-7) /* Request arguments bad */
#define YPPUSH_DBM ((long)-8) /* Local dbm operation failed */
#define YPPUSH_FILE ((long)-9) /* Local file I/O operation failed */
#define YPPUSH_SKEW ((long)-10) /* Map version skew during transfer */
#define YPPUSH_CLEAR ((long)-11) /* Can't send "Clear" req to local
* ypserv */
#define YPPUSH_FORCE ((long)-12) /* No local order number in map -
* use -f flag. */
#define YPPUSH_XFRERR ((long)-13) /* ypxfr error */
#define YPPUSH_REFUSED ((long)-14) /* Transfer request refused by ypserv */
#define YPPUSH_NOALIAS ((long)-15) /* Alias not found for map or domain */
enum yppush_status {
YPPUSH_SUCC = 1, /* Success */
#define YPPUSH_SUCC YPPUSH_SUCC
YPPUSH_AGE = 2, /* Master's version not newer */
#define YPPUSH_AGE YPPUSH_AGE
YPPUSH_NOMAP = -1, /* Can't find server for map */
#define YPPUSH_NOMAP YPPUSH_NOMAP
YPPUSH_NODOM = -2, /* Domain not supported */
#define YPPUSH_NODOM YPPUSH_NODOM
YPPUSH_RSRC = -3, /* Local resouce alloc failure */
#define YPPUSH_RSRC YPPUSH_RSRC
YPPUSH_RPC = -4, /* RPC failure talking to server */
#define YPPUSH_RPC YPPUSH_RPC
YPPUSH_MADDR = -5, /* Can't get master address */
#define YPPUSH_MADDR YPPUSH_MADDR
YPPUSH_YPERR = -6, /* NIS server/map db error */
#define YPPUSH_YPERR YPPUSH_YPERR
YPPUSH_BADARGS = -7, /* Request arguments bad */
#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 {
bool_t more;
@ -303,33 +332,24 @@ struct ypresp_all {
__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_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_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_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_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_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_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_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_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_resptype __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_seq __P ((XDR *__xdrs, u_long * __objp));
extern bool_t xdr_ypmaplist_str __P ((XDR *__xdrs, char * __objp));
extern bool_t xdr_ypmaplist __P ((XDR *__xdrs, struct ypmaplist * __objp));
extern bool_t xdr_domainname __P ((XDR *__xdrs, char ** __objp));
__END_DECLS

View File

@ -253,7 +253,8 @@ static int last_nonopt;
/* Bash 2.0 gives us an environment variable containing flags
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 original_argc;
@ -272,6 +273,16 @@ store_args (int argc, char *const *argv)
original_argv = argv;
}
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
/* Exchange two adjacent subsequences of ARGV.
@ -301,6 +312,28 @@ exchange (argv)
It leaves the longer segment in the right place overall,
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)
{
if (top - middle > middle - bottom)
@ -315,6 +348,7 @@ exchange (argv)
tem = argv[bottom + i];
argv[bottom + i] = argv[top - (middle - bottom) + i];
argv[top - (middle - bottom) + i] = tem;
SWAP_FLAGS (bottom + i, top - (middle - bottom) + i);
}
/* Exclude the moved bottom segment from further swapping. */
top -= len;
@ -331,6 +365,7 @@ exchange (argv)
tem = argv[bottom + i];
argv[bottom + i] = argv[middle + i];
argv[middle + i] = tem;
SWAP_FLAGS (bottom + i, middle + i);
}
/* Exclude the moved top segment from further swapping. */
bottom += len;
@ -389,13 +424,33 @@ _getopt_initialize (argc, argv, optstring)
command it runs, specifying which ARGV elements are the results of
file name wildcard expansion and therefore should not be
considered as options. */
char var[100];
sprintf (var, "_%d_GNU_nonoption_argv_flags_", getpid ());
nonoption_flags = getenv (var);
if (nonoption_flags == NULL)
nonoption_flags_len = 0;
else
nonoption_flags_len = strlen (nonoption_flags);
if (nonoption_flags_max_len == 0)
{
char var[100];
const char *orig_str;
sprintf (var, "_%d_GNU_nonoption_argv_flags_", getpid ());
orig_str = getenv (var);
if (orig_str == NULL || orig_str[0] == '\0')
nonoption_flags_max_len = -1;
else
{
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
nonoption_flags_len = 0;

View File

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

View File

@ -1,5 +1,5 @@
/* 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.
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);
/* 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
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;
}
/* This code is used in dl-runtime.c to call the `fixup' function
and then redirect to the address it returns. */
#define ELF_MACHINE_RUNTIME_TRAMPOLINE asm ("\
.globl _dl_runtime_resolve
.type _dl_runtime_resolve, @function
_dl_runtime_resolve:
call fixup # Args pushed by PLT.
addl $8, %esp # Pop args.
jmp *%eax # Jump to function address.
pushl %eax # Preserve registers otherwise clobbered.
pushl %ecx
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. */
#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,
Boston, MA 02111-1307, USA. */
#ifndef _TERMBITS_H
#define _TERMBITS_H 1
typedef unsigned char cc_t;
typedef unsigned int speed_t;
typedef unsigned int tcflag_t;
@ -186,3 +189,5 @@ struct termios
#define _IOT_termios /* Hurd ioctl type field. */ \
_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
bytes. We need to take the additional field into account. We use
some heuristic. Assume the directory contains names with at least
3 characters we can compute a maximum number of entries which fit
in the buffer. Taking this number allows us to specify a correct
number of bytes to read. If we should be wrong, we can reset the
file descriptor. */
some heuristic. Assuming the directory contains names with 14
characters on average we can compute an estimate number of entries
which fit in the buffer. Taking this number allows us to specify a
correct number of bytes to read. If we should be wrong, we can reset
the file descriptor. */
ssize_t
__getdirentries (fd, buf, nbytes, basep)
int fd;
@ -62,12 +62,16 @@ __getdirentries (fd, buf, nbytes, basep)
off_t *basep;
{
off_t base = __lseek (fd, (off_t) 0, SEEK_CUR);
off_t last_offset = base;
size_t red_nbytes;
struct kernel_dirent *skdp, *kdp;
struct dirent *dp;
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;
skdp = kdp = __alloca (red_nbytes);
@ -76,26 +80,29 @@ __getdirentries (fd, buf, nbytes, basep)
while ((char *) kdp < (char *) skdp + retval)
{
const size_t size_diff = MAX (offsetof (struct dirent, d_name)
- offsetof (struct kernel_dirent, d_name),
__alignof__ (struct dirent));
const size_t alignment = __alignof__ (struct dirent);
/* Since kdp->d_reclen is already aligned for the kernel structure
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_off = kdp->d_off;
dp->d_reclen = kdp->d_reclen + size_diff;
dp->d_reclen = new_reclen;
dp->d_type = DT_UNKNOWN;
memcpy (dp->d_name, kdp->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);
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)

View File

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

View File

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