summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGlenn Strauss <gstrauss@gluelogic.com>2021-04-09 01:57:31 -0400
committerGlenn Strauss <gstrauss@gluelogic.com>2023-05-03 23:11:34 -0400
commit21eee1fad6554160daab6858591004af46bd83bb (patch)
treed99ba02b1c065a5004342ceaa59fb15ff7086f1c /src
parent2695a8b2e21ab7c4c16b7dddb6fff53a4797b98c (diff)
downloadlighttpd-git-21eee1fad6554160daab6858591004af46bd83bb.tar.gz
[core] _WIN32 sys-wait.h to wrap <sys/wait.h>
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am2
-rw-r--r--src/configfile.c1
-rw-r--r--src/fdevent.c4
-rw-r--r--src/gw_backend.c4
-rw-r--r--src/mod_cgi.c1
-rw-r--r--src/mod_ssi.c4
-rw-r--r--src/sys-wait.h36
7 files changed, 42 insertions, 10 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 6c4fbfc1..98afe53a 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -362,7 +362,7 @@ hdr = base64.h buffer.h burl.h network.h log.h http_kv.h keyvalue.h \
sys-crypto.h sys-crypto-md.h sys-dirent.h \
sys-endian.h sys-mmap.h sys-setjmp.h \
sys-socket.h sys-stat.h sys-strings.h \
- sys-time.h sys-unistd.h \
+ sys-time.h sys-unistd.h sys-wait.h \
sock_addr.h \
mod_auth_api.h \
mod_magnet_cache.h \
diff --git a/src/configfile.c b/src/configfile.c
index 020b0eb8..6a726745 100644
--- a/src/configfile.c
+++ b/src/configfile.c
@@ -2,6 +2,7 @@
#include "sys-stat.h"
#include "sys-unistd.h" /* <unistd.h> */
+#include "sys-wait.h"
#include "base.h"
#include "burl.h"
diff --git a/src/fdevent.c b/src/fdevent.c
index b2ddd22b..2100dbc2 100644
--- a/src/fdevent.c
+++ b/src/fdevent.c
@@ -475,9 +475,7 @@ pid_t fdevent_fork_execve(const char *name, char *argv[], char *envp[], int fdin
}
-#ifdef HAVE_SYS_WAIT_H
-#include <sys/wait.h>
-#endif
+#include "sys-wait.h"
int fdevent_waitpid(pid_t pid, int * const status, int nb) {
const int flags = nb ? WNOHANG : 0;
diff --git a/src/gw_backend.c b/src/gw_backend.c
index 1038da92..7765774a 100644
--- a/src/gw_backend.c
+++ b/src/gw_backend.c
@@ -12,12 +12,10 @@
#include "sys-socket.h"
#include "sys-stat.h"
#include "sys-unistd.h" /* <unistd.h> */
+#include "sys-wait.h"
#ifdef HAVE_SYS_UIO_H
#include <sys/uio.h>
#endif
-#ifdef HAVE_SYS_WAIT_H
-#include <sys/wait.h>
-#endif
#include <errno.h>
#include <fcntl.h>
diff --git a/src/mod_cgi.c b/src/mod_cgi.c
index 1847da6e..f7228ce7 100644
--- a/src/mod_cgi.c
+++ b/src/mod_cgi.c
@@ -15,6 +15,7 @@
#include <sys/types.h>
#include "sys-socket.h"
#include "sys-unistd.h" /* <unistd.h> */
+#include "sys-wait.h"
#include <errno.h>
#include <stdlib.h>
diff --git a/src/mod_ssi.c b/src/mod_ssi.c
index aa4c5d87..47f1e740 100644
--- a/src/mod_ssi.c
+++ b/src/mod_ssi.c
@@ -23,9 +23,7 @@
#include <sys/types.h>
#include <sys/stat.h>
-#ifdef HAVE_SYS_WAIT_H
-#include <sys/wait.h>
-#endif
+#include "sys-wait.h"
#include <ctype.h>
#include <stdlib.h>
diff --git a/src/sys-wait.h b/src/sys-wait.h
new file mode 100644
index 00000000..435762c2
--- /dev/null
+++ b/src/sys-wait.h
@@ -0,0 +1,36 @@
+/*
+ * sys-wait.h - sys/wait.h wrapper
+ *
+ * Copyright(c) 2021 Glenn Strauss gstrauss()gluelogic.com All rights reserved
+ * License: BSD 3-clause (same as lighttpd)
+ */
+#ifndef INCLUDED_SYS_WAIT_H
+#define INCLUDED_SYS_WAIT_H
+#include "first.h"
+
+#ifdef HAVE_SYS_WAIT_H
+#include <sys/wait.h>
+#endif
+
+#ifdef _WIN32
+
+#ifndef WEXITSTATUS
+#define WEXITSTATUS(status) (((status) & 0xff00) >> 8)
+#endif
+
+#ifndef WIFEXITED
+#define WIFEXITED(status) (((status) & 0x7f) == 0)
+#endif
+
+#ifndef WIFSIGNALED
+#define WIFSIGNALED(status) \
+ (((signed char) (((status) & 0x7f) + 1) >> 1) > 0)
+#endif
+
+#ifndef WTERMSIG
+#define WTERMSIG(status) ((status) & 0x7f)
+#endif
+
+#endif /* _WIN32 */
+
+#endif