File tree Expand file tree Collapse file tree 5 files changed +10
-7
lines changed Expand file tree Collapse file tree 5 files changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -451,7 +451,7 @@ static int fpm_cpuaffinity_set(struct fpm_cpuaffinity_conf *c)
451
451
452
452
static void fpm_cpuaffinity_destroy (struct fpm_cpuaffinity_conf * c )
453
453
{
454
- // some platform/apis requires to allocates data on the heap
454
+ // some platform/apis require to allocates data on the heap
455
455
}
456
456
457
457
static int fpm_setcpuaffinity (char * cpumask )
@@ -470,8 +470,8 @@ static int fpm_setcpuaffinity(char *cpumask)
470
470
char * cpumasksep ;
471
471
472
472
fconf .min = strtol (token , & cpumasksep , 0 );
473
- if (errno || fconf .min > cpumax ) {
474
- goto fail ;
473
+ if (errno || fconf .min < 0 || fconf . min > cpumax ) {
474
+ return -1 ;
475
475
}
476
476
fconf .max = fconf .min ;
477
477
if (* cpumasksep == '-' ) {
@@ -491,7 +491,6 @@ static int fpm_setcpuaffinity(char *cpumask)
491
491
token = php_strtok_r (NULL , ";" , & buf );
492
492
}
493
493
494
- fail :
495
494
r = fpm_cpuaffinity_set (& fconf );
496
495
fpm_cpuaffinity_destroy (& fconf );
497
496
return r ;
Original file line number Diff line number Diff line change 126
126
;systemd_interval = 10
127
127
128
128
; Bind the master process to a cpu set.
129
- ; The value can be one cpu id or a range .
129
+ ; The value can be one cpu id, a range or a list thereof .
130
130
;
131
131
; Default Value: not set
132
132
; process.cpumask = "4"
Original file line number Diff line number Diff line change 28
28
29
29
$ tester = new FPM \Tester ($ cfg );
30
30
$ tester ->start ();
31
- $ tester ->expectLogError ("failed to fpm_setcpuaffinity\(\d+\): Invalid argument \(\d+\) " );
31
+ $ tester ->expectLogError ("failed to fpm_setcpuaffinity\(\d+\): Inappropriate ioctl for device \(\d+\) " );
32
32
$ tester ->expectLogError ("FPM initialization failed " );
33
33
$ tester ->close ();
34
34
Original file line number Diff line number Diff line change @@ -6,6 +6,10 @@ FPM: cpu affinity test
6
6
if (!str_contains (PHP_OS , 'Linux ' )) {
7
7
die ('skipped supported only on Linux ' );
8
8
}
9
+ $ nproc = intval (exec ("nproc " ));
10
+ if ($ nproc < 2 ) {
11
+ die ('skipped supported only on multicores environments ' );
12
+ }
9
13
?>
10
14
--FILE--
11
15
<?php
Original file line number Diff line number Diff line change @@ -81,7 +81,7 @@ listen = 127.0.0.1:9000
81
81
; process.priority = -19
82
82
83
83
; Bind the pool processes to a cpu set.
84
- ; The value can be one cpu id or a range .
84
+ ; The value can be one cpu id, a range or a list thereof .
85
85
;
86
86
; Default Value: inherits master's cpu affinity
87
87
; process.cpumask = "8"
You can’t perform that action at this time.
0 commit comments