Library /sys$common/syshlp/helplib.hlb  —  CRTL  umask
    Creates a file protection mask that is used when a new file is
    created, and returns the previous mask value.

    Format

      #include  <stat.h>

      mode_t umask  (mode_t mode_complement);

1  –  Argument

 mode_complement

    Shows which bits to turn off when a new file is created. See the
    description of chmod to determine what the bits represent.

2  –  Description

    Initially, the file protection mask is set from the current
    process's default file protection. This is done when the C main
    program starts up or when DECC$CRTL_INIT (or VAXC$CRTL_INIT)
    is called. You can change this for all files created by your
    program by calling umask or you can use chmod to change the file
    protection on individual files. The file protection of a file
    created by open or creat is the bitwise AND of the open and creat
    mode argument with the complement of the value passed to umask on
    the previous call.

                                   NOTE

       The way to create files with OpenVMS RMS default protections
       using the UNIX system-call functions umask, mkdir, creat,
       and open is to call mkdir, creat, and open with a file-
       protection mode argument of 0777 in a program that never
       specifically calls umask. These default protections include
       correctly establishing protections based on ACLs, previous
       versions of files, and so on.

       In programs that do vfork/exec calls, the new process image
       inherits whether umask has ever been called or not from
       the calling process image. The umask setting and whether
       the umask function has ever been called are both inherited
       attributes.

3  –  Return Value

    x                  The old mask value.
Close Help