1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-29 11:41:21 +03:00
2002-10-09  Ulrich Drepper  <drepper@redhat.com>

	* Versions.def (libc): Add GLIBC_2.3.1.
	(libpthread): Add GLIBC_2.3.1.

	* include/signal.h: Add libc_hidden_proto for __sigwait, __sigwaitinfo,
	and __sigtimedwait.
	* signal/Versions: Add __sigtimedwait, __sigwait, and __sigwaitinfo.
	* sysdeps/unix/sysv/linux/sigtimedwait.c (__sigtimedwait): Add
	libc_hidden_def.
	* sysdeps/unix/sysv/linux/sigwait.c (__sigwait): Likewise.
	* sysdeps/unix/sysv/linux/sigwaitinfo.c (__sigwaitinfo): Likewise.

	* include/sys/msg.h: Declare __libc_msgrcv and __libc_msgsnd.
	* sysdeps/unix/sysv/linux/msgrcv.c (__msgrcv): Rename to __libc_msgrcv
	and make old name an alias.
	* sysdeps/unix/sysv/linux/msgsnd.c (__msgsnd): Rename to __libc_msgsnd
	and make old name an alias.
	* sysvipc/Versions (libc) [GLIBC_PRIVATE]: Add __libc_msgrcv and
	__libc_msgsnd.

	* include/sys/uio.h: Declare __libc_readv and __libc_writev.
	* misc/Versions (libc) [GLIBC_PRIVATE]: Add __libc_readv and
	__libc_writev.
	* sysdeps/generic/readv.c (__readv): Rename to __libc_readv and make
	old name an alias.
	* sysdeps/posix/readv.c: Likewise
	* sysdeps/unix/sysv/aix/readv.c: Likewise.
	* sysdeps/unix/sysv/linux/readv.c: Likewise.
	* sysdeps/generic/writev.c (__writev): Rename to __libc_writev and make
	old name an alias.
	* sysdeps/posix/writev.c: Likewise
	* sysdeps/unix/sysv/aix/writev.c: Likewise.
	* sysdeps/unix/sysv/linux/writev.c: Likewise.

	* include/sys/wait.h: Declare __waitid.
	* posix/Versions (libc) [GLIBC_PRIVATE]: Add __waitid.
	* sysdeps/generic/waitid.c (waitid): Rename to __waitid and make old
	name an alias.
	* sysdeps/posix/waitid.c: Likewise.
	* sysdeps/unix/sysv/aix/waitid.c: Likewise.

	* sysdeps/unix/sysv/linux/syscalls.list: Add creat syscall.

2002-10-07  Jakub Jelinek  <jakub@redhat.com>

	* include/alloca.h (__libc_use_alloca, __libc_alloca_cutoff): New
	prototypes.
	(__MAX_ALLOCA_CUTOFF): Define.
	Include allocalim.h.
	* resolv/nss_dns/dns-host.c (_nss_dns_gethostbyname2_r,
	_nss_dns_gethostbyaddr_r): Use alloca or malloc to allocate
	host_buffer depending on __libc_use_alloca.
	* resolv/nss_dns/dns-network.c (_nss_dns_getnetbyname_r,
	_nss_dns_getnetbyaddr_r): Use alloca or malloc to allocate
	net_buffer depending on __libc_use_alloca.
	* resolv/res_query.c (res_nquery): Use alloca or malloc to allocate
	buf depending on __libc_use_alloca.
	* resolv/gethnamaddr.c (gethostbyname2, gethostbyaddr): Likewise.
	* stdio-common/vfprintf.c (vfprintf): Use __libc_use_alloca
	instead of hardcoded constants.
	Pass proper size argument to alloca and compute end for wide char
	version.
	* stdio-common/printf_fp.c (__printf_fp): Use __libc_use_alloca
	instead of hardcoded constants.
	* string/strcoll.c (strcoll): Likewise.
	* string/strxfrm.c (strxfrm): Likewise.
	* sysdeps/posix/readv.c (__readv): Likewise.
	* sysdeps/posix/writev.c (__writev): Likewise.
	* sysdeps/generic/allocalim.h: New file.
This commit is contained in:
Ulrich Drepper
2002-10-09 09:42:48 +00:00
parent 4c2821faea
commit 6166815d69
43 changed files with 424 additions and 200 deletions

View File

@ -110,27 +110,47 @@ _nss_dns_getnetbyname_r (const char *name, struct netent *result,
int *herrnop)
{
/* Return entry for network with NAME. */
querybuf net_buffer;
int anslen;
querybuf *net_buffer;
int anslen, use_malloc = 0;
char *qbuf;
enum nss_status status;
if ((_res.options & RES_INIT) == 0 && __res_ninit (&_res) == -1)
return NSS_STATUS_UNAVAIL;
qbuf = strdupa (name);
anslen = res_nsearch (&_res, qbuf, C_IN, T_PTR, (u_char *) &net_buffer,
sizeof (querybuf));
if (!__libc_use_alloca (MAXPACKET))
{
net_buffer = (querybuf *) malloc (sizeof (querybuf));
if (net_buffer == NULL)
{
*errnop = ENOMEM;
return NSS_STATUS_UNAVAIL;
}
use_malloc = 1;
}
else
net_buffer = (querybuf *) alloca (sizeof (querybuf));
anslen = res_nsearch (&_res, qbuf, C_IN, T_PTR, net_buffer->buf,
sizeof (net_buffer->buf));
if (anslen < 0)
{
/* Nothing found. */
*errnop = errno;
if (use_malloc)
free (net_buffer);
return (errno == ECONNREFUSED
|| errno == EPFNOSUPPORT
|| errno == EAFNOSUPPORT)
? NSS_STATUS_UNAVAIL : NSS_STATUS_NOTFOUND;
}
return getanswer_r (&net_buffer, anslen, result, buffer, buflen, BYNAME);
status = getanswer_r (net_buffer, anslen, result, buffer, buflen, BYNAME);
if (use_malloc)
free (net_buffer);
return status;
}
@ -141,10 +161,10 @@ _nss_dns_getnetbyaddr_r (uint32_t net, int type, struct netent *result,
{
/* Return entry for network with NAME. */
enum nss_status status;
querybuf net_buffer;
querybuf *net_buffer;
unsigned int net_bytes[4];
char qbuf[MAXDNAME];
int cnt, anslen;
int cnt, anslen, use_malloc = 0;
u_int32_t net2;
int olderr = errno;
@ -181,20 +201,37 @@ _nss_dns_getnetbyaddr_r (uint32_t net, int type, struct netent *result,
break;
}
anslen = res_nquery (&_res, qbuf, C_IN, T_PTR, (u_char *) &net_buffer,
sizeof (querybuf));
if (!__libc_use_alloca (MAXPACKET))
{
net_buffer = (querybuf *) malloc (sizeof (querybuf));
if (net_buffer == NULL)
{
*errnop = ENOMEM;
return NSS_STATUS_UNAVAIL;
}
use_malloc = 1;
}
else
net_buffer = (querybuf *) alloca (sizeof (querybuf));
anslen = res_nquery (&_res, qbuf, C_IN, T_PTR, net_buffer->buf,
sizeof (net_buffer->buf));
if (anslen < 0)
{
/* Nothing found. */
int err = errno;
__set_errno (olderr);
if (use_malloc)
free (net_buffer);
return (err == ECONNREFUSED
|| err == EPFNOSUPPORT
|| err == EAFNOSUPPORT)
? NSS_STATUS_UNAVAIL : NSS_STATUS_NOTFOUND;
}
status = getanswer_r (&net_buffer, anslen, result, buffer, buflen, BYADDR);
status = getanswer_r (net_buffer, anslen, result, buffer, buflen, BYADDR);
if (use_malloc)
free (net_buffer);
if (status == NSS_STATUS_SUCCESS)
{
/* Strip trailing zeros. */