[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]

Technical Reference: Base Operating System and Extensions, Volume 2

umask Subroutine

Purpose

Sets and gets the value of the file creation mask.

Library

Standard C Library (libc.a)

Syntax

#include <sys/stat.h>


mode_t umask ( CreationMask)
mode_t CreationMask;

Description

The umask subroutine sets the file-mode creation mask of the process to the value of the CreationMask parameter and returns the previous value of the mask.

Whenever a file is created (by the open, mkdir, or mknod subroutine), all file permission bits set in the file mode creation mask are cleared in the mode of the created file. This clearing allows users to restrict the default access to their files.

The mask is inherited by child processes.

Parameters

CreationMask Specifies the value of the file mode creation mask. The CreationMask parameter is constructed by logically ORing file permission bits defined in the sys/mode.h file. Nine bits of the CreationMask parameter are significant.

Return Values

If successful, the file permission bits returned by the umask subroutine are the previous value of the file-mode creation mask. The CreationMask parameter can be set to this value in subsequent calls to the umask subroutine, returning the mask to its initial state.

Related Information

The chmod subroutine, mkdir subroutine, mkfifo subroutine, mknod subroutine, openx, open, or creat subroutine, stat (statx, stat, lstat, fstatx, fstat, fullstat, ffullstat, stat64, lstat64, or fstat64 Subroutine) subroutine.

The sh command, ksh command.

The sys/mode.h file.

Shells Overview in AIX 5L Version 5.2 System User's Guide: Operating System and Devices.

Files, Directories, and File Systems for Programmers in AIX 5L Version 5.2 General Programming Concepts: Writing and Debugging Programs.

[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]