| 1 | .\" Copyright (c) 1989 The Regents of the University of California. |
| 2 | .\" All rights reserved. |
| 3 | .\" |
| 4 | .\" %sccs.include.redist.man% |
| 5 | .\" |
| 6 | .\" @(#)setmode.3 5.3 (Berkeley) %G% |
| 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 |
| 15 | getmode(set, mode) |
| 16 | mode_t *set, mode; |
| 17 | |
| 18 | set = setmode(mode_str) |
| 19 | mode_t *set; |
| 20 | char *mode_str; |
| 21 | .ft R |
| 22 | .fi |
| 23 | .SH DESCRIPTION |
| 24 | .I Getmode |
| 25 | returns a copy of the file permission bits |
| 26 | .I mode |
| 27 | as altered by the values pointed to by |
| 28 | .IR set . |
| 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), |
| 35 | as an argument |
| 36 | and returns a pointer to mode values to be supplied to |
| 37 | .IR getmode . |
| 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 |
| 56 | is invalid, |
| 57 | .I setmode |
| 58 | returns NULL. |
| 59 | .SH ERRORS |
| 60 | .I Setmode |
| 61 | may fail and set errno for any of the errors specified for the library |
| 62 | routine |
| 63 | .IR malloc (3). |
| 64 | .SH SEE ALSO |
| 65 | chmod(1), stat(2), umask(2), malloc(3) |