ulimit open files linux打开文件数设置验证
2017-09-30 16:40
375 查看
1 #include <stdio.h> 2 #include <sys/types.h> 3 #include <fcntl.h> 4 #include <stdlib.h> 5 #include <unistd.h> 6 7 int main(int argc,char *argv[]){ 8 9 int fd; 10 char name[1024]; 11 int i = 0; 12 while(1){ 13 sprintf(name,"file%d",++i); 14 fd = open(name,O_CREAT,0777); //超过最大打开数时再打开会出错,返回-1 15 if (fd == -1){ 16 exit(1); 17 } 18 printf("%d ",i); 19 } 20 return 0; 21 }
相关文章推荐
- linux 打开文件数 too many open files 解决方法
- 遇到问题----linux-----linux 打开文件数 too many open files 解决方法
- 在Linux中打开了太多文件(Too many open files)的解决方法
- 在Linux中打开了太多文件(Too many open files)的解决方法
- linux下设置最大文件打开数nofile及nr_open、file-max说明
- linux修改最大文件链接数open files/ulimit -n
- linux下设置最大文件打开数nofile及nr_open、file-max说明
- 设置Linux打开文件句柄/proc/sys/fs/file-max和ulimit -n的区别
- 遇到问题----linux-----linux 打开文件数 too many open files 解决方法
- 在Linux中打开了太多文件(Too many open files)的解决方法
- linux 打开文件数 too many open files 解决方法
- linux 打开文件数 too many open files 解决方法
- linux 打开文件数 too many open files 解决方法
- linux 打开文件数 too many open files解决方法
- Linux:使用ulimit设置文件最大打开数<转>
- Linux:使用ulimit设置文件最大打开数
- linux 打开文件数 too many open files 解决方法
- 在Linux中打开了太多文件(Too many open files)的解决方法
- 在Linux中打开了太多文件(Too many open files)的解决方法
- Linux:使用ulimit设置文件最大打开数