set the file mode creation mask, umask, for a process
#include <sys/types.h> #include <sys/stat.h> mode_t qnx_umask( pid_t pid, mode_t cmask );
The qnx_umask() function sets the file mode creation mask of process pid to cmask, and returns the previous value of the mask. Only the file permission bits (as defined in sys/stat.h) are used. If pid is zero then the current process is used.
The process's file mode creation mask is used during open(), creat(), mkdir() and mkfifo() calls to turn off permission bits in the mode argument supplied. Bit positions set in cmask are cleared in the mode of the created file.
The qnx_umask() function returns the previous value of the file mode creation mask. On error, a (-1) is returned, and errno is set.
chmod(), creat(), errno, mkdir(), mkfifo(), open(), umask()
/* * Set the umask to RW for owner,group; R for other */ #include <stdio.h> #include <sys/types.h> #include <sys/stat.h> void main() { mode_t omask; mode_t nmask; nmask = S_IRUSR | S_IWUSR | /* owner read write */ S_IRGRP | S_IRGRP | /* group read write */ S_IROTH; /* other read */ omask = qnx_umask( 0, nmask ); printf( "mask changed from %o to %o\n", omask, nmask ); }
QNX
QNX