Commit | Line | Data |
---|---|---|
3edffd06 KB |
1 | .\" Copyright (c) 1989 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 the above copyright notice and this paragraph are | |
6 | .\" duplicated in all such forms and that any documentation, | |
7 | .\" advertising materials, and other materials related to such | |
8 | .\" distribution and use acknowledge that the software was developed | |
9 | .\" by the University of California, Berkeley. The name of the | |
10 | .\" University may not be used to endorse or promote products derived | |
11 | .\" from this software without specific prior written permission. | |
12 | .\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR | |
13 | .\" IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED | |
14 | .\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | |
15 | .\" | |
a80ac655 | 16 | .\" @(#)setmode.3 5.2 (Berkeley) %G% |
3edffd06 KB |
17 | .\" |
18 | .TH SETMODE 3 "" | |
19 | .UC 7 | |
20 | .SH NAME | |
21 | getmode, setmode \- modify mode bits | |
22 | .SH SYNOPSIS | |
23 | .nf | |
24 | .ft B | |
a80ac655 KB |
25 | getmode(set, mode) |
26 | mode_t *set, mode; | |
3edffd06 | 27 | |
a80ac655 KB |
28 | set = setmode(mode_str) |
29 | mode_t *set; | |
3edffd06 KB |
30 | char *mode_str; |
31 | .ft R | |
32 | .fi | |
33 | .SH DESCRIPTION | |
34 | .I Getmode | |
a80ac655 | 35 | returns a copy of the file permission bits |
3edffd06 | 36 | .I mode |
a80ac655 KB |
37 | as altered by the values pointed to by |
38 | .IR set . | |
3edffd06 KB |
39 | While only the mode bits are altered, other parts of the file mode |
40 | may be examined. | |
41 | .PP | |
42 | .I Setmode | |
43 | takes an absolute (octal) or symbolic value, as described in | |
44 | .IR chmod (1), | |
a80ac655 KB |
45 | as an argument |
46 | and returns a pointer to mode values to be supplied to | |
47 | .IR getmode . | |
3edffd06 KB |
48 | Because some of the symbolic values are relative to the file |
49 | creation mask, | |
50 | .I setmode | |
51 | may call | |
52 | .IR umask (2). | |
53 | If this occurs, the file creation mask will be restored before | |
54 | .I setmode | |
55 | returns. | |
56 | If the calling program changes the value of its file creation mask | |
57 | after calling | |
58 | .IR setmode , | |
59 | .I setmode | |
60 | must be called again if | |
61 | .I getmode | |
62 | is to modify future file modes correctly. | |
63 | .PP | |
64 | If the mode passed to | |
65 | .I setmode | |
a80ac655 | 66 | is invalid, |
3edffd06 | 67 | .I setmode |
a80ac655 | 68 | returns NULL. |
3edffd06 | 69 | .SH ERRORS |
a80ac655 KB |
70 | .I Setmode |
71 | may fail and set errno for any of the errors specified for the library | |
72 | routine | |
73 | .IR malloc (3). | |
3edffd06 | 74 | .SH SEE ALSO |
a80ac655 | 75 | chmod(1), stat(2), umask(2), malloc(3) |