Linux Programmer's Manual
umask (2)
set file creation mask
#include <sys/types.h>
#include <sys/stat.h>
mode_t umask(mode_t mask);
设置umask值为mask&0777。其实就是指定要去掉哪些权限。比如umask的值为022就是指去掉group和other的写权限(2),那么创建的文件权限就是~022=0644=rw-r--r--。
return value
This system call always succeeds and the previous value of the mask is returned.
umask (2)
set file creation mask
#include <sys/types.h>
#include <sys/stat.h>
mode_t umask(mode_t mask);
设置umask值为mask&0777。其实就是指定要去掉哪些权限。比如umask的值为022就是指去掉group和other的写权限(2),那么创建的文件权限就是~022=0644=rw-r--r--。
return value
This system call always succeeds and the previous value of the mask is returned.