Project

General

Profile

Statistics
| Revision:

root / branches / simulator / projects / simulator / libsim / libsim.c @ 1072

History | View | Annotate | Download (718 Bytes)

1
#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
#include <robot_shared.h>
10
#include <string.h>
11
#include <dragonfly_lib.h>
12

    
13
RobotShared* shared_state;
14

    
15
void dragonfly_init(int config)
16
{
17
  struct itimerval iv;
18
  int ret;
19

    
20
  shared_state = shmat(atoi(getenv("memory_id")), NULL, 0);
21

    
22
  if(shared_state < 0)
23
  {
24
    fprintf(stderr, "unable to get shared memory region\n");
25
    return;
26
  }
27

    
28

    
29
  //printf("setitimer returned %d.\n waiting...\n", ret);
30
  fflush(stdout);
31

    
32
  //TODO: clean up code??
33

    
34
}
35

    
36
void simulator_do()
37
{
38
     if(raise(SIGTSTP)<0)
39
          fprintf(stderr, "ERROR: could not kill self\n");
40

    
41
}