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