new copyright notice
[unix-history] / usr / src / lib / libc / gen / setmode.3
... / ...
CommitLineData
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
11getmode, setmode \- modify mode bits
12.SH SYNOPSIS
13.nf
14.ft B
15getmode(set, mode)
16mode_t *set, mode;
17
18set = setmode(mode_str)
19mode_t *set;
20char *mode_str;
21.ft R
22.fi
23.SH DESCRIPTION
24.I Getmode
25returns a copy of the file permission bits
26.I mode
27as altered by the values pointed to by
28.IR set .
29While only the mode bits are altered, other parts of the file mode
30may be examined.
31.PP
32.I Setmode
33takes an absolute (octal) or symbolic value, as described in
34.IR chmod (1),
35as an argument
36and returns a pointer to mode values to be supplied to
37.IR getmode .
38Because some of the symbolic values are relative to the file
39creation mask,
40.I setmode
41may call
42.IR umask (2).
43If this occurs, the file creation mask will be restored before
44.I setmode
45returns.
46If the calling program changes the value of its file creation mask
47after calling
48.IR setmode ,
49.I setmode
50must be called again if
51.I getmode
52is to modify future file modes correctly.
53.PP
54If the mode passed to
55.I setmode
56is invalid,
57.I setmode
58returns NULL.
59.SH ERRORS
60.I Setmode
61may fail and set errno for any of the errors specified for the library
62routine
63.IR malloc (3).
64.SH SEE ALSO
65chmod(1), stat(2), umask(2), malloc(3)