Skip to content

Commit 651df1f

Browse files
committed
Include linux/wait.h on Linux to check for idtype constants
1 parent e23bc2d commit 651df1f

File tree

3 files changed

+22
-4
lines changed

3 files changed

+22
-4
lines changed

ext/pcntl/pcntl.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,16 @@ static zend_class_entry *QosClass_ce;
125125

126126
#define LONG_CONST(c) (zend_long) c
127127

128+
#if defined(__linux__)
129+
#include <linux/wait.h>
130+
#endif
131+
#if defined (P_ALL)
132+
#define HAVE_P_ALL 1
133+
#endif
134+
#if defined (P_PIDFD)
135+
#define HAVE_P_PIDFD 1
136+
#endif
137+
128138
#include "Zend/zend_enum.h"
129139
#include "Zend/zend_max_execution_timer.h"
130140

@@ -403,7 +413,7 @@ PHP_FUNCTION(pcntl_waitid)
403413
Z_PARAM_LONG(options)
404414
ZEND_PARSE_PARAMETERS_END();
405415

406-
#ifdef __linux__
416+
#ifdef P_PIDFD
407417
if (idtype != P_ALL && idtype != P_PID && idtype != P_PGID && idtype != P_PIDFD) {
408418
zend_argument_value_error(1, "must be one of P_ALL, P_PID, P_PGID, P_PIDFD");
409419
RETURN_THROWS();

ext/pcntl/pcntl.stub.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
#endif
4949

5050
/* First argument to waitid */
51+
#ifdef HAVE_P_ALL
5152
/**
5253
* @var int
5354
* @cvalue LONG_CONST(P_ALL)
@@ -63,7 +64,8 @@
6364
* @cvalue LONG_CONST(P_PGID)
6465
*/
6566
const P_PGID = UNKNOWN;
66-
#ifdef __linux__
67+
#endif
68+
#ifdef HAVE_P_PIDFD
6769
/**
6870
* @var int
6971
* @cvalue LONG_CONST(P_PIDFD)

ext/pcntl/pcntl_arginfo.h

Lines changed: 8 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)