Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Watcom C/C++ v10.0 : C library - <b>synopsis:</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Synopsis:
    #include <sys\types.h>
    #include <sys\stat.h>
    #include <fcntl.h>
    #include <io.h>
    int umask( int cmask );

Description:
    The umask function sets the process's file mode creation mask to cmask.
     The process's file mode creation mask is used during  creat,  open or
     sopen to turn off permission bits in the permission argument supplied.
     In other words, if a bit in the mask is on, then the corresponding bit
    in the file's requested permission value is disallowed.

    The argument cmask is a constant expression involving the constants
    described below.  The access permissions for the file or directory are
    specified as a combination of bits (defined in the <sys\stat.h> header
    file).

    The following bits define permissions for the owner.

    S_IRWXU
        Read, write, execute/search

    S_IRUSR
        Read permission

    S_IWUSR
        Write permission

    S_IXUSR
        Execute/search permission

    The following bits define permissions for the group.

    S_IRWXG
        Read, write, execute/search

    S_IRGRP
        Read permission

    S_IWGRP
        Write permission

    S_IXGRP
        Execute/search permission

    The following bits define permissions for others.

    S_IRWXO
        Read, write, execute/search

    S_IROTH
        Read permission

    S_IWOTH
        Write permission

    S_IXOTH
        Execute/search permission

    The following bits define miscellaneous permissions used by other
    implementations.

    S_IREAD
        is equivalent to S_IRUSR (read permission)

    S_IWRITE
        is equivalent to S_IWUSR (write permission)

    S_IEXEC
        is equivalent to S_IXUSR (execute/search permission)

    For example, if  S_IRUSR is specified, then reading is not allowed
    (i.e., the file is write only).  If  S_IWUSR is specified, then writing
    is not allowed (i.e., the file is read only).

Returns:
    The umask function returns the previous value of cmask.

See Also:
    chmod, creat, mkdir, open, sopen

Example:
    #include <sys\types.h>
    #include <sys\stat.h>
    #include <fcntl.h>
    #include <io.h>

    void main()
      {
        int old_mask;

        /* set mask to create read-only files */
        old_mask = umask( S_IWUSR | S_IWGRP | S_IWOTH |
                          S_IXUSR | S_IXGRP | S_IXOTH );
      }

Classification:
    POSIX 1003.1

Systems:
    All

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson