summaryrefslogtreecommitdiff
path: root/src/wait.c
diff options
context:
space:
mode:
authorJannis Hoffmann <jannis@fehcom.de>2024-07-09 13:58:20 +0200
committerJannis Hoffmann <jannis@fehcom.de>2024-07-09 13:58:20 +0200
commit249866e3d1e11dc72eaa1305f4bb479ded92ef38 (patch)
tree7118c5f58e29fe61c100e4d067bb90ba8d52589e /src/wait.c
parent96cf8dffe4f7b0b910f790066ae622dc429eb522 (diff)
reorganized file structure
Moved c files into src/. Corrected VERSION file. Removed BUILD and FILES.
Diffstat (limited to 'src/wait.c')
-rw-r--r--src/wait.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/wait.c b/src/wait.c
new file mode 100644
index 0000000..869a120
--- /dev/null
+++ b/src/wait.c
@@ -0,0 +1,25 @@
+#include <sys/types.h>
+#include <sys/wait.h>
+#include "logmsg.h"
+
+/**
+ @file wait.c
+ @author djb
+ @source qmail
+ @brief wait for forked processes
+*/
+
+int wait_nohang(int *wstat)
+{
+ return waitpid(-1,wstat,WNOHANG);
+}
+
+int wait_pid(int *wstat,int pid)
+{
+ int r;
+
+ do
+ r = waitpid(pid,wstat,0);
+ while ((r == -1) && (errno == EINTR));
+ return r;
+}