'\" te .\" Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved. .TH getlabel 2 "15 Jun 2012" "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\fBEINVAL\fR\fR .ad .RS 16n .rt Unable to get the label; this may occur if \fIpath\fR or \fIfd\fR is not a regular file or directory, or if there is an unexpected error with the file. .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 _ Availabilitysystem/library _ 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 \fITrusted 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.