{
uint64_t starttime; // written only by recv thread
int64_t allocmem; // written only by recv thread
- int pid; // written only by recv thread
+ pid_t pid; // written only by recv thread
int socket; // written only by main thread
pthread_t recv_thread; // written only by main thread
int event_fd; // for thread communication (from recv thread to main thread)
{
// send stop message to main thread
event = EVENT_STOP;
- write(manager.target[index].event_fd, &event, sizeof(uint64_t));
-
- struct timeval tv;
- gettimeofday(&tv, NULL);
- struct msg_data_t msg = {
- .id = NMSG_TERMINATE,
- .seq_num = 0,
- .sec = tv.tv_sec,
- .nsec = tv.tv_usec * 1000,
- .len = 0
- };
- write_to_buf(&msg);
+ write(manager.target[index].event_fd, &event,
+ sizeof(uint64_t));
+
+ struct msg_data_t *msg = malloc(sizeof(*msg) + /* pid */
+ sizeof(uint32_t));
+ fill_data_msg_head(msg, NMSG_TERMINATE, 0,
+ sizeof(uint32_t));
+ *(uint32_t *) msg->payload = (uint32_t) manager.target[index].pid;
+ write_to_buf(msg);
+ free(msg);
break;
}
else if(log.type == MSG_MSG)