9070 Remove wanboot from gate
[unleashed.git] / usr / src / man / man3tnf / tnfctl_register_funcs.3tnf
blobb1af9e7c8b6188b396f49206bfb74683f1e2f02b
1 '\" te
2 .\"  Copyright (c) 2004 Sun Microsystems, Inc.  All Rights Reserved
3 .\" 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.
4 .\" 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.
5 .\" 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]
6 .TH TNFCTL_REGISTER_FUNCS 3TNF "Mar 1, 2004"
7 .SH NAME
8 tnfctl_register_funcs \- register callbacks for probe creation and destruction
9 .SH SYNOPSIS
10 .LP
11 .nf
12 \fBcc\fR [ \fIflag\fR ... ] \fIfile\fR ... \fB-ltnfctl\fR [ \fIlibrary\fR ... ]
13 #include <tnf/tnfctl.h>
15 \fBtnfctl_errcode_t\fR \fBtnfctl_register_funcs\fR(\fBtnfctl_handle_t *\fR\fIhndl\fR, \fBvoid * (*\fR\fIcreate_func\fR)
16      (tnfctl_handle_t *, tnfctl_probe_t *), \fBvoid (*\fR\fIdestroy_func\fR)(void *));
17 .fi
19 .SH DESCRIPTION
20 .sp
21 .LP
22 The function \fBtnfctl_register_funcs()\fR is used to store client-specific
23 data on a per-probe basis.  It registers a creator and a destructor function
24 with  \fIhndl\fR, either of which can be  \fBNULL.\fR The creator function is
25 called for every probe that currently exists in \fIhndl.\fR Every time a new
26 probe is discovered, that is brought in by \fBdlopen\fR(3C), \fIcreate_func\fR
27 is called.
28 .sp
29 .LP
30 The return value of the creator function is  stored as part of the probe state
31 and can be retrieved by \fBtnfctl_probe_state_get\fR(3TNF) in the member field
32 \fIclient_registered_data\fR.
33 .sp
34 .LP
35 \fIdestroy_func\fR is called for every probe handle that is freed.  This does
36 not necessarily happen at the time \fBdlclose\fR(3C) frees the shared object.
37 The probe handles are freed only when \fIhndl\fR is closed by
38 \fBtnfctl_close\fR(3TNF). If \fBtnfctl_register_funcs()\fR is called a second
39 time for the same \fIhndl,\fR then the previously registered destructor
40 function is called first for  all of the probes.
41 .SH RETURN VALUES
42 .sp
43 .LP
44 \fBtnfctl_register_funcs()\fR returns \fBTNFCTL_ERR_NONE\fR upon success.
45 .SH ERRORS
46 .sp
47 .ne 2
48 .na
49 \fB\fBTNFCTL_ERR_INTERNAL\fR\fR
50 .ad
51 .RS 23n
52 An internal error occurred.
53 .RE
55 .SH ATTRIBUTES
56 .sp
57 .LP
58 See \fBattributes\fR(5) for descriptions of the following attributes:
59 .sp
61 .sp
62 .TS
63 box;
64 c | c
65 l | l .
66 ATTRIBUTE TYPE  ATTRIBUTE VALUE
68 MT Level        MT-Safe
69 .TE
71 .SH SEE ALSO
72 .sp
73 .LP
74 \fBprex\fR(1), \fBTNF_PROBE\fR(3TNF), \fBdlclose\fR(3C), \fBdlopen\fR(3C),
75 \fBlibtnfctl\fR(3TNF), \fBtnfctl_close\fR(3TNF),
76 \fBtnfctl_probe_state_get\fR(3TNF), \fBtracing\fR(3TNF),
77 \fBtnf_kernel_probes\fR(4), \fBattributes\fR(5)
78 .sp
79 .LP
80 \fILinker and Libraries Guide\fR