|
Chris PeBenito |
473ea7 |
.TH "getfilecon" "3" "1 January 2004" "russell@coker.com.au" "SE Linux API documentation"
|
|
Chris PeBenito |
473ea7 |
.SH "NAME"
|
|
Chris PeBenito |
473ea7 |
getfilecon, fgetfilecon, lgetfilecon \- get SE Linux security context of a file
|
|
Chris PeBenito |
473ea7 |
.SH "SYNOPSIS"
|
|
Chris PeBenito |
473ea7 |
.B #include <selinux/selinux.h>
|
|
Chris PeBenito |
473ea7 |
.sp
|
|
Chris PeBenito |
473ea7 |
.BI "int getfilecon(const char *" path ", security_context_t *" con );
|
|
Chris PeBenito |
473ea7 |
.br
|
|
Chris PeBenito |
473ea7 |
.BI "int lgetfilecon(const char *" path ", security_context_t *" con );
|
|
Chris PeBenito |
473ea7 |
.br
|
|
Chris PeBenito |
473ea7 |
.BI "int fgetfilecon(int "fd ", security_context_t *" con );
|
|
Chris PeBenito |
473ea7 |
.SH "DESCRIPTION"
|
|
Chris PeBenito |
473ea7 |
.B getfilecon
|
|
Chris PeBenito |
473ea7 |
retrieves the context associated with the given path in the file system, the
|
|
Chris PeBenito |
473ea7 |
length of the context is returned.
|
|
Chris PeBenito |
473ea7 |
|
|
Chris PeBenito |
473ea7 |
.B lgetfilecon
|
|
Chris PeBenito |
473ea7 |
is identical to getfilecon, except in the case of a symbolic link, where the
|
|
Chris PeBenito |
473ea7 |
link itself is interrogated, not the file that it refers to.
|
|
Chris PeBenito |
473ea7 |
|
|
Chris PeBenito |
473ea7 |
.B fgetfilecon
|
|
Chris PeBenito |
473ea7 |
is identical to getfilecon, only the open file pointed to by filedes (as
|
|
Chris PeBenito |
473ea7 |
returned by open(2)) is interrogated in place of path.
|
|
Chris PeBenito |
473ea7 |
|
|
Chris PeBenito |
473ea7 |
.br
|
|
Chris PeBenito |
473ea7 |
|
|
Chris PeBenito |
473ea7 |
The returned context should be freed with freecon if non-NULL.
|
|
Chris PeBenito |
473ea7 |
.SH "RETURN VALUE"
|
|
Chris PeBenito |
473ea7 |
On success, a positive number is returned indicating the size of the
|
|
Chris PeBenito |
473ea7 |
extended attribute value. On failure, \-1 is returned and errno is set
|
|
Chris PeBenito |
473ea7 |
appropriately.
|
|
Chris PeBenito |
473ea7 |
|
|
Chris PeBenito |
473ea7 |
If the context does not exist, or the process has no access to
|
|
Chris PeBenito |
473ea7 |
this attribute, errno is set to ENODATA.
|
|
Chris PeBenito |
473ea7 |
|
|
Chris PeBenito |
473ea7 |
If extended attributes are not supported by the filesystem, or are dis\-
|
|
Chris PeBenito |
473ea7 |
abled, errno is set to ENOTSUP.
|
|
Chris PeBenito |
473ea7 |
|
|
Chris PeBenito |
473ea7 |
The errors documented for the stat(2) system call are also applicable
|
|
Chris PeBenito |
473ea7 |
here.
|
|
Chris PeBenito |
473ea7 |
|
|
Chris PeBenito |
473ea7 |
.SH "SEE ALSO"
|
|
Chris PeBenito |
473ea7 |
.BR freecon "(3), " setfilecon "(3), " setfscreatecon "(3)"
|