add getvfsbyname
[unix-history] / usr / src / lib / libc / gen / setmode.3
CommitLineData
e21b505d
KB
1.\" Copyright (c) 1989, 1991, 1993
2.\" The Regents of the University of California. All rights reserved.
3edffd06 3.\"
91cff1e1 4.\" %sccs.include.redist.man%
3edffd06 5.\"
94ac01c9 6.\" @(#)setmode.3 8.2 (Berkeley) %G%
3edffd06 7.\"
ae59e04c
CL
8.Dd
9.Dt SETMODE 3
10.Os
11.Sh NAME
12.Nm getmode ,
13.Nm setmode
14.Nd modify mode bits
15.Sh SYNOPSIS
16.Ft mode_t
17.Fn getmode "const void *set" "mode_t mode"
94ac01c9 18.Ft void *
ae59e04c
CL
19.Fn setmode "const char *mode_str"
20.Sh DESCRIPTION
21The
22.Fn getmode
23function
a80ac655 24returns a copy of the file permission bits
ae59e04c 25.Fa mode
a80ac655 26as altered by the values pointed to by
ae59e04c 27.Fa set .
3edffd06
KB
28While only the mode bits are altered, other parts of the file mode
29may be examined.
ae59e04c
CL
30.Pp
31The
32.Fn setmode
33function
3edffd06 34takes an absolute (octal) or symbolic value, as described in
ae59e04c 35.Xr chmod 1 ,
a80ac655
KB
36as an argument
37and returns a pointer to mode values to be supplied to
ae59e04c 38.Fn getmode .
3edffd06
KB
39Because some of the symbolic values are relative to the file
40creation mask,
ae59e04c 41.Fn setmode
3edffd06 42may call
ae59e04c 43.Xr umask 2 .
3edffd06 44If this occurs, the file creation mask will be restored before
ae59e04c 45.Fn setmode
3edffd06
KB
46returns.
47If the calling program changes the value of its file creation mask
48after calling
ae59e04c
CL
49.Fn setmode ,
50.Fn setmode
3edffd06 51must be called again if
ae59e04c 52.Fn getmode
3edffd06 53is to modify future file modes correctly.
ae59e04c 54.Pp
3edffd06 55If the mode passed to
ae59e04c 56.Fn setmode
a80ac655 57is invalid,
ae59e04c
CL
58.Fn setmode
59returns
60.Dv NULL .
61.Sh ERRORS
62The
63.Fn setmode
64function
a80ac655
KB
65may fail and set errno for any of the errors specified for the library
66routine
ae59e04c
CL
67.Xr malloc 3 .
68.Sh SEE ALSO
69.Xr chmod 1 ,
70.Xr stat 2 ,
71.Xr umask 2 ,
72.Xr malloc 3
73.Sh HISTORY
74The
75.Fn getmode
76and
77.Fn setmode
3e882c4f 78functions first appeared in 4.4BSD.