Current File : //usr/share/man/man3devinfo/di_devlink_dup.3devinfo
'\" te
.\" Copyright (c) 2008, Sun Microsystems, Inc.  All Rights Reserved.
.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 <libdevinfo.h>

\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)