I am using OpenIPMI 2.0.6
________________________________
From: Singh, Ruchika
Sent: Tuesday, January 16, 2007 7:06 PM
To: '[email protected]'
Subject: OpenIPMI clean shutdown
I need an application that connects to IPMI, does some work and shutdown
IPMI in a loop. I occasionally receive an IPMI connection failure
code:10000ff while doing so. It appears there is some resource that is
not released when I do ipmi clean up ( connection close, free_os_handler
) like this in a loop. A single command line application, doing the same
work can however be called multiple times from shell to do the same
work. Apparently the application exit() takes care of all ipmi cleanup.
I am not sure what function call I might be missing in my clean up code
or what I am doing wrong. I am pretty much using the same code for
startup and shutdown as in the sample application.
static void
conn_close(ipmi_con_t *con, void *cb_data)
{
printf("Connection closed\n");
not_done = 0;
}
void
leave(int ret)
{
printf( "In Leave\n");
not_done = 1;
int rv;
if (con && con->close_connection) {
printf("Closing Connection\n");
con->close_connection_done(con, conn_close, NULL);
while (not_done) {
rv = os_hnd->perform_one_op(os_hnd, NULL);
if (rv)
break;
}
}
con = NULL;
if (os_hnd) {
printf("free os handler\n");
os_hnd->free_os_handler(os_hnd);
os_hnd = NULL;
sel = NULL;
}
}
int
main(int argc, char *argv[])
{
int i;
time_t start_time, cur_time;
for ( i=0; i<1000; i++){
doWork();
printf("Value of i is %d\n", i);
time(&start_time);
do
{
time(&cur_time);
}
while((cur_time - start_time) < 1);
}
}
int doWork(){
os_hnd = NULL;
sel = NULL;
con = NULL;
continue_operation = 1;
int rv;
/* OS handler allocated first. */
os_hnd = ipmi_posix_get_os_handler();
printf("handler allocated\n");
if (!os_hnd) {
fprintf(stderr, "ipmi_smi_setup_con: Unable to allocate os
handler\n");
exit(1);
}
/* Create selector with os handler. */
sel_alloc_selector(os_hnd, &sel);
printf("selector allocated\n");
/* The OS handler has to know about the selector. */
ipmi_posix_os_handler_set_sel(os_hnd, sel);
printf("set ssel\n");
/* Initialize the OEM handlers. */
//printf("IPMI init");
rv = ipmi_init(os_hnd);
printf("init ipmi\n");
if (rv) {
fprintf(stderr, "Error initializing connections: 0x%x\n", rv);
exit(1);
}
/* Establish connections to domain through system interface.
* After the connection is established, setup_done will be
called. */
rv = ipmi_smi_setup_con(0, os_hnd, NULL, &con);
if (rv) {
printf("ipmi_smi_setup_con: %s", strerror(rv));
exit(1);
}
con->add_con_change_handler(con, con_changed_handler, NULL);
rv = con->start_con(con);
if (rv) {
fprintf(stderr, "Could not start connection: %x\n", rv);
exit(1);
}
fflush(stdout);
/* rv = ipmi_open_domain("", &con, 1, setup_done, NULL, NULL, NULL,
NULL, 0, NULL);
if (rv) {
fprintf(stderr, "ipmi_init_domain: %s\n", strerror(rv));
exit(1);
}*/
while (continue_operation) {
rv = os_hnd->perform_one_op(os_hnd, NULL);
if (rv)
break;
}
leave(rv);
return rv;
}
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Openipmi-developer mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openipmi-developer