'\" te .\" Copyright (c) 2004 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 tnfctl_internal_open 3TNF "1 Mar 2004" "SunOS 5.11" "TNF Library Functions" .SH NAME tnfctl_internal_open \- create handle for internal process probe control .SH SYNOPSIS .LP .nf \fBcc\fR [ \fIflag\fR ... ] \fIfile\fR ... \fB-ltnfctl\fR [ \fIlibrary\fR ... ] #include \fBtnfctl_errcode_t\fR \fBtnfctl_internal_open\fR(\fBtnfctl_handle_t **\fR\fIret_val\fR); .fi .SH DESCRIPTION .sp .LP \fBtnfctl_internal_open()\fR returns in \fIret_val\fR a pointer to an opaque handle that can be used to control probes in the same process as the caller (internal process probe control). The process must have \fBlibtnfprobe.so.1\fR loaded. Probes in libraries that are brought in by \fBdlopen\fR(3C) will be visible after the library has been opened. Probes in libraries closed by a \fBdlclose\fR(3C) will not be visible after the library has been disassociated. See the \fBNOTES\fR section for more details. .SH RETURN VALUES .sp .LP \fBtnfctl_internal_open()\fR returns \fBTNFCTL_ERR_NONE\fR upon success. .SH ERRORS .sp .ne 2 .mk .na \fB\fBTNFCTL_ERR_ALLOCFAIL\fR\fR .ad .RS 28n .rt A memory allocation failure occurred. .RE .sp .ne 2 .mk .na \fB\fBTNFCTL_ERR_BUSY\fR\fR .ad .RS 28n .rt Another client is already tracing this program (internally or externally). .RE .sp .ne 2 .mk .na \fB\fBTNFCTL_ERR_NOLIBTNFPROBE\fR\fR .ad .RS 28n .rt \fBlibtnfprobe.so.1\fR is not linked in the target process. .RE .sp .ne 2 .mk .na \fB\fBTNFCTL_ERR_INTERNAL\fR\fR .ad .RS 28n .rt An internal error occurred. .RE .SH ATTRIBUTES .sp .LP See \fBattributes\fR(5) for descriptions of the following attributes: .sp .sp .TS tab() box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i) . ATTRIBUTE TYPEATTRIBUTE VALUE _ MT LevelMT-Safe .TE .SH SEE ALSO .sp .LP \fBld\fR(1), \fBprex\fR(1), \fBTNF_PROBE\fR(3TNF), \fBdlopen\fR(3C), \fBdlclose\fR(3C), \fBlibtnfctl\fR(3TNF), \fBtracing\fR(3TNF), \fBattributes\fR(5) .sp .LP \fILinker and Libraries Guide\fR .SH NOTES .sp .LP \fBlibtnfctl\fR interposes on \fBdlopen\fR(3C) and \fBdlclose\fR(3C) in order to be notified of libraries being dynamically opened and closed. This interposition is necessary for internal process probe control to update its list of probes. In these interposition functions, a lock is acquired to synchronize on traversal of the library list maintained by the runtime linker. To avoid deadlocking on this lock, \fBtnfctl_internal_open()\fR should not be called from within the init section of a library that can be opened by \fBdlopen\fR(3C). .sp .LP Since interposition does not work as expected when a library is opened dynamically, \fBtnfctl_internal_open()\fR should not be used if the client opened \fBlibtnfctl\fR through \fBdlopen\fR(3C). In this case, the client program should be built with a static dependency on \fBlibtnfctl.\fR Also, if the client program is explicitly linking in \fB-ldl\fR, it should link \fB-ltnfctl\fR before \fB-ldl\fR. .sp .LP Probes in filtered libraries (see \fBld\fR(1)) will not be seen because the filtee (backing library) is loaded lazily on the first symbol reference and not at process startup or \fBdlopen\fR(3C) time. A workaround is to call \fBtnfctl_check_libs\fR(3TNF) once the caller is sure that the filtee has been loaded.