1PMGETCONFIG(3) Library Functions Manual PMGETCONFIG(3)
2
3
4
6 pmGetConfig, pmGetOptionalConfig, pmGetAPIConfig - return values for
7 Performance Co-Pilot configuration variables
8
10 #include <pcp/pmapi.h>
11 char *pmGetConfig(const char *variable);
12 char *pmGetOptionalConfig(const char *variable);
13 char *pmGetAPIConfig(const char *feature);
14
15 cc ... -lpcp
16
18 The pmGetConfig and pmGetOptionalConfig functions search for variable
19 first in the environment and then, if not found, in the Performance Co-
20 Pilot (PCP) configuration file and returns the string result. If vari‐
21 able is not already in the environment, it is added with a call to
22 setenv(3) before returning.
23
24 The pmGetOptionalConfig function allows for failures - either from
25 variable not being set at all, or due to the configuration file being
26 missing. pmGetConfig is less tolerant to a missing configuration file,
27 which it treats as a critical PCP installation failure - see the
28 ``RETURN VALUE'' section below for further details.
29
30 The default location of the PCP configuration file is /etc/pcp.conf but
31 this may be changed by setting PCP_CONF in the environment to a new
32 location, as described in pcp.conf(5).
33
34 The pmGetAPIConfig function reports on features of the PCP library. It
35 can be used to query support for multi-threading, security extensions,
36 and other features.
37
38 The pmconfig(1) utility provides command line access to both of these
39 interfaces, and also provides a mechanism for listing all available
40 variables and features that are valid arguments to these routines.
41
43 If variable is not found in either the environment or the PCP configu‐
44 ration file, or if the configuration file is inaccessible, then pmGe‐
45 tOptionalConfig returns NULL.
46
47 If variable is found in neither the environment nor the PCP configura‐
48 tion file, then pmGetConfig returns an empty string. If the PCP con‐
49 figuration file is not found then a fatal error message is printed and
50 the process will exit(2) - although this sounds drastic, it is the only
51 course of action available because the PCP configuration/installation
52 is deemed fatally flawed.
53
54 The pmGetAPIConfig routine returns NULL on failure to lookup the
55 requested feature. It does not modify the environment, and returns a
56 pointer to a static read-only string.
57
58 The value returned by all of these routines is either a static pointer
59 or pointer into the environment, and so changing it is a bad idea.
60
62 Environment variables with the prefix PCP_ are used to parameterize the
63 file and directory names used by PCP. On each installation, the file
64 /etc/pcp.conf contains the local values for these variables. The
65 $PCP_CONF variable may be used to specify an alternative configuration
66 file, as described in pcp.conf(5). Values for these variables may be
67 obtained programmatically using the pmGetConfig(3) function.
68
70 PCPIntro(1), pmconfig(1), pmGetVersion(3), exit(2), PMAPI(3),
71 getenv(3), setenv(3), pcp.conf(5), pcp.env(5) and environ(7).
72
73
74
75Performance Co-Pilot PCP PMGETCONFIG(3)