码迷,mamicode.com
首页 >  
搜索关键字:fd    ( 1602个结果
Linux服务器编程之:truncate()函数+案例说明
1.依赖头文件 #include #include 2.函数定义: int truncate(const char *path,off_t length); int ftruncate(int fd,off_t length); 函数说明: The  truncate()  and ftruncate() functions cause the regular file named...
分类:系统相关   时间:2014-09-14 19:20:57    阅读次数:289
Linux服务器编程之:chown()函数,chown命令
1.依赖的头文件 #include 2.函数定义: //通过传入path的方式,改变和文件的拥有关系,如果他是一个符号链接,则跟踪它 int chown(const char *path, uid_t owner, gid_t group); //通过文件描述的方式进行修改用户所有组等的情况 int fchown(int fd, uid_t owner, gid_t group); ...
分类:系统相关   时间:2014-09-14 18:03:07    阅读次数:321
Linux服务器开发之:chmod()函数,chmod命令,以及文件屏蔽umask命令,程序修改umask,详细介绍+案例演示
1.依赖的头文件 #include 2.函数定义: //通过传入path中给定的文件名的方式来改变文件制定的权限 int chmod(const char *path,mode_t mode); //通过传入文件描述符的方式为一个文件重设权限 int fchmod(int fd,mode_t mode); 注意:如果使用Linux的chmod命令时,得有root权...
分类:系统相关   时间:2014-09-14 15:26:47    阅读次数:273
Linux服务器开发之:stat(),fstat(),lstat()详细介绍+案例演示
1.依赖的头文件 #include #include #include 2.函数定义: //通过传入文件路径,struct stat结构体指针的方式 int stat(const char *path, struct stat *buf); //通过文件描述符获取文件对应的属性。文件打开后这样操作 int fstat(int fd, struct stat *buf)...
分类:系统相关   时间:2014-09-14 12:52:37    阅读次数:352
Linux下多路复用IO接口epoll/select/poll的区别
select比epoll效率差的原因:select是轮询,epoll是触发式的,所以效率高。Select:1.Socket数量限制:该模式可操作的Socket数由FD_SETSIZE决定,内核默认32*32=1024.2.操作限制:通过遍历FD_SETSIZE(1024)个Socket来完成调度,不...
分类:系统相关   时间:2014-09-13 20:06:55    阅读次数:199
检查打开的文件是不是ELF格式的文件,如果是就输出节头表表項的数目,各表項指向的节的地址
#include "elf.h" #include int main(int argc, char  *argv[]) {     FILE  *fp;     int i = 0;     int fd = 0;     Elf64_Ehdr  ehdr;          if ((fp=fopen(argv[1],"r"))==NULL)     {         ...
分类:其他好文   时间:2014-09-12 08:55:03    阅读次数:259
检查打开的文件是不是ELF格式的文件,如果是就输出节头字符串表的地址,并依次输出各节的名称,字符串
#include "elf.h" #include int main(int argc, char  *argv[]) {     FILE  *fp;     int i = 0;     int fd = 0;     Elf64_Ehdr  ehdr;          if ((fp=fopen(argv[1],"r"))==NULL)     {         ...
分类:其他好文   时间:2014-09-12 08:54:53    阅读次数:183
Java自动创建多层文件目录
// 创建文件上传路径 public static void mkdir(String path) { File fd = null; try { fd = new File(path); if (!fd.exists()...
分类:编程语言   时间:2014-09-11 07:39:51    阅读次数:195
关于函数指针
今天在看redis源码的时候发现这样的一种函数定义方法,就是将函数作为类型来定义,然后在结构体当中使用 typedef void aeFileProc(struct aeEventLoop *eventLoop, int fd, void *clientData, int mask); typ...
分类:其他好文   时间:2014-09-10 13:55:30    阅读次数:259
epoll 的两种用法
struct epoll_event 的data成员是一个union类型里面要么就是fd,要么就是ptr最好不要一会用ptr一会用fd最好坚持从头到尾的使用一个第一种只是使用epoll_event.data.fd#include #include #include #include #include...
分类:其他好文   时间:2014-09-09 22:50:29    阅读次数:293
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!