mirror of
https://sourceware.org/git/glibc.git
synced 2025-01-03 00:10:10 +00:00
*** empty log message ***
Thu Jun 6 07:32:14 1996 Miles Bader <miles@gnu.ai.mit.edu> * resolv/gethnamaddr.c (struct hstorage): Make NAME field a pointer. (_gethtbyname2): Remove ALIAS variable. Initialize NAME field of SELF and TARGET to 0. Add SELF_NAME_SIZE static variable. Add loop to call gethostname until the space we allocated is enough. Use malloced strings instead of fixed size buffers. <stdlib.h>, <unistd.h>: New includes. * sysdeps/generic/sys/socket.h (PF_INET6, AF_INET6): New macros. * sysdeps/mach/hurd/errlist.c (_sys_errlist): Add EILSEQ. (_sys_nerr): Initialize to 107. Update _HURD_ERRNOS consistency check. * stdlib/canonicalize.c (canonicalize): Use pathconf for PATH_MAX, not sysconf. * login/login.c [!PATH_MAX] (PATH_MAX): Define to be 1024 if not already defined. * sysdeps/mach/hurd/setitimer.c (timer_thread): Supply SIGCODE argument to __msg_sig_post_request. * hurd/hurdmalloc.c: Changes to bring in line with the hurd libthreads/malloc.c: (more_memory): Use assert_perror instead of MACH_CALL. "cthread_internals.h": Include removed. (realloc): Use LOG2_MIN_SIZE. (LOG2_MIN_SIZE): New macro. (realloc): Don't bother allocating a new block if the new size request fits in the old one and doesn't waste any space. Only free the old block if we successfully got a new one. [MCHECK] (struct header): New type. (union header): Only define if !MCHECK. (HEADER_SIZE, HEADER_NEXT, HEADER_FREE, HEADER_CHECK): New macros. [MCHECK] (MIN_SIZE): Add correct definition for this case. (more_memory, malloc, free, realloc): Use above macros, and add appropiate checks & frobs in MCHECK case.
This commit is contained in:
parent
e550852065
commit
02eec64431
40
ChangeLog
40
ChangeLog
@ -1,3 +1,43 @@
|
|||||||
|
Thu Jun 6 07:32:14 1996 Miles Bader <miles@gnu.ai.mit.edu>
|
||||||
|
|
||||||
|
* resolv/gethnamaddr.c (struct hstorage): Make NAME field a pointer.
|
||||||
|
(_gethtbyname2): Remove ALIAS variable.
|
||||||
|
Initialize NAME field of SELF and TARGET to 0.
|
||||||
|
Add SELF_NAME_SIZE static variable.
|
||||||
|
Add loop to call gethostname until the space we allocated is enough.
|
||||||
|
Use malloced strings instead of fixed size buffers.
|
||||||
|
<stdlib.h>, <unistd.h>: New includes.
|
||||||
|
* sysdeps/generic/sys/socket.h (PF_INET6, AF_INET6): New macros.
|
||||||
|
|
||||||
|
* sysdeps/mach/hurd/errlist.c (_sys_errlist): Add EILSEQ.
|
||||||
|
(_sys_nerr): Initialize to 107.
|
||||||
|
Update _HURD_ERRNOS consistency check.
|
||||||
|
|
||||||
|
* stdlib/canonicalize.c (canonicalize): Use pathconf for PATH_MAX,
|
||||||
|
not sysconf.
|
||||||
|
|
||||||
|
* login/login.c [!PATH_MAX] (PATH_MAX): Define to be 1024 if not
|
||||||
|
already defined.
|
||||||
|
|
||||||
|
* sysdeps/mach/hurd/setitimer.c (timer_thread): Supply SIGCODE
|
||||||
|
argument to __msg_sig_post_request.
|
||||||
|
|
||||||
|
* hurd/hurdmalloc.c: Changes to bring in line with the hurd
|
||||||
|
libthreads/malloc.c:
|
||||||
|
(more_memory): Use assert_perror instead of MACH_CALL.
|
||||||
|
"cthread_internals.h": Include removed.
|
||||||
|
(realloc): Use LOG2_MIN_SIZE.
|
||||||
|
(LOG2_MIN_SIZE): New macro.
|
||||||
|
(realloc): Don't bother allocating a new block if the
|
||||||
|
new size request fits in the old one and doesn't waste any space.
|
||||||
|
Only free the old block if we successfully got a new one.
|
||||||
|
[MCHECK] (struct header): New type.
|
||||||
|
(union header): Only define if !MCHECK.
|
||||||
|
(HEADER_SIZE, HEADER_NEXT, HEADER_FREE, HEADER_CHECK): New macros.
|
||||||
|
[MCHECK] (MIN_SIZE): Add correct definition for this case.
|
||||||
|
(more_memory, malloc, free, realloc): Use above macros, and add
|
||||||
|
appropiate checks & frobs in MCHECK case.
|
||||||
|
|
||||||
Thu Jun 6 02:00:42 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
|
Thu Jun 6 02:00:42 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
|
||||||
|
|
||||||
* Makerules (distinfo-vars): Don't write constant line to frob sources.
|
* Makerules (distinfo-vars): Don't write constant line to frob sources.
|
||||||
|
@ -37,24 +37,39 @@
|
|||||||
/*
|
/*
|
||||||
* HISTORY
|
* HISTORY
|
||||||
* $Log$
|
* $Log$
|
||||||
* Revision 1.10 1995/02/13 22:04:34 roland
|
* Revision 1.11 1996/06/06 15:13:47 miles
|
||||||
* (malloc_init): Add self reference to avoid not only the `defined but not
|
* Changes to bring in line with the hurd libthreads/malloc.c:
|
||||||
* used' warning, but also to avoid GCC optimizing out the entire function
|
* (more_memory): Use assert_perror instead of MACH_CALL.
|
||||||
* (!).
|
* "cthread_internals.h": Include removed.
|
||||||
|
* (realloc): Use LOG2_MIN_SIZE.
|
||||||
|
* (LOG2_MIN_SIZE): New macro.
|
||||||
|
* (realloc): Don't bother allocating a new block if the
|
||||||
|
* new size request fits in the old one and doesn't waste any space.
|
||||||
|
* Only free the old block if we successfully got a new one.
|
||||||
|
* [MCHECK] (struct header): New type.
|
||||||
|
* (union header): Only define if !MCHECK.
|
||||||
|
* (HEADER_SIZE, HEADER_NEXT, HEADER_FREE, HEADER_CHECK): New macros.
|
||||||
|
* [MCHECK] (MIN_SIZE): Add correct definition for this case.
|
||||||
|
* (more_memory, malloc, free, realloc): Use above macros, and add appropiate
|
||||||
|
* checks & frobs in MCHECK case.
|
||||||
*
|
*
|
||||||
* Revision 1.9 1995/02/13 16:36:08 roland
|
* Revision 1.6 1996/03/07 21:13:08 miles
|
||||||
* Include string.h; #define bcopy using memcpy.
|
* (realloc):
|
||||||
|
* Use LOG2_MIN_SIZE.
|
||||||
|
* Don't bother allocating a new block if the new size request fits in the old
|
||||||
|
* one and doesn't waste any space.
|
||||||
|
* Only free the old block if we successfully got a new one.
|
||||||
|
* (LOG2_MIN_SIZE): New macro.
|
||||||
*
|
*
|
||||||
* Revision 1.8 1995/02/03 01:54:21 roland
|
* Revision 1.5 1996/03/06 23:51:04 miles
|
||||||
* Remove bogus bcopy decl.
|
* [MCHECK] (struct header): New type.
|
||||||
|
* (union header): Only define if !MCHECK.
|
||||||
|
* (HEADER_SIZE, HEADER_NEXT, HEADER_FREE, HEADER_CHECK): New macros.
|
||||||
|
* [MCHECK] (MIN_SIZE): Add correct definition for this case.
|
||||||
|
* (more_memory, malloc, free, realloc):
|
||||||
|
* Use above macros, and add appropiate checks & frobs in MCHECK case.
|
||||||
*
|
*
|
||||||
* Revision 1.7 1995/01/26 04:22:02 roland
|
* Revision 1.4 1994/05/05 11:21:42 roland
|
||||||
* Don't include gnu-stabs.h.
|
|
||||||
*
|
|
||||||
* Revision 1.6 1994/12/07 19:41:26 roland
|
|
||||||
* (vm_allocate, vm_page_size): #define these to __ names at top.
|
|
||||||
*
|
|
||||||
* Revision 1.5 1994/06/04 01:48:44 roland
|
|
||||||
* entered into RCS
|
* entered into RCS
|
||||||
*
|
*
|
||||||
* Revision 2.7 91/05/14 17:57:34 mrt
|
* Revision 2.7 91/05/14 17:57:34 mrt
|
||||||
@ -99,9 +114,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <cthreads.h>
|
#include <assert.h>
|
||||||
#include "cthread_internals.h"
|
|
||||||
|
|
||||||
|
#include <cthreads.h>
|
||||||
|
|
||||||
|
#define MCHECK
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Structure of memory block header.
|
* Structure of memory block header.
|
||||||
@ -109,12 +126,41 @@
|
|||||||
* When allocated, fl points to free list.
|
* When allocated, fl points to free list.
|
||||||
* Size of header is 4 bytes, so minimum usable block size is 8 bytes.
|
* Size of header is 4 bytes, so minimum usable block size is 8 bytes.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define CHECK_BUSY 0x8a3c743e
|
||||||
|
#define CHECK_FREE 0x66688b92
|
||||||
|
|
||||||
|
#ifdef MCHECK
|
||||||
|
|
||||||
|
typedef struct header {
|
||||||
|
long check;
|
||||||
|
union {
|
||||||
|
struct header *next;
|
||||||
|
struct free_list *fl;
|
||||||
|
} u;
|
||||||
|
} *header_t;
|
||||||
|
|
||||||
|
#define HEADER_SIZE sizeof (struct header)
|
||||||
|
#define HEADER_NEXT(h) ((h)->u.next)
|
||||||
|
#define HEADER_FREE(h) ((h)->u.fl)
|
||||||
|
#define HEADER_CHECK(h) ((h)->check)
|
||||||
|
#define MIN_SIZE 16
|
||||||
|
#define LOG2_MIN_SIZE 4
|
||||||
|
|
||||||
|
#else /* ! MCHECK */
|
||||||
|
|
||||||
typedef union header {
|
typedef union header {
|
||||||
union header *next;
|
union header *next;
|
||||||
struct free_list *fl;
|
struct free_list *fl;
|
||||||
} *header_t;
|
} *header_t;
|
||||||
|
|
||||||
|
#define HEADER_SIZE sizeof (union header)
|
||||||
|
#define HEADER_NEXT(h) ((h)->next)
|
||||||
|
#define HEADER_FREE(h) ((h)->fl)
|
||||||
#define MIN_SIZE 8 /* minimum block size */
|
#define MIN_SIZE 8 /* minimum block size */
|
||||||
|
#define LOG2_MIN_SIZE 3
|
||||||
|
|
||||||
|
#endif /* MCHECK */
|
||||||
|
|
||||||
typedef struct free_list {
|
typedef struct free_list {
|
||||||
spin_lock_t lock; /* spin lock for mutual exclusion */
|
spin_lock_t lock; /* spin lock for mutual exclusion */
|
||||||
@ -125,10 +171,10 @@ typedef struct free_list {
|
|||||||
} *free_list_t;
|
} *free_list_t;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Free list with index i contains blocks of size 2^(i+3) including header.
|
* Free list with index i contains blocks of size 2 ^ (i + LOG2_MIN_SIZE)
|
||||||
* Smallest block size is 8, with 4 bytes available to user.
|
* including header. Smallest block size is MIN_SIZE, with MIN_SIZE -
|
||||||
* Size argument to malloc is a signed integer for sanity checking,
|
* HEADER_SIZE bytes available to user. Size argument to malloc is a signed
|
||||||
* so largest block size is 2^31.
|
* integer for sanity checking, so largest block size is 2^31.
|
||||||
*/
|
*/
|
||||||
#define NBUCKETS 29
|
#define NBUCKETS 29
|
||||||
|
|
||||||
@ -173,18 +219,23 @@ more_memory(size, fl)
|
|||||||
if (size <= vm_page_size) {
|
if (size <= vm_page_size) {
|
||||||
amount = vm_page_size;
|
amount = vm_page_size;
|
||||||
n = vm_page_size / size;
|
n = vm_page_size / size;
|
||||||
/*
|
/* We lose vm_page_size - n*size bytes here. */
|
||||||
* We lose vm_page_size - n*size bytes here. */
|
|
||||||
} else {
|
} else {
|
||||||
amount = size;
|
amount = size;
|
||||||
n = 1;
|
n = 1;
|
||||||
}
|
}
|
||||||
MACH_CALL(vm_allocate(mach_task_self(), &where, (vm_size_t) amount, TRUE), r);
|
|
||||||
|
r = vm_allocate(mach_task_self(), &where, (vm_size_t) amount, TRUE);
|
||||||
|
assert_perror (r);
|
||||||
|
|
||||||
h = (header_t) where;
|
h = (header_t) where;
|
||||||
do {
|
do {
|
||||||
h->next = fl->head;
|
HEADER_NEXT (h) = fl->head;
|
||||||
fl->head = h;
|
#ifdef MCHECK
|
||||||
h = (header_t) ((char *) h + size);
|
HEADER_CHECK (h) = CHECK_FREE;
|
||||||
|
#endif
|
||||||
|
fl->head = h;
|
||||||
|
h = (header_t) ((char *) h + size);
|
||||||
} while (--n != 0);
|
} while (--n != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -199,7 +250,7 @@ malloc(size)
|
|||||||
|
|
||||||
if ((int) size < 0) /* sanity check */
|
if ((int) size < 0) /* sanity check */
|
||||||
return 0;
|
return 0;
|
||||||
size += sizeof(union header);
|
size += HEADER_SIZE;
|
||||||
/*
|
/*
|
||||||
* Find smallest power-of-two block size
|
* Find smallest power-of-two block size
|
||||||
* big enough to hold requested size plus header.
|
* big enough to hold requested size plus header.
|
||||||
@ -232,7 +283,13 @@ malloc(size)
|
|||||||
/*
|
/*
|
||||||
* Pop block from free list.
|
* Pop block from free list.
|
||||||
*/
|
*/
|
||||||
fl->head = h->next;
|
fl->head = HEADER_NEXT (h);
|
||||||
|
|
||||||
|
#ifdef MCHECK
|
||||||
|
assert (HEADER_CHECK (h) == CHECK_FREE);
|
||||||
|
HEADER_CHECK (h) = CHECK_BUSY;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fl->in_use += 1;
|
fl->in_use += 1;
|
||||||
#endif DEBUG
|
#endif DEBUG
|
||||||
@ -242,11 +299,11 @@ malloc(size)
|
|||||||
* so we can figure out where it goes
|
* so we can figure out where it goes
|
||||||
* at free() time.
|
* at free() time.
|
||||||
*/
|
*/
|
||||||
h->fl = fl;
|
HEADER_FREE (h) = fl;
|
||||||
/*
|
/*
|
||||||
* Return pointer past the block header.
|
* Return pointer past the block header.
|
||||||
*/
|
*/
|
||||||
return ((char *) h) + sizeof(union header);
|
return ((char *) h) + HEADER_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Declaration changed to standard one for GNU. */
|
/* Declaration changed to standard one for GNU. */
|
||||||
@ -263,8 +320,13 @@ free(base)
|
|||||||
/*
|
/*
|
||||||
* Find free list for block.
|
* Find free list for block.
|
||||||
*/
|
*/
|
||||||
h = (header_t) (base - sizeof(union header));
|
h = (header_t) (base - HEADER_SIZE);
|
||||||
fl = h->fl;
|
|
||||||
|
#ifdef MCHECK
|
||||||
|
assert (HEADER_CHECK (h) == CHECK_BUSY);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
fl = HEADER_FREE (h);
|
||||||
i = fl - malloc_free_list;
|
i = fl - malloc_free_list;
|
||||||
/*
|
/*
|
||||||
* Sanity checks.
|
* Sanity checks.
|
||||||
@ -281,7 +343,10 @@ free(base)
|
|||||||
* Push block on free list.
|
* Push block on free list.
|
||||||
*/
|
*/
|
||||||
spin_lock(&fl->lock);
|
spin_lock(&fl->lock);
|
||||||
h->next = fl->head;
|
HEADER_NEXT (h) = fl->head;
|
||||||
|
#ifdef MCHECK
|
||||||
|
HEADER_CHECK (h) = CHECK_FREE;
|
||||||
|
#endif
|
||||||
fl->head = h;
|
fl->head = h;
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fl->in_use -= 1;
|
fl->in_use -= 1;
|
||||||
@ -308,8 +373,11 @@ realloc(old_base, new_size)
|
|||||||
/*
|
/*
|
||||||
* Find size of old block.
|
* Find size of old block.
|
||||||
*/
|
*/
|
||||||
h = (header_t) (old_base - sizeof(union header));
|
h = (header_t) (old_base - HEADER_SIZE);
|
||||||
fl = h->fl;
|
#ifdef MCHECK
|
||||||
|
assert (HEADER_CHECK (h) == CHECK_BUSY);
|
||||||
|
#endif
|
||||||
|
fl = HEADER_FREE (h);
|
||||||
i = fl - malloc_free_list;
|
i = fl - malloc_free_list;
|
||||||
/*
|
/*
|
||||||
* Sanity checks.
|
* Sanity checks.
|
||||||
@ -323,16 +391,29 @@ realloc(old_base, new_size)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* Free list with index i contains blocks of size 2^(i+3) including header.
|
* Free list with index i contains blocks of size
|
||||||
|
* 2 ^ (i + * LOG2_MIN_SIZE) including header.
|
||||||
*/
|
*/
|
||||||
old_size = (1 << (i+3)) - sizeof(union header);
|
old_size = (1 << (i + LOG2_MIN_SIZE)) - HEADER_SIZE;
|
||||||
|
|
||||||
|
if (new_size <= old_size
|
||||||
|
&& new_size > (((old_size + HEADER_SIZE) >> 1) - HEADER_SIZE))
|
||||||
|
/* The new size still fits in the same block, and wouldn't fit in
|
||||||
|
the next smaller block! */
|
||||||
|
return old_base;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Allocate new block, copy old bytes, and free old block.
|
* Allocate new block, copy old bytes, and free old block.
|
||||||
*/
|
*/
|
||||||
new_base = malloc(new_size);
|
new_base = malloc(new_size);
|
||||||
if (new_base != 0)
|
if (new_base)
|
||||||
bcopy(old_base, new_base, (int) (old_size < new_size ? old_size : new_size));
|
bcopy(old_base, new_base,
|
||||||
free(old_base);
|
(int) (old_size < new_size ? old_size : new_size));
|
||||||
|
|
||||||
|
if (new_base || new_size == 0)
|
||||||
|
/* Free OLD_BASE, but only if the malloc didn't fail. */
|
||||||
|
free (old_base);
|
||||||
|
|
||||||
return new_base;
|
return new_base;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -354,7 +435,7 @@ print_malloc_free_list()
|
|||||||
spin_lock(&fl->lock);
|
spin_lock(&fl->lock);
|
||||||
if (fl->in_use != 0 || fl->head != 0) {
|
if (fl->in_use != 0 || fl->head != 0) {
|
||||||
total_used += fl->in_use * size;
|
total_used += fl->in_use * size;
|
||||||
for (n = 0, h = fl->head; h != 0; h = h->next, n += 1)
|
for (n = 0, h = fl->head; h != 0; h = HEADER_NEXT (h), n += 1)
|
||||||
;
|
;
|
||||||
total_free += n * size;
|
total_free += n * size;
|
||||||
fprintf(stderr, "%10d %10d %10d %10d\n",
|
fprintf(stderr, "%10d %10d %10d %10d\n",
|
||||||
|
@ -23,6 +23,10 @@ Boston, MA 02111-1307, USA. */
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <utmp.h>
|
#include <utmp.h>
|
||||||
|
|
||||||
|
/* XXX used for tty name array in login. */
|
||||||
|
#ifndef PATH_MAX
|
||||||
|
#define PATH_MAX 1024
|
||||||
|
#endif
|
||||||
|
|
||||||
void
|
void
|
||||||
login (const struct utmp *ut)
|
login (const struct utmp *ut)
|
||||||
|
@ -65,6 +65,8 @@ static char rcsid[] = "$Id$";
|
|||||||
#include <arpa/nameser.h>
|
#include <arpa/nameser.h>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <unistd.h>
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
#include <resolv.h>
|
#include <resolv.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
@ -823,7 +825,7 @@ _gethtent()
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct hstorage {
|
struct hstorage {
|
||||||
char name[MAXHOSTNAMELEN + 1]; /* canonical name */
|
char *name; /* canonical name */
|
||||||
char ** alp; /* address list pointer */
|
char ** alp; /* address list pointer */
|
||||||
char * abp; /* address buffer pointer */
|
char * abp; /* address buffer pointer */
|
||||||
char * addr_list[MAXADDRS + 1]; /* address list storage */
|
char * addr_list[MAXADDRS + 1]; /* address list storage */
|
||||||
@ -891,20 +893,53 @@ _gethtbyname2(name, af)
|
|||||||
* interface changes to make these functions
|
* interface changes to make these functions
|
||||||
* reentrant.
|
* reentrant.
|
||||||
*/
|
*/
|
||||||
static char * aliases[2];
|
static char *aliases[2] = {0};
|
||||||
static char alias[MAXHOSTNAMELEN + 1];
|
static struct hstorage self = {0}, target = {0};
|
||||||
static struct hstorage self, target;
|
static size_t self_name_size = 0; /* Allocated in self.name. */
|
||||||
static struct hostent ht;
|
static struct hostent ht;
|
||||||
int found;
|
int found;
|
||||||
|
|
||||||
|
if (aliases[0])
|
||||||
|
free (aliases[0]); /* Malloced in a prev call. */
|
||||||
aliases[0] = aliases[1] = 0;
|
aliases[0] = aliases[1] = 0;
|
||||||
|
|
||||||
gethostname(self.name, sizeof(self.name));
|
/* Get current host name in a large enough buffer. */
|
||||||
|
do {
|
||||||
|
errno = 0;
|
||||||
|
|
||||||
|
if (self.name)
|
||||||
|
{
|
||||||
|
self_name_size += self_name_size;
|
||||||
|
self.name =
|
||||||
|
realloc (self.name, self_name_size);
|
||||||
|
} else {
|
||||||
|
self_name_size = 128; /* Initial guess */
|
||||||
|
self.name = malloc (self_name_size);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! self.name)
|
||||||
|
{
|
||||||
|
errno = ENOMEM;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
} while ((gethostname(self.name, self_name_size) == 0
|
||||||
|
&& !memchr (self.name, '\0', self_name_size))
|
||||||
|
|| errno == ENAMETOOLONG);
|
||||||
|
|
||||||
|
if (errno)
|
||||||
|
/* gethostname failed, abort. */
|
||||||
|
{
|
||||||
|
free (self.name);
|
||||||
|
self.name = 0;
|
||||||
|
}
|
||||||
|
|
||||||
self.alp = self.addr_list;
|
self.alp = self.addr_list;
|
||||||
self.abp = self.addr_buf;
|
self.abp = self.addr_buf;
|
||||||
|
|
||||||
strncpy(target.name, name, MAXHOSTNAMELEN);
|
if (target.name)
|
||||||
target.name[MAXHOSTNAMELEN] = '\0';
|
free (target.name);
|
||||||
|
target.name = strdup (name);
|
||||||
|
|
||||||
target.alp = target.addr_list;
|
target.alp = target.addr_list;
|
||||||
target.abp = target.addr_buf;
|
target.abp = target.addr_buf;
|
||||||
|
|
||||||
@ -920,13 +955,10 @@ _gethtbyname2(name, af)
|
|||||||
if (strcasecmp(*cp, name) == 0) {
|
if (strcasecmp(*cp, name) == 0) {
|
||||||
found = 1;
|
found = 1;
|
||||||
if (!aliases[0]) {
|
if (!aliases[0]) {
|
||||||
strcpy(target.name,
|
aliases[0] =
|
||||||
p->h_name);
|
target.name;
|
||||||
strncpy(alias, name,
|
target.name =
|
||||||
MAXHOSTNAMELEN);
|
strdup (p->h_name);
|
||||||
alias[MAXHOSTNAMELEN]
|
|
||||||
= '\0';
|
|
||||||
aliases[0] = alias;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ canonicalize (const char *name, char *resolved)
|
|||||||
#ifdef PATH_MAX
|
#ifdef PATH_MAX
|
||||||
path_max = PATH_MAX;
|
path_max = PATH_MAX;
|
||||||
#else
|
#else
|
||||||
path_max = sysconf (_SC_PATH_MAX);
|
path_max = pathconf (name, _PC_PATH_MAX);
|
||||||
if (path_max <= 0)
|
if (path_max <= 0)
|
||||||
path_max = 1024;
|
path_max = 1024;
|
||||||
#endif
|
#endif
|
||||||
|
@ -113,12 +113,13 @@ const char *_sys_errlist[] =
|
|||||||
"You really blew it this time", /* 103 = EGREGIOUS */
|
"You really blew it this time", /* 103 = EGREGIOUS */
|
||||||
"Computer bought the farm", /* 104 = EIEIO */
|
"Computer bought the farm", /* 104 = EIEIO */
|
||||||
"Gratuitous error", /* 105 = EGRATUITOUS */
|
"Gratuitous error", /* 105 = EGRATUITOUS */
|
||||||
|
"Invalid or incomplete multibyte or wide character", /* 106 = EILSEQ */
|
||||||
};
|
};
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#if _HURD_ERRNOS != 106
|
#if _HURD_ERRNOS != 107
|
||||||
#error errlist/errnos generation bug
|
#error errlist/errnos generation bug
|
||||||
#endif
|
#endif
|
||||||
const int _sys_nerr = 106;
|
const int _sys_nerr = 107;
|
||||||
weak_alias (_sys_errlist, sys_errlist)
|
weak_alias (_sys_errlist, sys_errlist)
|
||||||
weak_alias (_sys_nerr, sys_nerr)
|
weak_alias (_sys_nerr, sys_nerr)
|
||||||
|
@ -88,7 +88,7 @@ timer_thread (void)
|
|||||||
__msg_sig_post_request (_hurd_msgport,
|
__msg_sig_post_request (_hurd_msgport,
|
||||||
_hurd_itimer_port,
|
_hurd_itimer_port,
|
||||||
MACH_MSG_TYPE_MAKE_SEND_ONCE,
|
MACH_MSG_TYPE_MAKE_SEND_ONCE,
|
||||||
SIGALRM, __mach_task_self ());
|
SIGALRM, 0, __mach_task_self ());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MACH_RCV_INTERRUPTED:
|
case MACH_RCV_INTERRUPTED:
|
||||||
|
Loading…
Reference in New Issue
Block a user