jeans chen
we've got them by the balls
摘要: fcntl设置FD_CLOEXEC标志作用 分类: C/C++ linux 2011-11-02 22:11 3217人阅读 评论(0) 收藏 举报bufferexegccnullfile通过fcntl设置FD_CLOEXEC标志有什么用?close on exec, not on-fork, 意为如果对描述符设置了FD_CLOEXEC,使用execl执行的程序里,此描述符被关闭,不能再使用它,但是在使用fork调用的子进程中,此描述符并不关闭,仍可使用。eg:jamie@jamie-laptop:~$ cat test.c#include #include #include #incl... 阅读全文
posted @ 2014-01-09 18:10 jeans chen 阅读(268) 评论(0) 推荐(0) 编辑
摘要: int execl(const char *path, const char *arg, ...);函数说明execl()其中后缀"l"代表list也就是参数列表的意思第一参数path字符指针所指向要执行的文件路径 接下来的参数代表执行该文件时传递的参数列表argv[0],argv[1]... 最后一个参数须用空指针NULL作结束2函数用法函数返回值成功则不返回值 失败返回-1 失败原因存于errno中可通过perror()打印Windows下示例(vs编译)#include #include int main(){printf("调用D盘Test目录下的hell 阅读全文
posted @ 2014-01-09 18:02 jeans chen 阅读(486) 评论(0) 推荐(0) 编辑