Commit | Line | Data |
---|---|---|
e21b505d KB |
1 | .\" Copyright (c) 1989, 1991, 1993 |
2 | .\" The Regents of the University of California. All rights reserved. | |
3edffd06 | 3 | .\" |
91cff1e1 | 4 | .\" %sccs.include.redist.man% |
3edffd06 | 5 | .\" |
94ac01c9 | 6 | .\" @(#)setmode.3 8.2 (Berkeley) %G% |
3edffd06 | 7 | .\" |
ae59e04c CL |
8 | .Dd |
9 | .Dt SETMODE 3 | |
10 | .Os | |
11 | .Sh NAME | |
12 | .Nm getmode , | |
13 | .Nm setmode | |
14 | .Nd modify mode bits | |
15 | .Sh SYNOPSIS | |
16 | .Ft mode_t | |
17 | .Fn getmode "const void *set" "mode_t mode" | |
94ac01c9 | 18 | .Ft void * |
ae59e04c CL |
19 | .Fn setmode "const char *mode_str" |
20 | .Sh DESCRIPTION | |
21 | The | |
22 | .Fn getmode | |
23 | function | |
a80ac655 | 24 | returns a copy of the file permission bits |
ae59e04c | 25 | .Fa mode |
a80ac655 | 26 | as altered by the values pointed to by |
ae59e04c | 27 | .Fa set . |
3edffd06 KB |
28 | While only the mode bits are altered, other parts of the file mode |
29 | may be examined. | |
ae59e04c CL |
30 | .Pp |
31 | The | |
32 | .Fn setmode | |
33 | function | |
3edffd06 | 34 | takes an absolute (octal) or symbolic value, as described in |
ae59e04c | 35 | .Xr chmod 1 , |
a80ac655 KB |
36 | as an argument |
37 | and returns a pointer to mode values to be supplied to | |
ae59e04c | 38 | .Fn getmode . |
3edffd06 KB |
39 | Because some of the symbolic values are relative to the file |
40 | creation mask, | |
ae59e04c | 41 | .Fn setmode |
3edffd06 | 42 | may call |
ae59e04c | 43 | .Xr umask 2 . |
3edffd06 | 44 | If this occurs, the file creation mask will be restored before |
ae59e04c | 45 | .Fn setmode |
3edffd06 KB |
46 | returns. |
47 | If the calling program changes the value of its file creation mask | |
48 | after calling | |
ae59e04c CL |
49 | .Fn setmode , |
50 | .Fn setmode | |
3edffd06 | 51 | must be called again if |
ae59e04c | 52 | .Fn getmode |
3edffd06 | 53 | is to modify future file modes correctly. |
ae59e04c | 54 | .Pp |
3edffd06 | 55 | If the mode passed to |
ae59e04c | 56 | .Fn setmode |
a80ac655 | 57 | is invalid, |
ae59e04c CL |
58 | .Fn setmode |
59 | returns | |
60 | .Dv NULL . | |
61 | .Sh ERRORS | |
62 | The | |
63 | .Fn setmode | |
64 | function | |
a80ac655 KB |
65 | may fail and set errno for any of the errors specified for the library |
66 | routine | |
ae59e04c CL |
67 | .Xr malloc 3 . |
68 | .Sh SEE ALSO | |
69 | .Xr chmod 1 , | |
70 | .Xr stat 2 , | |
71 | .Xr umask 2 , | |
72 | .Xr malloc 3 | |
73 | .Sh HISTORY | |
74 | The | |
75 | .Fn getmode | |
76 | and | |
77 | .Fn setmode | |
3e882c4f | 78 | functions first appeared in 4.4BSD. |