// Report that a child has exited void child_cb(EV_P_ ev_child *w, int revents) { char str[100]; char format[] = "{\"processTerminated\" : " " {\"pid\" : %d, \"returnCode\" : %d, \"bySignal\" : %d, \"endTime\" : %ld }}"; struct timeval tp; gettimeofday(&tp, NULL); long int time = (long int) tp.tv_sec * 1000 + tp.tv_usec; sprintf(str, format, w->rpid, WEXITSTATUS(w->rstatus), WSTOPSIG(w->rstatus), time); socket_t *s = w->data; ev_child_stop (EV_A_ w); frame_t *frame = malloc(sizeof(frame_t)); frame->fin = 1; frame->opcode = WS_OP_BIN; frame->len = strlen(str); frame->payload = str; int fr_len; char *fr_str = write_frame(frame, &fr_len); socket_write(s, fr_str, fr_len); free(frame); free(fr_str); ilist_remove(processes, w->rpid); }
static void _ibb_session_release(xmpp_ibb_session_t *sess) { if (sess == NULL) { return; } ilist_remove(g_list, sess); if (sess->userdata != NULL) { free(sess->userdata); } free(sess); //printf("%s(): list size %d.", __FUNCTION__, ilist_size(g_list)); }