<html><body><div style="color:#000; background-color:#fff; font-family:arial, helvetica, sans-serif;font-size:10pt"><div><span style="font-size: 10pt;">Am procedat in felul urmator: am pus un sleep inainte de mq_receive, am rulat programul cu strace cum ai zis si tu si am afisat cu lsof fisierele deschise de procesul respectiv. </span><br></div><div style="font-family: arial, helvetica, sans-serif; font-size: 10pt;"><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt;"><div id="yiv0095669852"><div style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); font-family: arial, helvetica, sans-serif; font-size: 10pt;"><div style="font-family: arial, helvetica, sans-serif; font-size: 13px; color: rgb(0, 0, 0); background-color: transparent; font-style: normal;"><span><br></span></div><div style="font-family: arial, helvetica, sans-serif; font-size: 13px; color: rgb(0, 0, 0); background-color: transparent;
font-style: normal;"><span> - strace imi returneaza :</span></div><div style="background-color: transparent; color: rgb(0, 0, 0); font-size: 13px; font-family: arial, helvetica, sans-serif; font-style: normal;"><span><div style="color: rgb(0, 0, 0); font-family: arial, helvetica, sans-serif; font-size: 13px; font-style: normal; background-color: transparent;"><font size="2">[pid 3142] mq_timedreceive(4, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 8193, 0, NULL) = -1 EBADF (Bad file descriptor)</font></div><div style="color: rgb(0, 0, 0); font-family: arial, helvetica, sans-serif; font-size: 13px; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-family: arial, helvetica, sans-serif; font-size: 13px; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-family: arial, helvetica, sans-serif; font-size: 13px; font-style: normal;">- "lsof -a -p 3142 " in momentul respectiv imi afiseaza
pe ultima linie</div><div style="color: rgb(0, 0, 0); font-family: arial, helvetica, sans-serif; font-size: 13px; font-style: normal;"><br></div><div><span style="font-size:13px;">COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME</span><br></div><div style="color: rgb(0, 0, 0); font-family: arial, helvetica, sans-serif; font-size: 13px; font-style: normal;"><font size="2">test2 3142 clau 4w REG 0,13 80 17577 /queue_1</font><br></div></span></div><div style="font-family: arial, helvetica, sans-serif; font-size: 10pt;"><br></div> <div style="font-family: arial, helvetica, sans-serif; font-size: 10pt;"> <div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt;"> <div dir="ltr"> <font size="2" face="Arial"> <hr size="1"> <b><span style="font-weight:bold;">From:</span></b> Adrian Sendroiu <molecula2788@gmail.com><br> <b><span
style="font-weight:bold;">To:</span></b> Claudiu Olteanu <olteanu.claudiu@ymail.com> <br><b><span style="font-weight:bold;">Cc:</span></b> Sisteme de Operare <so@cursuri.cs.pub.ro> <br> <b><span style="font-weight:bold;">Sent:</span></b> Wednesday, April 10, 2013 9:42
AM<br> <b><span style="font-weight:bold;">Subject:</span></b> Re: [so] [Tema 2][linux] mq_receive returneaza Bad file descriptor<br> </font> </div> <br>Claudiu Olteanu <<a rel="nofollow" ymailto="mailto:olteanu.claudiu@ymail.com" target="_blank" href="mailto:olteanu.claudiu@ymail.com">olteanu.claudiu@ymail.com</a>> writes:<br><br>> Salut!<br>><br>> Nu imi dau seama de ce atunci cand incerc sa fac preiau ceva de pe<br>> coada imi da Bad file descriptor. Sa pun pe ea nu intampin nicio<br>> problema. File descriptorul este identic cu cel intors de<br>> mq_open. Aveti idee care ar putea fi problema?<br>><br>> Apelul functiei mele arata ceva de genul : mq_receive(mq, (char *)msg,<br>> attr.mq_msgsize + 1 , NULL);<br>><br>> Multumesc, Claudiu<br><br>Salut,<br><br>Esti sigur ca file descriptorul e bun? Cum ai verificat?<br><br>Incearca si cu strace<br><br>strace -f -etrace=mq_timedreceive
comanda<br><br>Adrian<br><br><br> </div> </div>
</div></div><br><br> </div> </div> </div></body></html>