'\" te
.\" Copyright (c) 2007, 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 GETPATHBYLABEL 3TSOL "Jul 20, 2007"
.SH NAME
getpathbylabel \- return the zone pathname
.SH SYNOPSIS
.LP
.nf
\fBcc\fR [\fIflags\fR...] \fIfile\fR... \fB-ltsol\fR [\fIlibrary\fR...]
.fi

.LP
.nf
#include <tsol/label.h>

\fBchar *\fR\fBgetpathbylabel\fR(\fBconst char *\fR\fIpath\fR, \fBchar *\fR\fIresolved_path\fR,
     \fBsize_t\fR \fIbufsize\fR, \fBconst m_label_t *\fR\fIsl\fR);
.fi

.SH DESCRIPTION
.sp
.LP
The \fBgetpathbylabel()\fR function expands all symbolic links and resolves
references to '/./', '/../', extra '/' characters, and stores the zone pathname
in the buffer named by \fIresolved_path\fR. The \fIbufsize\fR argument
specifies the size in bytes of this buffer. The resulting path will have no
symbolic links components, nor any '/./', '/.\|./'. This function can only be
called from the global zone.
.sp
.LP
The zone pathname is relative to the sensitivity label \fIsl\fR. To specify a
sensitivity label for a zone name which does not exist, the process must assert
either the \fBPRIV_FILE_UPGRADE_SL\fR or \fBPRIV_FILE_DOWNGRADE_SL\fR privilege
depending on whether the specified sensitivity label dominates or does not
dominate the process sensitivity label.
.SH RETURN VALUES
.sp
.LP
The \fBgetpathbylabel()\fR function returns a pointer to the
\fIresolved_path\fR on success. Otherwise it returns \fINULL\fR and sets
\fIerrno\fR to indicate the error.
.SH ERRORS
.sp
.LP
The \fBgetpathbylabel()\fR function will fail if:
.sp
.ne 2
.na
\fB\fBEACCES\fR\fR
.ad
.RS 16n
Search permission is denied for a component of the path prefix of \fIpath\fR.
.RE

.sp
.ne 2
.na
\fB\fBEFAULT\fR\fR
.ad
.RS 16n
\fIresolved_path\fR extends outside the process's allocated address space or
beyond \fIbufsize\fR bytes.
.RE

.sp
.ne 2
.na
\fB\fBEINVAL\fR\fR
.ad
.RS 16n
\fIpath\fR or \fIresolved_path\fR was \fINULL\fR, current zone is not the
global zone, or \fIsl\fR is invalid.
.RE

.sp
.ne 2
.na
\fB\fBEIO\fR\fR
.ad
.RS 16n
An \fBI/O\fR error occurred while reading from or writing to the file system.
.RE

.sp
.ne 2
.na
\fB\fBELOOP\fR\fR
.ad
.RS 16n
Too many symbolic links were encountered in translating \fIpath\fR.
.RE

.sp
.ne 2
.na
\fB\fBENAMETOOLONG\fR\fR
.ad
.RS 16n
The length of the path argument exceeds \fIPATH_MAX\fR, or a pathname component
is longer than \fINAME_MAX\fR (see \fBsysconf\fR(3C)) while
\fB_POSIX_NO_TRUNC\fR is in effect (see \fBpathconf\fR(2)).
.RE

.sp
.ne 2
.na
\fB\fBENOENT\fR\fR
.ad
.RS 16n
The named file does not exist.
.RE

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

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

.SH SEE ALSO
.sp
.LP
\fBreadlink\fR(2), \fBgetzonerootbyid\fR(3TSOL), \fBlibtsol\fR(3LIB),
\fBattributes\fR(5), \fBlabels\fR(5)
.SH WARNINGS
.sp
.LP
The \fBgetpathbylabel()\fR function indirectly invokes the \fBreadlink\fR(2)
system call, and hence inherits the possibility of hanging due to inaccessible
file system resources.
.SH NOTES
.sp
.LP
The functionality described on this manual page is available only if the system
is configured with Trusted Extensions.