8895 libtsol man pages are out of step with reality
[unleashed.git] / usr / src / man / man3tsol / getlabel.3tsol
blob3eb47754fd4a913a2100384ea75b6b654389bdb8
1 '\" te
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"
7 .SH NAME
8 getlabel, fgetlabel \- get file sensitivity label
9 .SH SYNOPSIS
10 .LP
11 .nf
12 \fBcc\fR [\fIflags\fR...] \fIfile\fR... \fB-ltsol\fR [\fIlibrary\fR...]
13 .fi
15 .LP
16 .nf
17 #include <tsol/label.h>
19 \fBint\fR \fBgetlabel\fR(\fBconst char *\fR\fIpath\fR, \fBm_label_t *\fR\fIlabel_p\fR);
20 .fi
22 .LP
23 .nf
24 \fBint\fR \fBfgetlabel\fR(\fBint\fR \fIfd\fR, \fBm_label_t *\fR\fIlabel_p\fR);
25 .fi
27 .SH DESCRIPTION
28 .LP
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.
33 .sp
34 .LP
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
37 \fBopen\fR(2) call.
38 .sp
39 .LP
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).
43 .SH RETURN VALUES
44 .LP
45 Upon successful completion, \fBgetlabel()\fR and \fBfgetlabel()\fR return 0.
46 Otherwise they return \(mi1 and set \fBerrno\fR to indicate the error.
47 .SH ERRORS
48 .LP
49 The \fBgetlabel()\fR function will fail if:
50 .sp
51 .ne 2
52 .na
53 \fB\fBEACCES\fR\fR
54 .ad
55 .RS 16n
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.
59 .RE
61 .sp
62 .ne 2
63 .na
64 \fB\fBEFAULT\fR\fR
65 .ad
66 .RS 16n
67 \fIlabel_p\fR or \fIpath\fR points to an invalid address.
68 .RE
70 .sp
71 .ne 2
72 .na
73 \fB\fBEIO\fR\fR
74 .ad
75 .RS 16n
76 An \fBI/O\fR error occurred while reading from or writing to the file system.
77 .RE
79 .sp
80 .ne 2
81 .na
82 \fB\fBELOOP\fR\fR
83 .ad
84 .RS 16n
85 Too many symbolic links were encountered in translating \fIpath\fR.
86 .RE
88 .sp
89 .ne 2
90 .na
91 \fB\fBENAMETOOLONG\fR\fR
92 .ad
93 .RS 16n
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
96 \fBpathconf\fR(2)).
97 .RE
99 .sp
100 .ne 2
102 \fB\fBENOENT\fR\fR
104 .RS 16n
105 The file referred to by \fIpath\fR does not exist.
109 .ne 2
111 \fB\fBENOTDIR\fR\fR
113 .RS 16n
114 A component of the path prefix of \fIpath\fR is not a directory.
119 The \fBfgetlabel()\fR function will fail if:
121 .ne 2
123 \fB\fBEBADF\fR\fR
125 .RS 10n
126 The \fIfd\fR argument is not a valid open file descriptor.
130 .ne 2
132 \fB\fBEFAULT\fR\fR
134 .RS 10n
135 The \fIlabel_p\fR argument points to an invalid address.
139 .ne 2
141 \fB\fBEIO\fR\fR
143 .RS 10n
144 An \fBI/O\fR error occurred while reading from or writing to the file system.
147 .SH ATTRIBUTES
149 See \fBattributes\fR(5) for descriptions of the following attributes:
154 box;
155 c | c
156 l | l .
157 ATTRIBUTE TYPE  ATTRIBUTE VALUE
159 Interface Stability     Committed
162 .SH SEE ALSO
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
169 Guide\fR
170 .SH NOTES
172 The functionality described on this manual page is available only if the system
173 is configured with Trusted Extensions.