Ejemplo n.º 1
0
static int
perform_one_op(os_handler_t   *os_hnd,
	       struct timeval *timeout)
{
    iposix_info_t *info = os_hnd->internal_data;
    int           rv;

    rv = sel_select(info->sel, NULL, 0, NULL, timeout);
    if (rv == -1)
	return errno;
    return 0;
}
Ejemplo n.º 2
0
static int
perform_one_op(os_handler_t   *os_hnd,
	       struct timeval *timeout)
{
    pthread_t        self = pthread_self();
    pt_os_hnd_data_t *info = os_hnd->internal_data;
    int              rv;

    rv = sel_select(info->sel, posix_thread_send_sig, (long) &self, info,
		    timeout);
    if (rv == -1)
	return errno;
    return 0;
}
Ejemplo n.º 3
0
void ohoi_close_connection(ipmi_domain_id_t domain_id, void *user_data)
{
	struct oh_handler_state *handler = (struct oh_handler_state *)user_data;
	struct ohoi_handler *ipmi_handler = (struct ohoi_handler *)handler->data;
	int rv;

	trace_ipmi("ohoi_close_connection");

	rv = ipmi_domain_pointer_cb(domain_id, close_connection, ipmi_handler);
	
	if (rv) {
		err("ipmi_domain_pointer_cb failed!");
		return;
	}

	while (ipmi_handler->fully_up != 0) {
		sel_select(ipmi_handler->ohoi_sel, NULL, 0, NULL, NULL);
	}
}
Ejemplo n.º 4
0
int
main(int argc, const char *argv[])
{
    int         rv;
    int         curr_arg = 1;
    ipmi_args_t *args;
    ipmi_con_t  *con;

    progname = argv[0];

    /* OS handler allocated first. */
    os_hnd = ipmi_posix_get_os_handler();
    if (!os_hnd) {
	printf("ipmi_smi_setup_con: Unable to allocate os handler\n");
	exit(1);
    }

    /* Create selector with os handler. */
    sel_alloc_selector(os_hnd, &sel);

    /* The OS handler has to know about the selector. */
    ipmi_posix_os_handler_set_sel(os_hnd, sel);

    /* Initialize the OpenIPMI library. */
    ipmi_init(os_hnd);

#if 1
    if(argc > 1) {
        argc--;
        sname = argv[1];
        argv++;
    }else {
        usage();
        exit(-1);
    }
#endif

    rv = ipmi_parse_args(&curr_arg, argc, argv, &args);
    if (rv) {
	fprintf(stderr, "Error parsing command arguments, argument %d: %s\n",
		curr_arg, strerror(rv));
	usage();
	exit(1);
    }

    rv = ipmi_args_setup_con(args, os_hnd, sel, &con);
    if (rv) {
        fprintf(stderr, "ipmi_ip_setup_con: %s", strerror(rv));
	exit(1);
    }

    rv = ipmi_init_domain(&con, 1, setup_done, NULL, NULL, NULL);
    if (rv) {
	fprintf(stderr, "ipmi_init_domain: %s\n", strerror(rv));
	exit(1);
    }

    /* We run the select loop here, this shows how you can use
       sel_select.  You could add your own processing in this loop. */
    while (1) {
	sel_select(sel, NULL, 0, NULL, NULL);
        if (done) {
             done = 0;
             printf("done\n");
        }
    }
}