{"id":338476,"date":"2022-09-18T15:00:06","date_gmt":"2022-09-18T15:00:06","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=338476"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=338476","title":{"rendered":"<span>\u041f\u043e\u0441\u043e\u0431\u0438\u0435 \u043f\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e \u043c\u043e\u0434\u0443\u043b\u0435\u0439 \u044f\u0434\u0440\u0430 Linux. \u0427.6<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\"><a href=\"https:\/\/habr.com\/ru\/company\/ruvds\/blog\/688564\/\"><\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/-7\/yl\/hp\/-7ylhpzc6raohz-vopxottyejfu.png\" data-src=\"https:\/\/habrastorage.org\/webt\/-7\/yl\/hp\/-7ylhpzc6raohz-vopxottyejfu.png\"\/><\/div>\n<p><\/a><br \/>  \u041e\u0447\u0435\u0440\u0435\u0434\u043d\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u043f\u043e\u0441\u043e\u0431\u0438\u044f \u043f\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e \u043c\u043e\u0434\u0443\u043b\u0435\u0439 \u044f\u0434\u0440\u0430 \u043e\u0442 2 \u0438\u044e\u043b\u044f 2022 \u0433\u043e\u0434\u0430. \u0412 \u043d\u0435\u0439 \u043c\u044b \u043f\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u043c\u0441\u044f \u0441 \u043f\u043e\u043d\u044f\u0442\u0438\u0435\u043c tty, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u043c \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u0443 \u043c\u0430\u043a\u0440\u043e\u0441\u0443 <code>print<\/code>, \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u043c\u043e\u0434\u0443\u043b\u044c \u0434\u043b\u044f \u043c\u0438\u0433\u0430\u043d\u0438\u044f \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434\u0430\u043c\u0438 \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u044b, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u0442\u0435\u043c\u0443 \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0447 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0442\u0430\u0441\u043a\u043b\u0435\u0442\u043e\u0432 \u0438 \u043e\u0447\u0435\u0440\u0435\u0434\u0435\u0439 \u0437\u0430\u0434\u0430\u043d\u0438\u0439.<a name=\"habracut\"><\/a><\/p>\n<h2><font color=\"#3AC1EF\">\u258d \u0413\u043e\u0442\u043e\u0432\u044b\u0435 \u0447\u0430\u0441\u0442\u0438 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0430:<\/font><\/h2>\n<p>  <\/p>\n<ul>\n<li><a href=\"https:\/\/habr.com\/ru\/company\/ruvds\/blog\/681880\/\">\u0427\u0430\u0441\u0442\u044c 1<\/a><\/li>\n<li><a href=\"https:\/\/habr.com\/ru\/company\/ruvds\/blog\/683106\/\">\u0427\u0430\u0441\u0442\u044c 2<\/a><\/li>\n<li><a href=\"https:\/\/habr.com\/ru\/company\/ruvds\/blog\/684382\/\">\u0427\u0430\u0441\u0442\u044c 3<\/a><\/li>\n<li><a href=\"https:\/\/habr.com\/ru\/company\/ruvds\/blog\/685168\/\">\u0427\u0430\u0441\u0442\u044c 4<\/a><\/li>\n<li><a href=\"https:\/\/habr.com\/ru\/company\/ruvds\/blog\/686596\/\">\u0427\u0430\u0441\u0442\u044c 5<\/a><\/li>\n<li> <b><font color=\"#3AC1EF\">\u0412\u044b \u0442\u0443\u0442 &#8212;> <\/font><\/b><a href=\"https:\/\/habr.com\/ru\/company\/ruvds\/blog\/688564\/\">\u0427\u0430\u0441\u0442\u044c 6<\/a><\/li>\n<\/ul>\n<p>  <\/p>\n<h2><font color=\"#3AC1EF\">13. \u0417\u0430\u043c\u0435\u043d\u0430 \u043c\u0430\u043a\u0440\u043e\u0441\u0430 Print<\/font><\/h2>\n<p>  <\/p>\n<h3><font color=\"#3AC1EF\">\u258d 13.1 \u0417\u0430\u043c\u0435\u043d\u0430<\/font><\/h3>\n<p>  \u0412 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 2 \u044f \u0433\u043e\u0432\u043e\u0440\u0438\u043b, \u0447\u0442\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u043e\u0434\u0443\u043b\u0438 \u044f\u0434\u0440\u0430 \u0447\u0435\u0440\u0435\u0437 X Window System \u043d\u0435 \u0436\u0435\u043b\u0430\u0442\u0435\u043b\u044c\u043d\u043e. \u042d\u0442\u043e \u0432\u0435\u0440\u043d\u043e \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0438\u043c\u0435\u043d\u043d\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043c\u043e\u0434\u0443\u043b\u0435\u0439, \u043d\u043e \u043f\u0440\u0438 \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u0430 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043d\u0430 \u043b\u044e\u0431\u043e\u0439 tty, \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043f\u043e\u0441\u0442\u0443\u043f\u0438\u043b\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u043d\u0430 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u043c\u043e\u0434\u0443\u043b\u044f.<\/p>\n<p>  \u0410\u0431\u0431\u0440\u0435\u0432\u0438\u0430\u0442\u0443\u0440\u0430 tty \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u0442\u0435\u043b\u0435\u0442\u0430\u0439\u043f, \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432 \u0441\u0432\u043e\u0435\u043c \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u043c \u0432\u0438\u0434\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u043b\u043e \u0441\u043e\u0432\u043c\u0435\u0449\u0435\u043d\u043d\u0443\u044e \u0441 \u043f\u0440\u0438\u043d\u0442\u0435\u0440\u043e\u043c \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u0443, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0443\u044e \u0434\u043b\u044f \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441 \u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439 Unix. \u0412 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u043c \u0436\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u0442\u0435\u043b\u0435\u0442\u0430\u0439\u043f \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u0435\u0439 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u0442\u043e\u043a\u0430, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043e\u0439 Unix, \u0431\u0443\u0434\u044c \u0442\u043e \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b, xterm \u043d\u0430 X-\u0441\u0435\u0440\u0432\u0435\u0440\u0435, \u0441\u0435\u0442\u0435\u0432\u043e\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0447\u0435\u0440\u0435\u0437 ssh \u0438\u043b\u0438 \u043d\u0435\u0447\u0442\u043e \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e\u0435.<\/p>\n<p>  \u0420\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442\u0441\u044f \u044d\u0442\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>current<\/code>, \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f \u043d\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u0443\u044e \u0432 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0437\u0430\u0434\u0430\u0447\u0443, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0435\u0433\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c tty-\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u044d\u0442\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438. \u0417\u0430\u0442\u0435\u043c \u044d\u0442\u0430 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043f\u0440\u043e\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u043f\u043e\u0438\u0441\u043a\u0435 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f \u043d\u0430 \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e <code>write<\/code>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0437\u0430\u043f\u0438\u0441\u0438 \u0441\u0442\u0440\u043e\u043a\u0438 \u0432 \u0434\u0430\u043d\u043d\u044b\u0439 tty.<\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">print_string.c<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">\/*   * print_string.c \u2013 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0432\u044b\u0432\u043e\u0434 \u043d\u0430 tty, \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043c\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c,   * \u0431\u0443\u0434\u044c \u0442\u043e \u0447\u0435\u0440\u0435\u0437 X11, telnet \u0438 \u0442.\u0434. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u0432\u044b\u0432\u043e\u0434\u0438\u043c \u0441\u0442\u0440\u043e\u043a\u0443 \u043d\u0430   * tty, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0439 \u0441 \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0437\u0430\u0434\u0430\u0447\u0435\u0439.   *\/  #include &lt;linux\/init.h>  #include &lt;linux\/kernel.h>  #include &lt;linux\/module.h>  #include &lt;linux\/sched.h> \/* \u0414\u043b\u044f current. *\/  #include &lt;linux\/tty.h> \/* \u0414\u043b\u044f \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0439 tty. *\/    static void print_string(char *str)  {      \/* tty \u0434\u043b\u044f \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0437\u0430\u0434\u0430\u0447\u0438. *\/      struct tty_struct *my_tty = get_current_tty();        \/* \u0415\u0441\u043b\u0438 my_tty \u0440\u0430\u0432\u0435\u043d NULL, \u0437\u043d\u0430\u0447\u0438\u0442 \u0443 \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 \u043d\u0435\u0442 tty, \u043a\u0443\u0434\u0430       * \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0441\u0442\u0438 \u0432\u044b\u0432\u043e\u0434 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 \u044d\u0442\u043e \u0434\u0435\u043c\u043e\u043d). \u0412 \u0442\u0430\u043a\u043e\u043c        * \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u043f\u043e\u0434\u0435\u043b\u0430\u0435\u0448\u044c.      *\/      if (my_tty) {          const struct tty_operations *ttyops = my_tty->driver->ops;          \/* my_tty->driver \u2013 \u044d\u0442\u043e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430, \u0433\u0434\u0435 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u044b \u0444\u0443\u043d\u043a\u0446\u0438\u0438 tty,          * \u043e\u0434\u043d\u0430 \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 (write) \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0437\u0430\u043f\u0438\u0441\u0438 \u0441\u0442\u0440\u043e\u043a \u0432 tty.           * \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043d\u0435\u0435 \u043c\u043e\u0436\u043d\u043e \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0438 \u0438\u0437 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u043e\u0432 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430 \u043f\u0430\u043c\u044f\u0442\u0438 \u044f\u0434\u0440\u0430 \u0438\u043b\u0438           * \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f.           *           * \u041f\u0435\u0440\u0432\u044b\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u044d\u0442\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 tty, \u043a\u0443\u0434\u0430 \u043d\u0443\u0436\u043d\u043e          * \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u044c, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043e\u0434\u043d\u0430 \u0438 \u0442\u0430 \u0436\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0441\u043b\u0443\u0436\u0438\u0442          * \u0434\u043b\u044f \u0437\u0430\u043f\u0438\u0441\u0438 \u0432\u043e \u0432\u0441\u0435 tty \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430.           * \u0412\u0442\u043e\u0440\u043e\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u2013 \u044d\u0442\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u0441\u0442\u0440\u043e\u043a\u0443.           * \u0422\u0440\u0435\u0442\u0438\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u0434\u043b\u0438\u043d\u0443 \u0441\u0442\u0440\u043e\u043a\u0438.           *           * \u041a\u0430\u043a \u0432\u044b \u0443\u0432\u0438\u0434\u0438\u0442\u0435 \u043d\u0438\u0436\u0435, \u0438\u043d\u043e\u0433\u0434\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b           * \u043f\u0440\u0435\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043a\u043e\u0434, \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0439 \u0434\u043b\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445          * \u0432\u0435\u0440\u0441\u0438\u0439 \u044f\u0434\u0440\u0430. \u0420\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043d\u0430\u043c\u0438 \u0437\u0434\u0435\u0441\u044c \u043d\u0430\u0438\u0432\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043f\u043b\u043e\u0445\u043e           * \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u0443\u0435\u0442\u0441\u044f. \u041f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u043e\u043f\u0438\u0441\u0430\u043d           * \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 2 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438: linux\/Documentation\/SubmittingPatches           *\/          (ttyops->write)(my_tty, \/* \u0421\u0430\u043c tty. *\/                          str, \/* \u0421\u0442\u0440\u043e\u043a\u0430. *\/                          strlen(str)); \/* \u0414\u043b\u0438\u043d\u0430. *\/            \/* \u0418\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u0442\u0435\u043b\u0435\u0442\u0430\u0439\u043f\u044b \u0431\u044b\u043b\u0438 \u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u044b\u043c\u0438 \u0438, \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u0441\u0442\u0440\u043e\u0433\u043e           * \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043b\u0438 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0443 ASCII. \u0412 ASCII \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0430 \u043d\u0430 \u043d\u043e\u0432\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443           * \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u0432\u0430 \u0441\u0438\u043c\u0432\u043e\u043b\u0430, \u0432\u043e\u0437\u0432\u0440\u0430\u0442 \u043a\u0430\u0440\u0435\u0442\u043a\u0438 \u0438 \u043f\u0435\u0440\u0435\u0432\u043e\u0434 \u0441\u0442\u0440\u043e\u043a\u0438. \u0412           * Unix \u043f\u0435\u0440\u0435\u0432\u043e\u0434 \u0441\u0442\u0440\u043e\u043a\u0438 ASCII \u0437\u0430\u0434\u0435\u0439\u0441\u0442\u0432\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0442\u043e\u0433\u043e \u0438 \u0434\u0440\u0443\u0433\u043e\u0433\u043e,          * \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0435\u043b\u044c\u0437\u044f \u043f\u0440\u043e\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \\n, \u0442\u0430\u043a \u043a\u0430\u043a \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u0430          * \u043a\u0430\u0440\u0435\u0442\u043a\u0438 \u043d\u0435 \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0435\u0442, \u0438 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u043d\u0430\u0447\u043d\u0435\u0442\u0441\u044f \u0432 \u0441\u0442\u043e\u043b\u0431\u0446\u0435,           * \u0438\u0434\u0443\u0449\u0438\u043c \u0441\u0440\u0430\u0437\u0443 \u0437\u0430 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u043e\u043c \u0441\u0442\u0440\u043e\u043a\u0438.          *          * \u0418\u043c\u0435\u043d\u043d\u043e \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432 Unix \u0438 MS Windows \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0435 \u0444\u0430\u0439\u043b\u044b \u043e\u0442\u043b\u0438\u0447\u0430\u044e\u0442\u0441\u044f.                * \u0412 CP\/M \u0438 \u0435\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u044b\u0445 \u0432\u0440\u043e\u0434\u0435 MS-DOS \u0438 MS Windows \u0442\u0435\u043a\u0441\u0442 \u0441\u0442\u0440\u043e\u0433\u043e           * \u043f\u043e\u0434\u0447\u0438\u043d\u044f\u0435\u0442\u0441\u044f \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0443 ASCII, \u0432 \u0441\u0432\u044f\u0437\u0438 \u0441 \u0447\u0435\u043c \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0430 \u043d\u0430           * \u043d\u043e\u0432\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0438 LF, \u0438 CR.           *\/          (ttyops->write)(my_tty, \"\\015\\012\", 2);      }  }    static int __init print_string_init(void)  {      print_string(\"The module has been inserted.  Hello world!\");      return 0;  }    static void __exit print_string_exit(void)  {      print_string(\"The module has been removed.  Farewell world!\");  }    module_init(print_string_init);  module_exit(print_string_exit);    MODULE_LICENSE(\"GPL\");<\/code><\/pre>\n<p>  <\/div>\n<\/p><\/div>\n<p>  <\/p>\n<h3><font color=\"#3AC1EF\">\u258d 13.2 \u041c\u0438\u0433\u0430\u043d\u0438\u0435 \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434\u0430\u043c\u0438 \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u044b<\/font><\/h3>\n<p>  \u0412 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u0443\u0441\u043b\u043e\u0432\u0438\u044f\u0445 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0435\u0441\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0438 \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0441\u0432\u044f\u0437\u0438 \u0441 \u0432\u043d\u0435\u0448\u043d\u0438\u043c \u043c\u0438\u0440\u043e\u043c. \u0420\u0435\u0448\u0435\u043d\u0438\u0435\u043c \u0432 \u0442\u0430\u043a\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u043e\u0436\u0435\u0442 \u0441\u0442\u0430\u0442\u044c \u043c\u0438\u0433\u0430\u043d\u0438\u0435 \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434\u0430\u043c\u0438 \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u044b. \u042d\u0442\u043e \u043f\u0440\u044f\u043c\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043f\u0440\u0438\u0432\u043b\u0435\u0447\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u0438\u043b\u0438 \u043f\u0440\u043e\u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0435\u043a\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435. \u0421\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434\u044b \u0435\u0441\u0442\u044c \u0443 \u043b\u044e\u0431\u043e\u0439 \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u044b, \u043e\u043d\u0438 \u0432\u0441\u0435\u0433\u0434\u0430 \u043d\u0430 \u0432\u0438\u0434\u0443, \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u044e\u0442 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0438 \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u044b \u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438, \u0435\u0441\u043b\u0438 \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0442\u044c \u0441 \u0437\u0430\u043f\u0438\u0441\u044c\u044e \u0432 tty \u0438\u043b\u0438 \u0444\u0430\u0439\u043b.<\/p>\n<p>  \u0412 v4.14 \u0438 v.4.15 \u0432 API \u0442\u0430\u0439\u043c\u0435\u0440\u0430 \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u0435\u043b \u0440\u044f\u0434 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439, \u043d\u0430\u0446\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u043d\u0430 \u043f\u043e\u0432\u044b\u0448\u0435\u043d\u0438\u0435 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u043f\u0430\u043c\u044f\u0442\u0438. \u041f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0431\u0443\u0444\u0435\u0440\u0430 \u0432 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b <code>timer_list<\/code> \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043a \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0438\u0441\u0438 \u043f\u043e\u043b\u0435\u0439 <code>function<\/code> \u0438 <code>data<\/code>, \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0432 \u0430\u0442\u0430\u043a\u0443\u044e\u0449\u0435\u043c\u0443 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u043d\u043e-\u043e\u0431\u044a\u0435\u043a\u0442\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432 \u044f\u0434\u0440\u0435. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u043f\u0440\u043e\u0442\u043e\u0442\u0438\u043f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0430, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0439 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 <code>unsigned long<\/code>, \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0442\u0438\u043f\u043e\u0432. \u041f\u043b\u044e\u0441 \u0442\u0430\u043a\u043e\u0439 \u043f\u0440\u043e\u0442\u043e\u0442\u0438\u043f \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043c\u0435\u0448\u0430\u0442\u044c \u0437\u0430\u0449\u0438\u0442\u0438\u0442\u044c \u043a\u043e\u0441\u0432\u0435\u043d\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u044b \u0438 \u0432\u044b\u0437\u043e\u0432\u044b (forward-edge) \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0446\u0435\u043b\u043e\u0441\u0442\u043d\u043e\u0441\u0442\u0438 \u043f\u043e\u0442\u043e\u043a\u0430 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f (CFI).<\/p>\n<p>  \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043b\u0443\u0447\u0448\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u0440\u043e\u0442\u043e\u0442\u0438\u043f, \u0447\u0442\u043e\u0431\u044b \u043e\u0442\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u043e\u0442 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 <code>unsigned long<\/code>. \u0412 \u043e\u0431\u0440\u0430\u0442\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 \u0442\u0430\u0439\u043c\u0435\u0440\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u043d\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 <code>unsigned long<\/code>, \u0430 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 <code>timer_list<\/code>. \u0422\u043e\u0433\u0434\u0430 \u043e\u043d \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0438\u0442 \u0432\u0441\u044e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0443\u044e \u0435\u043c\u0443 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 <code>timer_list<\/code>, \u0432 \u0431\u043e\u043b\u0435\u0435 \u043e\u0431\u0448\u0438\u0440\u043d\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0438 \u0441\u043c\u043e\u0436\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u043c\u0435\u0441\u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f <code>unsigned long<\/code> \u043c\u0430\u043a\u0440\u043e\u0441 <code>container_of<\/code>. \u0411\u043e\u043b\u0435\u0435 \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u043e \u044d\u0442\u0430 \u0442\u0435\u043c\u0430 \u043e\u043f\u0438\u0441\u0430\u043d\u0430 \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 <a href=\"https:\/\/lwn.net\/Articles\/735887\/\">Improving the kernel timers API<\/a>.<\/p>\n<p>  \u0414\u043e Linux v4.14 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0442\u0430\u0439\u043c\u0435\u0440\u043e\u0432 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u043b\u0430\u0441\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>setup_timer<\/code>, \u0430 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 <code>timer_list<\/code> \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u043b\u0430 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"cpp\">struct timer_list {      unsigned long expires;      void (*function)(unsigned long);      unsigned long data;      u32 flags;      \/* ... *\/  };    void setup_timer(struct timer_list *timer, void (*callback)(unsigned long),                   unsigned long data);<\/code><\/pre>\n<p>  \u0412 Linux v4.14 \u043f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c <code>timer_setup<\/code>, \u0438 \u044f\u0434\u0440\u043e \u043f\u043e\u0441\u0442\u0435\u043f\u0435\u043d\u043d\u043e \u043f\u0435\u0440\u0435\u0441\u0442\u0440\u043e\u0438\u043b\u043e\u0441\u044c \u0441 <code>setup_timer<\/code> \u043d\u0430 <code>timer_setup<\/code>. \u041e\u0434\u043d\u0430 \u0438\u0437 \u043f\u0440\u0438\u0447\u0438\u043d \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f API \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u043b\u0430\u0441\u044c \u0432 \u043f\u043e\u0442\u0440\u0435\u0431\u043d\u043e\u0441\u0442\u0438 \u0441\u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u0438\u044f \u0441 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u043c \u0441\u0442\u0430\u0440\u044b\u0445 \u0432\u0435\u0440\u0441\u0438\u0439. \u0411\u043e\u043b\u0435\u0435 \u0442\u043e\u0433\u043e, \u043f\u043e \u043d\u0430\u0447\u0430\u043b\u0443 <code>timer_setup<\/code> \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u043b\u0430\u0441\u044c \u0447\u0435\u0440\u0435\u0437 <code>setup_timer<\/code>.<\/p>\n<pre><code class=\"cpp\">void timer_setup(struct timer_list *timer,                   void (*callback)(struct timer_list *), unsigned int flags);<\/code><\/pre>\n<p>  \u041f\u043e\u0437\u0434\u043d\u0435\u0435 \u0432 v4.15 <code>setup_timer<\/code> \u0443\u0434\u0430\u043b\u0438\u043b\u0438, \u0447\u0442\u043e \u0442\u0430\u043a\u0436\u0435 \u043e\u0442\u0440\u0430\u0437\u0438\u043b\u043e\u0441\u044c \u043d\u0430 \u043e\u0431\u043b\u0438\u043a\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b <code>timer_list<\/code>:<\/p>\n<pre><code class=\"cpp\">struct timer_list {      unsigned long expires;      void (*function)(struct timer_list *);      u32 flags;      \/* ... *\/  };<\/code><\/pre>\n<p>  \u041f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0439 \u043d\u0438\u0436\u0435 \u043a\u043e\u0434 \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u0442 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c \u044f\u0434\u0440\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442 \u043c\u0438\u0433\u0430\u0442\u044c \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434\u0430\u043c\u0438 \u0434\u043e \u0442\u0435\u0445 \u043f\u043e\u0440, \u043f\u043e\u043a\u0430 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u0440\u0443\u0436\u0435\u043d.<\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">kbleds.c<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">\/*   * kbleds.c \u2013 \u043c\u0438\u0433\u0430\u0435\u0442 \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434\u0430\u043c\u0438 \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u044b, \u043f\u043e\u043a\u0430 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u0440\u0443\u0436\u0435\u043d.   *\/    #include &lt;linux\/init.h>  #include &lt;linux\/kd.h> \/* \u0414\u043b\u044f KDSETLED. *\/  #include &lt;linux\/module.h>  #include &lt;linux\/tty.h> \/* \u0414\u043b\u044f tty_struct. *\/  #include &lt;linux\/vt.h> \/* \u0414\u043b\u044f MAX_NR_CONSOLES. *\/  #include &lt;linux\/vt_kern.h> \/* \u0414\u043b\u044f fg_console. *\/  #include &lt;linux\/console_struct.h> \/* \u0414\u043b\u044f vc_cons. *\/    MODULE_DESCRIPTION(\"Example module illustrating the use of Keyboard LEDs.\");    static struct timer_list my_timer;  static struct tty_driver *my_driver;  static unsigned long kbledstatus = 0;    #define BLINK_DELAY HZ \/ 5  #define ALL_LEDS_ON 0x07  #define RESTORE_LEDS 0xFF    \/* \u0424\u0443\u043d\u043a\u0446\u0438\u044f my_timer_func \u043f\u0435\u0440\u0438\u043e\u0434\u0438\u0447\u0435\u0441\u043a\u0438 \u043c\u0438\u0433\u0430\u0435\u0442 \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434\u0430\u043c\u0438,   * \u0432\u044b\u0437\u044b\u0432\u0430\u044f \u0434\u043b\u044f \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430 \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u044b \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0432\u0432\u043e\u0434\u043e\u043c-\u0432\u044b\u0432\u043e\u0434\u043e\u043c    * KDSETLED. \u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043f\u043e \u043a\u043e\u043c\u0430\u043d\u0434\u0430\u043c \u0432\u0432\u043e\u0434\u0430-\u0432\u044b\u0432\u043e\u0434\u0430   * \u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 vt_ioctl() \u0444\u0430\u0439\u043b\u0430 drivers\/tty\/vt\/vt_ioctl.c.   *   * \u0410\u0440\u0433\u0443\u043c\u0435\u043d\u0442 KDSETLED \u043f\u043e\u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0442\u043e \u043d\u0430 7 (\u0447\u0442\u043e \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a   * \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438 \u0440\u0435\u0436\u0438\u043c\u0430 LED_SHOW_IOCTL \u0438 \u0437\u0430\u0433\u043e\u0440\u0430\u043d\u0438\u044e \u0432\u0441\u0435\u0445 \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434\u043e\u0432), \u0442\u043e \u043d\u0430   * 0xFF (\u043b\u044e\u0431\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432\u044b\u0448\u0435 7 \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0440\u0435\u0436\u0438\u043c \u043e\u0431\u0440\u0430\u0442\u043d\u043e \u043d\u0430   * LED_SHOW_FLAGS, \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0447\u0435\u0433\u043e \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434\u044b \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u044e\u0442 \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439   * \u0441\u0442\u0430\u0442\u0443\u0441 \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u044b). \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 setledstate() \u0444\u0430\u0439\u043b\u0430   * drivers\/tty\/vt\/keyboard.c.   *\/  static void my_timer_func(struct timer_list *unused)  {      struct tty_struct *t = vc_cons[fg_console].d->port.tty;        if (kbledstatus == ALL_LEDS_ON)          kbledstatus = RESTORE_LEDS;      else          kbledstatus = ALL_LEDS_ON;        (my_driver->ops->ioctl)(t, KDSETLED, kbledstatus);        my_timer.expires = jiffies + BLINK_DELAY;      add_timer(&amp;my_timer);  }    static int __init kbleds_init(void)  {      int i;        pr_info(\"kbleds: loading\\n\");      pr_info(\"kbleds: fgconsole is %x\\n\", fg_console);      for (i = 0; i &lt; MAX_NR_CONSOLES; i++) {          if (!vc_cons[i].d)              break;          pr_info(\"poet_atkm: console[%i\/%i] #%i, tty %p\\n\", i, MAX_NR_CONSOLES,                  vc_cons[i].d->vc_num, (void *)vc_cons[i].d->port.tty);      }      pr_info(\"kbleds: finished scanning consoles\\n\");        my_driver = vc_cons[fg_console].d->port.tty->driver;      pr_info(\"kbleds: tty driver magic %x\\n\", my_driver->magic);        \/* \u041f\u0435\u0440\u0432\u0430\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0442\u0430\u0439\u043c\u0435\u0440\u0430 \u043c\u0438\u0433\u0430\u043d\u0438\u044f \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434\u043e\u0432. *\/      timer_setup(&amp;my_timer, my_timer_func, 0);      my_timer.expires = jiffies + BLINK_DELAY;      add_timer(&amp;my_timer);        return 0;  }    static void __exit kbleds_cleanup(void)  {      pr_info(\"kbleds: unloading...\\n\");      del_timer(&amp;my_timer);      (my_driver->ops->ioctl)(vc_cons[fg_console].d->port.tty, KDSETLED,                              RESTORE_LEDS);  }    module_init(kbleds_init);  module_exit(kbleds_cleanup);    MODULE_LICENSE(\"GPL\");<\/code><\/pre>\n<p>  <\/div>\n<\/p><\/div>\n<p>  \u0415\u0441\u043b\u0438 \u043d\u0438 \u043e\u0434\u0438\u043d \u0438\u0437 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0445 \u0432 \u044d\u0442\u043e\u0439 \u0433\u043b\u0430\u0432\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u043d\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u043f\u043e\u0434 \u0432\u0430\u0448\u0438 \u043e\u0442\u043b\u0430\u0434\u043e\u0447\u043d\u044b\u0435 \u043d\u0443\u0436\u0434\u044b, \u0442\u043e \u043d\u0430\u0432\u0435\u0440\u043d\u044f\u043a\u0430 \u0435\u0441\u0442\u044c \u0434\u0440\u0443\u0433\u0438\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f. \u041d\u0435 \u0437\u0430\u0434\u0443\u043c\u044b\u0432\u0430\u043b\u0438\u0441\u044c, \u0434\u043b\u044f \u0447\u0435\u0433\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u043e\u043b\u0435\u0437\u043d\u0430 <code>CONFIG_LL_DEBUG<\/code> \u0438\u0437 <code>menu menuconfig<\/code>? \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u0435\u0435 \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438 \u0432\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0435 \u043d\u0438\u0437\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u044b\u0439 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u043c\u0443 \u043f\u043e\u0440\u0442\u0443. \u0418 \u0445\u043e\u0442\u044f \u044d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u043d\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u043e\u0441\u043e\u0431\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u043c, \u0442\u0430\u043a\u043e\u0439 \u043f\u0440\u0438\u0435\u043c \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0440\u043e\u043f\u0430\u0442\u0447\u0438\u0442\u044c <code><a href=\"https:\/\/git.kernel.org\/pub\/scm\/linux\/kernel\/git\/stable\/linux.git\/tree\/kernel\/printk.c\">kernel\/printk.c<\/a><\/code> \u0438\u043b\u0438 \u043b\u044e\u0431\u043e\u0439 \u0434\u0440\u0443\u0433\u043e\u0439 \u0432\u0430\u0436\u043d\u044b\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 \u0434\u043b\u044f \u043f\u0435\u0447\u0430\u0442\u0438 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 ASCII, \u0434\u0435\u043b\u0430\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u043c \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u0441\u0435\u0445 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u043a\u043e\u0434\u0430 \u043d\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u043c \u043f\u043e\u0440\u0442\u0443. \u0415\u0441\u043b\u0438 \u0432\u044b \u0437\u0430\u0439\u043c\u0435\u0442\u0435\u0441\u044c \u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u044f\u0434\u0440\u0430 \u043d\u0430 \u043d\u043e\u0432\u0443\u044e, \u0440\u0430\u043d\u0435\u0435 \u043d\u0435\u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u0443\u044e \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0443, \u0442\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u044d\u0442\u043e\u0433\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0434\u043e\u043b\u0436\u043d\u0430 \u0438\u0434\u0442\u0438 \u043e\u0434\u043d\u043e\u0439 \u0438\u0437 \u043f\u0435\u0440\u0432\u044b\u0445. \u0422\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0447\u0435\u0440\u0435\u0437 netconsole.<\/p>\n<p>  \u041d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u043d\u044b\u0445 \u0437\u0434\u0435\u0441\u044c \u043e\u0442\u043b\u0430\u0434\u043e\u0447\u043d\u044b\u0445 \u043f\u0440\u0438\u0435\u043c\u043e\u0432, \u043a\u043e\u0435-\u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0438\u043c\u0435\u0442\u044c \u0432\u0432\u0438\u0434\u0443. \u041e\u0442\u043b\u0430\u0434\u043a\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u0441\u0435\u0433\u0434\u0430 \u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0438\u043d\u0442\u0440\u0443\u0437\u0438\u0432\u043d\u043e\u0439 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u043e\u0439. \u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043e\u0442\u043b\u0430\u0434\u043e\u0447\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043a \u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u043e\u0448\u0438\u0431\u043a\u0430, \u043d\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u0432\u0437\u0433\u043b\u044f\u0434, \u0438\u0441\u0447\u0435\u0437\u043d\u0435\u0442. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0442\u0430\u043a\u043e\u0439 \u043a\u043e\u0434 \u043d\u0443\u0436\u043d\u043e \u043c\u0438\u043d\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438 \u0441\u043b\u0435\u0434\u0438\u0442\u044c, \u0447\u0442\u043e\u0431\u044b \u043e\u043d \u043d\u0435 \u043f\u043e\u043f\u0430\u043b \u0432 \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u043d-\u043a\u043e\u0434.<\/p>\n<h2><font color=\"#3AC1EF\">14. \u041f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0437\u0430\u0434\u0430\u0447<\/font><\/h2>\n<p>  \u0415\u0441\u0442\u044c \u0434\u0432\u0430 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0447: \u0442\u0430\u0441\u043a\u043b\u0435\u0442\u044b \u0438 \u043e\u0447\u0435\u0440\u0435\u0434\u0438 \u0437\u0430\u0434\u0430\u043d\u0438\u0439. \u0422\u0430\u0441\u043a\u043b\u0435\u0442\u044b \u2013 \u044d\u0442\u043e \u0431\u044b\u0441\u0442\u0440\u044b\u0439 \u0438 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043e\u0434\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u0440\u0438 \u0435\u0435 \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u0435\u043c. \u0410 \u0432\u043e\u0442 \u043e\u0447\u0435\u0440\u0435\u0434\u0438 \u0437\u0430\u0434\u0430\u043d\u0438\u0439 \u0445\u043e\u0442\u044c \u0438 \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b, \u043d\u043e \u0437\u0430\u0442\u043e \u043b\u0443\u0447\u0448\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0442 \u0434\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439 \u0437\u0430\u0434\u0430\u0447.<\/p>\n<h3><font color=\"#3AC1EF\">\u258d 14.1 \u0422\u0430\u0441\u043a\u043b\u0435\u0442\u044b<\/font><\/h3>\n<p>  \u041d\u0438\u0436\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043d \u043f\u0440\u0438\u043c\u0435\u0440 \u043c\u043e\u0434\u0443\u043b\u044f \u0442\u0430\u0441\u043a\u043b\u0435\u0442\u0430. \u0424\u0443\u043d\u043a\u0446\u0438\u044f <code>tasklet_fn<\/code> \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0435\u043a\u0443\u043d\u0434. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>example_tasklet_init<\/code> \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0442\u044c\u0441\u044f \u0434\u043e \u0442\u043e\u0447\u043a\u0438 \u0432\u044b\u0445\u043e\u0434\u0430, \u0447\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u0432\u0438\u0441\u0435\u0442\u044c \u043e\u0442 \u0442\u043e\u0433\u043e, \u0431\u044b\u043b\u0430 \u043b\u0438 \u043e\u043d\u0430 \u043f\u0440\u0435\u0440\u0432\u0430\u043d\u0430 <code>softirq<\/code>.<\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">example_tasklet.c<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">\/*   * example_tasklet.c   *\/  #include &lt;linux\/delay.h>  #include &lt;linux\/interrupt.h>  #include &lt;linux\/kernel.h>  #include &lt;linux\/module.h>    \/* \u041c\u0430\u043a\u0440\u043e\u0441 DECLARE_TASKLET_OLD \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0434\u043b\u044f \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e\u0441\u0442\u0438.   * \u0421\u043c. https:\/\/lwn.net\/Articles\/830964\/.  *\/  #ifndef DECLARE_TASKLET_OLD  #define DECLARE_TASKLET_OLD(arg1, arg2) DECLARE_TASKLET(arg1, arg2, 0L)  #endif    static void tasklet_fn(unsigned long data)  {      pr_info(\"Example tasklet starts\\n\");      mdelay(5000);      pr_info(\"Example tasklet ends\\n\");  }    static DECLARE_TASKLET_OLD(mytask, tasklet_fn);    static int example_tasklet_init(void)  {      pr_info(\"tasklet example init\\n\");      tasklet_schedule(&amp;mytask);      mdelay(200);      pr_info(\"Example tasklet init continues...\\n\");      return 0;  }    static void example_tasklet_exit(void)  {      pr_info(\"tasklet example exit\\n\");      tasklet_kill(&amp;mytask);  }    module_init(example_tasklet_init);  module_exit(example_tasklet_exit);    MODULE_DESCRIPTION(\"Tasklet example\");  MODULE_LICENSE(\"GPL\");<\/code><\/pre>\n<p>  <\/div>\n<\/p><\/div>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0430 <code>dmesg<\/code> \u0434\u043e\u043b\u0436\u043d\u0430 \u043e\u0442\u043e\u0431\u0440\u0430\u0437\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<pre><code class=\"bash\">tasklet example init Example tasklet starts Example tasklet init continues... Example tasklet ends<\/code><\/pre>\n<p>  \u0418 \u0445\u043e\u0442\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u0430\u0441\u043a\u043b\u0435\u0442\u044b \u043b\u0435\u0433\u043a\u043e, \u043e\u043d\u0438 \u0438\u043c\u0435\u044e\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u043e\u0432, \u0438 \u0432 \u0441\u0440\u0435\u0434\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u043e\u0431\u0441\u0443\u0436\u0434\u0430\u0435\u0442\u0441\u044f \u0438\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0435 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0438\u0437 \u044f\u0434\u0440\u0430. \u041e\u0431\u0440\u0430\u0442\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 \u0442\u0430\u0441\u043a\u043b\u0435\u0442\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0432 \u0430\u0442\u043e\u043c\u0430\u0440\u043d\u043e\u043c \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0435 \u0432\u043d\u0443\u0442\u0440\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e\u0433\u043e \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f, \u0442\u043e \u0435\u0441\u0442\u044c \u043e\u043d \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0432\u0445\u043e\u0434\u0438\u0442\u044c \u0432 \u0440\u0435\u0436\u0438\u043c \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u044f \u0438\u043b\u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0434\u0430\u043d\u043d\u044b\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430, \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0447\u0435\u0433\u043e \u0432 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0435 \u0442\u0430\u0441\u043a\u043b\u0435\u0442\u043e\u0432 \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0432\u0441\u044e \u0440\u0430\u0431\u043e\u0442\u0443. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u044f\u0434\u0440\u043e \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u0442 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043b\u044e\u0431\u043e\u0433\u043e \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u0442\u0430\u0441\u043a\u043b\u0435\u0442\u0430. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437\u043d\u044b\u0445 \u043c\u043e\u0433\u0443\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e.<\/p>\n<p>  \u0412 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445 \u044f\u0434\u0440\u0430 \u043f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0442\u0430\u0441\u043a\u043b\u0435\u0442\u044b \u043e\u0447\u0435\u0440\u0435\u0434\u044f\u043c\u0438 \u0437\u0430\u0434\u0430\u043d\u0438\u0439, \u0442\u0430\u0439\u043c\u0435\u0440\u0430\u043c\u0438 \u0438\u043b\u0438 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f\u043c\u0438, \u0432\u044b\u043d\u043e\u0441\u0438\u043c\u044b\u043c\u0438 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u0442\u043e\u043a\u0438 (threaded interrupts). \u041f\u043e\u043a\u0430 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0442\u0430\u0441\u043a\u043b\u0435\u0442\u043e\u0432 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u0442 \u043e\u0441\u0442\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u043e\u043b\u0433\u043e\u0441\u0440\u043e\u0447\u043d\u043e\u0439 \u0446\u0435\u043b\u044c\u044e, \u0432 \u0441\u0432\u043e\u0435\u043c \u0442\u0435\u043a\u0443\u0449\u0435\u043c \u0432\u0438\u0434\u0435 \u044f\u0434\u0440\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0431\u043e\u043b\u0435\u0435 \u0441\u043e\u0442\u043d\u0438 \u0441\u043b\u0443\u0447\u0430\u0435\u0432 \u0438\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f. \u0421\u0435\u0439\u0447\u0430\u0441 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u044e\u0442 \u0432\u043d\u043e\u0441\u0438\u0442\u044c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432 API, \u0438 \u0434\u043b\u044f \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e\u0441\u0442\u0438 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043c\u0430\u043a\u0440\u043e\u0441 <code>DECLARE_TASKLET_OLD<\/code>. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u0447\u0438\u0442\u0430\u0439\u0442\u0435 \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 <a href=\"https:\/\/lwn.net\/Articles\/830964\/\">https:\/\/lwn.net\/Articles\/830964\/<\/a>.<\/p>\n<h3><font color=\"#3AC1EF\">\u258d 14.2 \u041e\u0447\u0435\u0440\u0435\u0434\u0438 \u0437\u0430\u0434\u0430\u043d\u0438\u0439<\/font><\/h3>\n<p>  \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0438 \u0432 \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a \u043c\u043e\u0436\u043d\u043e \u0447\u0435\u0440\u0435\u0437 \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0437\u0430\u0434\u0430\u043d\u0438\u0439. \u0414\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0445 \u0432 \u044d\u0442\u043e\u0439 \u043e\u0447\u0435\u0440\u0435\u0434\u0438 \u0437\u0430\u0434\u0430\u0447 \u044f\u0434\u0440\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 Completely Fair Scheduler (CFS).<\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">sched.c<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">\/*   * sched.c   *\/  #include &lt;linux\/init.h>  #include &lt;linux\/module.h>  #include &lt;linux\/workqueue.h>    static struct workqueue_struct *queue = NULL;  static struct work_struct work;    static void work_handler(struct work_struct *data)  {      pr_info(\"work handler function.\\n\");  }    static int __init sched_init(void)  {      queue = alloc_workqueue(\"HELLOWORLD\", WQ_UNBOUND, 1);      INIT_WORK(&amp;work, work_handler);      schedule_work(&amp;work);      return 0;  }    static void __exit sched_exit(void)  {      destroy_workqueue(queue);  }    module_init(sched_init);  module_exit(sched_exit);    MODULE_LICENSE(\"GPL\");  MODULE_DESCRIPTION(\"Workqueue example\");<\/code><\/pre>\n<p>  <\/div>\n<\/p><\/div>\n<h2><font color=\"#3AC1EF\">\u258d \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u0435<\/font><\/h2>\n<p>  \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u044e\u0449\u0435\u0439. \u0412 \u043d\u0435\u0439 \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0442\u0430\u043a\u0438\u0435 \u0442\u0435\u043c\u044b, \u043a\u0430\u043a \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u0439, \u043a\u0440\u0438\u043f\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u044f, \u0434\u0440\u0430\u0439\u0432\u0435\u0440 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u0432\u0432\u043e\u0434\u0430, \u0441\u043f\u043e\u0441\u043e\u0431\u044b \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u0440\u0443\u0433\u0438\u0435.<\/p>\n<h2><font color=\"#3AC1EF\">\u258d \u0413\u043e\u0442\u043e\u0432\u044b\u0435 \u0447\u0430\u0441\u0442\u0438 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0430:<\/font><\/h2>\n<p>  <\/p>\n<ul>\n<li><a href=\"https:\/\/habr.com\/ru\/company\/ruvds\/blog\/681880\/\">\u0427\u0430\u0441\u0442\u044c 1<\/a><\/li>\n<li><a href=\"https:\/\/habr.com\/ru\/company\/ruvds\/blog\/683106\/\">\u0427\u0430\u0441\u0442\u044c 2<\/a><\/li>\n<li><a href=\"https:\/\/habr.com\/ru\/company\/ruvds\/blog\/684382\/\">\u0427\u0430\u0441\u0442\u044c 3<\/a><\/li>\n<li><a href=\"https:\/\/habr.com\/ru\/company\/ruvds\/blog\/685168\/\">\u0427\u0430\u0441\u0442\u044c 4<\/a><\/li>\n<li><a href=\"https:\/\/habr.com\/ru\/company\/ruvds\/blog\/686596\/\">\u0427\u0430\u0441\u0442\u044c 5<\/a><\/li>\n<li> <b><font color=\"#3AC1EF\">\u0412\u044b \u0442\u0443\u0442 &#8212;> <\/font><\/b><a href=\"https:\/\/habr.com\/ru\/company\/ruvds\/blog\/688564\/\">\u0427\u0430\u0441\u0442\u044c 6<\/a><\/li>\n<\/ul>\n<p>  <\/p>\n<blockquote><p><b><font color=\"#3AC1EF\"><a href=\"https:\/\/bit.ly\/3KZeaxv\">Telegram-\u043a\u0430\u043d\u0430\u043b<\/a> \u0438 <a href=\"https:\/\/bit.ly\/3qoIOXs\">\u0443\u044e\u0442\u043d\u044b\u0439 \u0447\u0430\u0442<\/a> \u0434\u043b\u044f \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432<\/font><\/b><\/p><\/blockquote>\n<p><a href=\"http:\/\/ruvds.com\/ru-rub?utm_source=habr&amp;utm_medium=article&amp;utm_campaign=Bright_Translate&amp;utm_content=posobie_po_programmirovaniyu_modulej_yadra_linux._ch.6\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/sz\/7j\/pf\/sz7jpfj8i1pa6ocj-eia09dev4q.png\" data-src=\"https:\/\/habrastorage.org\/webt\/sz\/7j\/pf\/sz7jpfj8i1pa6ocj-eia09dev4q.png\"\/><\/a><\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/company\/ruvds\/blog\/688564\/\"> https:\/\/habr.com\/ru\/company\/ruvds\/blog\/688564\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\"><a href=\"https:\/\/habr.com\/ru\/company\/ruvds\/blog\/688564\/\"><\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/-7\/yl\/hp\/-7ylhpzc6raohz-vopxottyejfu.png\" data-src=\"https:\/\/habrastorage.org\/webt\/-7\/yl\/hp\/-7ylhpzc6raohz-vopxottyejfu.png\"\/><\/div>\n<p><\/a><br \/>  \u041e\u0447\u0435\u0440\u0435\u0434\u043d\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u043f\u043e\u0441\u043e\u0431\u0438\u044f \u043f\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e \u043c\u043e\u0434\u0443\u043b\u0435\u0439 \u044f\u0434\u0440\u0430 \u043e\u0442 2 \u0438\u044e\u043b\u044f 2022 \u0433\u043e\u0434\u0430. \u0412 \u043d\u0435\u0439 \u043c\u044b \u043f\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u043c\u0441\u044f \u0441 \u043f\u043e\u043d\u044f\u0442\u0438\u0435\u043c tty, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u043c \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u0443 \u043c\u0430\u043a\u0440\u043e\u0441\u0443 <code>print<\/code>, \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u043c\u043e\u0434\u0443\u043b\u044c \u0434\u043b\u044f \u043c\u0438\u0433\u0430\u043d\u0438\u044f \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434\u0430\u043c\u0438 \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u044b, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u0442\u0435\u043c\u0443 \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0447 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0442\u0430\u0441\u043a\u043b\u0435\u0442\u043e\u0432 \u0438 \u043e\u0447\u0435\u0440\u0435\u0434\u0435\u0439 \u0437\u0430\u0434\u0430\u043d\u0438\u0439.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-338476","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/338476","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=338476"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/338476\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=338476"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=338476"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=338476"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}