mirror of
https://sourceware.org/git/glibc.git
synced 2024-12-30 06:21:07 +00:00
6166815d69
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.
84 lines
2.2 KiB
C
84 lines
2.2 KiB
C
/* Pseudo implementation of waitid.
|
|
Copyright (C) 1997, 1998, 2000, 2002 Free Software Foundation, Inc.
|
|
This file is part of the GNU C Library.
|
|
Contributed by Zack Weinberg <zack@rabi.phys.columbia.edu>, 1997.
|
|
|
|
The GNU C Library is free software; you can redistribute it and/or
|
|
modify it under the terms of the GNU Lesser General Public
|
|
License as published by the Free Software Foundation; either
|
|
version 2.1 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
|
|
Lesser General Public License for more details.
|
|
|
|
You should have received a copy of the GNU Lesser General Public
|
|
License along with the GNU C Library; if not, write to the Free
|
|
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
|
02111-1307 USA. */
|
|
|
|
#include <errno.h>
|
|
#include <signal.h>
|
|
#define __need_NULL
|
|
#include <stddef.h>
|
|
#include <sys/wait.h>
|
|
#include <sys/types.h>
|
|
|
|
#include <assert.h>
|
|
|
|
extern pid_t kwaitpid (int *stat_loc, pid_t pid, int options,
|
|
struct rusage *ru_loc, siginfo_t *infop);
|
|
|
|
int
|
|
__waitid (idtype, id, infop, options)
|
|
idtype_t idtype;
|
|
id_t id;
|
|
siginfo_t *infop;
|
|
int options;
|
|
{
|
|
pid_t pid, child;
|
|
int status;
|
|
|
|
switch (idtype)
|
|
{
|
|
case P_PID:
|
|
if(id <= 0)
|
|
goto invalid;
|
|
pid = (pid_t) id;
|
|
break;
|
|
case P_PGID:
|
|
if (id < 0 || id == 1)
|
|
goto invalid;
|
|
pid = (pid_t) -id;
|
|
break;
|
|
case P_ALL:
|
|
pid = -1;
|
|
break;
|
|
default:
|
|
invalid:
|
|
__set_errno (EINVAL);
|
|
return -1;
|
|
}
|
|
|
|
/* Technically we're supposed to return EFAULT if infop is bogus,
|
|
but that would involve mucking with signals, which is
|
|
too much hassle. User will have to deal with SIGSEGV/SIGBUS.
|
|
We just check for a null pointer. */
|
|
|
|
if (infop == NULL)
|
|
{
|
|
__set_errno (EFAULT);
|
|
return -1;
|
|
}
|
|
|
|
child = kwaitpid (&status, pid, options, NULL, infop);
|
|
|
|
if (child == -1)
|
|
/* `waitpid' set `errno' for us. */
|
|
return -1;
|
|
|
|
return 0;
|
|
}
|
|
weak_alias (__waitid, waitid)
|