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 3TSOL "Dec 3, 2017"
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);
29 The \fBgetlabel()\fR function obtains the sensitivity label of the file that is
30 named by \fIpath\fR. Discretionary read, write or execute permission to the
31 final component of \fIpath\fR is not required, but all directories in the path
32 prefix of \fIpath\fR must be searchable.
35 The \fBfgetlabel()\fR function obtains the label of an open file that is
36 referred to by the argument descriptor, such as would be obtained by an
40 The \fIlabel_p\fR argument is a pointer to an opaque label structure. The
41 caller must allocate space for \fIlabel_p\fR by using
42 \fBm_label_alloc\fR(3TSOL).
45 Upon successful completion, \fBgetlabel()\fR and \fBfgetlabel()\fR return 0.
46 Otherwise they return \(mi1 and set \fBerrno\fR to indicate the error.
49 The \fBgetlabel()\fR function will fail if:
56 Search permission is denied for a component of the path prefix of \fIpath\fR.
57 To override this restriction, the calling process can assert the
58 \fBPRIV_FILE_DAC_SEARCH\fR privilege.
67 \fIlabel_p\fR or \fIpath\fR points to an invalid address.
76 An \fBI/O\fR error occurred while reading from or writing to the file system.
85 Too many symbolic links were encountered in translating \fIpath\fR.
91 \fB\fBENAMETOOLONG\fR\fR
94 The length of the path argument exceeds \fIPATH_MAX\fR, or a pathname component
95 is longer than \fINAME_MAX\fR while \fI_POSIX_NO_TRUNC\fR is in effect (see
105 The file referred to by \fIpath\fR does not exist.
114 A component of the path prefix of \fIpath\fR is not a directory.
119 The \fBfgetlabel()\fR function will fail if:
126 The \fIfd\fR argument is not a valid open file descriptor.
135 The \fIlabel_p\fR argument points to an invalid address.
144 An \fBI/O\fR error occurred while reading from or writing to the file system.
149 See \fBattributes\fR(5) for descriptions of the following attributes:
157 ATTRIBUTE TYPE ATTRIBUTE VALUE
159 Interface Stability Committed
164 \fBopen\fR(2), \fBpathconf\fR(2), \fBm_label_alloc\fR(3TSOL),
165 \fBattributes\fR(5), \fBlabels\fR(5)
168 \fIObtaining a File Label\fR in \fISolaris Trusted Extensions Developer\&'s
172 The functionality described on this manual page is available only if the system
173 is configured with Trusted Extensions.