1SETMODE(3) Library Functions Manual SETMODE(3)
2
3
4
6 getmode, setmode - modify mode bits
7
9 #include <sys/types.h>
10
11 mode_t
12 getmode(set, mode)
13 void *set;
14 mode_t mode
15
16 void *
17 setmode(mode_str)
18 char *mode_str;
19
21 The getmode function returns a copy of the file permission bits mode as
22 altered by the values pointed to by set. While only the mode bits are
23 altered, other parts of the file mode may be examined.
24
25 The setmode function takes an absolute (octal) or symbolic value, as
26 described in chmod(1), as an argument and returns a pointer to mode
27 values to be supplied to getmode. Because some of the symbolic values
28 are relative to the file creation mask, setmode may call umask(2). If
29 this occurs, the file creation mask will be restored before setmode
30 returns. If the calling program changes the value of its file creation
31 mask after calling setmode, setmode must be called again if getmode is
32 to modify future file modes correctly.
33
34 If the mode passed to setmode is invalid, setmode returns NULL.
35
37 The setmode function may fail and set errno for any of the errors spec‐
38 ified for the library routine malloc(3).
39
41 chmod(1), stat(2), umask(2), malloc(3)
42
44 The getmode and setmode functions first appeared in 4.4BSD.
45
46
47
484.4 Berkeley Distribution February 20, 1996 SETMODE(3)