Project

General

Profile

Statistics
| Revision:

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

History | View | Annotate | Download (683 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
  shared_state = shmat(atoi(getenv("memory_id")), NULL, 0);
18

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

    
25

    
26
  //printf("setitimer returned %d.\n waiting...\n", ret);
27
  fflush(stdout);
28

    
29
  //TODO: clean up code??
30

    
31
}
32

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