Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP-UX Reference > U

umask(2)

HP-UX 11i Version 3: February 2007
» 

Technical documentation

» Feedback
Content starts here

 » Table of Contents

 » Index

NAME

umask — set and get file creation mask

SYNOPSIS

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

DESCRIPTION

umask() sets the process's file mode creation mask to cmask and returns the previous value of the mask. Only the file access permission bits of the masks are used.

The bits set in cmask specify which permission bits to turn off in the mode of the created file, and should be specified using the symbolic values defined in stat(5).

EXAMPLES

The following creates a file named path in the current directory with permissions S_IRWXU|S_IRGRP|S_IXGRP, so that the file can be written only by its owner, and can be read or executed only by the owner or processes with group permission, even though group write permission and all permissions for others are passed in to creat().

#include <sys/types.h> #include <sys/stat.h> int fildes; (void) umask(S_IWGRP|S_IRWXO); fildes = creat("path", S_IRWXU|S_IRWXG|S_IRWXO);

RETURN VALUE

The previous value of the file mode creation mask is returned.

STANDARDS CONFORMANCE

umask(): AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 1983-2007 Hewlett-Packard Development Company, L.P.