Commit | Line | Data |
---|---|---|
3edffd06 KB |
1 | .\" Copyright (c) 1989 The Regents of the University of California. |
2 | .\" All rights reserved. | |
3 | .\" | |
91cff1e1 | 4 | .\" %sccs.include.redist.man% |
3edffd06 | 5 | .\" |
91cff1e1 | 6 | .\" @(#)setmode.3 5.3 (Berkeley) %G% |
3edffd06 KB |
7 | .\" |
8 | .TH SETMODE 3 "" | |
9 | .UC 7 | |
10 | .SH NAME | |
11 | getmode, setmode \- modify mode bits | |
12 | .SH SYNOPSIS | |
13 | .nf | |
14 | .ft B | |
a80ac655 KB |
15 | getmode(set, mode) |
16 | mode_t *set, mode; | |
3edffd06 | 17 | |
a80ac655 KB |
18 | set = setmode(mode_str) |
19 | mode_t *set; | |
3edffd06 KB |
20 | char *mode_str; |
21 | .ft R | |
22 | .fi | |
23 | .SH DESCRIPTION | |
24 | .I Getmode | |
a80ac655 | 25 | returns a copy of the file permission bits |
3edffd06 | 26 | .I mode |
a80ac655 KB |
27 | as altered by the values pointed to by |
28 | .IR set . | |
3edffd06 KB |
29 | While only the mode bits are altered, other parts of the file mode |
30 | may be examined. | |
31 | .PP | |
32 | .I Setmode | |
33 | takes an absolute (octal) or symbolic value, as described in | |
34 | .IR chmod (1), | |
a80ac655 KB |
35 | as an argument |
36 | and returns a pointer to mode values to be supplied to | |
37 | .IR getmode . | |
3edffd06 KB |
38 | Because some of the symbolic values are relative to the file |
39 | creation mask, | |
40 | .I setmode | |
41 | may call | |
42 | .IR umask (2). | |
43 | If this occurs, the file creation mask will be restored before | |
44 | .I setmode | |
45 | returns. | |
46 | If the calling program changes the value of its file creation mask | |
47 | after calling | |
48 | .IR setmode , | |
49 | .I setmode | |
50 | must be called again if | |
51 | .I getmode | |
52 | is to modify future file modes correctly. | |
53 | .PP | |
54 | If the mode passed to | |
55 | .I setmode | |
a80ac655 | 56 | is invalid, |
3edffd06 | 57 | .I setmode |
a80ac655 | 58 | returns NULL. |
3edffd06 | 59 | .SH ERRORS |
a80ac655 KB |
60 | .I Setmode |
61 | may fail and set errno for any of the errors specified for the library | |
62 | routine | |
63 | .IR malloc (3). | |
3edffd06 | 64 | .SH SEE ALSO |
a80ac655 | 65 | chmod(1), stat(2), umask(2), malloc(3) |