'\" 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 "20 Jul 2007" "SunOS 5.11" "System Calls" .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 .mk .na \fB\fBEACCES\fR\fR .ad .RS 16n .rt 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 .mk .na \fB\fBEFAULT\fR\fR .ad .RS 16n .rt \fIlabel_p\fR or \fIpath\fR points to an invalid address. .RE .sp .ne 2 .mk .na \fB\fBEIO\fR\fR .ad .RS 16n .rt An \fBI/O\fR error occurred while reading from or writing to the file system. .RE .sp .ne 2 .mk .na \fB\fBELOOP\fR\fR .ad .RS 16n .rt Too many symbolic links were encountered in translating \fIpath\fR. .RE .sp .ne 2 .mk .na \fB\fBENAMETOOLONG\fR\fR .ad .RS 16n .rt 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 .mk .na \fB\fBENOENT\fR\fR .ad .RS 16n .rt The file referred to by \fIpath\fR does not exist. .RE .sp .ne 2 .mk .na \fB\fBENOTDIR\fR\fR .ad .RS 16n .rt 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 .mk .na \fB\fBEBADF\fR\fR .ad .RS 10n .rt The \fIfd\fR argument is not a valid open file descriptor. .RE .sp .ne 2 .mk .na \fB\fBEFAULT\fR\fR .ad .RS 10n .rt The \fIlabel_p\fR argument points to an invalid address. .RE .sp .ne 2 .mk .na \fB\fBEIO\fR\fR .ad .RS 10n .rt 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 tab() box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i) . ATTRIBUTE TYPEATTRIBUTE VALUE _ Interface StabilityCommitted .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.