xref: /csrg-svn/lib/libc/gen/setmode.3 (revision 69050)
162867Sbostic.\" Copyright (c) 1989, 1991, 1993
262867Sbostic.\"	The Regents of the University of California.  All rights reserved.
339979Sbostic.\"
443571Strent.\" %sccs.include.redist.man%
539979Sbostic.\"
6*69050Sbostic.\"     @(#)setmode.3	8.2 (Berkeley) 04/28/95
739979Sbostic.\"
848352Scael.Dd
948352Scael.Dt SETMODE 3
1048352Scael.Os
1148352Scael.Sh NAME
1248352Scael.Nm getmode ,
1348352Scael.Nm setmode
1448352Scael.Nd modify mode bits
1548352Scael.Sh SYNOPSIS
1648352Scael.Ft mode_t
1748352Scael.Fn getmode "const void *set" "mode_t mode"
18*69050Sbostic.Ft void *
1948352Scael.Fn setmode "const char *mode_str"
2048352Scael.Sh DESCRIPTION
2148352ScaelThe
2248352Scael.Fn getmode
2348352Scaelfunction
2440942Sbosticreturns a copy of the file permission bits
2548352Scael.Fa mode
2640942Sbosticas altered by the values pointed to by
2748352Scael.Fa set .
2839979SbosticWhile only the mode bits are altered, other parts of the file mode
2939979Sbosticmay be examined.
3048352Scael.Pp
3148352ScaelThe
3248352Scael.Fn setmode
3348352Scaelfunction
3439979Sbostictakes an absolute (octal) or symbolic value, as described in
3548352Scael.Xr chmod 1 ,
3640942Sbosticas an argument
3740942Sbosticand returns a pointer to mode values to be supplied to
3848352Scael.Fn getmode .
3939979SbosticBecause some of the symbolic values are relative to the file
4039979Sbosticcreation mask,
4148352Scael.Fn setmode
4239979Sbosticmay call
4348352Scael.Xr umask 2 .
4439979SbosticIf this occurs, the file creation mask will be restored before
4548352Scael.Fn setmode
4639979Sbosticreturns.
4739979SbosticIf the calling program changes the value of its file creation mask
4839979Sbosticafter calling
4948352Scael.Fn setmode ,
5048352Scael.Fn setmode
5139979Sbosticmust be called again if
5248352Scael.Fn getmode
5339979Sbosticis to modify future file modes correctly.
5448352Scael.Pp
5539979SbosticIf the mode passed to
5648352Scael.Fn setmode
5740942Sbosticis invalid,
5848352Scael.Fn setmode
5948352Scaelreturns
6048352Scael.Dv NULL .
6148352Scael.Sh ERRORS
6248352ScaelThe
6348352Scael.Fn setmode
6448352Scaelfunction
6540942Sbosticmay fail and set errno for any of the errors specified for the library
6640942Sbosticroutine
6748352Scael.Xr malloc 3 .
6848352Scael.Sh SEE ALSO
6948352Scael.Xr chmod 1 ,
7048352Scael.Xr stat 2 ,
7148352Scael.Xr umask 2 ,
7248352Scael.Xr malloc 3
7348352Scael.Sh HISTORY
7448352ScaelThe
7548352Scael.Fn getmode
7648352Scaeland
7748352Scael.Fn setmode
7862866Sbosticfunctions first appeared in 4.4BSD.
79