Store init process pid in INIT_PID environmental variable.

This commit is contained in:
Jonas 'Sortie' Termansen 2013-06-15 16:32:41 +02:00
parent 740187674a
commit f8f65d5713
1 changed files with 5 additions and 0 deletions

View File

@ -34,6 +34,11 @@
int child()
{
pid_t init_pid = getppid();
char init_pid_str[sizeof(pid_t)*3];
snprintf(init_pid_str, sizeof(pid_t)*3, "%ju", (uintmax_t) init_pid);
setenv("INIT_PID", init_pid_str, 1);
const char* programname = "sh";
const char* newargv[] = { programname, NULL };