SETMODE(3) BSD Programmer's Manual SETMODE(3) NNAAMMEE ggeettmmooddee, sseettmmooddee - modify mode bits SSYYNNOOPPSSIISS _m_o_d_e___t ggeettmmooddee(_c_o_n_s_t _v_o_i_d _*_s_e_t, _m_o_d_e___t _m_o_d_e); _v_o_i_d sseettmmooddee(_c_o_n_s_t _c_h_a_r _*_m_o_d_e___s_t_r); DDEESSCCRRIIPPTTIIOONN The ggeettmmooddee() function returns a copy of the file permission bits _m_o_d_e as altered by the values pointed to by _s_e_t. While only the mode bits are al- tered, other parts of the file mode may be examined. The sseettmmooddee() 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 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 after calling sseettmmooddee(), sseettmmooddee() must be called again if ggeettmmooddee() is to mod- ify future file modes correctly. If the mode passed to sseettmmooddee() is invalid, sseettmmooddee() returns NULL. EERRRROORRSS The sseettmmooddee() function may fail and set errno for any of the errors spec- ified for the library routine malloc(3). SSEEEE AALLSSOO chmod(1), stat(2), umask(2), malloc(3) HHIISSTTOORRYY The ggeettmmooddee() and sseettmmooddee() functions first appeared in 4.4BSD. 4.4BSD June 9, 1993 1