'\" te .\" Copyright (c) 2008, 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 di_devlink_dup 3DEVINFO "15 May 2008" "SunOS 5.11" "Device Information Library Functions" .SH NAME di_devlink_dup, di_devlink_free \- copy and free a devlink object .SH SYNOPSIS .LP .nf \fBcc\fR [ \fIflag\fR... ] \fIfile\fR... \fB-ldevinfo\fR [ \fIlibrary\fR... ] #include \fBdi_devlink_t\fR \fBdi_devlink_dup\fR(\fBdi_devlink_t\fR \fIdevlink\fR); .fi .LP .nf \fBint\fR \fBdi_devlink_free\fR(\fBdi_devlink_t\fR \fIdevlink\fR); .fi .SH PARAMETERS .sp .ne 2 .mk .na \fB\fIdevlink\fR\fR .ad .RS 11n .rt An opaque handle to a devlink. .RE .SH DESCRIPTION .sp .LP Typically, a \fBdi_devlink_t\fR object is only accessible from within the scope of the \fBdi_devlink_walk\fR(3DEVINFO) callback function. The \fBdi_devlink_dup()\fR function allows the callback function implementation to make a duplicate copy of the \fBdi_devlink_t\fR object. The duplicate copy is valid and accessible until \fBdi_devlink_free()\fR is called. .sp .LP The \fBdi_devlink_dup()\fR function returns a copy of a \fIdevlink\fR object. The \fBdi_devlink_free()\fR function frees this copy. .SH RETURN VALUES .sp .LP Upon successful completion, \fBdi_devlink_dup()\fR returns a copy of the \fIdevlink\fR object passed in. Otherwise, \fINULL\fR is returned and \fBerrno\fR is set to indicate the error. .sp .LP Upon successful completion, \fBdi_devlink_free()\fR returns 0. Otherwise, -1 is returned and \fBerrno\fR is set to indicate the error. .SH ERRORS .sp .LP The \fBdi_devlink_dup()\fR and \fBdi_devlink_free()\fR functions will fail if: .sp .ne 2 .mk .na \fB\fBEINVAL\fR\fR .ad .RS 10n .rt The \fIdevlink\fR argument is not a valid handle. .RE .sp .LP The \fBdi_devlink_dup()\fR function can set \fBerrno\fR to any error value that can also be set by \fBmalloc\fR(3C). .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 _ Interface StabilityCommitted _ MT-LevelSafe .TE .SH SEE ALSO .sp .LP \fBdi_devlink_init\fR(3DEVINFO), \fBdi_devlink_path\fR(3DEVINFO), \fBdi_devlink_walk\fR(3DEVINFO), \fBlibdevinfo\fR(3LIB), \fBmalloc\fR(3C), \fBattributes\fR(5)