{"id":75367,"date":"2020-03-25T19:42:31","date_gmt":"2020-03-25T17:42:31","guid":{"rendered":"https:\/\/prohoster.info\/blog\/administrirovanie\/strace-v-linux-istoriya-ustrojstvo-i-ispolzovanie"},"modified":"2020-03-25T19:42:31","modified_gmt":"2020-03-25T17:42:31","slug":"strace-v-linux-istoriya-ustrojstvo-i-ispolzovanie","status":"publish","type":"post","link":"https:\/\/prohoster.info\/sq\/blog\/administrirovanie\/strace-v-linux-istoriya-ustrojstvo-i-ispolzovanie","title":{"rendered":"Strace \u0432 Linux: \u0438\u0441\u0442\u043e\u0440\u0438\u044f, \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435","gt_translate_keys":[{"key":"rendered","format":"text"}]},"content":{"rendered":"<p><img decoding=\"async\" alt=\"Strace \u0432 Linux: \u0438\u0441\u0442\u043e\u0440\u0438\u044f, \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\" src=\"\/wp-content\/uploads\/2020\/03\/d34dbc0574850a7a8b3bb4896a121c75.jpg\" style=\"display:block;margin: 0 auto;\" \/><\/p>\n<p><\/p>\n<p>\u0412 Unix-\u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u0445 \u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0441 \u0432\u043d\u0435\u0448\u043d\u0438\u043c \u043c\u0438\u0440\u043e\u043c \u0438 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0447\u0435\u0440\u0435\u0437 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043d\u0430\u0431\u043e\u0440 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u2014 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432. \u0410 \u0437\u043d\u0430\u0447\u0438\u0442, \u0432 \u043e\u0442\u043b\u0430\u0434\u043e\u0447\u043d\u044b\u0445 \u0446\u0435\u043b\u044f\u0445 \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u0431\u044b\u0432\u0430\u0435\u0442 \u043f\u043e\u0434\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0437\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u043c\u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430\u043c\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u043c\u0438 \u0432\u044b\u0437\u043e\u0432\u0430\u043c\u0438.<\/p>\n<p><\/p>\n<p>\u0421\u043b\u0435\u0434\u0438\u0442\u044c \u0437\u0430 \u00ab\u0438\u043d\u0442\u0438\u043c\u043d\u043e\u0439 \u0436\u0438\u0437\u043d\u044c\u044e\u00bb \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c \u043d\u0430 Linux \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u0443\u0442\u0438\u043b\u0438\u0442\u0430 <code>strace<\/code>, \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0438 \u043f\u043e\u0441\u0432\u044f\u0449\u0435\u043d\u0430 \u044d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f. \u041a \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u00ab\u0448\u043f\u0438\u043e\u043d\u0441\u043a\u043e\u0433\u043e\u00bb \u043e\u0431\u043e\u0440\u0443\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u0438\u043b\u0430\u0433\u0430\u044e\u0442\u0441\u044f \u043a\u0440\u0430\u0442\u043a\u0430\u044f \u0438\u0441\u0442\u043e\u0440\u0438\u044f <code>strace<\/code> \u0438 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c.<\/p>\n<p><noindex><a rel=\"nofollow\" name=\"habracut\"><\/a><\/noindex><\/p>\n<h1 id=\"soderzhanie\">\u0421\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435<\/h1>\n<p><\/p>\n<ul>\n<li><noindex><a rel=\"nofollow\" href=\"#proishozhdenie-vidov\">\u041f\u0440\u043e\u0438\u0441\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u0435 \u0432\u0438\u0434\u043e\u0432<\/a><\/noindex><\/li>\n<li><noindex><a rel=\"nofollow\" href=\"#ustroystvo-strace-v-dvuh-slovah-piglet-trace\">\u0423\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e strace \u0432 \u0434\u0432\u0443\u0445 \u0441\u043b\u043e\u0432\u0430\u0445: Piglet Trace<\/a><\/noindex><\/li>\n<li><noindex><a rel=\"nofollow\" href=\"#azy-zapusk-programmy-pod-upravleniem-strace\">\u0410\u0437\u044b: \u0437\u0430\u043f\u0443\u0441\u043a \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u043f\u043e\u0434 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435\u043c strace<\/a><\/noindex><\/li>\n<li><noindex><a rel=\"nofollow\" href=\"#azy-prisoedinenie-k-processu-na-letu\">\u0410\u0437\u044b: \u043f\u0440\u0438\u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u043a \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0443 \u043d\u0430 \u043b\u0435\u0442\u0443<\/a><\/noindex><\/li>\n<li><noindex><a rel=\"nofollow\" href=\"#primer-otslezhivanie-dochernih-processov\">\u041f\u0440\u0438\u043c\u0435\u0440: \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u0435 \u0434\u043e\u0447\u0435\u0440\u043d\u0438\u0445 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432<\/a><\/noindex><\/li>\n<li><noindex><a rel=\"nofollow\" href=\"#primer-puti-k-faylam-vmesto-deskriptorov\">\u041f\u0440\u0438\u043c\u0435\u0440: \u043f\u0443\u0442\u0438 \u043a \u0444\u0430\u0439\u043b\u0430\u043c \u0432\u043c\u0435\u0441\u0442\u043e \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440\u043e\u0432<\/a><\/noindex><\/li>\n<li><noindex><a rel=\"nofollow\" href=\"#primer-otslezhivanie-obrascheniy-k-faylam\">\u041f\u0440\u0438\u043c\u0435\u0440: \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u0435 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0439 \u043a \u0444\u0430\u0439\u043b\u0430\u043c<\/a><\/noindex><\/li>\n<li><noindex><a rel=\"nofollow\" href=\"#primer-mnogopotochnye-programmy\">\u041f\u0440\u0438\u043c\u0435\u0440: \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u044b\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b<\/a><\/noindex><\/li>\n<li><noindex><a rel=\"nofollow\" href=\"#master-klass-stek-processa-v-moment-sistemnogo-vyzova\">\u041c\u0430\u0441\u0442\u0435\u0440-\u043a\u043b\u0430\u0441\u0441: \u0441\u0442\u0435\u043a \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u0432 \u043c\u043e\u043c\u0435\u043d\u0442 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0430<\/a><\/noindex><\/li>\n<li><noindex><a rel=\"nofollow\" href=\"#master-klass-inekciya-oshibok\">\u041c\u0430\u0441\u0442\u0435\u0440-\u043a\u043b\u0430\u0441\u0441: \u0438\u043d\u044a\u0435\u043a\u0446\u0438\u044f \u043e\u0448\u0438\u0431\u043e\u043a<\/a><\/noindex><\/li>\n<li><noindex><a rel=\"nofollow\" href=\"#posleslovie\">\u041f\u043e\u0441\u043b\u0435\u0441\u043b\u043e\u0432\u0438\u0435<\/a><\/noindex><\/li>\n<\/ul>\n<p><\/p>\n<h1 id=\"proishozhdenie-vidov\">\u041f\u0440\u043e\u0438\u0441\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u0435 \u0432\u0438\u0434\u043e\u0432<\/h1>\n<p><\/p>\n<p>\u0413\u043b\u0430\u0432\u043d\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043c\u0435\u0436\u0434\u0443 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430\u043c\u0438 \u0438 \u044f\u0434\u0440\u043e\u043c OC \u0432 Unix \u2014 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0435 \u0432\u044b\u0437\u043e\u0432\u044b (\u0430\u043d\u0433\u043b. <em>system calls<\/em>, <em>syscalls<\/em>), \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c \u0441 \u0432\u043d\u0435\u0448\u043d\u0438\u043c \u043c\u0438\u0440\u043e\u043c \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0447\u0435\u0440\u0435\u0437 \u043d\u0438\u0445.<\/p>\n<p><\/p>\n<p>\u041d\u043e \u0432 \u043f\u0435\u0440\u0432\u043e\u0439 \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 Unix (<noindex><a rel=\"nofollow\" href=\"https:\/\/en.wikipedia.org\/wiki\/Version_6_Unix\">Version 6 Unix<\/a><\/noindex>, 1975 \u0433\u043e\u0434) \u0443\u0434\u043e\u0431\u043d\u044b\u0445 \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u044f \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0445 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432 \u043d\u0435 \u0431\u044b\u043b\u043e. \u0414\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b Bell Labs \u043a \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 (<noindex><a rel=\"nofollow\" href=\"https:\/\/en.wikipedia.org\/wiki\/Version_7_Unix\">Version 7 Unix<\/a><\/noindex>, 1979 \u0433\u043e\u0434) \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0438\u043b\u0438 \u043d\u043e\u0432\u044b\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 \u2014 <code>ptrace<\/code>.<\/p>\n<p><\/p>\n<p>\u0420\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043b\u0441\u044f ptrace \u043f\u0440\u0435\u0436\u0434\u0435 \u0432\u0441\u0435\u0433\u043e \u0434\u043b\u044f \u0438\u043d\u0442\u0435\u0440\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0445 \u043e\u0442\u043b\u0430\u0434\u0447\u0438\u043a\u043e\u0432, \u043d\u043e \u043a \u043a\u043e\u043d\u0446\u0443 80-\u0445 (\u0432 \u044d\u043f\u043e\u0445\u0443 \u043a\u043e\u043c\u043c\u0435\u0440\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0443\u0436\u0435 <noindex><a rel=\"nofollow\" href=\"https:\/\/en.wikipedia.org\/wiki\/UNIX_System_V#SVR4\">System V Release 4<\/a><\/noindex>) \u043d\u0430 \u044d\u0442\u043e\u0439 \u043e\u0441\u043d\u043e\u0432\u0435 \u043f\u043e\u044f\u0432\u0438\u043b\u0438\u0441\u044c \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0448\u0438\u0440\u043e\u0447\u0430\u0439\u0448\u0435\u0435 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0443\u0437\u043a\u043e\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u043e\u0442\u043b\u0430\u0434\u0447\u0438\u043a\u0438 \u2014 \u0442\u0440\u0430\u0441\u0441\u0438\u0440\u043e\u0432\u0449\u0438\u043a\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432.<\/p>\n<p><\/p>\n<p><noindex><a rel=\"nofollow\" href=\"https:\/\/stuff.mit.edu\/afs\/sipb\/project\/eichin\/cruft\/machine\/sun\/sun-Strace\">\u041f\u0435\u0440\u0432\u0430\u044f<\/a><\/noindex> \u0436\u0435 \u0432\u0435\u0440\u0441\u0438\u044f strace \u0431\u044b\u043b\u0430 \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043d\u0430 \u041f\u043e\u043b\u043e\u043c \u041a\u0440\u043e\u043d\u0435\u043d\u0431\u0443\u0440\u0433\u043e\u043c \u0432 \u0440\u0430\u0441\u0441\u044b\u043b\u043a\u0435 comp.sources.sun \u0432 1992 \u0433\u043e\u0434\u0443 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u044b \u0437\u0430\u043a\u0440\u044b\u0442\u043e\u0439 \u0443\u0442\u0438\u043b\u0438\u0442\u0435 <code>trace<\/code> \u043e\u0442 Sun. \u041a\u0430\u043a \u043a\u043b\u043e\u043d, \u0442\u0430\u043a \u0438 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0430\u043b\u0438\u0441\u044c \u0434\u043b\u044f SunOS, \u043d\u043e \u043a 1994 \u0433\u043e\u0434\u0443 <code>strace<\/code> \u0431\u044b\u043b\u0430 \u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u043d\u0430 System V, Solaris \u0438 \u043d\u0430\u0431\u0438\u0440\u0430\u044e\u0449\u0438\u0439 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u043e\u0441\u0442\u044c Linux.<\/p>\n<p><\/p>\n<p>\u0421\u0435\u0433\u043e\u0434\u043d\u044f strace \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e Linux \u0438 \u043e\u043f\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u0432\u0441\u0451 \u0442\u043e\u0442 \u0436\u0435 <code>ptrace<\/code>, \u043e\u0431\u0440\u043e\u0441\u0448\u0438\u0439 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e\u043c \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0439.<\/p>\n<p><\/p>\n<p>\u0421\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0439 (\u0438 \u0432\u0435\u0441\u044c\u043c\u0430 \u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0439) \u043c\u0435\u0439\u043d\u0442\u0435\u0439\u043d\u0435\u0440 <code>strace<\/code> \u2014 <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/ldv-alt\">\u0414\u043c\u0438\u0442\u0440\u0438\u0439 \u041b\u0435\u0432\u0438\u043d<\/a><\/noindex>. \u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0435\u043c\u0443 \u0443\u0442\u0438\u043b\u0438\u0442\u0430 \u043e\u0431\u0437\u0430\u0432\u0435\u043b\u0430\u0441\u044c \u043f\u0440\u043e\u0434\u0432\u0438\u043d\u0443\u0442\u044b\u043c\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u043c\u0438 \u0432\u0440\u043e\u0434\u0435 \u0438\u043d\u044a\u0435\u043a\u0446\u0438\u0438 \u043e\u0448\u0438\u0431\u043e\u043a \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0435 \u0432\u044b\u0437\u043e\u0432\u044b, \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u043e\u0439 \u0448\u0438\u0440\u043e\u043a\u043e\u0433\u043e \u0441\u043f\u0435\u043a\u0442\u0440\u0430 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440 \u0438, \u0433\u043b\u0430\u0432\u043d\u043e\u0435, <noindex><a rel=\"nofollow\" href=\"https:\/\/strace.io\/Straus.png\">\u043c\u0430\u0441\u043a\u043e\u0442\u043e\u043c<\/a><\/noindex>. \u041d\u0435\u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0438 \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u044e\u0442, \u0447\u0442\u043e \u0432\u044b\u0431\u043e\u0440 \u043f\u0430\u043b \u043d\u0430 \u0441\u0442\u0440\u0430\u0443\u0441\u0430 \u0438\u0437-\u0437\u0430 \u0441\u043e\u0437\u0432\u0443\u0447\u043d\u043e\u0441\u0442\u0438 \u0440\u0443\u0441\u0441\u043a\u043e\u0433\u043e \u0441\u043b\u043e\u0432\u0430 \u00ab\u0441\u0442\u0440\u0430\u0443\u0441\u00bb \u0438 \u0430\u043d\u0433\u043b\u0438\u0439\u0441\u043a\u043e\u0433\u043e &quot;strace&quot;.<\/p>\n<p><\/p>\n<p>\u041d\u0435\u043c\u0430\u043b\u043e\u0432\u0430\u0436\u043d\u043e \u0438 \u0442\u043e, \u0447\u0442\u043e \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 ptrace \u0438 \u0442\u0440\u0430\u0441\u0441\u0438\u0440\u043e\u0432\u0449\u0438\u043a\u0438 \u0442\u0430\u043a \u0438 \u043d\u0435 \u0431\u044b\u043b\u0438 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u044b \u0432 POSIX, \u043d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u0434\u043e\u043b\u0433\u0443\u044e \u0438\u0441\u0442\u043e\u0440\u0438\u044e \u0438 \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0432 Linux, FreeBSD, OpenBSD \u0438 \u0442\u0440\u0430\u0434\u0438\u0446\u0438\u043e\u043d\u043d\u044b\u0445 Unix.<\/p>\n<p><\/p>\n<h1 id=\"ustroystvo-strace-v-dvuh-slovah-piglet-trace\">\u0423\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e strace \u0432 \u0434\u0432\u0443\u0445 \u0441\u043b\u043e\u0432\u0430\u0445: Piglet Trace<\/h1>\n<p><\/p>\n<blockquote><p>&quot;You are not expected to understand this&quot; (\u0414\u0435\u043d\u043d\u0438\u0441 \u0420\u0438\u0447\u0438, \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439 \u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u043c \u043a\u043e\u0434\u0435 Version 6 Unix)<\/p><\/blockquote>\n<p>\u0421 \u0440\u0430\u043d\u043d\u0435\u0433\u043e \u0434\u0435\u0442\u0441\u0442\u0432\u0430 \u044f \u0442\u0435\u0440\u043f\u0435\u0442\u044c \u043d\u0435 \u043c\u043e\u0433\u0443 \u0447\u0451\u0440\u043d\u044b\u0435 \u044f\u0449\u0438\u043a\u0438: \u0441 \u0438\u0433\u0440\u0443\u0448\u043a\u0430\u043c\u0438 \u044f \u043d\u0435 \u0438\u0433\u0440\u0430\u043b, \u0430 \u043f\u044b\u0442\u0430\u043b\u0441\u044f \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0432 \u0438\u0445 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0435 (\u0432\u0437\u0440\u043e\u0441\u043b\u044b\u0435 \u0443\u043f\u043e\u0442\u0440\u0435\u0431\u043b\u044f\u043b\u0438 \u0441\u043b\u043e\u0432\u043e \u00ab\u043b\u043e\u043c\u0430\u043b\u00bb, \u043d\u043e \u043d\u0435 \u0432\u0435\u0440\u044c\u0442\u0435 \u0437\u043b\u044b\u043c \u044f\u0437\u044b\u043a\u0430\u043c). \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u043d\u0435 \u0442\u0430\u043a \u0431\u043b\u0438\u0437\u043a\u0438 \u043d\u0435\u0444\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u0430\u044f \u043a\u0443\u043b\u044c\u0442\u0443\u0440\u0430 \u043f\u0435\u0440\u0432\u044b\u0445 Unix \u0438 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0433\u043e open-source-\u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f.<\/p>\n<p><\/p>\n<p>\u0412 \u0440\u0430\u043c\u043a\u0430\u0445 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u0440\u0430\u0437\u0434\u043e\u0431\u0440\u0435\u0432\u0448\u0435\u0439 \u0437\u0430 \u0434\u0435\u0441\u044f\u0442\u0438\u043b\u0435\u0442\u0438\u044f strace \u043d\u0435\u0440\u0430\u0437\u0443\u043c\u043d\u043e. \u041d\u043e \u0438 \u0442\u0430\u0439\u043d \u0434\u043b\u044f \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u0435\u0439 \u043e\u0441\u0442\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u043e. \u041f\u043e\u044d\u0442\u043e\u043c\u0443, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u0440\u0438\u043d\u0446\u0438\u043f \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 strace \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c, \u044f \u043f\u0440\u0438\u0432\u0435\u0434\u0443 \u043a\u043e\u0434 \u043c\u0438\u043d\u0438\u0430\u0442\u044e\u0440\u043d\u043e\u0433\u043e \u0442\u0440\u0430\u0441\u0441\u0438\u0440\u043e\u0432\u0449\u0438\u043a\u0430 \u2014 <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/vkazanov\/strace-post\/blob\/master\/examples\/piglet-trace.c\">Piglet Trace<\/a><\/noindex> (ptr). \u041d\u0438\u0447\u0435\u0433\u043e \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0433\u043e \u043e\u043d \u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0435 \u0443\u043c\u0435\u0435\u0442, \u043d\u043e \u0433\u043b\u0430\u0432\u043d\u043e\u0435 \u2014 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0435 \u0432\u044b\u0437\u043e\u0432\u044b \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u2014 \u0432\u044b\u0432\u043e\u0434\u0438\u0442:<\/p>\n<p><\/p>\n<pre><code class=\"plaintext\">$ gcc examples\/piglet-trace.c -o ptr\n$ ptr echo test &gt; \/dev\/null\nBRK(12) -&gt; 94744690540544\nACCESS(21) -&gt; 18446744073709551614\nACCESS(21) -&gt; 18446744073709551614\nunknown(257) -&gt; 3\nFSTAT(5) -&gt; 0\nMMAP(9) -&gt; 140694657216512\nCLOSE(3) -&gt; 0\nACCESS(21) -&gt; 18446744073709551614\nunknown(257) -&gt; 3\nREAD(0) -&gt; 832\nFSTAT(5) -&gt; 0\nMMAP(9) -&gt; 140694657208320\nMMAP(9) -&gt; 140694650953728\nMPROTECT(10) -&gt; 0\nMMAP(9) -&gt; 140694655045632\nMMAP(9) -&gt; 140694655070208\nCLOSE(3) -&gt; 0\nunknown(158) -&gt; 0\nMPROTECT(10) -&gt; 0\nMPROTECT(10) -&gt; 0\nMPROTECT(10) -&gt; 0\nMUNMAP(11) -&gt; 0\nBRK(12) -&gt; 94744690540544\nBRK(12) -&gt; 94744690675712\nunknown(257) -&gt; 3\nFSTAT(5) -&gt; 0\nMMAP(9) -&gt; 140694646390784\nCLOSE(3) -&gt; 0\nFSTAT(5) -&gt; 0\nIOCTL(16) -&gt; 18446744073709551591\nWRITE(1) -&gt; 5\nCLOSE(3) -&gt; 0\nCLOSE(3) -&gt; 0\nunknown(231)\nTracee terminated<\/code><\/pre>\n<p><\/p>\n<p>Piglet Trace \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0435\u0442 \u043f\u043e\u0440\u044f\u0434\u043a\u0430 \u0441\u043e\u0442\u043d\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432 Linux (\u0441\u043c. <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/vkazanov\/strace-post\/blob\/master\/examples\/piglet-trace-syscalls.h\">\u0442\u0430\u0431\u043b\u0438\u0446\u0443<\/a><\/noindex>) \u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0435 x86-64. \u0414\u043b\u044f \u0443\u0447\u0435\u0431\u043d\u044b\u0445 \u0446\u0435\u043b\u0435\u0439 \u044d\u0442\u043e\u0433\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e.<\/p>\n<p><\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0437\u0431\u0435\u0440\u0451\u043c \u0440\u0430\u0431\u043e\u0442\u0443 \u043d\u0430\u0448\u0435\u0433\u043e \u043a\u043b\u043e\u043d\u0430. \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441 Linux \u0434\u043b\u044f \u043e\u0442\u043b\u0430\u0434\u0447\u0438\u043a\u043e\u0432 \u0438 \u0442\u0440\u0430\u0441\u0441\u0438\u0440\u043e\u0432\u0449\u0438\u043a\u043e\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f, \u043a\u0430\u043a \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u043b\u043e\u0441\u044c \u0432\u044b\u0448\u0435, \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 ptrace. \u041e\u043d \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0432 \u043f\u0435\u0440\u0432\u043e\u043c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0435 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u043e\u0432 \u043a\u043e\u043c\u0430\u043d\u0434, \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u044b \u0442\u043e\u043b\u044c\u043a\u043e <code>PTRACE_TRACEME<\/code>, <code>PTRACE_SYSCALL<\/code> \u0438 <code>PTRACE_GETREGS<\/code>.<\/p>\n<p><\/p>\n<p>\u0420\u0430\u0431\u043e\u0442\u0430 \u0442\u0440\u0430\u0441\u0441\u0438\u0440\u043e\u0432\u0449\u0438\u043a\u0430 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0432 \u043e\u0431\u044b\u0447\u043d\u043e\u043c Unix-\u0441\u0442\u0438\u043b\u0435: <code>fork(2)<\/code> \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u0434\u043e\u0447\u0435\u0440\u043d\u0438\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441, \u0430 \u0442\u043e\u0442 \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>exec(3)<\/code> \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u0438\u0441\u0441\u043b\u0435\u0434\u0443\u0435\u043c\u0443\u044e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443. \u0415\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u0430\u044f \u0442\u043e\u043d\u043a\u043e\u0441\u0442\u044c \u0437\u0434\u0435\u0441\u044c \u2014 \u0432\u044b\u0437\u043e\u0432 <code>ptrace(PTRACE_TRACEME)<\/code> \u043f\u0435\u0440\u0435\u0434 <code>exec<\/code>: \u043f\u0440\u043e\u0446\u0435\u0441\u0441-\u043f\u043e\u0442\u043e\u043c\u043e\u043a \u043e\u0436\u0438\u0434\u0430\u0435\u0442, \u0447\u0442\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441-\u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c \u0431\u0443\u0434\u0435\u0442 \u0435\u0433\u043e \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0442\u044c:<\/p>\n<p><\/p>\n<pre><code class=\"cpp\">pid_t child_pid = fork();\nswitch (child_pid) {\ncase -1:\n    err(EXIT_FAILURE, &quot;fork&quot;);\ncase 0:\n    \/* Child here *\/\n    \/* A traced mode has to be enabled. A parent will have to wait(2) for it\n     * to happen. *\/\n    ptrace(PTRACE_TRACEME, 0, NULL, NULL);\n    \/* Replace itself with a program to be run. *\/\n    execvp(argv[1], argv + 1);\n    err(EXIT_FAILURE, &quot;exec&quot;);\n}<\/code><\/pre>\n<p><\/p>\n<p>\u041f\u0440\u043e\u0446\u0435\u0441\u0441-\u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c \u0442\u0435\u043f\u0435\u0440\u044c \u0434\u043e\u043b\u0436\u0435\u043d \u0432\u044b\u0437\u0432\u0430\u0442\u044c <code>wait(2)<\/code> \u0432 \u0434\u043e\u0447\u0435\u0440\u043d\u0435\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435, \u0442\u043e \u0435\u0441\u0442\u044c \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0432 \u0440\u0435\u0436\u0438\u043c \u0442\u0440\u0430\u0441\u0441\u0438\u0440\u043e\u0432\u043a\u0438 \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u043e:<\/p>\n<p><\/p>\n<pre><code class=\"cpp\">\/* Parent *\/\n\n\/* First we wait for the child to set the traced mode (see\n * ptrace(PTRACE_TRACEME) above) *\/\nif (waitpid(child_pid, NULL, 0) == -1)\n    err(EXIT_FAILURE, &quot;traceme -&gt; waitpid&quot;);<\/code><\/pre>\n<p><\/p>\n<p>\u041d\u0430 \u044d\u0442\u043e\u043c \u043f\u0440\u0438\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043a\u043e\u043d\u0447\u0435\u043d\u044b \u0438 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0430\u0442\u044c \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043a \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u0432 \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u043e\u043c \u0446\u0438\u043a\u043b\u0435.<\/p>\n<p><\/p>\n<p>\u0412\u044b\u0437\u043e\u0432 <code>ptrace(PTRACE_SYSCALL)<\/code> \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u0435\u0442, \u0447\u0442\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 <code>wait<\/code> \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044f \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u0441\u044f \u043b\u0438\u0431\u043e \u043f\u0435\u0440\u0435\u0434 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435\u043c \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0430, \u043b\u0438\u0431\u043e \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u0441\u043b\u0435 \u0435\u0433\u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f. \u041c\u0435\u0436\u0434\u0443 \u0434\u0432\u0443\u043c\u044f \u0432\u044b\u0437\u043e\u0432\u0430\u043c\u0438 \u043c\u043e\u0436\u043d\u043e \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0438\u0442\u044c \u043a\u0430\u043a\u0438\u0435-\u043b\u0438\u0431\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f: \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0432\u044b\u0437\u043e\u0432 \u043d\u0430 \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0439, \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u0438\u043b\u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435.<\/p>\n<p><\/p>\n<p>\u041d\u0430\u043c \u0436\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0434\u0432\u0430\u0436\u0434\u044b \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u0443 <code>ptrace(PTRACE_GETREGS)<\/code>, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 <code>rax<\/code> \u0434\u043e \u0432\u044b\u0437\u043e\u0432\u0430 (\u043d\u043e\u043c\u0435\u0440 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0430) \u0438 \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u0441\u043b\u0435 (\u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435).<\/p>\n<p><\/p>\n<p>\u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0446\u0438\u043a\u043b:<\/p>\n<p><\/p>\n<pre><code class=\"cpp\">\/* A system call tracing loop, one interation per call. *\/\nfor (;;) {\n    \/* A non-portable structure defined for ptrace\/GDB\/strace usage mostly.\n     * It allows to conveniently dump and access register state using\n     * ptrace. *\/\n    struct user_regs_struct registers;\n\n    \/* Enter syscall: continue execution until the next system call\n     * beginning. Stop right before syscall.\n     *\n     * It's possible to change the system call number, system call\n     * arguments, return value or even avoid executing the system call\n     * completely. *\/\n  if (ptrace(PTRACE_SYSCALL, child_pid, NULL, NULL) == -1)\n      err(EXIT_FAILURE, &quot;enter_syscall&quot;);\n  if (waitpid(child_pid, NULL, 0) == -1)\n      err(EXIT_FAILURE, &quot;enter_syscall -&gt; waitpid&quot;);\n\n  \/* According to the x86-64 system call convention on Linux (see man 2\n   * syscall) the number identifying a syscall should be put into the rax\n   * general purpose register, with the rest of the arguments residing in\n   * other general purpose registers (rdi,rsi, rdx, r10, r8, r9). *\/\n  if (ptrace(PTRACE_GETREGS, child_pid, NULL, &amp;registers) == -1)\n      err(EXIT_FAILURE, &quot;enter_syscall -&gt; getregs&quot;);\n\n  \/* Note how orig_rax is used here. That's because on x86-64 rax is used\n   * both for executing a syscall, and returning a value from it. To\n   * differentiate between the cases both rax and orig_rax are updated on\n   * syscall entry\/exit, and only rax is updated on exit. *\/\n  print_syscall_enter(registers.orig_rax);\n\n  \/* Exit syscall: execute of the syscall, and stop on system\n   * call exit.\n   *\n   * More system call tinkering possible: change the return value, record\n   * time it took to finish the system call, etc. *\/\n  if (ptrace(PTRACE_SYSCALL, child_pid, NULL, NULL) == -1)\n      err(EXIT_FAILURE, &quot;exit_syscall&quot;);\n  if (waitpid(child_pid, NULL, 0) == -1)\n      err(EXIT_FAILURE, &quot;exit_syscall -&gt; waitpid&quot;);\n\n  \/* Retrieve register state again as we want to inspect system call\n   * return value. *\/\n  if (ptrace(PTRACE_GETREGS, child_pid, NULL, &amp;registers) == -1) {\n      \/* ESRCH is returned when a child terminates using a syscall and no\n       * return value is possible, e.g. as a result of exit(2). *\/\n      if (errno == ESRCH) {\n          fprintf(stderr, &quot;nTracee terminatedn&quot;);\n          break;\n      }\n      err(EXIT_FAILURE, &quot;exit_syscall -&gt; getregs&quot;);\n  }\n\n  \/* Done with this system call, let the next iteration handle the next\n   * one *\/\n  print_syscall_exit(registers.rax);\n}<\/code><\/pre>\n<p><\/p>\n<p>\u0412\u043e\u0442 \u0438 \u0432\u0435\u0441\u044c \u0442\u0440\u0430\u0441\u0441\u0438\u0440\u043e\u0432\u0449\u0438\u043a. \u0422\u0435\u043f\u0435\u0440\u044c \u0432\u044b \u0437\u043d\u0430\u0435\u0442\u0435, \u0441 \u0447\u0435\u0433\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u0442\u044c \u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e\u0435 \u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 <noindex><a rel=\"nofollow\" href=\"https:\/\/en.wikipedia.org\/wiki\/DTrace\">DTrace<\/a><\/noindex> \u043d\u0430 Linux.<\/p>\n<p><\/p>\n<h1 id=\"azy-zapusk-programmy-pod-upravleniem-strace\">\u0410\u0437\u044b: \u0437\u0430\u043f\u0443\u0441\u043a \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u043f\u043e\u0434 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435\u043c strace<\/h1>\n<p><\/p>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f <code>strace<\/code>, \u043f\u043e\u0436\u0430\u043b\u0443\u0439, \u0441\u0442\u043e\u0438\u0442 \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u0441\u0430\u043c\u044b\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u2014 \u0437\u0430\u043f\u0443\u0441\u043a \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043f\u043e\u0434 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435\u043c <code>strace<\/code>.<\/p>\n<p><\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u043d\u0435 \u043a\u043e\u043f\u0430\u0442\u044c\u0441\u044f \u0432 \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u043e\u043c \u0441\u043f\u0438\u0441\u043a\u0435 \u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u0442\u0438\u043f\u0438\u0447\u043d\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b, \u043d\u0430\u043f\u0438\u0448\u0435\u043c <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/vkazanov\/strace-post\/blob\/master\/examples\/write-simple.c\">\u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u0443\u044e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443<\/a><\/noindex> \u0432\u043e\u043a\u0440\u0443\u0433 <code>write<\/code>:<\/p>\n<p><\/p>\n<pre><code class=\"cpp\">int main(int argc, char *argv[])\n{\n    char str[] = &quot;write me to stdoutn&quot;;\n    \/* write(2) is a simple wrapper around a syscall so it should be easy to\n     * find in the syscall trace. *\/\n    if (sizeof(str) != write(STDOUT_FILENO, str, sizeof(str))){\n        perror(&quot;write&quot;);\n        return EXIT_FAILURE;\n    }\n    return EXIT_SUCCESS;\n}\n<\/code><\/pre>\n<p><\/p>\n<p>\u0421\u043e\u0431\u0435\u0440\u0435\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u0438 \u0443\u0431\u0435\u0434\u0438\u043c\u0441\u044f, \u0447\u0442\u043e \u043e\u043d\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442:<\/p>\n<p><\/p>\n<pre><code class=\"plaintext\">$ gcc examples\/write-simple.c -o write-simple\n$ .\/write-simple\nwrite me to stdout<\/code><\/pre>\n<p><\/p>\n<p>\u0418 \u043d\u0430\u043a\u043e\u043d\u0435\u0446 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u0435\u0435 \u043f\u043e\u0434 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435\u043c strace:<\/p>\n<p><\/p>\n<pre><code class=\"plaintext\">$ strace .\/write-simple\npexecve(&quot;.\/write&quot;, [&quot;.\/write&quot;], 0x7ffebd6145b0 \/* 71 vars *\/) = 0\nbrk(NULL)                               = 0x55ff5489e000\naccess(&quot;\/etc\/ld.so.nohwcap&quot;, F_OK)      = -1 ENOENT (No such file or directory)\naccess(&quot;\/etc\/ld.so.preload&quot;, R_OK)      = -1 ENOENT (No such file or directory)\nopenat(AT_FDCWD, &quot;\/etc\/ld.so.cache&quot;, O_RDONLY|O_CLOEXEC) = 3\nfstat(3, {st_mode=S_IFREG|0644, st_size=197410, ...}) = 0\nmmap(NULL, 197410, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f7a2a633000\nclose(3)                                = 0\naccess(&quot;\/etc\/ld.so.nohwcap&quot;, F_OK)      = -1 ENOENT (No such file or directory)\nopenat(AT_FDCWD, &quot;\/lib\/x86_64-linux-gnu\/libc.so.6&quot;, O_RDONLY|O_CLOEXEC) = 3\nread(3, &quot;177ELF2113\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00003\u0000&gt;\u00001\u0000\u0000\u0000260342\u0000\u0000\u0000\u0000\u0000&quot;..., 832) = 832\nfstat(3, {st_mode=S_IFREG|0755, st_size=2030544, ...}) = 0\nmmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f7a2a631000\nmmap(NULL, 4131552, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f7a2a04c000\nmprotect(0x7f7a2a233000, 2097152, PROT_NONE) = 0\nmmap(0x7f7a2a433000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1e7000) = 0x7f7a2a433000\nmmap(0x7f7a2a439000, 15072, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f7a2a439000\nclose(3)                                = 0\narch_prctl(ARCH_SET_FS, 0x7f7a2a6324c0) = 0\nmprotect(0x7f7a2a433000, 16384, PROT_READ) = 0\nmprotect(0x55ff52b52000, 4096, PROT_READ) = 0\nmprotect(0x7f7a2a664000, 4096, PROT_READ) = 0\nmunmap(0x7f7a2a633000, 197410)          = 0\nwrite(1, &quot;write me to stdoutn\u0000&quot;, 20write me to stdout\n)  = 20\nexit_group(0)                           = ?<\/code><\/pre>\n<p><\/p>\n<p>\u041e\u0447\u0435\u043d\u044c \u00ab\u043c\u043d\u043e\u0433\u043e\u0441\u043b\u043e\u0432\u043d\u043e\u00bb \u0438 \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u0437\u043d\u0430\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e. \u041f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0437\u0434\u0435\u0441\u044c \u0434\u0432\u0435: \u0432\u044b\u0432\u043e\u0434 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0441\u043c\u0435\u0448\u0430\u043d \u0441 \u0432\u044b\u0432\u043e\u0434\u043e\u043c <code>strace<\/code> \u0438 \u0438\u0437\u043e\u0431\u0438\u043b\u0438\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u0441 \u043d\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u044e\u0442.<\/p>\n<p><\/p>\n<p>\u0420\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u044c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u043f\u043e\u0442\u043e\u043a \u0432\u044b\u0432\u043e\u0434\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0438 \u0432\u044b\u0432\u043e\u0434 \u043e\u0448\u0438\u0431\u043e\u043a strace \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043a\u043b\u044e\u0447\u0430 -o, \u043f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0435\u0433\u043e \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u0432 \u0444\u0430\u0439\u043b-\u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442.<\/p>\n<p><\/p>\n<p>\u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0441 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439 \u00ab\u043b\u0438\u0448\u043d\u0438\u0445\u00bb \u0432\u044b\u0437\u043e\u0432\u043e\u0432. \u041f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0447\u0442\u043e \u043d\u0430\u0441 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u044e\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u044b\u0437\u043e\u0432\u044b <code>write<\/code>. \u041a\u043b\u044e\u0447 <code>-e<\/code> \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f, \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0431\u0443\u0434\u0443\u0442 \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0435 \u0432\u044b\u0437\u043e\u0432\u044b. \u0421\u0430\u043c\u044b\u0439 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0443\u0441\u043b\u043e\u0432\u0438\u044f \u2014 \u0435\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e, <code>trace=*<\/code>, \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u044e\u0449\u0438\u0435 \u043d\u0430\u0441 \u0432\u044b\u0437\u043e\u0432\u044b.<\/p>\n<p><\/p>\n<p>\u041f\u0440\u0438 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 <code>-o<\/code> \u0438 <code>-e<\/code> \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c:<\/p>\n<p><\/p>\n<pre><code class=\"plaintext\">$ strace -e trace=write -owrite-simple.log .\/write-simple\nwrite me to stdout\n$ cat write-simple.log\nwrite(1, &quot;write me to stdoutn\u0000&quot;, 20\n)  = 20\n+++ exited with 0 +++<\/code><\/pre>\n<p><\/p>\n<p>\u0422\u0430\u043a, \u0441\u043e\u0433\u043b\u0430\u0441\u0438\u0442\u0435\u0441\u044c, \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0449\u0435 \u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f.<\/p>\n<p><\/p>\n<p>\u0410 \u0435\u0449\u0451 \u043c\u043e\u0436\u043d\u043e \u0443\u0431\u0438\u0440\u0430\u0442\u044c \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0435 \u0432\u044b\u0437\u043e\u0432\u044b \u2014 \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u0441 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u0435\u043c \u0438 \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0435\u043d\u0438\u0435\u043c \u043f\u0430\u043c\u044f\u0442\u0438:<\/p>\n<p><\/p>\n<pre><code class=\"plaintext\">$ strace -e trace=!brk,mmap,mprotect,munmap -owrite-simple.log .\/write-simple\nwrite me to stdout\n$ cat write-simple.log\nexecve(&quot;.\/write-simple&quot;, [&quot;.\/write-simple&quot;], 0x7ffe9972a498 \/* 69 vars *\/) = 0\naccess(&quot;\/etc\/ld.so.nohwcap&quot;, F_OK)      = -1 ENOENT (No such file or directory)\naccess(&quot;\/etc\/ld.so.preload&quot;, R_OK)      = -1 ENOENT (No such file or directory)\nopenat(AT_FDCWD, &quot;\/etc\/ld.so.cache&quot;, O_RDONLY|O_CLOEXEC) = 3\nfstat(3, {st_mode=S_IFREG|0644, st_size=124066, ...}) = 0\nclose(3)                                = 0\naccess(&quot;\/etc\/ld.so.nohwcap&quot;, F_OK)      = -1 ENOENT (No such file or directory)\nopenat(AT_FDCWD, &quot;\/lib\/x86_64-linux-gnu\/libc.so.6&quot;, O_RDONLY|O_CLOEXEC) = 3\nread(3, &quot;177ELF2113\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00003\u0000&gt;\u00001\u0000\u0000\u0000260342\u0000\u0000\u0000\u0000\u0000&quot;..., 832) = 832\nfstat(3, {st_mode=S_IFREG|0755, st_size=2030544, ...}) = 0\nclose(3)                                = 0\narch_prctl(ARCH_SET_FS, 0x7f00f0be74c0) = 0\nwrite(1, &quot;write me to stdoutn\u0000&quot;, 20)  = 20\nexit_group(0)                           = ?\n+++ exited with 0 +++<\/code><\/pre>\n<p><\/p>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u044d\u043a\u0440\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0432\u043e\u0441\u043a\u043b\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0437\u043d\u0430\u043a \u0432 \u0441\u043f\u0438\u0441\u043a\u0435 \u0438\u0441\u043a\u043b\u044e\u0447\u0451\u043d\u043d\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432: \u044d\u0442\u043e\u0433\u043e \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u0430\u044f \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0430 (\u0430\u043d\u0433\u043b. <em>shell<\/em>).<\/p>\n<p><\/p>\n<p>\u0412 \u043c\u043e\u0435\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 glibc \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 <code>exit_group<\/code>, \u0430 \u043d\u0435 \u0442\u0440\u0430\u0434\u0438\u0446\u0438\u043e\u043d\u043d\u044b\u0439 <code>_exit<\/code>. \u0412 \u044d\u0442\u043e\u043c \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u043c\u0438 \u0432\u044b\u0437\u043e\u0432\u0430\u043c\u0438: \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442, \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u043f\u0440\u044f\u043c\u043e\u0433\u043e \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u044f \u043a \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u043c \u0432\u044b\u0437\u043e\u0432\u0430\u043c. \u0411\u043e\u043b\u0435\u0435 \u0442\u043e\u0433\u043e, \u043e\u043d \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e \u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b.<\/p>\n<p><\/p>\n<h1 id=\"azy-prisoedinenie-k-processu-na-letu\">\u0410\u0437\u044b: \u043f\u0440\u0438\u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u043a \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0443 \u043d\u0430 \u043b\u0435\u0442\u0443<\/h1>\n<p><\/p>\n<p>\u0418\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 ptrace, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0430 <code>strace<\/code>, \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0432 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435. \u0422\u0430\u043a\u043e\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435, \u0431\u044b\u0442\u044c \u043c\u043e\u0436\u0435\u0442, \u0437\u0432\u0443\u0447\u0430\u043b\u043e \u0440\u0430\u0437\u0443\u043c\u043d\u043e \u0432\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0430 Version 6 Unix. \u0412 \u043d\u0430\u0448\u0438 \u0436\u0435 \u0434\u043d\u0438 \u044d\u0442\u043e\u0433\u043e \u0443\u0436\u0435 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e: \u0431\u044b\u0432\u0430\u0435\u0442, \u043d\u0443\u0436\u043d\u043e \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0435\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b. \u0422\u0438\u043f\u0438\u0447\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u2014 \u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043d\u0430 \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440\u0435 \u0438\u043b\u0438 \u0441\u043f\u044f\u0449\u0438\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f <code>strace<\/code> \u0443\u043c\u0435\u0435\u0442 \u043f\u0440\u0438\u0441\u043e\u0435\u0434\u0438\u043d\u044f\u0442\u044c\u0441\u044f \u043a \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430\u043c \u043d\u0430 \u043b\u0435\u0442\u0443.<\/p>\n<p><\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u0437\u0430\u0432\u0438\u0441\u0430\u044e\u0449\u0435\u0439 <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/vkazanov\/strace-post\/blob\/master\/examples\/write-sleep.c\">\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b<\/a><\/noindex>:<\/p>\n<p><\/p>\n<pre><code class=\"cpp\">int main(int argc, char *argv[])\n{\n    (void) argc; (void) argv;\n\n    char str[] = &quot;write men&quot;;\n\n    write(STDOUT_FILENO, str, sizeof(str));\n\n    \/* Sleep indefinitely or until a signal arrives *\/\n    pause();\n\n    write(STDOUT_FILENO, str, sizeof(str));\n\n    return EXIT_SUCCESS;\n}<\/code><\/pre>\n<p><\/p>\n<p>\u0421\u043e\u0431\u0435\u0440\u0451\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u0438 \u0443\u0431\u0435\u0434\u0438\u043c\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043e\u043d\u0430 \u0437\u0430\u0432\u0438\u0441\u043b\u0430:<\/p>\n<p><\/p>\n<pre><code class=\"plaintext\">$ gcc examples\/write-sleep.c -o write-sleep\n$ .\/write-sleep\n.\/write-sleep\nwrite me\n^C\n$<\/code><\/pre>\n<p><\/p>\n<p>\u0410 \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043f\u0440\u0438\u0441\u043e\u0435\u0434\u0438\u043d\u0438\u0442\u044c\u0441\u044f \u043a \u043d\u0435\u0439:<\/p>\n<p><\/p>\n<pre><code class=\"plaintext\">$ .\/write-sleep &amp;\n[1] 15329\nwrite me\n$ strace -p 15329\nstrace: Process 15329 attached\npause(\n^Cstrace: Process 15329 detached\n &lt;detached ...&gt;<\/code><\/pre>\n<p><\/p>\n<p>\u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u0432\u044b\u0437\u043e\u0432\u043e\u043c <code>pause<\/code>. \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a \u043e\u043d\u0430 \u043e\u0442\u0440\u0435\u0430\u0433\u0438\u0440\u0443\u0435\u0442 \u043d\u0430 \u0441\u0438\u0433\u043d\u0430\u043b\u044b:<\/p>\n<p><\/p>\n<pre><code class=\"plaintext\">$ strace -o write-sleep.log -p 15329 &amp;\nstrace: Process 15329 attached\n$\n$ kill -CONT 15329\n$ cat write-sleep.log\npause()                                 = ? ERESTARTNOHAND (To be restarted if no handler)\n--- SIGCONT {si_signo=SIGCONT, si_code=SI_USER, si_pid=14989, si_uid=1001} ---\npause(\n$\n$ kill -TERM 15329\n$ cat write-sleep.log\npause()                                 = ? ERESTARTNOHAND (To be restarted if no handler)\n--- SIGCONT {si_signo=SIGCONT, si_code=SI_USER, si_pid=14989, si_uid=1001} ---\npause()                                 = ? ERESTARTNOHAND (To be restarted if no handler)\n--- SIGTERM {si_signo=SIGTERM, si_code=SI_USER, si_pid=14989, si_uid=1001} ---\n+++ killed by SIGTERM +++<\/code><\/pre>\n<p><\/p>\n<p>\u041c\u044b \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043b\u0438 \u0437\u0430\u0432\u0438\u0441\u043d\u0443\u0432\u0448\u0443\u044e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u0438 \u043f\u0440\u0438\u0441\u043e\u0435\u0434\u0438\u043d\u0438\u043b\u0438\u0441\u044c \u043a \u043d\u0435\u0439 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 <code>strace<\/code>. \u0412\u044b\u044f\u0441\u043d\u0438\u043b\u0438\u0441\u044c \u0434\u0432\u0435 \u0432\u0435\u0449\u0438: \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 pause \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u0443\u0435\u0442 \u0441\u0438\u0433\u043d\u0430\u043b\u044b \u0431\u0435\u0437 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0438, \u0447\u0442\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0435\u0435, strace \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0435\u0442 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0435 \u0432\u044b\u0437\u043e\u0432\u044b, \u043d\u043e \u0438 \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0435 \u0441\u0438\u0433\u043d\u0430\u043b\u044b.<\/p>\n<p><\/p>\n<h1 id=\"primer-otslezhivanie-dochernih-processov\">\u041f\u0440\u0438\u043c\u0435\u0440: \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u0435 \u0434\u043e\u0447\u0435\u0440\u043d\u0438\u0445 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432<\/h1>\n<p><\/p>\n<p>\u0420\u0430\u0431\u043e\u0442\u0430 \u0441 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430\u043c\u0438 \u0447\u0435\u0440\u0435\u0437 \u0432\u044b\u0437\u043e\u0432 <code>fork<\/code> \u2014 \u043e\u0441\u043d\u043e\u0432\u0430 \u0432\u0441\u0435\u0445 Unix. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a strace \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 \u0434\u0435\u0440\u0435\u0432\u043e\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432 \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043d\u0435\u0441\u043b\u043e\u0436\u043d\u043e\u0439 \u00ab\u043f\u043b\u043e\u0434\u044f\u0449\u0435\u0439\u0441\u044f\u00bb <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/vkazanov\/strace-post\/blob\/master\/examples\/fork-write.c\">\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b<\/a><\/noindex>:<\/p>\n<p><\/p>\n<pre><code class=\"cpp\">int main(int argc, char *argv[])\n{\n    pid_t parent_pid = getpid();\n    pid_t child_pid = fork();\n    if (child_pid == 0) {\n        \/* A child is born! *\/\n        child_pid = getpid();\n\n        \/* In the end of the day printf is just a call to write(2). *\/\n        printf(&quot;child (self=%d)n&quot;, child_pid);\n        exit(EXIT_SUCCESS);\n    }\n\n    printf(&quot;parent (self=%d, child=%d)n&quot;, parent_pid, child_pid);\n\n    wait(NULL);\n\n    exit(EXIT_SUCCESS);\n}<\/code><\/pre>\n<p><\/p>\n<p>\u0417\u0434\u0435\u0441\u044c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0441\u043e\u0437\u0434\u0430\u0451\u0442 \u0434\u043e\u0447\u0435\u0440\u043d\u0438\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441, \u043e\u0431\u0430 \u043f\u0438\u0448\u0443\u0442 \u0432 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u043f\u043e\u0442\u043e\u043a \u0432\u044b\u0432\u043e\u0434\u0430:<\/p>\n<p><\/p>\n<pre><code class=\"plaintext\">$ gcc examples\/fork-write.c -o fork-write\n$ .\/fork-write\nparent (self=11274, child=11275)\nchild (self=11275)<\/code><\/pre>\n<p><\/p>\n<p>\u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043c\u044b \u0443\u0432\u0438\u0434\u0438\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0435 \u0432\u044b\u0437\u043e\u0432\u044b \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430:<\/p>\n<p><\/p>\n<pre><code class=\"plaintext\">$ strace -e trace=write -ofork-write.log .\/fork-write\nchild (self=22049)\nparent (self=22048, child=22049)\n$ cat fork-write.log\nwrite(1, &quot;parent (self=22048, child=22049)&quot;..., 33) = 33\n--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=22049, si_uid=1001, si_status=0, si_utime=0, si_stime=0} ---\n+++ exited with 0 +++<\/code><\/pre>\n<p><\/p>\n<p>\u041e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0442\u044c \u0434\u0435\u0440\u0435\u0432\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432 \u0446\u0435\u043b\u0438\u043a\u043e\u043c \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u0444\u043b\u0430\u0433 <code>-f<\/code>, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c <code>strace<\/code> \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0435\u0442 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0435 \u0432\u044b\u0437\u043e\u0432\u044b \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430\u0445-\u043f\u043e\u0442\u043e\u043c\u043a\u0430\u0445. \u041a \u043a\u0430\u0436\u0434\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \u0432\u044b\u0432\u043e\u0434\u0430 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f <code>pid<\/code> \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430, \u0434\u0435\u043b\u0430\u044e\u0449\u0435\u0433\u043e \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439 \u0432\u044b\u0432\u043e\u0434:<\/p>\n<p><\/p>\n<pre><code class=\"plaintext\">$ strace -f -e trace=write -ofork-write.log .\/fork-write\nparent (self=22710, child=22711)\nchild (self=22711)\n$ cat fork-write.log\n22710 write(1, &quot;parent (self=22710, child=22711)&quot;..., 33) = 33\n22711 write(1, &quot;child (self=22711)n&quot;, 19) = 19\n22711 +++ exited with 0 +++\n22710 --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=22711, si_uid=1001, si_status=0, si_utime=0, si_stime=0} ---\n22710 +++ exited with 0 +++<\/code><\/pre>\n<p><\/p>\n<p>\u0412 \u044d\u0442\u043e\u043c \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0435 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u044f \u043f\u043e \u0433\u0440\u0443\u043f\u043f\u0430\u043c \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432:<\/p>\n<p><\/p>\n<pre><code class=\"plaintext\">$ strace -f -e trace=%process -ofork-write.log .\/fork-write\nparent (self=23610, child=23611)\nchild (self=23611)\n$ cat fork-write.log\n23610 execve(&quot;.\/fork-write&quot;, [&quot;.\/fork-write&quot;], 0x7fff696ff720 \/* 63 vars *\/) = 0\n23610 arch_prctl(ARCH_SET_FS, 0x7f3d03ba44c0) = 0\n23610 clone(child_stack=NULL, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7f3d03ba4790) = 23611\n23610 wait4(-1,  &lt;unfinished ...&gt;\n23611 exit_group(0)                     = ?\n23611 +++ exited with 0 +++\n23610 &lt;... wait4 resumed&gt; NULL, 0, NULL) = 23611\n23610 --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=23611, si_uid=1001, si_status=0, si_utime=0, si_stime=0} ---\n23610 exit_group(0)                     = ?\n23610 +++ exited with 0 +++<\/code><\/pre>\n<p><\/p>\n<p>\u041a\u0441\u0442\u0430\u0442\u0438, \u043a\u0430\u043a\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430?<\/p>\n<p><\/p>\n<h1 id=\"primer-puti-k-faylam-vmesto-deskriptorov\">\u041f\u0440\u0438\u043c\u0435\u0440: \u043f\u0443\u0442\u0438 \u043a \u0444\u0430\u0439\u043b\u0430\u043c \u0432\u043c\u0435\u0441\u0442\u043e \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440\u043e\u0432<\/h1>\n<p><\/p>\n<p>\u0417\u043d\u0430\u0442\u044c \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0435 \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440\u044b, \u0431\u0435\u0437\u0443\u0441\u043b\u043e\u0432\u043d\u043e, \u043f\u043e\u043b\u0435\u0437\u043d\u043e, \u043d\u043e \u0438\u043c\u0435\u043d\u0430 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432, \u043a \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043e\u0431\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430, \u0442\u043e\u0436\u0435 \u043c\u043e\u0433\u0443\u0442 \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u044c\u0441\u044f.<\/p>\n<p><\/p>\n<p>\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/vkazanov\/strace-post\/blob\/master\/examples\/write-tmp-file.c\">\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430<\/a><\/noindex> \u043f\u0438\u0448\u0435\u0442 \u0441\u0442\u0440\u043e\u043a\u0443 \u0432\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b:<\/p>\n<p><\/p>\n<pre><code class=\"cpp\">void do_write(int out_fd)\n{\n    char str[] = &quot;write me to a filen&quot;;\n\n    if (sizeof(str) != write(out_fd, str, sizeof(str))){\n        perror(&quot;write&quot;);\n        exit(EXIT_FAILURE);\n    }\n}\n\nint main(int argc, char *argv[])\n{\n    char tmp_filename_template[] = &quot;\/tmp\/output_fileXXXXXX&quot;;\n\n    int out_fd = mkstemp(tmp_filename_template);\n    if (out_fd == -1) {\n        perror(&quot;mkstemp&quot;);\n        exit(EXIT_FAILURE);\n    }\n\n    do_write(out_fd);\n\n    return EXIT_SUCCESS;\n}<\/code><\/pre>\n<p><\/p>\n<p>\u041f\u0440\u0438 \u043e\u0431\u044b\u0447\u043d\u043e\u043c \u0432\u044b\u0437\u043e\u0432\u0435 <code>strace<\/code> \u043f\u043e\u043a\u0430\u0436\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0447\u0438\u0441\u043b\u0430-\u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440\u0430, \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432:<\/p>\n<p><\/p>\n<pre><code class=\"plaintext\">$ strace -e trace=write -o write-tmp-file.log .\/write-tmp-file\n$ cat write-tmp-file.log\nwrite(3, &quot;write me to a filen\u0000&quot;, 20)  = 20\n+++ exited with 0 +++<\/code><\/pre>\n<p><\/p>\n<p>\u0421 \u0444\u043b\u0430\u0433\u043e\u043c <code>-y<\/code> \u0443\u0442\u0438\u043b\u0438\u0442\u0430 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043f\u0443\u0442\u044c \u043a \u0444\u0430\u0439\u043b\u0443, \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440:<\/p>\n<p><\/p>\n<pre><code class=\"plaintext\">$ strace -y -e trace=write -o write-tmp-file.log .\/write-tmp-file\n$ cat write-tmp-file.log\nwrite(3&lt;\/tmp\/output_fileCf5MyW&gt;, &quot;write me to a filen\u0000&quot;, 20) = 20\n+++ exited with 0 +++<\/code><\/pre>\n<p><\/p>\n<h1 id=\"primer-otslezhivanie-obrascheniy-k-faylam\">\u041f\u0440\u0438\u043c\u0435\u0440: \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u0435 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0439 \u043a \u0444\u0430\u0439\u043b\u0430\u043c<\/h1>\n<p><\/p>\n<p>\u0415\u0449\u0451 \u043e\u0434\u043d\u0430 \u043f\u043e\u043b\u0435\u0437\u043d\u0430\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c: \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0435 \u0432\u044b\u0437\u043e\u0432\u044b, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u0441 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u043c \u0444\u0430\u0439\u043b\u043e\u043c. \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/vkazanov\/strace-post\/blob\/master\/examples\/write-file.c\">\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430<\/a><\/noindex> \u0434\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u0441\u0442\u0440\u043e\u043a\u0443 \u0432 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u044b\u0439 \u0444\u0430\u0439\u043b, \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u0439 \u0432 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0435:<\/p>\n<p><\/p>\n<pre><code class=\"cpp\">void do_write(int out_fd)\n{\n    char str[] = &quot;write me to a filen&quot;;\n\n    if (sizeof(str) != write(out_fd, str, sizeof(str))){\n        perror(&quot;write&quot;);\n        exit(EXIT_FAILURE);\n    }\n}\n\nint main(int argc, char *argv[])\n{\n    \/*\n     * Path will be provided by the first program argument.\n     *  *\/\n    const char *path = argv[1];\n\n    \/*\n     * Open an existing file for writing in append mode.\n     *  *\/\n    int out_fd = open(path, O_APPEND | O_WRONLY);\n    if (out_fd == -1) {\n        perror(&quot;open&quot;);\n        exit(EXIT_FAILURE);\n    }\n\n    do_write(out_fd);\n\n    return EXIT_SUCCESS;\n}\n<\/code><\/pre>\n<p><\/p>\n<p>\u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e <code>strace<\/code> \u0432\u044b\u0432\u043e\u0434\u0438\u0442 \u043c\u043d\u043e\u0433\u043e \u043b\u0438\u0448\u043d\u0435\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438. \u0424\u043b\u0430\u0433 <code>-P<\/code> \u0441 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u043c \u0437\u0430\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 strace \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u043a \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u043c\u0443 \u0444\u0430\u0439\u043b\u0443:<\/p>\n<p><\/p>\n<pre><code class=\"plaintext\">$ strace -y -P\/tmp\/test_file.log -o write-file.log .\/write-file \/tmp\/test_file.log\n$ cat write-file.log\nopenat(AT_FDCWD, &quot;\/tmp\/test_file.log&quot;, O_WRONLY|O_APPEND) = 3&lt;\/tmp\/test_file.log&gt;\nwrite(3&lt;\/tmp\/test_file.log&gt;, &quot;write me to a filen\u0000&quot;, 20) = 20\n+++ exited with 0 +++<\/code><\/pre>\n<p><\/p>\n<h1 id=\"primer-mnogopotochnye-programmy\">\u041f\u0440\u0438\u043c\u0435\u0440: \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u044b\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b<\/h1>\n<p><\/p>\n<p>\u0423\u0442\u0438\u043b\u0438\u0442\u0430 <code>strace<\/code> \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043c\u043e\u0447\u044c \u0438 \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u0439 <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/vkazanov\/strace-post\/blob\/master\/examples\/thread-write.c\">\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043e\u0439<\/a><\/noindex>. \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u043f\u0438\u0448\u0435\u0442 \u0432 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u043f\u043e\u0442\u043e\u043a \u0432\u044b\u0432\u043e\u0434\u0430 \u0438\u0437 \u0434\u0432\u0443\u0445 \u043f\u043e\u0442\u043e\u043a\u043e\u0432:<\/p>\n<p><\/p>\n<pre><code class=\"cpp\">void *thread(void *arg)\n{\n    (void) arg;\n\n    printf(&quot;Secondary thread: workingn&quot;);\n    sleep(1);\n    printf(&quot;Secondary thread: donen&quot;);\n\n    return NULL;\n}\n\nint main(int argc, char *argv[])\n{\n    printf(&quot;Initial thread: launching a threadn&quot;);\n\n    pthread_t thr;\n    if (0 != pthread_create(&amp;thr, NULL, thread, NULL)) {\n        fprintf(stderr, &quot;Initial thread: failed to create a thread&quot;);\n        exit(EXIT_FAILURE);\n    }\n\n    printf(&quot;Initial thread: joining a threadn&quot;);\n    if (0 != pthread_join(thr, NULL)) {\n        fprintf(stderr, &quot;Initial thread: failed to join a thread&quot;);\n        exit(EXIT_FAILURE);\n    };\n\n    printf(&quot;Initial thread: done&quot;);\n\n    exit(EXIT_SUCCESS);\n}<\/code><\/pre>\n<p><\/p>\n<p>\u0421\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u0435\u0451 \u043d\u0430\u0434\u043e, \u0435\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0441\u043e \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u043c \u043f\u0440\u0438\u0432\u0435\u0442\u043e\u043c \u043b\u0438\u043d\u043a\u043e\u0432\u0449\u0438\u043a\u0443 \u2014 \u0444\u043b\u0430\u0433\u043e\u043c -pthread:<\/p>\n<p><\/p>\n<pre><code class=\"plaintext\">$ gcc examples\/thread-write.c -pthread -o thread-write\n$ .\/thread-write\n\/thread-write\nInitial thread: launching a thread\nInitial thread: joining a thread\nSecondary thread: working\nSecondary thread: done\nInitial thread: done\n$<\/code><\/pre>\n<p><\/p>\n<p>\u0424\u043b\u0430\u0433 <code>-f<\/code>, \u043a\u0430\u043a \u0438 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441 \u043e\u0431\u044b\u0447\u043d\u044b\u043c\u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430\u043c\u0438, \u0434\u043e\u0431\u0430\u0432\u0438\u0442 \u0432 \u043d\u0430\u0447\u0430\u043b\u043e \u043a\u0430\u0436\u0434\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 pid \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430.<\/p>\n<p><\/p>\n<blockquote><p>\u0415\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0440\u0435\u0447\u044c \u0438\u0434\u0451\u0442 \u043d\u0435 \u043e\u0431 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0435 \u043f\u043e\u0442\u043e\u043a\u0430 \u0432 \u0441\u043c\u044b\u0441\u043b\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0430 POSIX Threads, \u0430 \u043e \u043d\u043e\u043c\u0435\u0440\u0435, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u043e\u043c \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a\u043e\u043c \u0437\u0430\u0434\u0430\u0447 \u0432 Linux. \u0421 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u043d\u0435\u0442 \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432 \u0438 \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u2014 \u0435\u0441\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u0434\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043f\u043e \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u043c \u044f\u0434\u0440\u0430\u043c \u043c\u0430\u0448\u0438\u043d\u044b.<\/p><\/blockquote>\n<p>\u041f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0432 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043c\u043d\u043e\u0433\u043e:<\/p>\n<p><\/p>\n<pre><code class=\"plaintext\">$ strace -f -othread-write.log .\/thread-write\n$ wc -l thread-write.log\n60 thread-write.log<\/code><\/pre>\n<p><\/p>\n<p>\u0418\u043c\u0435\u0435\u0442 \u0441\u043c\u044b\u0441\u043b \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0442\u044c\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430\u043c\u0438 \u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u043c \u0432\u044b\u0437\u043e\u0432\u043e\u043c <code>write<\/code>:<\/p>\n<p><\/p>\n<pre><code class=\"plaintext\">$ strace -f -e trace=&quot;%process,write&quot; -othread-write.log .\/thread-write\n$ cat thread-write.log\n18211 execve(&quot;.\/thread-write&quot;, [&quot;.\/thread-write&quot;], 0x7ffc6b8d58f0 \/* 64 vars *\/) = 0\n18211 arch_prctl(ARCH_SET_FS, 0x7f38ea3b7740) = 0\n18211 write(1, &quot;Initial thread: launching a thre&quot;..., 35) = 35\n18211 clone(child_stack=0x7f38e9ba2fb0, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID, parent_tidptr=0x7f38e9ba39d0, tls=0x7f38e9ba3700, child_tidptr=0x7f38e9ba39d0) = 18212\n18211 write(1, &quot;Initial thread: joining a thread&quot;..., 33) = 33\n18212 write(1, &quot;Secondary thread: workingn&quot;, 26) = 26\n18212 write(1, &quot;Secondary thread: donen&quot;, 23) = 23\n18212 exit(0)                           = ?\n18212 +++ exited with 0 +++\n18211 write(1, &quot;Initial thread: done&quot;, 20) = 20\n18211 exit_group(0)                     = ?\n18211 +++ exited with 0 +++<\/code><\/pre>\n<p><\/p>\n<p>\u041a\u0441\u0442\u0430\u0442\u0438, \u0432\u043e\u043f\u0440\u043e\u0441\u044b. \u041a\u0430\u043a\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u0442\u043e\u043a\u0430? \u0427\u0435\u043c \u0442\u0430\u043a\u043e\u0439 \u0432\u044b\u0437\u043e\u0432 \u0434\u043b\u044f \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 \u0432\u044b\u0437\u043e\u0432\u0430 \u0434\u043b\u044f \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432?<\/p>\n<p><\/p>\n<h1 id=\"master-klass-stek-processa-v-moment-sistemnogo-vyzova\">\u041c\u0430\u0441\u0442\u0435\u0440-\u043a\u043b\u0430\u0441\u0441: \u0441\u0442\u0435\u043a \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u0432 \u043c\u043e\u043c\u0435\u043d\u0442 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0430<\/h1>\n<p><\/p>\n<p>\u041e\u0434\u043d\u0430 \u0438\u0437 \u043d\u0435\u0434\u0430\u0432\u043d\u043e \u043f\u043e\u044f\u0432\u0438\u0432\u0448\u0438\u0445\u0441\u044f \u0432 <code>strace<\/code> \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439 \u2014 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0441\u0442\u0435\u043a\u0430 \u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0432 \u043c\u043e\u043c\u0435\u043d\u0442 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0430. \u041f\u0440\u043e\u0441\u0442\u043e\u0439 <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/vkazanov\/strace-post\/blob\/master\/examples\/write-simple.c\">\u043f\u0440\u0438\u043c\u0435\u0440<\/a><\/noindex>:<\/p>\n<p><\/p>\n<pre><code class=\"cpp\">void do_write(void)\n{\n    char str[] = &quot;write me to stdoutn&quot;;\n    if (sizeof(str) != write(STDOUT_FILENO, str, sizeof(str))){\n        perror(&quot;write&quot;);\n        exit(EXIT_FAILURE);\n    }\n}\n\nint main(int argc, char *argv[])\n{\n    do_write();\n    return EXIT_SUCCESS;\n}<\/code><\/pre>\n<p><\/p>\n<p>\u0415\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0432\u044b\u0432\u043e\u0434 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u043e\u0447\u0435\u043d\u044c \u043e\u0431\u044a\u0451\u043c\u043d\u044b\u043c, \u0438, \u043f\u043e\u043c\u0438\u043c\u043e \u0444\u043b\u0430\u0433\u0430 <code>-k<\/code> (\u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0441\u0442\u0435\u043a\u0430 \u0432\u044b\u0437\u043e\u0432\u043e\u0432), \u0438\u043c\u0435\u0435\u0442 \u0441\u043c\u044b\u0441\u043b \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0435 \u0432\u044b\u0437\u043e\u0432\u044b \u043f\u043e \u0438\u043c\u0435\u043d\u0438:<\/p>\n<p><\/p>\n<pre><code class=\"plaintext\">$ gcc examples\/write-simple.c -o write-simple\n$ strace -k -e trace=write -o write-simple.log .\/write-simple\nwrite me to stdout\n$ cat write-simple.log\nwrite(1, &quot;write me to stdoutn\u0000&quot;, 20)  = 20\n &gt; \/lib\/x86_64-linux-gnu\/libc-2.27.so(__write+0x14) [0x110154]\n &gt; \/home\/vkazanov\/projects-my\/strace-post\/write-simple(do_write+0x50) [0x78a]\n &gt; \/home\/vkazanov\/projects-my\/strace-post\/write-simple(main+0x14) [0x7d1]\n &gt; \/lib\/x86_64-linux-gnu\/libc-2.27.so(__libc_start_main+0xe7) [0x21b97]\n &gt; \/home\/vkazanov\/projects-my\/strace-post\/write-simple(_start+0x2a) [0x65a]\n+++ exited with 0 +++<\/code><\/pre>\n<p><\/p>\n<h1 id=\"master-klass-inekciya-oshibok\">\u041c\u0430\u0441\u0442\u0435\u0440-\u043a\u043b\u0430\u0441\u0441: \u0438\u043d\u044a\u0435\u043a\u0446\u0438\u044f \u043e\u0448\u0438\u0431\u043e\u043a<\/h1>\n<p><\/p>\n<p>\u0418 \u0435\u0449\u0451 \u043e\u0434\u043d\u0430 \u043d\u043e\u0432\u0430\u044f \u0438 \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u043b\u0435\u0437\u043d\u0430\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c: \u0438\u043d\u044a\u0435\u043a\u0446\u0438\u044f \u043e\u0448\u0438\u0431\u043e\u043a. \u0412\u043e\u0442 <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/vkazanov\/strace-post\/blob\/master\/examples\/write-twice.c\">\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430<\/a><\/noindex>, \u043f\u0438\u0448\u0443\u0449\u0430\u044f \u0434\u0432\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 \u0432 \u043f\u043e\u0442\u043e\u043a \u0432\u044b\u0432\u043e\u0434\u0430:<\/p>\n<p><\/p>\n<pre><code class=\"cpp\">#include &lt;unistd.h&gt;\n#include &lt;stdio.h&gt;\n#include &lt;stdlib.h&gt;\n\nvoid do_write(const char *str, ssize_t len)\n{\n    if (len != write(STDOUT_FILENO, str, (size_t)len)){\n        perror(&quot;write&quot;);\n        exit(EXIT_FAILURE);\n    }\n}\n\nint main(int argc, char *argv[])\n{\n    (void) argc; (void) argv;\n\n    char str1[] = &quot;write me 1n&quot;;\n    do_write(str1, sizeof(str1));\n\n    char str2[] = &quot;write me 2n&quot;;\n    do_write(str2, sizeof(str2));\n\n    return EXIT_SUCCESS;\n}<\/code><\/pre>\n<p><\/p>\n<p>\u041e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0435\u043c \u043e\u0431\u0430 \u0432\u044b\u0437\u043e\u0432\u0430 write:<\/p>\n<p><\/p>\n<pre><code class=\"plaintext\">$ gcc examples\/write-twice.c -o write-twice\n$ .\/write-twice\nwrite me 1\nwrite me 2\n$ strace -e trace=write -owrite-twice.log .\/write-twice\nwrite me 1\nwrite me 2\n$ cat write-twice.log\nwrite(1, &quot;write me 1n\u0000&quot;, 12)          = 12\nwrite(1, &quot;write me 2n\u0000&quot;, 12)          = 12\n+++ exited with 0 +++<\/code><\/pre>\n<p><\/p>\n<p>\u0410 \u0442\u0435\u043f\u0435\u0440\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 <code>inject<\/code>, \u0447\u0442\u043e\u0431\u044b \u0432\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0443 <code>EBADF<\/code> \u0432\u043e \u0432\u0441\u0435 \u0432\u044b\u0437\u043e\u0432\u044b write:<\/p>\n<p><\/p>\n<pre><code class=\"plaintext\">$ strace -e trace=write -e inject=write:error=EBADF -owrite-twice.log .\/write-twice\n$ cat write-twice.log\nwrite(1, &quot;write me 1n\u0000&quot;, 12)          = -1 EBADF (Bad file descriptor) (INJECTED)\nwrite(3, &quot;write: Bad file descriptorn&quot;, 27) = -1 EBADF (Bad file descriptor) (INJECTED)\n+++ exited with 1 +++<\/code><\/pre>\n<p><\/p>\n<p>\u0418\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e, \u0447\u0442\u043e \u043e\u0448\u0438\u0431\u043a\u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0442 <strong>\u0432\u0441\u0435<\/strong> \u0432\u044b\u0437\u043e\u0432\u044b <code>write<\/code>, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u0432\u044b\u0437\u043e\u0432, \u0441\u043a\u0440\u044b\u0442\u044b\u0439 \u0437\u0430 perror. \u0418\u043c\u0435\u0435\u0442 \u0441\u043c\u044b\u0441\u043b \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0443 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0438\u0437 \u0432\u044b\u0437\u043e\u0432\u043e\u0432:<\/p>\n<p><\/p>\n<pre><code class=\"plaintext\">$ strace -e trace=write -e inject=write:error=EBADF:when=1 -owrite-twice.log .\/write-twice\nwrite: Bad file descriptor\n$ cat write-twice.log\nwrite(1, &quot;write me 1n\u0000&quot;, 12)          = -1 EBADF (Bad file descriptor) (INJECTED)\nwrite(3, &quot;write: Bad file descriptorn&quot;, 27) = 27\n+++ exited with 1 +++<\/code><\/pre>\n<p><\/p>\n<p>\u0418\u043b\u0438 \u0432\u0442\u043e\u0440\u043e\u0433\u043e:<\/p>\n<p><\/p>\n<pre><code class=\"plaintext\">$ strace -e trace=write -e inject=write:error=EBADF:when=2 -owrite-twice.log .\/write-twice\nwrite me 1\nwrite: Bad file descriptor\n$ cat write-twice.log\nwrite(1, &quot;write me 1n\u0000&quot;, 12)          = 12\nwrite(1, &quot;write me 2n\u0000&quot;, 12)          = -1 EBADF (Bad file descriptor) (INJECTED)\nwrite(3, &quot;write: Bad file descriptorn&quot;, 27) = 27\n+++ exited with 1 +++<\/code><\/pre>\n<p><\/p>\n<p>\u0422\u0438\u043f \u043e\u0448\u0438\u0431\u043a\u0438 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e:<\/p>\n<p><\/p>\n<pre><code class=\"plaintext\">$ strace -e trace=write -e fault=write:when=1 -owrite-twice.log .\/write-twice\n$ cat write-twice.log\nwrite(1, &quot;write me 1n\u0000&quot;, 12)          = -1 ENOSYS (Function not implemented) (INJECTED)\nwrite(3, &quot;write: Function not implementedn&quot;, 32) = 32\n+++ exited with 1 +++<\/code><\/pre>\n<p><\/p>\n<p>\u0412 \u0441\u043e\u0447\u0435\u0442\u0430\u043d\u0438\u0438 \u0441 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u0444\u043b\u0430\u0433\u0430\u043c\u0438 \u043c\u043e\u0436\u043d\u043e \u00ab\u043b\u043e\u043c\u0430\u0442\u044c\u00bb \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u043a \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u043c\u0443 \u0444\u0430\u0439\u043b\u0443. \u041f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<p><\/p>\n<pre><code class=\"plaintext\">$ strace -y -P\/tmp\/test_file.log -e inject=file:error=ENOENT -o write-file.log .\/write-file \/tmp\/test_file.log\nopen: No such file or directory\n$ cat write-file.log\nopenat(AT_FDCWD, &quot;\/tmp\/test_file.log&quot;, O_WRONLY|O_APPEND) = -1 ENOENT (No such file or directory) (INJECTED)\n+++ exited with 1 +++<\/code><\/pre>\n<p><\/p>\n<p>\u041f\u043e\u043c\u0438\u043c\u043e \u0438\u043d\u044a\u0435\u043a\u0446\u0438\u0439 \u043e\u0448\u0438\u0431\u043e\u043a, <noindex><a rel=\"nofollow\" href=\"http:\/\/www.man7.org\/linux\/man-pages\/man1\/strace.1.html\">\u043c\u043e\u0436\u043d\u043e<\/a><\/noindex> \u0432\u0432\u043e\u0434\u0438\u0442\u044c \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u0438 \u043f\u0440\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u0438\u043b\u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0438 \u0441\u0438\u0433\u043d\u0430\u043b\u043e\u0432.<\/p>\n<p><\/p>\n<h1 id=\"posleslovie\">\u041f\u043e\u0441\u043b\u0435\u0441\u043b\u043e\u0432\u0438\u0435<\/h1>\n<p><\/p>\n<p>\u0423\u0442\u0438\u043b\u0438\u0442\u0430 <code>strace<\/code> \u2014 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0438 \u043d\u0430\u0434\u0451\u0436\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442. \u041d\u043e \u043f\u043e\u043c\u0438\u043c\u043e \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u043e\u0442\u043b\u0430\u0436\u0438\u0432\u0430\u0442\u044c \u0441\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u0430\u0441\u043f\u0435\u043a\u0442\u044b \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c \u0438 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0442\u044c \u0432\u044b\u0437\u043e\u0432\u044b \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438 \u043b\u0438\u043d\u043a\u0443\u0435\u043c\u044b\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0443\u043c\u0435\u0435\u0442 <noindex><a rel=\"nofollow\" href=\"https:\/\/en.wikipedia.org\/wiki\/Ltrace\">ltrace<\/a><\/noindex>, \u0437\u0430\u0433\u043b\u044f\u043d\u0443\u0442\u044c \u0432 \u0440\u0430\u0431\u043e\u0442\u0443 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043c\u043e\u0433\u0443\u0442 <noindex><a rel=\"nofollow\" href=\"https:\/\/en.wikipedia.org\/wiki\/SystemTap\">SystemTap<\/a><\/noindex> \u0438 <noindex><a rel=\"nofollow\" href=\"https:\/\/en.wikipedia.org\/wiki\/Ftrace\">ftrace<\/a><\/noindex>, \u0430 \u0433\u043b\u0443\u0431\u043e\u043a\u043e \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 <noindex><a rel=\"nofollow\" href=\"https:\/\/en.wikipedia.org\/wiki\/Perf_%2528Linux%2529\">perf<\/a><\/noindex>. \u0422\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435 \u0438\u043c\u0435\u043d\u043d\u043e <code>strace<\/code> \u2014 \u043f\u0435\u0440\u0432\u0430\u044f \u043b\u0438\u043d\u0438\u044f \u043e\u0431\u043e\u0440\u043e\u043d\u044b \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0441 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c\u0438 \u0438 \u0447\u0443\u0436\u0438\u043c\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430\u043c\u0438, \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e \u044f \u0435\u0451 \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u043f\u0430\u0440\u0443 \u0440\u0430\u0437 \u0432 \u043d\u0435\u0434\u0435\u043b\u044e.<\/p>\n<p><\/p>\n<p>\u0421\u043b\u043e\u0432\u043e\u043c, \u043b\u044e\u0431\u0438\u0442\u0435 Unix, \u0447\u0438\u0442\u0430\u0439\u0442\u0435 <code>man 1 strace<\/code> \u0438 \u043d\u0435 \u0441\u0442\u0435\u0441\u043d\u044f\u0439\u0442\u0435\u0441\u044c \u043f\u043e\u0434\u0433\u043b\u044f\u0434\u044b\u0432\u0430\u0442\u044c \u0437\u0430 \u0432\u0430\u0448\u0438\u043c\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430\u043c\u0438!<\/p>\n<p>\u0418\u0441\u0442\u043e\u0447\u043d\u0438\u043a: <a content=\"nofollow\" rel=\"nofollow\" href=\"https:\/\/habr.com\/ru\/company\/badoo\/blog\/493856\/\">habr.com<\/a> <\/p>\n","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"excerpt":{"rendered":"<p>\u0412 Unix-\u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u0445 \u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0441 \u0432\u043d\u0435\u0448\u043d\u0438\u043c \u043c\u0438\u0440\u043e\u043c \u0438 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0447\u0435\u0440\u0435\u0437 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043d\u0430\u0431\u043e\u0440 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u2014 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432. \u0410 \u0437\u043d\u0430\u0447\u0438\u0442, \u0432 \u043e\u0442\u043b\u0430\u0434\u043e\u0447\u043d\u044b\u0445 \u0446\u0435\u043b\u044f\u0445 \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u0431\u044b\u0432\u0430\u0435\u0442 \u043f\u043e\u0434\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0437\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u043c\u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430\u043c\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u043c\u0438 \u0432\u044b\u0437\u043e\u0432\u0430\u043c\u0438. \u0421\u043b\u0435\u0434\u0438\u0442\u044c \u0437\u0430 \u00ab\u0438\u043d\u0442\u0438\u043c\u043d\u043e\u0439 \u0436\u0438\u0437\u043d\u044c\u044e\u00bb \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c \u043d\u0430 Linux \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u0443\u0442\u0438\u043b\u0438\u0442\u0430 strace, \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0438 \u043f\u043e\u0441\u0432\u044f\u0449\u0435\u043d\u0430 \u044d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f. \u041a \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u00ab\u0448\u043f\u0438\u043e\u043d\u0441\u043a\u043e\u0433\u043e\u00bb \u043e\u0431\u043e\u0440\u0443\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u0438\u043b\u0430\u0433\u0430\u044e\u0442\u0441\u044f \u043a\u0440\u0430\u0442\u043a\u0430\u044f [&hellip;]<\/p>\n","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"author":1,"featured_media":75368,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[688],"tags":[],"class_list":["post-75367","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-administrirovanie"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.10 - aioseo.com -->\n\t<meta name=\"description\" content=\"\u0412 Unix-\u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u0445 \u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0441 \u0432\u043d\u0435\u0448\u043d\u0438\u043c \u043c\u0438\u0440\u043e\u043c \u0438 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0447\u0435\u0440\u0435\u0437 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043d\u0430\u0431\u043e\u0440 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u2014 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432. \u0410 \u0437\u043d\u0430\u0447\u0438\u0442, \u0432 \u043e\u0442\u043b\u0430\u0434\u043e\u0447\u043d\u044b\u0445 \u0446\u0435\u043b\u044f\u0445 \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u0431\u044b\u0432\u0430\u0435\u0442 \u043f\u043e\u0434\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0437\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u043c\u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430\u043c\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u043c\u0438 \u0432\u044b\u0437\u043e\u0432\u0430\u043c\u0438. \u0421\u043b\u0435\u0434\u0438\u0442\u044c \u0437\u0430 \u00ab\u0438\u043d\u0442\u0438\u043c\u043d\u043e\u0439 \u0436\u0438\u0437\u043d\u044c\u044e\u00bb \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c \u043d\u0430 Linux \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u0443\u0442\u0438\u043b\u0438\u0442\u0430 strace, \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0438 \u043f\u043e\u0441\u0432\u044f\u0449\u0435\u043d\u0430 \u044d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f. \u041a \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u00ab\u0448\u043f\u0438\u043e\u043d\u0441\u043a\u043e\u0433\u043e\u00bb \u043e\u0431\u043e\u0440\u0443\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u0438\u043b\u0430\u0433\u0430\u044e\u0442\u0441\u044f \u043a\u0440\u0430\u0442\u043a\u0430\u044f\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Yuri Gagarin\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/prohoster.info\/sq\/blog\/administrirovanie\/strace-v-linux-istoriya-ustrojstvo-i-ispolzovanie\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 4.9.10\" \/>\n\t\t<meta property=\"og:locale\" content=\"sq_AL\" \/>\n\t\t<meta property=\"og:site_name\" content=\"ProHoster | \u041a\u0443\u043f\u0438\u0442\u044c \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439 \u0445\u043e\u0441\u0442\u0438\u043d\u0433 \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u043e\u0432 \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043e\u0442 DDoS, VPS VDS \u0441\u0435\u0440\u0432\u0435\u0440\u044b\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"\ud83e\udd47Strace \u0432 Linux: \u0438\u0441\u0442\u043e\u0440\u0438\u044f, \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 | ProHoster\" \/>\n\t\t<meta property=\"og:description\" content=\"\u0412 Unix-\u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u0445 \u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0441 \u0432\u043d\u0435\u0448\u043d\u0438\u043c \u043c\u0438\u0440\u043e\u043c \u0438 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0447\u0435\u0440\u0435\u0437 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043d\u0430\u0431\u043e\u0440 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u2014 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432. \u0410 \u0437\u043d\u0430\u0447\u0438\u0442, \u0432 \u043e\u0442\u043b\u0430\u0434\u043e\u0447\u043d\u044b\u0445 \u0446\u0435\u043b\u044f\u0445 \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u0431\u044b\u0432\u0430\u0435\u0442 \u043f\u043e\u0434\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0437\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u043c\u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430\u043c\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u043c\u0438 \u0432\u044b\u0437\u043e\u0432\u0430\u043c\u0438. \u0421\u043b\u0435\u0434\u0438\u0442\u044c \u0437\u0430 \u00ab\u0438\u043d\u0442\u0438\u043c\u043d\u043e\u0439 \u0436\u0438\u0437\u043d\u044c\u044e\u00bb \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c \u043d\u0430 Linux \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u0443\u0442\u0438\u043b\u0438\u0442\u0430 strace, \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0438 \u043f\u043e\u0441\u0432\u044f\u0449\u0435\u043d\u0430 \u044d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f. \u041a \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u00ab\u0448\u043f\u0438\u043e\u043d\u0441\u043a\u043e\u0433\u043e\u00bb \u043e\u0431\u043e\u0440\u0443\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u0438\u043b\u0430\u0433\u0430\u044e\u0442\u0441\u044f \u043a\u0440\u0430\u0442\u043a\u0430\u044f\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/prohoster.info\/sq\/blog\/administrirovanie\/strace-v-linux-istoriya-ustrojstvo-i-ispolzovanie\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg\" \/>\n\t\t<meta property=\"og:image:width\" content=\"350\" \/>\n\t\t<meta property=\"og:image:height\" content=\"350\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2020-03-25T17:42:31+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2020-03-25T17:42:31+00:00\" \/>\n\t\t<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/prohoster\" \/>\n\t\t<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/prohoster\" \/>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"\ud83e\udd47Strace \u0432 Linux: \u0438\u0441\u0442\u043e\u0440\u0438\u044f, \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 | ProHoster","description":"\u0412 Unix-\u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u0445 \u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0441 \u0432\u043d\u0435\u0448\u043d\u0438\u043c \u043c\u0438\u0440\u043e\u043c \u0438 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0447\u0435\u0440\u0435\u0437 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043d\u0430\u0431\u043e\u0440 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u2014 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432. \u0410 \u0437\u043d\u0430\u0447\u0438\u0442, \u0432 \u043e\u0442\u043b\u0430\u0434\u043e\u0447\u043d\u044b\u0445 \u0446\u0435\u043b\u044f\u0445 \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u0431\u044b\u0432\u0430\u0435\u0442 \u043f\u043e\u0434\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0437\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u043c\u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430\u043c\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u043c\u0438 \u0432\u044b\u0437\u043e\u0432\u0430\u043c\u0438. \u0421\u043b\u0435\u0434\u0438\u0442\u044c \u0437\u0430 \u00ab\u0438\u043d\u0442\u0438\u043c\u043d\u043e\u0439 \u0436\u0438\u0437\u043d\u044c\u044e\u00bb \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c \u043d\u0430 Linux \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u0443\u0442\u0438\u043b\u0438\u0442\u0430 strace, \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0438 \u043f\u043e\u0441\u0432\u044f\u0449\u0435\u043d\u0430 \u044d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f. \u041a \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u00ab\u0448\u043f\u0438\u043e\u043d\u0441\u043a\u043e\u0433\u043e\u00bb \u043e\u0431\u043e\u0440\u0443\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u0438\u043b\u0430\u0433\u0430\u044e\u0442\u0441\u044f \u043a\u0440\u0430\u0442\u043a\u0430\u044f","canonical_url":"https:\/\/prohoster.info\/sq\/blog\/administrirovanie\/strace-v-linux-istoriya-ustrojstvo-i-ispolzovanie","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":null,"og:locale":"sq_AL","og:site_name":"ProHoster | \u041a\u0443\u043f\u0438\u0442\u044c \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439 \u0445\u043e\u0441\u0442\u0438\u043d\u0433 \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u043e\u0432 \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043e\u0442 DDoS, VPS VDS \u0441\u0435\u0440\u0432\u0435\u0440\u044b","og:type":"article","og:title":"\ud83e\udd47Strace \u0432 Linux: \u0438\u0441\u0442\u043e\u0440\u0438\u044f, \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 | ProHoster","og:description":"\u0412 Unix-\u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u0445 \u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0441 \u0432\u043d\u0435\u0448\u043d\u0438\u043c \u043c\u0438\u0440\u043e\u043c \u0438 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0447\u0435\u0440\u0435\u0437 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043d\u0430\u0431\u043e\u0440 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u2014 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432. \u0410 \u0437\u043d\u0430\u0447\u0438\u0442, \u0432 \u043e\u0442\u043b\u0430\u0434\u043e\u0447\u043d\u044b\u0445 \u0446\u0435\u043b\u044f\u0445 \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u0431\u044b\u0432\u0430\u0435\u0442 \u043f\u043e\u0434\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0437\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u043c\u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430\u043c\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u043c\u0438 \u0432\u044b\u0437\u043e\u0432\u0430\u043c\u0438. \u0421\u043b\u0435\u0434\u0438\u0442\u044c \u0437\u0430 \u00ab\u0438\u043d\u0442\u0438\u043c\u043d\u043e\u0439 \u0436\u0438\u0437\u043d\u044c\u044e\u00bb \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c \u043d\u0430 Linux \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u0443\u0442\u0438\u043b\u0438\u0442\u0430 strace, \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0438 \u043f\u043e\u0441\u0432\u044f\u0449\u0435\u043d\u0430 \u044d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f. \u041a \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u00ab\u0448\u043f\u0438\u043e\u043d\u0441\u043a\u043e\u0433\u043e\u00bb \u043e\u0431\u043e\u0440\u0443\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u0438\u043b\u0430\u0433\u0430\u044e\u0442\u0441\u044f \u043a\u0440\u0430\u0442\u043a\u0430\u044f","og:url":"https:\/\/prohoster.info\/sq\/blog\/administrirovanie\/strace-v-linux-istoriya-ustrojstvo-i-ispolzovanie","og:image":"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg","og:image:secure_url":"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg","og:image:width":350,"og:image:height":350,"article:published_time":"2020-03-25T17:42:31+00:00","article:modified_time":"2020-03-25T17:42:31+00:00","article:publisher":"https:\/\/www.facebook.com\/prohoster","article:author":"https:\/\/www.facebook.com\/prohoster"},"aioseo_meta_data":{"post_id":"75367","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"seo_analyzer_scan_date":null,"breadcrumb_settings":null,"limit_modified_date":false,"reviewed_by":null,"ai":null,"created":"2021-02-28 17:57:27","updated":"2022-09-28 09:19:35"},"gt_translate_keys":[{"key":"link","format":"url"}],"_links":{"self":[{"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/posts\/75367","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/comments?post=75367"}],"version-history":[{"count":0,"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/posts\/75367\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/media\/75368"}],"wp:attachment":[{"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/media?parent=75367"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/categories?post=75367"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/tags?post=75367"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}