24.01.2014 Views

Codice

Codice

Codice

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

276 volume VI os16<br />

Script e sorgenti del kernel 277<br />

«<br />

«<br />

«<br />

«<br />

1790006 | addr_t address_i;<br />

1790007 | addr_t address_d;<br />

1790008 | size_t size_i;<br />

1790009 | size_t size_d;<br />

1790010 | //<br />

1790011 | if (proc_sig_status (pid, sig))<br />

1790012 | {<br />

1790013 | if (proc_sig_ignore (pid, sig))<br />

1790014 | {<br />

1790015 | proc_sig_off (pid, sig);<br />

1790016 | }<br />

1790017 | else<br />

1790018 | {<br />

1790019 | //<br />

1790020 | // Save process addresses and sizes (might be useful if<br />

1790021 | // we want to try to exit the process before core dump.<br />

1790022 | //<br />

1790023 | address_i = proc_table[pid].address_i;<br />

1790024 | address_d = proc_table[pid].address_d;<br />

1790025 | size_i = proc_table[pid].size_i;<br />

1790026 | size_d = proc_table[pid].size_d;<br />

1790027 | //<br />

1790028 | // Core dump: the process who formally writes the file<br />

1790029 | // is the terminating one.<br />

1790030 | //<br />

1790031 | if (address_d == address_i)<br />

1790032 | {<br />

1790033 | proc_dump_memory (pid, address_i, size_i, "core");<br />

1790034 | }<br />

1790035 | else<br />

1790036 | {<br />

1790037 | proc_dump_memory (pid, address_i, size_i, "core.i");<br />

1790038 | proc_dump_memory (pid, address_d, size_d, "core.d");<br />

1790039 | }<br />

1790040 | //<br />

1790041 | // The signal, translated to negative, is returned (but<br />

1790042 | // the effective value received by the application will<br />

1790043 | // be cutted, leaving only the low 8 bit).<br />

1790044 | //<br />

1790045 | proc_sys_exit (pid, -sig);<br />

1790046 | }<br />

1790047 | }<br />

1790048 |}<br />

104.9.15 kernel/proc/proc_sig_ignore.c<br />

Si veda la sezione 103.8.15.<br />

1800001 |#include <br />

1800002 |//----------------------------------------------------------------------<br />

1800003 |int<br />

1800004 |proc_sig_ignore (pid_t pid, int sig)<br />

1800005 |{<br />

1800006 | unsigned long int flag = 1L

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!