1 /* 2 * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana 3 * University Research and Technology 4 * Corporation. All rights reserved. 5 * Copyright (c) 2004-2006 The University of Tennessee and The University 6 * of Tennessee Research Foundation. All rights 7 * reserved. 8 * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, 9 * University of Stuttgart. All rights reserved. 10 * Copyright (c) 2004-2005 The Regents of the University of California. 11 * All rights reserved. 12 * $COPYRIGHT$ 13 * 14 * Additional copyrights may follow 15 * 16 * $HEADER$ 17 */ 18 /** @file **/ 19 20 #ifndef OPAL_DAEMON_INIT_H 21 #define OPAL_DAEMON_INIT_H 22 23 #include "opal_config.h" 24 25 BEGIN_C_DECLS 26 27 /* 28 * Turn a process into a daemon. 29 * 30 * This function converts a process into a daemon in an orderly manner. It first forks a child process, 31 * then the parent exits. The child continues on to become a session leader, reset the file mode creation 32 * mask, and changes working directories to the one specified. 33 * 34 * @param working_dir Pointer to a character string containing the desired working directory. Providing 35 * a value of NULL will cause the function to leave the program in the current working directory. 36 * 37 * @retval OPAL_SUCCESS Indicates that the conversion was successful 38 * @retval OPAL_ERROR Indicates that the conversion was not successful - a fork could not be completed. 39 */ 40 OPAL_DECLSPEC int opal_daemon_init(char *working_dir); 41 42 END_C_DECLS 43 44 #endif /* OPAL_DAEMON_INIT_H */