1 /* 2 * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana 3 * University Research and Technology 4 * Corporation. All rights reserved. 5 * Copyright (c) 2004-2005 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 19 #ifndef OPAL_FEW_H 20 #define OPAL_FEW_H 21 22 #include "opal_config.h" 23 24 BEGIN_C_DECLS 25 26 /** 27 * Forks, execs, and waits for a subordinate program 28 * 29 * @param argv Null-terminated argument vector; argv[0] is the program 30 * (same as arguments to execvp()) 31 * 32 * @param status Upon success, will be filled with the return status 33 * from waitpid(2). The WIF* macros can be used to examine the value 34 * (see waitpid(2)). 35 * 36 * @retval OPAL_SUCCESS If the child launched and exited. 37 * @retval OPAL_ERR_IN_ERRNO If a failure occurred, errno should be 38 * examined for the specific error. 39 * 40 * This function forks, execs, and waits for an executable to 41 * complete. The input argv must be a NULL-terminated array (perhaps 42 * built with the opal_arr_*() interface). Upon success, OPAL_SUCCESS 43 * is returned. This function will wait either until the child 44 * process has exited or waitpid() returns an error other than EINTR. 45 * 46 * Note that a return of OPAL_SUCCESS does \em not imply that the child 47 * process exited successfully -- it simply indicates that the child 48 * process exited. The WIF* macros (see waitpid(2)) should be used to 49 * examine the status to see hold the child exited. 50 * 51 * \warning This function should not be called if \c orte_init() 52 * or \c MPI_Init() have been called. This function is not 53 * safe in a multi-threaded environment in which a handler 54 * for \c SIGCHLD has been registered. 55 */ 56 OPAL_DECLSPEC int opal_few(char *argv[], int *status); 57 58 END_C_DECLS 59 #endif /* OPAL_FEW_H */