
{"id":16403,"date":"2015-07-04T18:40:09","date_gmt":"2015-07-04T18:40:09","guid":{"rendered":"http:\/\/www.beautifulwork.org\/?p=16403"},"modified":"2015-07-04T18:40:09","modified_gmt":"2015-07-04T18:40:09","slug":"hacking-with-ansi-c-signal-handling","status":"publish","type":"post","link":"https:\/\/www.trueangle.org\/index.php\/2015\/07\/04\/hacking-with-ansi-c-signal-handling\/","title":{"rendered":"Hacking with ANSI C signal Handling"},"content":{"rendered":"<pre>\n$sudo strace -e trace=signal -p 1 \n[sudo] password for jeffrin: \nProcess 1 attached\nkill(4659, SIGTERM)                     = 0\nkill(4659, SIGCONT)                     = 0\n\n<\/pre>\n<pre>\n$gcc crtlc1-p1.c \n$.\/a.out \nHello world \nHello world \nHello world \nHello world \nHello world \nHello world \nHello world \nHello world \nHello world \n^Ci got a signal 2\nHello world \nHello world \n^C\n$cat crtlc1-p1.c \n#include \n#include \n#include \n\nvoid ouch(int sig)\n{\n\n  printf(\"i got a signal %d\\n\",sig);\n  (void) signal(SIGINT, SIG_DFL);\n}\n\nint main()\n{\n\n  (void) signal(SIGINT,ouch);\n\n  while(1)\n    {\n      printf(\"Hello world \\n\");\n      sleep(1);\n    }\n}\n$\n\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>$sudo strace -e trace=signal -p 1 [sudo] password for jeffrin: Process 1 attached kill(4659, SIGTERM) = 0 kill(4659, SIGCONT) = 0 $gcc crtlc1-p1.c $.\/a.out Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world Hello world ^Ci got a signal 2 Hello world Hello world ^C $cat crtlc1-p1.c #include &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.trueangle.org\/index.php\/2015\/07\/04\/hacking-with-ansi-c-signal-handling\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Hacking with ANSI C signal Handling&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[141,83,91,116],"tags":[1447],"_links":{"self":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts\/16403"}],"collection":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/comments?post=16403"}],"version-history":[{"count":0,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts\/16403\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/media?parent=16403"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/categories?post=16403"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/tags?post=16403"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}