|
|
1.1 root 1: .\" Copyright (c) 1990 The Regents of the University of California.
2: .\" All rights reserved.
3: .\"
4: .\" Redistribution and use in source and binary forms are permitted
5: .\" provided that: (1) source distributions retain this entire copyright
6: .\" notice and comment, and (2) distributions including binaries display
7: .\" the following acknowledgement: ``This product includes software
8: .\" developed by the University of California, Berkeley and its contributors''
9: .\" in the documentation or other materials provided with the distribution
10: .\" and in all advertising materials mentioning features or use of this
11: .\" software. Neither the name of the University nor the names of its
12: .\" contributors may be used to endorse or promote products derived
13: .\" from this software without specific prior written permission.
14: .\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
15: .\" IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
16: .\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
17: .\"
18: .\" @(#)strmode.3 5.1 (Berkeley) 5/10/90
19: .\"
20: .TH STRMODE 3 "May 10, 1990"
21: .UC 7
22: .SH NAME
23: strmode \- convert inode status information into a symbolic string
24: .SH SYNOPSIS
25: .nf
26: .ft B
27: #include <string.h>
28:
29: void
30: strmode(mode_t mode, char *bp);
31: .ft R
32: .fi
33: .SH DESCRIPTION
34: .I Strmode
35: converts a file
36: .I mode
37: (the type and permission information associated with an inode, see
38: .IR stat (2))
39: into a symbolic string which is stored in the location referenced by
40: .IR bp .
41: This stored string is eleven characters in length plus a trailing NULL.
42: .PP
43: The first character is the inode type, and will be one of the following:
44: .TP
45: \-
46: regular file
47: .br
48: .ns
49: .TP
50: b
51: block special
52: .br
53: .ns
54: .TP
55: c
56: character special
57: .br
58: .ns
59: .TP
60: d
61: directory
62: .br
63: .ns
64: .TP
65: l
66: symbolic link
67: .br
68: .ns
69: .TP
70: p
71: fifo
72: .br
73: .ns
74: .TP
75: s
76: socket
77: .br
78: .ns
79: .TP
80: ?
81: unknown inode type
82: .PP
83: The next nine characters encode three sets of permissions, in three
84: characters each.
85: The first three characters are the permissions for the owner of the
86: file, the second three for the group the file belongs to, and the
87: third for the ``other'', or default, set of users.
88: .PP
89: Permission checking is done as specifically as possible.
90: If read permission is denied to the owner of a file in the first set
91: of permssions, the owner of the file will not be able to read the file.
92: This is true even if the owner is in the file's group and the group
93: permissions allow reading or the ``other'' permissions allow reading.
94: .PP
95: If the first character of the three character set is an ``r'', the file is
96: readable for that set of users; if a dash ``\-'', it is not readable.
97: .PP
98: If the second character of the three character set is a ``w'', the file is
99: writable for that set of users; if a dash ``\-'', it is not writable.
100: .PP
101: The third character is the first of the following characters that apply:
102: .TP
103: S
104: If the character is part of the owner permissions and the file is not
105: executable or the directory is not searchable, by the owner, and the
106: set-user-id bit is set.
107: .TP
108: S
109: If the character is part of the group permissions and the file is not
110: executable or the directory is not searchable, by the group, and the
111: set-group-id bit is set.
112: .TP
113: T
114: If the character is part of the other permissions and the file is not
115: executable or the directory is not searchable, by others, and the ``sticky''
116: (S_ISVTX) bit is set.
117: .TP
118: s
119: If the character is part of the owner permissions and the file is
120: executable or the directory searchable, by the owner, and the set-user-id
121: bit is set.
122: .TP
123: s
124: If the character is part of the group permissions and the file is
125: executable or the directory searchable, by the group, and the set-group-id
126: bit is set.
127: .TP
128: t
129: If the character is part of the other permissions and the file is
130: executable or the directory searchable, by others, and the ``sticky''
131: (S_ISVTX) bit is set.
132: .TP
133: x
134: The file is executable or the directory is searchable.
135: .TP
136: \-
137: None of the above apply.
138: .PP
139: The last character is a plus sign ``+'' if any there are any alternate
140: or additional access control methods associated with the inode, otherwise
141: it will be a space.
142: .SH RETURN VALUE
143: .I Strmode
144: always returns 0.
145: .SH SEE ALSO
146: chmod(1), find(1), stat(2), getmode(3), setmode(3)
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.