X hits on this document

PDF document

February 10, 2006 - page 214 / 238

565 views

0 shares

0 downloads

0 comments

214 / 238

202

APPENDIX J. COMMAND RECEIVER PROGRAM

perror("open"); exit(1);

}

}

/* Register to get the command */ cmdspec.netfn = MY_NETFN; cmdspec.cmd = MY_CMD; rv = ioctl(fd, IPMICTL_REGISTER_FOR_CMD, &cmdspec); if (rv == -1) {

p e r r o r ( " i o c t l r e g i s t e r _ f o r _ c m d " exit(1); } count = 0; got_one = 0; ) ;

while (count || !got_one) { /* Wait for a message. */ F D _ Z E R O ( & r s e t ) ; F D _ S E T ( f d , & r s e t rv = select(fd+1, &rset, NULL, NULL, NULL); if (rv == -1) { if (errno == EINTR) continue; perror("select"); exit(1); ) ;

}

/* Get the message. */ recv.msg.data = data; recv.msg.data_len = sizeof(data); recv.addr = (unsigned char *) &addr; recv.addr_len = sizeof(addr); r v = i o c t l ( f d , I P M I C T L _ R E C E I V E _ M S G _ T R U N C , & r e c v ) if (rv == -1) { ;

p e r r o r ( " i o c t l r e c v _ m s g _ t r u n c " ) exit(1); ;

}

i f ( ( r e c v . r e c v _ t y p e = = I P M I _ C M D _ R E C V _ T Y P E && (recv.msg.netfn == MY_NETFN) && (recv.msg.cmd == MY_CMD)) )

{

/* We got a command, send a response. */ data[0] = 0; /* No error */ for (i=1; i<10; i++)

Document info
Document views565
Page views565
Page last viewedMon Dec 05 05:01:28 UTC 2016
Pages238
Paragraphs8090
Words85809

Comments