source: trunk/src/emx/src/lib/process/wait.c@ 1744

Last change on this file since 1744 was 1744, checked in by bird, 21 years ago

0 is correct return value.

  • Property cvs2svn:cvs-rev set to 1.7
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 1.9 KB
Line 
1/* $Id: waitid.c,v 1.1 2004/11/08 09:57:37 bird Exp $ */
2/** @file
3 *
4 * LIBC - wait().
5 *
6 * Copyright (c) 2004 knut st. osmundsen <[email protected]>
7 *
8 *
9 * This file is part of InnoTek LIBC.
10 *
11 * InnoTek LIBC is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License as published
13 * by the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * InnoTek LIBC is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License for more details.
20 *
21 * You should have received a copy of the GNU Lesser General Public License
22 * along with InnoTek LIBC; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 *
25 */
26
27
28/*******************************************************************************
29* Header Files *
30*******************************************************************************/
31#include "libc-alias.h"
32#include <sys/wait.h>
33#include <errno.h>
34#include <InnoTekLIBC/backend.h>
35#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_PROCESS
36#include <InnoTekLIBC/logstrict.h>
37
38
39/**
40 * Waits/polls for a child process to change it's running status.
41 *
42 * @returns Process id of the child.
43 * @returns -1 and errno on failure.
44 * @param piStatus Where to return the status.
45 */
46pid_t _STD(wait)(int *piStatus)
47{
48 LIBCLOG_ENTER("piStatus=%p\n", (void *)piStatus);
49 /*
50 * Just pass it along to waitpid.
51 */
52 pid_t pid = wait4(-1, piStatus, 0, NULL);
53 if (pid >= 0)
54 LIBCLOG_RETURN_MSG(pid, "ret %d (%#x) iStatus=%#x\n", pid, pid, piStatus ? *piStatus : -1);
55 LIBCLOG_RETURN_INT(pid);
56}
Note: See TracBrowser for help on using the repository browser.