root / branches / simulator / projects / simulator / libsim / libsim.c @ 1074
History | View | Annotate | Download (683 Bytes)
1 | 986 | bneuman | #include <stdio.h> |
---|---|---|---|
2 | #include <stdlib.h> |
||
3 | #include <sys/time.h> |
||
4 | #include <signal.h> |
||
5 | #include <unistd.h> |
||
6 | #include <stdlib.h> |
||
7 | #include <sys/shm.h> |
||
8 | #include <sys/ipc.h> |
||
9 | 993 | ayeager | #include <robot_shared.h> |
10 | 986 | bneuman | #include <string.h> |
11 | 1072 | bneuman | #include <dragonfly_lib.h> |
12 | 1039 | bneuman | |
13 | 993 | ayeager | RobotShared* shared_state; |
14 | 986 | bneuman | |
15 | 906 | bcoltin | void dragonfly_init(int config) |
16 | { |
||
17 | 996 | bneuman | shared_state = shmat(atoi(getenv("memory_id")), NULL, 0); |
18 | |||
19 | 986 | bneuman | if(shared_state < 0) |
20 | { |
||
21 | 1047 | bcoltin | fprintf(stderr, "unable to get shared memory region\n");
|
22 | return;
|
||
23 | 993 | ayeager | } |
24 | 986 | bneuman | |
25 | |||
26 | 1047 | bcoltin | //printf("setitimer returned %d.\n waiting...\n", ret);
|
27 | 986 | bneuman | fflush(stdout); |
28 | |||
29 | //TODO: clean up code??
|
||
30 | |||
31 | 906 | bcoltin | } |
32 | |||
33 | 1072 | bneuman | void simulator_do()
|
34 | { |
||
35 | if(raise(SIGTSTP)<0) |
||
36 | fprintf(stderr, "ERROR: could not kill self\n");
|
||
37 | 1074 | bcoltin | } |