Created
December 17, 2013 02:34
-
-
Save snyh/7999045 to your computer and use it in GitHub Desktop.
it's show that /proc/`pid`/exe is not always valid.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include <stdio.h> | |
#include <unistd.h> | |
#include <pthread.h> | |
#define NUM_THREADS 5 | |
void func(void *a) | |
{ | |
printf("/proc/%ld/exe\n", getpid()); | |
//the /proc/getpid()/exe will can't read | |
sleep(100); | |
pthread_exit(NULL); | |
} | |
int main() | |
{ | |
pthread_t t; | |
pthread_create(&t, NULL, func, 0); | |
pthread_exit(NULL); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment