system_setumask(3f) - [M_system:FILE_SYSTEM] set the file mode creation umask (LICENSE:PD)
Synopsis
Description
Return Value
Errors
Examples
integer function system_setumask(new_umask) result (old_umask)
integer,intent(in) :: new_umask integer(kind=c_int) :: umask_c
The system_umask(3f) function sets the file mode creation mask of the process to cmask and return the previous value of the mask. Only the file permission bits of cmask (see <sys/stat.h>) are used; the meaning of the other bits is implementation-defined.The file mode creation mask of the process is used to turn off permission bits in the mode argument supplied during calls to the following functions:
o open(), openat(), creat(), mkdir(), mkdirat(), mkfifo(), and mkfifoat() o mknod(), mknodat() o mq_open() o sem_open() Bit positions that are set in cmask are cleared in the mode of the created file.
The file permission bits in the value returned by umask() shall be the previous value of the file mode creation mask. The state of any other bits in that value is unspecified, except that a subsequent call to umask() with the returned value as cmask shall leave the state of the mask the same as its state before the first call, including any unspecified use of those bits.
No errors are defined.
Sample program
program demo_setumask use M_system, only : system_getumask, system_setumask integer :: newmask integer :: i integer :: old_umask write(*,101)(system_getumask(),i=1,4) 101 format(1x,i0,1x,"O",o4.4,"",1x,Z",z0,"",1x,"B",b12.12,"") newmask=63 old_umask=system_setumask(newmask) write(*,*)NEW write(*,101)(system_getumask(),i=1,4) end program demo_setumaskResults:
> 2 O0002 Z"2 B000000000010 > NEW > 63 O0077 Z"3F B000000111111
Nemo Release 3.1 | system_setumask (3m_system) | March 07, 2025 |