daemon(3) Library Functions Manual daemon(3) NOMBRE daemon - ejecucion en segundo plano BIBLIOTECA Biblioteca Estandar C (libc, -lc) SINOPSIS #include int daemon(int nochdir, int noclose); Requisitos de Macros de Prueba de Caracteristicas para glibc (vease feature_test_macros(7)): daemon(): Since glibc 2.21: _DEFAULT_SOURCE In glibc 2.19 and 2.20: _DEFAULT_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE < 500) Up to and including glibc 2.19: _BSD_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE < 500) DESCRIPCION La funcion daemon() es utilizada por programas que desean desvincularse de la terminal de control y correr en segundo plano como demonios de sistema. If nochdir is zero, daemon() changes the process's current working directory to the root directory ("/"); otherwise, the current working directory is left unchanged. If noclose is zero, daemon() redirects standard input, standard output, and standard error to /dev/null; otherwise, no changes are made to these file descriptors. VALOR DEVUELTO (This function forks, and if the fork(2) succeeds, the parent calls _exit(2), so that further errors are seen by the child only.) On success daemon() returns zero. If an error occurs, daemon() returns -1 and sets errno to any of the errors specified for the fork(2) and setsid(2). ATRIBUTOS Para obtener una explicacion de los terminos usados en esta seccion, vease attributes(7). +-----------------------------+--------------------+-------------------+ |Interfaz | Atributo | Valor | +-----------------------------+--------------------+-------------------+ |daemon() | Seguridad del hilo | Multi-hilo seguro | +-----------------------------+--------------------+-------------------+ VERSIONES A similar function appears on the BSDs. La implementacion de glibc puede devolver tambien -1 cuando /dev/null existe pero no es un dispositivo de caracteres con los numeros mayor y menor esperados. En este caso errno no necesita ser modificado. ESTANDARES None. HISTORIAL 4.4BSD. ERRORES The GNU C library implementation of this function was taken from BSD, and does not employ the double-fork technique (i.e., fork(2), setsid(2), fork(2)) that is necessary to ensure that the resulting daemon process is not a session leader. Instead, the resulting daemon is a session leader. On systems that follow System V semantics (e.g., Linux), this means that if the daemon opens a terminal that is not already a controlling terminal for another session, then that terminal will inadvertently become the controlling terminal for the daemon. VEASE TAMBIEN fork(2), setsid(2), daemon(7), logrotate(8) TRADUCCION La traduccion al espanol de esta pagina del manual fue creada por Miguel Perez Ibars Esta traduccion es documentacion libre; lea la GNU General Public License Version 3 o posterior con respecto a las condiciones de copyright. No existe NINGUNA RESPONSABILIDAD. Si encuentra algun error en la traduccion de esta pagina del manual, envie un correo electronico a . Paginas de manual de Linux 6.06 31 Octubre 2023 daemon(3)