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