File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -203,7 +203,26 @@ PHP_FUNCTION(pcntl_fork)
203203 id = fork ();
204204 if (id == -1 ) {
205205 PCNTL_G (last_error ) = errno ;
206- php_error_docref (NULL , E_WARNING , "Error %d" , errno );
206+ switch (errno ) {
207+ case EAGAIN :
208+ php_error_docref (NULL , E_WARNING , "Error %d: Reached the maximum limit of number of processes" , errno );
209+ break ;
210+ case ENOMEM :
211+ php_error_docref (NULL , E_WARNING , "Error %d: Insufficient memory" , errno );
212+ break ;
213+ // unlikely, especially nowadays.
214+ case ENOSYS :
215+ php_error_docref (NULL , E_WARNING , "Error %d: Unimplemented" , errno );
216+ break ;
217+ // QNX is the only platform returning it so far and is a different case from EAGAIN.
218+ // Retries can be handled with sleep eventually.
219+ case EBADF :
220+ php_error_docref (NULL , E_WARNING , "Error %d: File descriptor concurrency issue" , errno );
221+ break ;
222+ default :
223+ php_error_docref (NULL , E_WARNING , "Error %d" , errno );
224+
225+ }
207226 } else if (id == 0 ) {
208227 zend_max_execution_timer_init ();
209228 }
You can’t perform that action at this time.
0 commit comments