[UP]


Manual Reference Pages  - system_setumask (3)

NAME

system_setumask(3f) - [M_system:FILE_SYSTEM] set the file mode creation umask (LICENSE:PD)

CONTENTS

Synopsis
Description
Return Value
Errors
Example

SYNOPSIS

integer function system_setumask(new_umask) result (old_umask)

    integer,intent(in)  :: new_umask
    integer(kind=c_int) :: umask_c

DESCRIPTION

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.

RETURN VALUE

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.

ERRORS

No errors are defined.

EXAMPLE

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_setumask

Expected output

    18 O’022’ Z"12’ B’000010010"

    NEW

63 O’077’ Z"3F’ B’000111111"


system_setumask (3) March 11, 2021
Generated by manServer 1.08 from ca7fb1bf-c3be-44d0-af45-1a1aca926bd5 using man macros.