2 .\" Copyright (c) 2006, Sun Microsystems Inc. All Rights Reserved.
3 .\" 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.
4 .\" 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.
5 .\" 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]
6 .TH GETLABEL 2 "Jul 20, 2007"
8 getlabel, fgetlabel \- get file sensitivity label
12 \fBcc\fR [\fIflags\fR...] \fIfile\fR... \fB-ltsol\fR [\fIlibrary\fR...]
17 #include <tsol/label.h>
19 \fBint\fR \fBgetlabel\fR(\fBconst char *\fR\fIpath\fR, \fBm_label_t *\fR\fIlabel_p\fR);
24 \fBint\fR \fBfgetlabel\fR(\fBint\fR \fIfd\fR, \fBm_label_t *\fR\fIlabel_p\fR);
30 The \fBgetlabel()\fR function obtains the sensitivity label of the file that is
31 named by \fIpath\fR. Discretionary read, write or execute permission to the
32 final component of \fIpath\fR is not required, but all directories in the path
33 prefix of \fIpath\fR must be searchable.
36 The \fBfgetlabel()\fR function obtains the label of an open file that is
37 referred to by the argument descriptor, such as would be obtained by an
41 The \fIlabel_p\fR argument is a pointer to an opaque label structure. The
42 caller must allocate space for \fIlabel_p\fR by using
43 \fBm_label_alloc\fR(3TSOL).
47 Upon successful completion, \fBgetlabel()\fR and \fBfgetlabel()\fR return 0.
48 Otherwise they return \(mi1 and set \fBerrno\fR to indicate the error.
52 The \fBgetlabel()\fR function will fail if:
59 Search permission is denied for a component of the path prefix of \fIpath\fR.
60 To override this restriction, the calling process can assert the
61 \fBPRIV_FILE_DAC_SEARCH\fR privilege.
70 \fIlabel_p\fR or \fIpath\fR points to an invalid address.
79 An \fBI/O\fR error occurred while reading from or writing to the file system.
88 Too many symbolic links were encountered in translating \fIpath\fR.
94 \fB\fBENAMETOOLONG\fR\fR
97 The length of the path argument exceeds \fIPATH_MAX\fR, or a pathname component
98 is longer than \fINAME_MAX\fR while \fI_POSIX_NO_TRUNC\fR is in effect (see
108 The file referred to by \fIpath\fR does not exist.
117 A component of the path prefix of \fIpath\fR is not a directory.
122 The \fBfgetlabel()\fR function will fail if:
129 The \fIfd\fR argument is not a valid open file descriptor.
138 The \fIlabel_p\fR argument points to an invalid address.
147 An \fBI/O\fR error occurred while reading from or writing to the file system.
153 See \fBattributes\fR(5) for descriptions of the following attributes:
161 ATTRIBUTE TYPE ATTRIBUTE VALUE
163 Interface Stability Committed
169 \fBopen\fR(2), \fBpathconf\fR(2), \fBm_label_alloc\fR(3TSOL),
170 \fBattributes\fR(5), \fBlabels\fR(5)
173 \fIObtaining a File Label\fR in \fISolaris Trusted Extensions Developer\&'s
178 The functionality described on this manual page is available only if the system
179 is configured with Trusted Extensions.