diff --git a/libmaxsi/include/sys/wait.h b/libmaxsi/include/sys/wait.h index 6278f9ae..b4d6b401 100644 --- a/libmaxsi/include/sys/wait.h +++ b/libmaxsi/include/sys/wait.h @@ -24,10 +24,11 @@ // TODO: Make this header comply with POSIX-1.2008 -#ifndef _SYS_WAIT_H -#define _SYS_WAIT_H 1 +#ifndef _SYS_WAIT_H +#define _SYS_WAIT_H 1 #include +#include __BEGIN_DECLS diff --git a/sortix/include/sortix/wait.h b/sortix/include/sortix/wait.h new file mode 100644 index 00000000..ca0dd3c3 --- /dev/null +++ b/sortix/include/sortix/wait.h @@ -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 . + + sortix/wait.h + Declarations for waiting for the events of children. + +*******************************************************************************/ + +#ifndef INCLUDE_SORTIX_WAIT_H +#define INCLUDE_SORTIX_WAIT_H + +#include + +__BEGIN_DECLS + +#define WNOHANG (1<<0) + +__END_DECLS + +#endif diff --git a/sortix/process.cpp b/sortix/process.cpp index c461f56d..6c8f68a4 100644 --- a/sortix/process.cpp +++ b/sortix/process.cpp @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -353,6 +354,8 @@ namespace Sortix break; if ( zombie ) break; + if ( options & WNOHANG ) + return 0; zombiewaiting++; kthread_cond_wait(&zombiecond, &childlock); zombiewaiting--;