Esempio n. 1
0
static void
list_update(list_t *list, lwp_info_t *lwp)
{
	id_info_t *id;
	if (list->l_head == NULL) {			/* first element */
		list->l_head = list->l_tail = id = Zalloc(sizeof (id_info_t));
		id_update(id, lwp, list->l_type);
		list->l_count++;
		return;
	}

	for (id = list->l_head; id; id = id->id_next) {
		if ((list->l_type == LT_PROCESS) &&
			(id->id_pid != lwp->li_psinfo->pr_pid))
			continue;
		if ((list->l_type == LT_USERS) &&
			(id->id_uid != lwp->li_psinfo->pr_uid))
			continue;
		if ((list->l_type == LT_PROJECTS) &&
			(id->id_projid != lwp->li_psinfo->pr_projid))
			continue;
		id_update(id, lwp, list->l_type);
		return;
	}

	/* a new element */
	id = list->l_tail;
	id->id_next = Zalloc(sizeof (id_info_t));
	id->id_next->id_prev = list->l_tail;
	id->id_next->id_next = NULL;
	list->l_tail = id->id_next;
	id = list->l_tail;
	id_update(id, lwp, list->l_type);
	list->l_count++;
}
Esempio n. 2
0
void msg_complete(msg_dir_t dir) {
    switch (ctx.msg.reg) {
        case WRITE_ID:
            // Get and save a new given ID
            id_update(ctx.msg.data[0]);
        break;
        case GET_ID:
        case GET_MODULE_TYPE:
        case GET_STATUS:
        case GET_FIRM_REVISION:
            // ERROR
            ctx.status.rx_error = TRUE;
        break;
        default:
            if (dir == RX)
                ctx.rx_cb(dir, &ctx.msg);
            else
                ctx.rxgc_cb(dir, &ctx.msg);
        break;
    }
}