summaryrefslogtreecommitdiff
path: root/usr/src/man/man3cpc/cpc_access.3cpc
blob: 2a275157221b26feba78e4c6a707d59ebdf8988a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
'\" te
.\" Copyright (c) 2005, Sun Microsystems, Inc.
.\" All Rights Reserved.
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH CPC_ACCESS 3CPC "Mar 28, 2005"
.SH NAME
cpc_access \- test access CPU performance counters
.SH SYNOPSIS
.LP
.nf
cc [ \fIflag\fR... ] \fIfile\fR... \(milcpc [ \fIlibrary\fR... ]
#include <libcpc.h>

\fBint\fR \fBcpc_access\fR(\fBvoid\fR);
.fi

.SH DESCRIPTION
.sp
.LP
Access to CPU performance counters is possible only on systems where the
appropriate hardware exists and is correctly configured. The \fBcpc_access()\fR
function \fBmust\fR be used to determine if the hardware exists and is
accessible on the platform before any of the interfaces that use the counters
are invoked.
.sp
.LP
When the hardware is available, access to the per-process counters is always
allowed to the process itself, and allowed to other processes mediated using
the existing security mechanisms of \fB/proc\fR.
.SH RETURN VALUES
.sp
.LP
Upon successful completion, \fBcpc_access()\fR returns \fB0\fR.  Otherwise, it
returns \fB\(mi1\fR and sets \fBerrno\fR to indicate the error.
.sp
.LP
By default, two common \fBerrno\fR values are decoded and cause the library to
print an error message using its reporting mechanism. See
\fBcpc_seterrfn\fR(3CPC) for a description of how this behavior can be
modified.
.SH ERRORS
.sp
.LP
The \fBcpc_access()\fR function will fail if:
.sp
.ne 2
.na
\fB\fBEAGAIN\fR\fR
.ad
.RS 10n
Another process may be sampling system-wide CPU statistics.
.RE

.sp
.ne 2
.na
\fB\fBENOSYS\fR\fR
.ad
.RS 10n
CPU performance counters are inaccessible on this machine. This error can occur
when the machine supports CPU performance counters, but some software
components are missing. Check to see that all CPU Performance Counter packages
have been correctly installed.
.RE

.SH ATTRIBUTES
.sp
.LP
See \fBattributes\fR(7) for descriptions of the following attributes:
.sp

.sp
.TS
box;
l | l
l | l .
ATTRIBUTE TYPE	ATTRIBUTE VALUE
_
MT-Level	MT-Safe
_
Interface Stability	Obsolete
.TE

.SH SEE ALSO
.sp
.LP
.BR cpc (3CPC),
.BR cpc_open (3CPC),
.BR cpc_seterrfn (3CPC),
.BR libcpc (3LIB),
.BR proc (5),
.BR attributes (7)
.SH NOTES
.sp
.LP
The \fBcpc_access()\fR function exists for binary compatibility only. Source
containing this function will not compile. This function is obsolete and might
be removed in a future release. Applications should use \fBcpc_open\fR(3CPC)
instead.