1getlabel(2)                      System Calls                      getlabel(2)
2
3
4

NAME

6       getlabel, fgetlabel - get file sensitivity label
7

SYNOPSIS

9       cc [flags...] file... -ltsol [library...]
10
11
12       #include <tsol/label.h>
13
14       int getlabel(const char *path, m_label_t *label_p);
15
16
17       int fgetlabel(int fd, m_label_t *label_p);
18
19

DESCRIPTION

21       The  getlabel() function obtains the sensitivity label of the file that
22       is named by path. Discretionary read, write or  execute  permission  to
23       the final component of path is not required, but all directories in the
24       path prefix of path must be searchable.
25
26
27       The fgetlabel() function obtains the label of  an  open  file  that  is
28       referred to by the argument descriptor, such as would be obtained by an
29       open(2) call.
30
31
32       The label_p argument is a pointer to an  opaque  label  structure.  The
33       caller must allocate space for label_p by using m_label_alloc(3TSOL).
34

RETURN VALUES

36       Upon successful completion, getlabel() and fgetlabel() return 0. Other‐
37       wise they return −1 and set errno to indicate the error.
38

ERRORS

40       The getlabel() function will fail if:
41
42       EACCES          Search permission is denied for a component of the path
43                       prefix of path. To override this restriction, the call‐
44                       ing process can assert the PRIV_FILE_DAC_SEARCH  privi‐
45                       lege.
46
47
48       EFAULT          label_p or path points to an invalid address.
49
50
51       EIO             An  I/O error occurred while reading from or writing to
52                       the file system.
53
54
55       ELOOP           Too many symbolic links were encountered in translating
56                       path.
57
58
59       ENAMETOOLONG    The  length of the path argument exceeds PATH_MAX, or a
60                       pathname  component  is  longer  than  NAME_MAX   while
61                       _POSIX_NO_TRUNC is in effect (see pathconf(2)).
62
63
64       ENOENT          The file referred to by path does not exist.
65
66
67       ENOTDIR         A  component of the path prefix of path is not a direc‐
68                       tory.
69
70
71
72       The fgetlabel() function will fail if:
73
74       EBADF     The fd argument is not a valid open file descriptor.
75
76
77       EFAULT    The label_p argument points to an invalid address.
78
79
80       EIO       An I/O error occurred while reading from or  writing  to  the
81                 file system.
82
83

ATTRIBUTES

85       See attributes(5) for descriptions of the following attributes:
86
87
88
89
90       ┌─────────────────────────────┬─────────────────────────────┐
91       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
92       ├─────────────────────────────┼─────────────────────────────┤
93       │Availability                 │SUNWcslr                     │
94       ├─────────────────────────────┼─────────────────────────────┤
95       │Interface Stability          │Committed                    │
96       └─────────────────────────────┴─────────────────────────────┘
97

SEE ALSO

99       open(2), pathconf(2), m_label_alloc(3TSOL), attributes(5), labels(5)
100
101
102       Obtaining a File Label in Solaris Trusted Extensions Developer's Guide
103

NOTES

105       The  functionality  described  on this manual page is available only if
106       the system is configured with Trusted Extensions.
107
108
109
110SunOS 5.11                        20 Jul 2007                      getlabel(2)
Impressum