HP 3000 Manuals

umask [ MPE/iX Developer's Kit Reference Manual Volume I ] MPE/iX 5.0 Documentation


MPE/iX Developer's Kit Reference Manual Volume I

umask 

Sets a process's file mode creation mask.

Syntax 

     #include <sys/types.h>
     #include <sys/stat.h>
     mode_t umask (mode_t cmask);

Parameters 

cmask      A bit map specifying a creation mask.  Bits that are not
           access permission bits must be set to zero or an error occurs.

Return Values 

0             Success.  This is the first time umask() has been invoked
              by the calling process.  There is no previous valid file
              creation mask.

-1            An error occurred, and errno is set to indicate the error
              condition.

Any other     Success.  The previous file creation mask of the calling
value         process.

Description 

The umask() function sets the calling process's file mode creation mask
to the mask specified in the object of type mode_t passed in cmask and
returns the previous value of the mask.

Only the file permission bits (defined in <sys/stat.h>) of cmask are
used.  Bits of cmask that are not file permission bits must contain zeros
or an error occurs.

The process's file mode creation mask is used during open(), create(),
and mkdir() calls to turn off permission bits in the mode parameter
supplied.  Bit positions that are set in cmask are cleared in the mode of
the created file.

Implementation Considerations 

Refer to the EIMPL error description below.

The first time umask() is invoked by a process, zero is returned to
indicate that the previous file creation mask was not initialized.

Errors 

If an error occurs, errno is set to the following value:

EIMPL             CAUSE           Bits of cmask that are not file permission bits do
                                  not contain zeros.
                  ACTION          Make sure that bits that are not file permission bits
                                  contain zeros.

See Also 

chmod(), creat(), mkdir(), open(), <sys/stat.h>, POSIX.1 (Section 5.3.3)



MPE/iX 5.0 Documentation