Am intampinat si eu problema asta. Problema e in teste, deoarece in main() este apelat un "set_signal()" intainte de vinit(). Din cate am vazut set_signal() este reapelata din nou dupa vinit, iar dupa vend() este refacut semnalul default (de aici si eroare doar la primul test). Prima varianta (si cea corecta in care refaci vechiul handler) reface handlerul vechi (din teste) si nu cel default.
<br><br><div class="gmail_quote">On Jan 6, 2008 6:58 PM, Silviu-Ionut Ganceanu <<a href="mailto:silviug@gmail.com">silviug@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Intr-o abordare de genu:<br><br>void *vinit(size_t virt_pages, size_t phys_pages) {<br>....<br> sigaction(SIGSEGV, &action, &default_action);<br>....<br>}<br><br>int vend(void) {<br>....<br> sigaction(SIGSEGV, &default_action;
<br>....<br>}<br>pic primul test 'sig_closed'.<br><br>Daca in schimb, schimb "vinit" sa fie ceva de genu (am inrosit schimbarile):<br><br>void *vinit(size_t virt_pages, size_t phys_pages) {<br>
....<br><span style="color: rgb(255, 0, 0);"> memset(&default_action, 0, sizeof(struct sigaction));</span><br style="color: rgb(255, 0, 0);"><span style="color: rgb(255, 0, 0);"> default_action.sa_handler = SIG_DFL;
</span><br style="color: rgb(255, 0, 0);"><span style="color: rgb(255, 0, 0);"> sigemptyset(&default_action.sa_mask);</span><br style="color: rgb(255, 0, 0);"><br>
sigaction(SIGSEGV, &action, <span style="color: rgb(255, 0, 0);">NULL</span>);<br>
....<br>
}<br>
<br>trece.<br><br>Sa presupun ca e problema in teste? Este un detaliu minor, dar cred ca inainte de orice vinit ar trebui setat handler-ul de semnal pe care testul 'sig_closed' il asteapta.<br><font color="#888888">
<br>Silviu<br><br>
</font><br>_______________________________________________<br>so mailing list<br><a href="mailto:so@cursuri.cs.pub.ro">so@cursuri.cs.pub.ro</a><br><a href="http://cursuri.cs.pub.ro/cgi-bin/mailman/listinfo/so" target="_blank">
http://cursuri.cs.pub.ro/cgi-bin/mailman/listinfo/so</a><br><br></blockquote></div><br><br clear="all"><br>-- <br>Alexandru Mošoi<br><a href="http://alexandru.mosoi.googlepages.com">http://alexandru.mosoi.googlepages.com</a>
<br><br>Please avoid sending me Word or PowerPoint attachments.<br>See <a href="http://www.gnu.org/philosophy/no-word-attachments.html">http://www.gnu.org/philosophy/no-word-attachments.html</a>