posix_setsid
(PHP 4, PHP 5)
posix_setsid — Make the current process a session leader
Description
int posix_setsid
( void
)
Make the current process a session leader.
Return Values
Returns the session id, or -1 on errors.
See Also
- The POSIX.1 and the setsid(2) manual page on the POSIX system for more information on process groups and job control.
- PHP Руководство
- Функции по категориям
- Индекс функций
- Справочник функций
- Расширения для управления процессами программ
- POSIX
- posix_access
- posix_ctermid
- posix_errno
- posix_get_last_error
- posix_getcwd
- posix_getegid
- posix_geteuid
- posix_getgid
- posix_getgrgid
- posix_getgrnam
- posix_getgroups
- posix_getlogin
- posix_getpgid
- posix_getpgrp
- posix_getpid
- posix_getppid
- posix_getpwnam
- posix_getpwuid
- posix_getrlimit
- posix_getsid
- posix_getuid
- posix_initgroups
- posix_isatty
- posix_kill
- posix_mkfifo
- posix_mknod
- posix_setegid
- posix_seteuid
- posix_setgid
- posix_setpgid
- posix_setrlimit
- posix_setsid
- posix_setuid
- posix_strerror
- posix_times
- posix_ttyname
- posix_uname
Коментарии
Very useful when making daemons, for example:
<?php
$pid = pcntl_fork(); // fork
if ($pid < 0)
exit;
else if ($pid) // parent
exit;
else { // child
$sid = posix_setsid();
if ($sid < 0)
exit;
for($i = 0; $i <= 60; $i++) { // do something for 5 minutes
sleep(5);
}
}
?>