'\" te .\" Copyright (c) 2006, 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 GETLABEL 2 "Jul 20, 2007" .SH NAME getlabel, fgetlabel \- get file sensitivity label .SH SYNOPSIS .LP .nf \fBcc\fR [\fIflags\fR...] \fIfile\fR... \fB-ltsol\fR [\fIlibrary\fR...] .fi .LP .nf #include \fBint\fR \fBgetlabel\fR(\fBconst char *\fR\fIpath\fR, \fBm_label_t *\fR\fIlabel_p\fR); .fi .LP .nf \fBint\fR \fBfgetlabel\fR(\fBint\fR \fIfd\fR, \fBm_label_t *\fR\fIlabel_p\fR); .fi .SH DESCRIPTION .sp .LP The \fBgetlabel()\fR function obtains the sensitivity label of the file that is named by \fIpath\fR. Discretionary read, write or execute permission to the final component of \fIpath\fR is not required, but all directories in the path prefix of \fIpath\fR must be searchable. .sp .LP The \fBfgetlabel()\fR function obtains the label of an open file that is referred to by the argument descriptor, such as would be obtained by an \fBopen\fR(2) call. .sp .LP The \fIlabel_p\fR argument is a pointer to an opaque label structure. The caller must allocate space for \fIlabel_p\fR by using \fBm_label_alloc\fR(3TSOL). .SH RETURN VALUES .sp .LP Upon successful completion, \fBgetlabel()\fR and \fBfgetlabel()\fR return 0. Otherwise they return \(mi1 and set \fBerrno\fR to indicate the error. .SH ERRORS .sp .LP The \fBgetlabel()\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. To override this restriction, the calling process can assert the \fBPRIV_FILE_DAC_SEARCH\fR privilege. .RE .sp .ne 2 .na \fB\fBEFAULT\fR\fR .ad .RS 16n \fIlabel_p\fR or \fIpath\fR points to an invalid address. .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 while \fI_POSIX_NO_TRUNC\fR is in effect (see \fBpathconf\fR(2)). .RE .sp .ne 2 .na \fB\fBENOENT\fR\fR .ad .RS 16n The file referred to by \fIpath\fR does not exist. .RE .sp .ne 2 .na \fB\fBENOTDIR\fR\fR .ad .RS 16n A component of the path prefix of \fIpath\fR is not a directory. .RE .sp .LP The \fBfgetlabel()\fR function will fail if: .sp .ne 2 .na \fB\fBEBADF\fR\fR .ad .RS 10n The \fIfd\fR argument is not a valid open file descriptor. .RE .sp .ne 2 .na \fB\fBEFAULT\fR\fR .ad .RS 10n The \fIlabel_p\fR argument points to an invalid address. .RE .sp .ne 2 .na \fB\fBEIO\fR\fR .ad .RS 10n An \fBI/O\fR error occurred while reading from or writing to the file system. .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 .TE .SH SEE ALSO .sp .LP \fBopen\fR(2), \fBpathconf\fR(2), \fBm_label_alloc\fR(3TSOL), \fBattributes\fR(5), \fBlabels\fR(5) .sp .LP \fIObtaining a File Label\fR in \fISolaris Trusted Extensions Developer\&'s Guide\fR .SH NOTES .sp .LP The functionality described on this manual page is available only if the system is configured with Trusted Extensions.