NAME
ggeettmmooddee, sseettmmooddee - modify mode bits
LLIIBBRRAARRYYStandard C Library (libc, -lc)
SYNOPSIS
##iinncclluuddee <
modet ggeettmmooddee(const void *set, modet mode); void * sseettmmooddee(const char *modestr);> DESCRIPTION
The ggeettmmooddee() function returns a copy of the file permission bits mode as altered by the values pointed to by set. While only the mode bits are altered, other parts of the file mode may be examined. The sseettmmooddee() function takes an absolute (octal) or symbolic value, asdescribed in chmod(1), as an argument and returns a pointer to mode val-
ues to be supplied to ggeettmmooddee(). Because some of the symbolic values are relative to the file creation mask, sseettmmooddee() may call umask(2). If this occurs, the file creation mask will be restored before sseettmmooddee() returns. If the calling program changes the value of its file creation mask aftercalling sseettmmooddee(), sseettmmooddee() must be called again if ggeettmmooddee() is to mod-
ify future file modes correctly.If the mode passed to sseettmmooddee() is invalid or if memory cannot be allo-
cated for the return value, sseettmmooddee() returns NULL. The value returned from sseettmmooddee() is obtained from mmaalllloocc() and should bereturned to the system with ffrreeee() when the program is done with it, gen-
erally after a call to ggeettmmooddee(). EERRRROORRSSThe sseettmmooddee() function may fail and set errno for any of the errors spec-
ified for the library routine malloc(3).SEE ALSO
chmod(1), stat(2), umask(2), malloc(3) HISTORY The ggeettmmooddee() and sseettmmooddee() functions first appeared in 4.4BSD. BSD April 28, 1995 BSD