File tree Expand file tree Collapse file tree 5 files changed +136
-2
lines changed Expand file tree Collapse file tree 5 files changed +136
-2
lines changed Original file line number Diff line number Diff line change @@ -356,6 +356,8 @@ if test "$PHP_FPM" != "no"; then
356
356
AC_CHECK_HEADER ( [ priv.h] , [ AC_CHECK_FUNCS ( [ setpflags] ) ] )
357
357
AC_CHECK_HEADER ( [ sys/times.h] , [ AC_CHECK_FUNCS ( [ times] ) ] )
358
358
AC_CHECK_HEADER ( [ port.h] , [ AC_CHECK_FUNCS ( [ port_create] ) ] )
359
+ AC_CHECK_HEADER ( [ sched.h] , [ AC_CHECK_FUNCS ( [ sched_setaffinity] ) ] )
360
+ AC_CHECK_HEADER ( [ sys/cpuset.h] , [ AC_CHECK_FUNCS ( [ cpuset_setaffinity] ) ] )
359
361
360
362
PHP_ARG_WITH([ fpm-user] ,,
361
363
[ AS_HELP_STRING ( [ [ --with-fpm-user[ =USER] ] ] ,
Original file line number Diff line number Diff line change 37
37
#include <selinux/selinux.h>
38
38
#endif
39
39
40
- #if defined(HAVE_SCHED_H )
40
+ #if defined(HAVE_SCHED_SETAFFINITY )
41
41
#include <sched.h>
42
- #elif defined(HAVE_SYS_CPUSET_H )
42
+ #elif defined(HAVE_CPUSETAFFINITY )
43
43
#include <sys/cpuset.h>
44
44
typedef cpuset_t cpu_set_t ;
45
45
#endif
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ FPM: cpu affinity test
3
+ --SKIPIF--
4
+ <?php include "skipif.inc " ;
5
+
6
+ if (!str_contains (PHP_OS , 'Linux ' ) && !str_contains (PHP_OS , 'FreeBSD ' )) {
7
+ die ('skipped supported only on Linux and FreeBSD ' );
8
+ }
9
+ ?>
10
+ --FILE--
11
+ <?php
12
+
13
+ require_once "tester.inc " ;
14
+
15
+ $ cfg = <<<EOT
16
+ [global]
17
+ process.cpu_list = MYcpuListIs1024-2048
18
+ error_log = {{FILE:LOG}}
19
+ pid = {{FILE:PID}}
20
+ [unconfined]
21
+ listen = {{ADDR:IPv4}}
22
+ pm = dynamic
23
+ pm.max_children = 1
24
+ pm.start_servers = 1
25
+ pm.min_spare_servers = 1
26
+ pm.max_spare_servers = 1
27
+ EOT ;
28
+
29
+ $ tester = new FPM \Tester ($ cfg );
30
+ $ tester ->start ();
31
+ $ tester ->expectLogError ("FPM initialization failed " );
32
+ $ tester ->close ();
33
+
34
+ ?>
35
+ Done
36
+ --EXPECT--
37
+ Done
38
+ --CLEAN--
39
+ <?php
40
+ require_once "tester.inc " ;
41
+ FPM \Tester::clean ();
42
+ ?>
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ FPM: cpu affinity test
3
+ --SKIPIF--
4
+ <?php include "skipif.inc " ;
5
+
6
+ if (!str_contains (PHP_OS , 'Linux ' ) && !str_contains (PHP_OS , 'FreeBSD ' )) {
7
+ die ('skipped supported only on Linux and FreeBSD ' );
8
+ }
9
+ ?>
10
+ --FILE--
11
+ <?php
12
+
13
+ require_once "tester.inc " ;
14
+
15
+ $ cfg = <<<EOT
16
+ [global]
17
+ process.cpu_list = 12de-34ad
18
+ error_log = {{FILE:LOG}}
19
+ pid = {{FILE:PID}}
20
+ [unconfined]
21
+ listen = {{ADDR:IPv4}}
22
+ pm = dynamic
23
+ pm.max_children = 1
24
+ pm.start_servers = 1
25
+ pm.min_spare_servers = 1
26
+ pm.max_spare_servers = 1
27
+ EOT ;
28
+
29
+ $ tester = new FPM \Tester ($ cfg );
30
+ $ tester ->start ();
31
+ $ tester ->expectLogError ("FPM initialization failed " );
32
+ $ tester ->close ();
33
+
34
+ ?>
35
+ Done
36
+ --EXPECT--
37
+ Done
38
+ --CLEAN--
39
+ <?php
40
+ require_once "tester.inc " ;
41
+ FPM \Tester::clean ();
42
+ ?>
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ FPM: cpu affinity test
3
+ --SKIPIF--
4
+ <?php include "skipif.inc " ;
5
+
6
+ if (!str_contains (PHP_OS , 'Linux ' ) && !str_contains (PHP_OS , 'FreeBSD ' )) {
7
+ die ('skipped supported only on Linux and FreeBSD ' );
8
+ }
9
+
10
+ if (FPM \Tester::getCores () < 4 ) {
11
+ die ('skipped supported only on multicores environments ' );
12
+ }
13
+ ?>
14
+ --FILE--
15
+ <?php
16
+
17
+ require_once "tester.inc " ;
18
+
19
+ $ cfg = <<<EOT
20
+ [global]
21
+ error_log = {{FILE:LOG}}
22
+ pid = {{FILE:PID}}
23
+ [unconfined]
24
+ listen = {{ADDR:IPv4}}
25
+ pm = dynamic
26
+ pm.max_children = 1
27
+ pm.start_servers = 1
28
+ pm.min_spare_servers = 1
29
+ pm.max_spare_servers = 1
30
+ process.cpu_list = 1,2-3,4
31
+ EOT ;
32
+
33
+ $ tester = new FPM \Tester ($ cfg );
34
+ $ tester ->start ();
35
+ $ tester ->expectLogStartNotices ();
36
+ $ tester ->terminate ();
37
+ $ tester ->expectLogTerminatingNotices ();
38
+ $ tester ->close ();
39
+
40
+ ?>
41
+ Done
42
+ --EXPECT--
43
+ Done
44
+ --CLEAN--
45
+ <?php
46
+ require_once "tester.inc " ;
47
+ FPM \Tester::clean ();
48
+ ?>
You can’t perform that action at this time.
0 commit comments