SETMODE(3) BSD Programmer's Manual SETMODE(3)
g
\bge
\bet
\btm
\bmo
\bod
\bde
\be, s
\bse
\bet
\btm
\bmo
\bod
\bde
\be - modify mode bits
S
\bSY
\bYN
\bNO
\bOP
\bPS
\bSI
\bIS
\bS
g
\bge
\bet
\btm
\bmo
\bod
\bde
\be(_
\bc_
\bo_
\bn_
\bs_
\bt _
\bv_
\bo_
\bi_
\bd _
\b*_
\bs_
\be_
\bt, _
\bm_
\bo_
\bd_
\be_
\b__
\bt _
\bm_
\bo_
\bd_
\be);
s
\bse
\bet
\btm
\bmo
\bod
\bde
\be(_
\bc_
\bo_
\bn_
\bs_
\bt _
\bc_
\bh_
\ba_
\br _
\b*_
\bm_
\bo_
\bd_
\be_
\b__
\bs_
\bt_
\br);
D
\bDE
\bES
\bSC
\bCR
\bRI
\bIP
\bPT
\bTI
\bIO
\bON
\bN
The g
\bge
\bet
\btm
\bmo
\bod
\bde
\be() function returns a copy of the file permission bits _
\bm_
\bo_
\bd_
\be as
altered by the values pointed to by _
\bs_
\be_
\bt. While only the mode bits are al-
tered, other parts of the file mode may be examined.
The s
\bse
\bet
\btm
\bmo
\bod
\bde
\be() function takes an absolute (octal) or symbolic value, as
described in chmod(1), as an argument and returns a pointer to mode val-
ues to be supplied to g
\bge
\bet
\btm
\bmo
\bod
\bde
\be(). Because some of the symbolic values are
relative to the file creation mask, s
\bse
\bet
\btm
\bmo
\bod
\bde
\be() may call umask(2). If this
occurs, the file creation mask will be restored before s
\bse
\bet
\btm
\bmo
\bod
\bde
\be() returns.
If the calling program changes the value of its file creation mask after
calling s
\bse
\bet
\btm
\bmo
\bod
\bde
\be(), s
\bse
\bet
\btm
\bmo
\bod
\bde
\be() must be called again if g
\bge
\bet
\btm
\bmo
\bod
\bde
\be() is to mod-
ify future file modes correctly.
If the mode passed to s
\bse
\bet
\btm
\bmo
\bod
\bde
\be() is invalid, s
\bse
\bet
\btm
\bmo
\bod
\bde
\be() returns NULL.
The s
\bse
\bet
\btm
\bmo
\bod
\bde
\be() function may fail and set errno for any of the errors spec-
ified for the library routine malloc(3).
S
\bSE
\bEE
\bE A
\bAL
\bLS
\bSO
\bO
chmod(1), stat(2), umask(2), malloc(3)
H
\bHI
\bIS
\bST
\bTO
\bOR
\bRY
\bY
The g
\bge
\bet
\btm
\bmo
\bod
\bde
\be() and s
\bse
\bet
\btm
\bmo
\bod
\bde
\be() functions first appeared in 4.4BSD.