Skip to content

Instantly share code, notes, and snippets.

@snyh
Created December 17, 2013 02:34
Show Gist options
  • Save snyh/7999045 to your computer and use it in GitHub Desktop.
Save snyh/7999045 to your computer and use it in GitHub Desktop.
it's show that /proc/`pid`/exe is not always valid.
#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