linux之umask函数解析
来源:互联网 发布:oanda 数据接口 编辑:程序博客网 时间:2024/05/17 10:26
[lingyun@localhost umask_1]$ vim umask.c
+ umask.c
/*********************************************************************************
* Copyright: (C) 2013 fulinux<fulinux@sina.com>
* All rights reserved.
*
* Filename: umask.c
* Description: This file
*
* Version: 1.0.0(08/02/2013~)
* Author: fulinux <fulinux@sina.com>
* ChangeLog: 1, Release initial version on "08/02/2013 07:09:24 PM"
*
********************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/stat.h>
#define RWRWRW (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)
int main(void)
{
umask(0);
if(creat("hello", RWRWRW) < 0)
{
printf("creat error for hello\n");
exit(1);
}
umask(S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH);
if(creat("world", RWRWRW) < 0)
{
printf("creat error for world");
exit(1);
}
exit(0);
}
~
~
~
~
~
~
~
~
~
~
~/apue/umask/umask_1/umask.c[+] CWD: /usr/local/src/lingyun/apue/umask/umask_1 Line: 37/38:12
"umask.c" [New] 38L, 1016C written
[lingyun@localhost umask_1]$ gcc umask.c
[lingyun@localhost umask_1]$ umask
0022
[lingyun@localhost umask_1]$ ./a.out
[lingyun@localhost umask_1]$ ls -l hello world
-rw-rw-rw- 1 lingyun trainning 0 Aug 2 19:19 hello
-rw------- 1 lingyun trainning 0 Aug 2 19:19 world
[lingyun@localhost umask_1]$ umask
0022
[lingyun@localhost umask_1]$
+ umask.c
/*********************************************************************************
* Copyright: (C) 2013 fulinux<fulinux@sina.com>
* All rights reserved.
*
* Filename: umask.c
* Description: This file
*
* Version: 1.0.0(08/02/2013~)
* Author: fulinux <fulinux@sina.com>
* ChangeLog: 1, Release initial version on "08/02/2013 07:09:24 PM"
*
********************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/stat.h>
#define RWRWRW (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)
int main(void)
{
umask(0);
if(creat("hello", RWRWRW) < 0)
{
printf("creat error for hello\n");
exit(1);
}
umask(S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH);
if(creat("world", RWRWRW) < 0)
{
printf("creat error for world");
exit(1);
}
exit(0);
}
~
~
~
~
~
~
~
~
~
~
~/apue/umask/umask_1/umask.c[+] CWD: /usr/local/src/lingyun/apue/umask/umask_1 Line: 37/38:12
"umask.c" [New] 38L, 1016C written
[lingyun@localhost umask_1]$ gcc umask.c
[lingyun@localhost umask_1]$ umask
0022
[lingyun@localhost umask_1]$ ./a.out
[lingyun@localhost umask_1]$ ls -l hello world
-rw-rw-rw- 1 lingyun trainning 0 Aug 2 19:19 hello
-rw------- 1 lingyun trainning 0 Aug 2 19:19 world
[lingyun@localhost umask_1]$ umask
0022
[lingyun@localhost umask_1]$
- linux之umask函数解析
- umask()函数 -- linux函数
- Linux umask解析
- linux umask解析
- linux中的 umask 函数
- umask函数linux
- linux 之umask命令
- Linux命令之umask
- Linux命令之umask
- Linux下的umask函数
- linux的umask函数详解
- Linux下的umask函数
- linux下的umask()函数
- linux umask以及mknod函数
- C语言之--umask()函数
- Linux命令之umask命令
- Linux服务器开发之:chmod()函数,chmod命令,以及文件屏蔽umask命令,程序修改umask,详细介绍+案例演示
- linux下的umask( )函数、setsid( )函数
- hdu 1024 Max Sum Plus Plus
- 判断二叉树是不是平衡
- 泰山挑夫1
- 获取当前项目在部署在服务器的绝对位置
- UVA 10285 - Longest Run on a Snowboard (记忆化搜索+dp)
- linux之umask函数解析
- 图解CSS的padding,margin,border属性
- 傅立叶变换及应用2-傅立叶变换
- MySQL数据库的主从复制详解
- qsort函数和bsearch函数的使用
- 执行Android JUnit测试出现java.net.SocketException: Permission denied的解决方法
- android的frameworks层键盘事件处理流程分析
- 吐槽1--弄了一个下午的黑苹果,结果还是以失败告终
- 韩信点兵