root/opal/mca/pmix/pmix4x/pmix/src/util/os_path.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


   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-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 (c) 2015-2018 Intel, Inc.  All rights reserved.
  13  * $COPYRIGHT$
  14  *
  15  * Additional copyrights may follow
  16  *
  17  * $HEADER$
  18  */
  19 
  20 /** @file:
  21  * Creates an operating system-acceptable path name.
  22  *
  23  * The pmix_os_path() function takes a variable number of string arguments and
  24  * concatenates them into a path name using the path separator character appropriate
  25  * to the local operating system. NOTE: the string returned by this function has been
  26  * malloc'd - thus, the user is responsible for free'ing the memory used by
  27  * the string.
  28  *
  29  * CRITICAL NOTE: The input variable list MUST be terminated by a NULL value. Failure
  30  * to do this will cause the program to suffer a catastrophic failure - usually a
  31  * segmentation violation or bus error.
  32  *
  33  * The function calls orte_sys_info() to ensure that the path separator character
  34  * has been identified. If that value cannot be identified for some reason,
  35  * the function will return a NULL value. Likewise, specifying a path name that
  36  * exceeds the maximum allowable path name length on the local system will result
  37  * in the return of a NULL value.
  38  *
  39  *
  40  */
  41 
  42 #ifndef PMIX_OS_PATH_H
  43 #define PMIX_OS_PATH_H
  44 
  45 #include <src/include/pmix_config.h>
  46 #include <pmix_common.h>
  47 
  48 #include <stdio.h>
  49 #include <stdarg.h>
  50 
  51 BEGIN_C_DECLS
  52 
  53 /**
  54  * @param relative A boolean that specifies if the path name is to be constructed
  55  * relative to the current directory or as an absolute path. If no path
  56  * elements are included in the function call, then the function returns
  57  * "." for a relative path name and "<path separator char>" -
  58  * the top of the directory tree - for an absolute path name.
  59  * @param elem1,elem2,... A variable number of (char *)path_elements
  60  * can be provided to the function, terminated by a NULL value. These
  61  * elements will be concatenated, each separated by the path separator
  62  * character, into a path name and returned.
  63  * @retval path_name A pointer to a fully qualified path name composed of the
  64  * provided path elements, separated by the path separator character
  65  * appropriate to the local operating system. The path_name string has been malloc'd
  66  * and therefore the user is responsible for free'ing the field.
  67  *
  68  * Note that the "relative" argument is int instead of bool, because
  69  * passing a parameter that undergoes default argument promotion to
  70  * va_start() has undefined behavior (according to clang warnings on
  71  * MacOS High Sierra).
  72 */
  73 PMIX_EXPORT char *pmix_os_path(int relative, ...) __pmix_attribute_malloc__ __pmix_attribute_sentinel__ __pmix_attribute_warn_unused_result__;
  74 
  75 /**
  76  * Convert the path to be OS friendly. On UNIX this function will
  77  * be empty.
  78  */
  79 #define pmix_make_filename_os_friendly(PATH)   (PATH)
  80 
  81 END_C_DECLS
  82 
  83 #endif /* PMIX_OS_PATH_H */

/* [<][>][^][v][top][bottom][index][help] */