1 /* 2 * Copyright (c) 2007 Cisco Systems, Inc. All rights reserved. 3 * $COPYRIGHT$ 4 * 5 * Additional copyrights may follow 6 * 7 * $HEADER$ 8 */ 9 10 /** 11 * @file 12 * 13 * Per https://svn.open-mpi.org/trac/ompi/ticket/933, use a 14 * combination of $PWD and getcwd() to find the current working 15 * directory. 16 */ 17 18 #ifndef OPAL_GETCWD_H 19 #define OPAL_GETCWD_H 20 21 #include "opal_config.h" 22 23 BEGIN_C_DECLS 24 25 /** 26 * Per https://svn.open-mpi.org/trac/ompi/ticket/933, use a 27 * combination of $PWD and getcwd() to find the current working 28 * directory. 29 * 30 * Use $PWD instead of getcwd() a) if $PWD exists and b) is a valid 31 * synonym for the results from getcwd(). If both of these conditions 32 * are not met, just fall back and use the results of getcwd(). 33 * 34 * @param buf Caller-allocated buffer to put the result 35 * @param size Length of the buf array 36 * 37 * @retval OPAL_ERR_OUT_OF_RESOURCE If internal malloc() fails. 38 * @retval OPAL_ERR_TEMP_OUT_OF_RESOURCE If the supplied buf buffer 39 * was not long enough to handle the result. 40 * @retval OPAL_ERR_BAD_PARAM If buf is NULL or size>INT_MAX 41 * @retval OPAL_ERR_IN_ERRNO If an other error occurred 42 * @retval OPAL_SUCCESS If all went well and a valid value was placed 43 * in the buf buffer. 44 */ 45 OPAL_DECLSPEC int opal_getcwd(char *buf, size_t size); 46 47 48 END_C_DECLS 49 50 #endif /* OPAL_GETCWD_H */