⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 execve.c

📁 java 到c的转换程序的原代码.对喜欢C程序而不懂JAVA程序的人很有帮助
💻 C
字号:
/* Redefinition of the execve system call, so that we can remove the  * non-blocking flags from the files we marked as non-blocking and  * asynchronous */#include <sys/types.h>#include <sys/stat.h>#include <fcntl.h>int reestablishFileDesc(int fd){    return fcntl(fd, F_SETFL, (FASYNC|FNDELAY));}intresetFileDesc(int fd) {    return fcntl(fd, F_SETFL, 0);}int __wrap_execve(const char *filename, const char *argv[], const char *envp[]){    int i, ret;    /* Reset all of the open files to blocking and synchronous */       for (i = fdescGetFirstOpen(); i >= 0; i = fdescGetNextOpen(i)) {	if (resetFileDesc(i) == -1)	    perror("reset file desc");    }    /* Call execve. It normally doesn't return. */    ret = __real_execve(filename, argv, envp);    /* What to do if exec returns??? We need to re-setup the file      * descriptors to non-blocking and asynchronous. */    for (i = fdescGetFirstOpen(); i >= 0; i = fdescGetNextOpen(i)) {	if (reestablishFileDesc(i) == -1)	    perror("reset file desc");    }    return ret;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -