1PMGETARCHIVEEND(3) Library Functions Manual PMGETARCHIVEEND(3)
2
3
4
6 pmGetArchiveEnd - locate logical end of file for a set of archive logs
7
9 #include <pcp/pmapi.h>
10
11 int pmGetArchiveEnd(struct timeval *tvp);
12
13 cc ... -lpcp
14
16 Assuming the current PMAPI context is associated with a set of archive
17 logs, pmGetArchiveEnd will attempt to find the logical end of file (af‐
18 ter the last complete record in the set of archives), and return the
19 last recorded timestamp via tvp. This timestamp may be passed to pm‐
20 SetMode(3) to reliably position the context at the last valid log
21 record, e.g. in preparation for subsequent reading in reverse chrono‐
22 logical order.
23
24 For archive logs that are not concurrently being written, the physical
25 end of file and the logical end of file are co-incident. However if an
26 archive log is being written by pmlogger(1) at the same time an appli‐
27 cation is trying to read the archive, the logical end of file may be
28 before the physical end of file due to write buffering that is not
29 aligned with the logical record boundaries.
30
31 pmGetArchiveEnd returns an error less than zero if the context is nei‐
32 ther valid, nor associated with a set of archives, or the set of ar‐
33 chives is seriously corrupted. Otherwise, the return value is 0 if
34 there has been no change of state since the last call, or 1 if the log‐
35 ical end of file has advanced since the last call.
36
37 In the absence of an error, the result returned via tvp is well-de‐
38 fined.
39
40 pmGetArchiveEnd preserves the positioning state of the log file prior
41 to this function call.
42
44 PM_ERR_NOCONTEXT
45 the current PMAPI context is either invalid, or not associated
46 with an set of archive logs
47
48 PM_ERR_LOGREC
49 the set of archives is sufficiently damaged, that not a single
50 valid record can be found
51
53 Environment variables with the prefix PCP_ are used to parameterize the
54 file and directory names used by PCP. On each installation, the file
55 /etc/pcp.conf contains the local values for these variables. The
56 $PCP_CONF variable may be used to specify an alternative configuration
57 file, as described in pcp.conf(5). Values for these variables may be
58 obtained programmatically using the pmGetConfig(3) function.
59
61 PMAPI(3), pmFetch(3), pmFetchArchive(3), pmGetArchiveLabel(3), pmGet‐
62 Config(3), pmSetMode(3), pcp.conf(5) and pcp.env(5).
63
64
65
66Performance Co-Pilot PCP PMGETARCHIVEEND(3)