Revision 996
fixed the environment variable stuff
branches/simulator/projects/simulator/libsim/libsim.c | ||
---|---|---|
30 | 30 |
struct itimerval iv; |
31 | 31 |
int ret; |
32 | 32 |
|
33 |
int shared_state = shmat(atoi(getenv("memory_id")), NULL, 0); |
|
33 |
shared_state = shmat(atoi(getenv("memory_id")), NULL, 0); |
|
34 |
|
|
34 | 35 |
if(shared_state < 0) |
35 | 36 |
{ |
36 |
printf("unable to get shared memory region\n");
|
|
37 |
return 1;
|
|
37 |
printf("unable to get shared memory region\n");
|
|
38 |
return 1;
|
|
38 | 39 |
} |
39 | 40 |
|
40 | 41 |
|
branches/simulator/projects/simulator/simulator/core/robot.c | ||
---|---|---|
100 | 100 |
|
101 | 101 |
if(!pid) |
102 | 102 |
{ |
103 |
char var[21];
|
|
104 |
char *envp[] = {var, NULL};
|
|
105 |
/* restore default sigchld handler */
|
|
106 |
signal(SIGCHLD, SIG_DFL);
|
|
107 |
sprintf(var, "memory_id=%d", r->sharedMemID);
|
|
108 |
//TODO: keep the other env. stuff around
|
|
109 |
execve(execname, NULL, envp);
|
|
110 |
fprintf(stderr, "exec failed to run child process.\n");
|
|
111 |
exit(-1);
|
|
103 |
char var[21];
|
|
104 |
/* restore default sigchld handler */
|
|
105 |
signal(SIGCHLD, SIG_DFL);
|
|
106 |
sprintf(var, "memory_id=%d", r->sharedMemID);
|
|
107 |
putenv(var);
|
|
108 |
//TODO: keep the other env. stuff around
|
|
109 |
execv(execname, NULL);
|
|
110 |
fprintf(stderr, "exec failed to run child process.\n");
|
|
111 |
exit(-1);
|
|
112 | 112 |
} |
113 | 113 |
else |
114 | 114 |
{ |
Also available in: Unified diff