int isproc(int pid, char *exe);
int main(int argc, char **argv) { int status; status = isproc(atoi(argv[1]), argv[2]); printf("file is %d\n", status); }
int isproc(int pid, char *exe) { char procfile[80]; char null[40]; char exename[80]; FILE *fp; sprintf(procfile, "/proc/%d/stat", pid); if (access(procfile, F_OK) != 0) { return 0; } if (exe == NULL) { return 1; } if ((fp = fopen(procfile, "r")) == NULL) return 0; fscanf(fp, "%s %s",null, exename); fclose(fp); if (strstr(exename, exe) != NULL) return 1; return 0; }
Copyrights © - Joinc, All Rights Reserved. Inherited From - Yundream Rebranded By - Joonphil
설명
사용방법
코드
토의
변경사항
2004/01/08
Recent Posts
Archive Posts
Tags