lib/master.c
changeset 1313 ed15eef57d5c
parent 1287 cc7b679c74e9
child 1326 ef907b0b5125
equal deleted inserted replaced
1312:74853e018898 1313:ed15eef57d5c
   109 {
   109 {
   110     if (ioctl(master->fd, EC_IOCTL_ACTIVATE,
   110     if (ioctl(master->fd, EC_IOCTL_ACTIVATE,
   111                 &master->process_data_size) == -1) {
   111                 &master->process_data_size) == -1) {
   112         fprintf(stderr, "Failed to activate master: %s\n",
   112         fprintf(stderr, "Failed to activate master: %s\n",
   113                 strerror(errno));
   113                 strerror(errno));
   114         return -1; 
   114         return -1; // FIXME
   115     }
   115     }
   116 
   116 
   117     if (master->process_data_size) {
   117     if (master->process_data_size) {
   118         master->process_data = mmap(0, master->process_data_size,
   118         master->process_data = mmap(0, master->process_data_size,
   119                 PROT_READ | PROT_WRITE, MAP_SHARED, master->fd, 0);
   119                 PROT_READ | PROT_WRITE, MAP_SHARED, master->fd, 0);
   120         if (master->process_data == MAP_FAILED) {
   120         if (master->process_data == MAP_FAILED) {
   121             fprintf(stderr, "Failed to map process data: %s", strerror(errno));
   121             fprintf(stderr, "Failed to map process data: %s", strerror(errno));
   122             master->process_data = NULL;
   122             master->process_data = NULL;
   123             master->process_data_size = 0;
   123             master->process_data_size = 0;
   124             return -1;
   124             return -1; // FIXME
   125         }
   125         }
   126 
   126 
   127         // Access the mapped region to cause the initial page fault
   127         // Access the mapped region to cause the initial page fault
   128         printf("pd: %x\n", master->process_data[0]);
   128         printf("pd: %x\n", master->process_data[0]);
   129     }
   129     }