Path Discovery

Path Discovery — Resolving file names with optional relocation support

Synopsis


#include <monitor/monitor.h>


enum        mon_path_type;
char*       mon_path                        (mon_path_type type,
                                             const char *filename);

Description

Details

enum mon_path_type

typedef enum {
	/* First the ones that have default values from configure */
	MON_PATH_ETC,
	MON_PATH_VAR,
	MON_PATH_LIBMERCURY,
	MON_PATH_SOCKET,
	MON_PATH_PIDFILE,
	/* These are always dynamic */
	MON_PATH_TMP,
	MON_PATH_HOME
} mon_path_type;

Defines the base of the path.

MON_PATH_ETCthe path is relative to ${sysconfdir}.
MON_PATH_VARthe path is relative to ${localstatedir}.
MON_PATH_LIBMERCURYthe path is relative to ${libdir}/mercury.
MON_PATH_SOCKETthe path is relative to ${monitorsocketdir} (default: ${localstatedir}/run).
MON_PATH_PIDFILEthe path is relative to ${pidfiledir} (default: ${localstatedir}/run).
MON_PATH_TMPthe path points to a temporary file
MON_PATH_HOMEthe path is relative to the user's home directory.

mon_path ()

char*       mon_path                        (mon_path_type type,
                                             const char *filename);

Expands a relative filename to a full path using the specified base. If Mercury was built with GridLab support, the value of the GRIDLAB_MONITOR_LOCATION environment variable will be used instead of the built-in ${prefix} value. If Mercury was built with DataGrid support, this function will try to parse first $HOME/.etc.sysconfig.edg then /etc/sysconfig/edg and use the value of EDG_LOCATION and EDG_LOCATION_VAR instead of the built-in value of ${prefix} and ${localstatedir}, respectively.

type :the base of the path.
filename :the component (usually filename) relative to the base.
Returns :the fully expanded path.