Implement WNOHANG in waitpid(2).
This commit is contained in:
parent
356ae79f64
commit
07b3cc8e06
|
@ -28,6 +28,7 @@
|
||||||
#define _SYS_WAIT_H 1
|
#define _SYS_WAIT_H 1
|
||||||
|
|
||||||
#include <features.h>
|
#include <features.h>
|
||||||
|
#include <sortix/wait.h>
|
||||||
|
|
||||||
__BEGIN_DECLS
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
|
||||||
|
Copyright(C) Jonas 'Sortie' Termansen 2012.
|
||||||
|
|
||||||
|
This file is part of Sortix.
|
||||||
|
|
||||||
|
Sortix is free software: you can redistribute it and/or modify it under the
|
||||||
|
terms of the GNU General Public License as published by the Free Software
|
||||||
|
Foundation, either version 3 of the License, or (at your option) any later
|
||||||
|
version.
|
||||||
|
|
||||||
|
Sortix 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 General Public License for more
|
||||||
|
details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License along with
|
||||||
|
Sortix. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
sortix/wait.h
|
||||||
|
Declarations for waiting for the events of children.
|
||||||
|
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
#ifndef INCLUDE_SORTIX_WAIT_H
|
||||||
|
#define INCLUDE_SORTIX_WAIT_H
|
||||||
|
|
||||||
|
#include <features.h>
|
||||||
|
|
||||||
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
#define WNOHANG (1<<0)
|
||||||
|
|
||||||
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
|
@ -30,6 +30,7 @@
|
||||||
#include <sortix/unistd.h>
|
#include <sortix/unistd.h>
|
||||||
#include <sortix/fork.h>
|
#include <sortix/fork.h>
|
||||||
#include <sortix/mman.h>
|
#include <sortix/mman.h>
|
||||||
|
#include <sortix/wait.h>
|
||||||
#include <libmaxsi/error.h>
|
#include <libmaxsi/error.h>
|
||||||
#include <libmaxsi/memory.h>
|
#include <libmaxsi/memory.h>
|
||||||
#include <libmaxsi/string.h>
|
#include <libmaxsi/string.h>
|
||||||
|
@ -353,6 +354,8 @@ namespace Sortix
|
||||||
break;
|
break;
|
||||||
if ( zombie )
|
if ( zombie )
|
||||||
break;
|
break;
|
||||||
|
if ( options & WNOHANG )
|
||||||
|
return 0;
|
||||||
zombiewaiting++;
|
zombiewaiting++;
|
||||||
kthread_cond_wait(&zombiecond, &childlock);
|
kthread_cond_wait(&zombiecond, &childlock);
|
||||||
zombiewaiting--;
|
zombiewaiting--;
|
||||||
|
|
Loading…
Reference in New Issue