new copyright notice
[unix-history] / usr / src / lib / libc / gen / setmode.3
CommitLineData
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
11getmode, setmode \- modify mode bits
12.SH SYNOPSIS
13.nf
14.ft B
a80ac655
KB
15getmode(set, mode)
16mode_t *set, mode;
3edffd06 17
a80ac655
KB
18set = setmode(mode_str)
19mode_t *set;
3edffd06
KB
20char *mode_str;
21.ft R
22.fi
23.SH DESCRIPTION
24.I Getmode
a80ac655 25returns a copy of the file permission bits
3edffd06 26.I mode
a80ac655
KB
27as altered by the values pointed to by
28.IR set .
3edffd06
KB
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),
a80ac655
KB
35as an argument
36and returns a pointer to mode values to be supplied to
37.IR getmode .
3edffd06
KB
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
a80ac655 56is invalid,
3edffd06 57.I setmode
a80ac655 58returns NULL.
3edffd06 59.SH ERRORS
a80ac655
KB
60.I Setmode
61may fail and set errno for any of the errors specified for the library
62routine
63.IR malloc (3).
3edffd06 64.SH SEE ALSO
a80ac655 65chmod(1), stat(2), umask(2), malloc(3)