PluginProbe
Defender Security – Malware Scanner, Login Security & Firewall / 6.3.0
Defender Security – Malware Scanner, Login Security & Firewall v6.3.0
6.3.0 6.2.3 6.2.4 6.2.0 6.2.1 6.2.2 6.1.0 5.3.1 5.4.0 5.4.1 5.5.0 5.5.1 5.6.0 5.6.1 5.6.2 5.7.0 5.7.1 5.7.2 5.8.0 5.8.1 5.9.0 6.0.0 6.0.1 3.0.1 3.1.0 All 141 releases
defender-security / lib / packages / Safe / generated / pcntl.php

pcntl.php in Defender Security – Malware Scanner, Login Security & Firewall 6.3.0, at lib/packages/Safe/generated/pcntl.php

170 lines 4.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace WP_DEFENDER_VENDOR\Safe;
4
5 use WP_DEFENDER_VENDOR\Safe\Exceptions\PcntlException;
6
7 /**
8 * Executes the program with the given arguments.
9 *
10 * @param string $path path must be the path to a binary executable or a
11 * script with a valid path pointing to an executable in the shebang (
12 * #!/usr/local/bin/perl for example) as the first line. See your system's
13 * man execve(2) page for additional information.
14 * @param array|null $args args is an array of argument strings passed to the
15 * program.
16 * @param array|null $envs envs is an array of strings which are passed as
17 * environment to the program. The array is in the format of name =&gt; value,
18 * the key being the name of the environmental variable and the value being
19 * the value of that variable.
20 *
21 * @throws PcntlException
22 *
23 */
24 function pcntl_exec(string $path, ?array $args = null, ?array $envs = null): void
25 {
26 error_clear_last();
27 if ($envs !== null) {
28 $result = \pcntl_exec($path, $args, $envs);
29 } elseif ($args !== null) {
30 $result = \pcntl_exec($path, $args);
31 } else {
32 $result = \pcntl_exec($path);
33 }
34 if ($result === false) {
35 throw PcntlException::createFromPhpError();
36 }
37 }
38
39
40 /**
41 * pcntl_getpriority gets the priority of
42 * pid. Because priority levels can differ between
43 * system types and kernel versions, please see your system's getpriority(2)
44 * man page for specific details.
45 *
46 * @param int|null $pid If not specified, the pid of the current process is used.
47 * @param int $process_identifier One of PRIO_PGRP, PRIO_USER
48 * or PRIO_PROCESS.
49 *
50 * @return int pcntl_getpriority returns the priority of the process. A lower numerical value causes more favorable
51 * scheduling.
52 * @throws PcntlException
53 *
54 */
55 function pcntl_getpriority(?int $pid = null, int $process_identifier = PRIO_PROCESS): int
56 {
57 error_clear_last();
58 if ($process_identifier !== PRIO_PROCESS) {
59 $result = \pcntl_getpriority($pid, $process_identifier);
60 } elseif ($pid !== null) {
61 $result = \pcntl_getpriority($pid);
62 } else {
63 $result = \pcntl_getpriority();
64 }
65 if ($result === false) {
66 throw PcntlException::createFromPhpError();
67 }
68 return $result;
69 }
70
71
72 /**
73 * pcntl_setpriority sets the priority of
74 * pid.
75 *
76 * @param int $priority priority is generally a value in the range
77 * -20 to 20. The default priority
78 * is 0 while a lower numerical value causes more
79 * favorable scheduling. Because priority levels can differ between
80 * system types and kernel versions, please see your system's setpriority(2)
81 * man page for specific details.
82 * @param int|null $pid If not specified, the pid of the current process is used.
83 * @param int $process_identifier One of PRIO_PGRP, PRIO_USER
84 * or PRIO_PROCESS.
85 *
86 * @throws PcntlException
87 *
88 */
89 function pcntl_setpriority(int $priority, ?int $pid = null, int $process_identifier = PRIO_PROCESS): void
90 {
91 error_clear_last();
92 if ($process_identifier !== PRIO_PROCESS) {
93 $result = \pcntl_setpriority($priority, $pid, $process_identifier);
94 } elseif ($pid !== null) {
95 $result = \pcntl_setpriority($priority, $pid);
96 } else {
97 $result = \pcntl_setpriority($priority);
98 }
99 if ($result === false) {
100 throw PcntlException::createFromPhpError();
101 }
102 }
103
104
105 /**
106 * The pcntl_signal_dispatch function calls the signal
107 * handlers installed by pcntl_signal for each pending
108 * signal.
109 *
110 * @throws PcntlException
111 *
112 */
113 function pcntl_signal_dispatch(): void
114 {
115 error_clear_last();
116 $result = \pcntl_signal_dispatch();
117 if ($result === false) {
118 throw PcntlException::createFromPhpError();
119 }
120 }
121
122
123 /**
124 * The pcntl_sigprocmask function adds, removes or sets blocked
125 * signals, depending on the how parameter.
126 *
127 * @param int $how Sets the behavior of pcntl_sigprocmask. Possible
128 * values:
129 *
130 * SIG_BLOCK: Add the signals to the
131 * currently blocked signals.
132 * SIG_UNBLOCK: Remove the signals from the
133 * currently blocked signals.
134 * SIG_SETMASK: Replace the currently
135 * blocked signals by the given list of signals.
136 *
137 * @param array $set List of signals.
138 * @param array|null $oldset The oldset parameter is set to an array
139 * containing the list of the previously blocked signals.
140 * @throws PcntlException
141 *
142 */
143 function pcntl_sigprocmask(int $how, array $set, ?array &$oldset = null): void
144 {
145 error_clear_last();
146 $result = \pcntl_sigprocmask($how, $set, $oldset);
147 if ($result === false) {
148 throw PcntlException::createFromPhpError();
149 }
150 }
151
152
153 /**
154 *
155 *
156 * @param int $errno
157 * @return string Returns error description on success.
158 * @throws PcntlException
159 *
160 */
161 function pcntl_strerror(int $errno): string
162 {
163 error_clear_last();
164 $result = \pcntl_strerror($errno);
165 if ($result === false) {
166 throw PcntlException::createFromPhpError();
167 }
168 return $result;
169 }
170