1.\" Copyright (c) 1989, 1991, 1993 2.\" The Regents of the University of California. All rights reserved. 3.\" 4.\" %sccs.include.redist.man% 5.\" 6.\" @(#)setmode.3 8.2 (Berkeley) 04/28/95 7.\" 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" 18.Ft void * 19.Fn setmode "const char *mode_str" 20.Sh DESCRIPTION 21The 22.Fn getmode 23function 24returns a copy of the file permission bits 25.Fa mode 26as altered by the values pointed to by 27.Fa set . 28While only the mode bits are altered, other parts of the file mode 29may be examined. 30.Pp 31The 32.Fn setmode 33function 34takes an absolute (octal) or symbolic value, as described in 35.Xr chmod 1 , 36as an argument 37and returns a pointer to mode values to be supplied to 38.Fn getmode . 39Because some of the symbolic values are relative to the file 40creation mask, 41.Fn setmode 42may call 43.Xr umask 2 . 44If this occurs, the file creation mask will be restored before 45.Fn setmode 46returns. 47If the calling program changes the value of its file creation mask 48after calling 49.Fn setmode , 50.Fn setmode 51must be called again if 52.Fn getmode 53is to modify future file modes correctly. 54.Pp 55If the mode passed to 56.Fn setmode 57is invalid, 58.Fn setmode 59returns 60.Dv NULL . 61.Sh ERRORS 62The 63.Fn setmode 64function 65may fail and set errno for any of the errors specified for the library 66routine 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 78functions first appeared in 4.4BSD. 79