#include<sys/types.h>
#include<sys/stat.h>
#include<fcntl.h>
#include<unistd.h>
int main(){
int fd;
umask(044); //屏蔽权限为044
fd=creat("f4",0666);//赋予权限为666
return 0;
}
执行结果:
-rw--w--w-. 1 root root 0 3月 20 12:54 f4
实际权限为 rw--w--w- 622
赋予权限-屏蔽权限=实际权限