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 @@ -408,7 +408,7 @@ static int fpm_cpuaffinity_set(struct fpm_cpuaffinity_conf *c)
408
408
409
409
static void fpm_cpuaffinity_destroy (struct fpm_cpuaffinity_conf * c )
410
410
{
411
- // some platform/apis requires to allocates data on the heap
411
+ // some platform/apis require to allocates data on the heap
412
412
}
413
413
414
414
static int fpm_setcpuaffinity (char * cpumask )
@@ -427,8 +427,8 @@ static int fpm_setcpuaffinity(char *cpumask)
427
427
char * cpumasksep ;
428
428
429
429
fconf .min = strtol (token , & cpumasksep , 0 );
430
- if (errno || fconf .min > cpumax ) {
431
- goto fail ;
430
+ if (errno || fconf .min < 0 || fconf . min > cpumax ) {
431
+ return -1 ;
432
432
}
433
433
fconf .max = fconf .min ;
434
434
if (* cpumasksep == '-' ) {
@@ -448,7 +448,6 @@ static int fpm_setcpuaffinity(char *cpumask)
448
448
token = php_strtok_r (NULL , ";" , & buf );
449
449
}
450
450
451
- fail :
452
451
r = fpm_cpuaffinity_set (& fconf );
453
452
fpm_cpuaffinity_destroy (& fconf );
454
453
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 @@ -75,7 +75,7 @@ listen = 127.0.0.1:9000
75
75
; process.priority = -19
76
76
77
77
; Bind the pool processes to a cpu set.
78
- ; The value can be one cpu id or a range .
78
+ ; The value can be one cpu id, a range or a list thereof .
79
79
;
80
80
; Default Value: inherits master's cpu affinity
81
81
; process.cpumask = "8"
You can’t perform that action at this time.
0 commit comments