{"id":331101,"date":"2022-03-26T21:00:08","date_gmt":"2022-03-26T21:00:08","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=331101"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=331101","title":{"rendered":"<span>\u0411\u0430\u0433 \u0432 \u044f\u0434\u0440\u0435 Linux \u0438 \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0436\u0430\u043b\u043e\u0432\u0430\u0442\u044c\u0441\u044f<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u042f \u0440\u0430\u0431\u043e\u0442\u0430\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u043e\u043c \u0432 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 \u041a\u0440\u0438\u043f\u0442\u043e\u041f\u0440\u043e. \u041d\u0435\u0440\u0435\u0434\u043a\u043e \u043c\u043e\u0438 \u0437\u0430\u0434\u0430\u0447\u0438 \u0441\u0432\u044f\u0437\u0430\u043d\u044b \u0441 \u043e\u0448\u0438\u0431\u043a\u0430\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043b\u0435\u0436\u0430\u0442 \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u043d\u0438\u0436\u043d\u0435\u043c \u0443\u0440\u043e\u0432\u043d\u0435 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c, \u043f\u043e\u0434 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u043f\u0438\u0448\u0435\u043c \u041f\u041e. \u042f \u0445\u043e\u0447\u0443 \u043f\u043e\u0432\u0435\u0434\u0430\u0442\u044c \u0442\u0435\u0431\u0435, \u0425\u0430\u0431\u0440, \u043e\u0431 \u043e\u0434\u043d\u043e\u0439 \u0438\u0437 \u0442\u0430\u043a\u0438\u0445 \u043e\u0448\u0438\u0431\u043e\u043a \u0438 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u044f \u0436\u0430\u043b\u043e\u0432\u0430\u043b\u0441\u044f \u043d\u0430 \u043d\u0435\u0451 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c.<\/p>\n<p>\u042f \u043e\u0442\u0432\u0435\u0447\u0430\u044e \u0437\u0430 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 \u043e\u0434\u043d\u043e\u0439 \u0438\u0437 \u043d\u0430\u0448\u0438\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0441 C-\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u043c, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0439 \u043d\u0430 C \u0438 C++. \u041c\u043e\u0439 \u043a\u043e\u043b\u043b\u0435\u0433\u0430 \u0438\u0437 \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u043e\u0442\u0434\u0435\u043b\u0430 \u0441\u043e\u043e\u0431\u0449\u0438\u043b, \u0447\u0442\u043e \u0435\u0433\u043e \u043d\u0430\u0433\u0440\u0443\u0437\u043e\u0447\u043d\u044b\u0439 \u0442\u0435\u0441\u0442 \u043d\u0430\u0448\u0435\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u043d\u0430 C# \u0432 Linux \u0432\u044b\u0434\u0430\u0451\u0442 \u043e\u0448\u0438\u0431\u043a\u0443 \u0432 \u0445\u0438\u0442\u0440\u043e\u043c \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0438: \u043d\u0443\u0436\u043d\u043e \u0438\u043c\u0435\u0442\u044c \u0434\u0432\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u043f\u043e \u043f\u044f\u0442\u044c \u043f\u043e\u0442\u043e\u043a\u043e\u0432, \u0434\u0435\u043b\u0430\u044e\u0449\u0438\u0445 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0434\u0435\u043d\u0442\u0438\u0447\u043d\u044b\u0435 \u0432\u044b\u0437\u043e\u0432\u044b. \u0415\u0441\u043b\u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043e\u0434\u0438\u043d, \u0430 \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u043c\u043d\u043e\u0433\u043e, \u0442\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u043d\u0435 \u043f\u0440\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f. \u0415\u0441\u043b\u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432 \u0434\u0432\u0430, \u043d\u043e \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443 \u043f\u043e\u0442\u043e\u043a\u0443, \u0442\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u043d\u0435 \u043f\u0440\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f. \u041f\u0443\u0442\u0451\u043c \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0430 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u043e\u0432 \u043d\u0430\u0433\u0440\u0443\u0437\u043e\u0447\u043d\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0430 \u0438 \u043b\u043e\u0433\u043e\u0432 \u0440\u0430\u0431\u043e\u0442\u044b \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043f\u0435\u0440\u0435\u043d\u0435\u0441\u0442\u0438 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u0432 \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0439 \u044e\u043d\u0438\u0442-\u0442\u0435\u0441\u0442 \u043d\u0430 C++ \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043d\u0430\u0448\u0435\u0433\u043e API.<\/p>\n<p>\u0412\u0441\u043a\u0440\u044b\u043b\u043e\u0441\u044c \u043e\u0447\u0435\u043d\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0435. \u041e\u0448\u0438\u0431\u043a\u0443 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u043b\u0430 <a href=\"https:\/\/man7.org\/linux\/man-pages\/man3\/lockf.3.html\" rel=\"noopener noreferrer nofollow\">\u0444\u0443\u043d\u043a\u0446\u0438\u044f lockf<\/a>, \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0449\u0430\u044f \u0437\u0430 \u0432\u0437\u044f\u0442\u0438\u0435 \u043e\u0431\u0449\u0435\u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0439 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438 \u043d\u0430 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0439 \u0444\u0430\u0439\u043b. \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0432 \u043e\u0431\u0449\u0438\u0445 \u0447\u0435\u0440\u0442\u0430\u0445 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0442\u0430\u043a: \u0435\u0441\u043b\u0438 \u043e\u0434\u0438\u043d \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043b \u0444\u0430\u0439\u043b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e lockf, \u0442\u043e \u0434\u0440\u0443\u0433\u0438\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u044b \u043f\u0440\u0438 \u043f\u043e\u043f\u044b\u0442\u043a\u0435 \u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e lockf \u0436\u0434\u0443\u0442 \u0435\u0433\u043e \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0432\u044b\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u043c. \u0412\u0441\u0435 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0441 \u0444\u0430\u0439\u043b\u043e\u043c \u043f\u043e-\u043f\u0440\u0435\u0436\u043d\u0435\u043c\u0443 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0434\u0440\u0443\u0433\u0438\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430\u043c, \u0442\u043e \u0435\u0441\u0442\u044c \u044d\u0442\u0430 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0430 \u043d\u0435 \u043d\u0430\u0432\u044f\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u043f\u044b\u0442\u0430\u043b\u0438\u0441\u044c \u0432\u0437\u044f\u0442\u044c \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0443 \u044f\u0432\u043d\u044b\u043c \u0432\u044b\u0437\u043e\u0432\u043e\u043c lockf.<\/p>\n<p>errno \u0431\u044b\u043b\u043e \u0440\u0430\u0432\u043d\u043e 35, \u0447\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u043b\u043e \u043a\u043e\u0434 EDEADLK \u0441 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435\u043c \u00abResource deadlock avoided\u00bb. \u042f \u043f\u043e\u043b\u0435\u0437 \u0432 \u043c\u0430\u043d\u044b. \u00abAllocating a system resource would have resulted in a deadlock situation. The system does not guarantee that it will notice all such situations. This error means you got lucky and the system noticed; it might just hang.\u00bb \u0421\u0438\u0441\u0442\u0435\u043c\u0430 \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u043d\u0430\u043c: \u0435\u0441\u043b\u0438 \u043e\u043d\u0430 \u0441\u0434\u0435\u043b\u0430\u0435\u0442 \u0442\u043e, \u0447\u0442\u043e \u043c\u044b \u043f\u043e\u043f\u0440\u043e\u0441\u0438\u043b\u0438, \u0442\u043e \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0451\u0442 \u0432\u0437\u0430\u0438\u043c\u043d\u0430\u044f \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0430, \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u044d\u0442\u043e\u0433\u043e \u043d\u0435 \u0445\u043e\u0447\u0435\u0442, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u0435\u0440\u043d\u0451\u0442 \u043e\u0448\u0438\u0431\u043a\u0443. \u041d\u043e \u0447\u0442\u043e \u044d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u043b\u043e \u0432 \u043c\u043e\u0451\u043c \u0441\u043b\u0443\u0447\u0430\u0435?<\/p>\n<p>\u0414\u043b\u044f \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043e\u0448\u0438\u0431\u043a\u0438 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043b\u043e\u0441\u044c \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u0434\u0432\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u043f\u043e \u0434\u0432\u0430 \u043f\u043e\u0442\u043e\u043a\u0430 \u0432 \u043a\u0430\u0436\u0434\u043e\u043c. \u041f\u0435\u0440\u0432\u044b\u0439 \u043f\u043e\u0442\u043e\u043a \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0432\u0437\u044f\u043b \u043b\u043e\u043a \u043d\u0430 \u0444\u0430\u0439\u043b \u0410. \u041f\u0435\u0440\u0432\u044b\u0439 \u043f\u043e\u0442\u043e\u043a \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0432\u0437\u044f\u043b \u043b\u043e\u043a \u043d\u0430 \u0444\u0430\u0439\u043b \u0411. \u0412\u0442\u043e\u0440\u043e\u0439 \u043f\u043e\u0442\u043e\u043a \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u0445\u043e\u0442\u0435\u043b \u0432\u0437\u044f\u0442\u044c \u043b\u043e\u043a \u043d\u0430 \u0444\u0430\u0439\u043b \u0411, \u043d\u043e \u043d\u0435 \u0441\u043c\u043e\u0433 \u2013 \u043b\u043e\u043a \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0438\u0442 \u0432\u0442\u043e\u0440\u043e\u043c\u0443 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0443. \u041e\u043d \u0436\u0434\u0451\u0442 \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u043b\u043e\u043a\u0430 \u043d\u0430 \u0444\u0430\u0439\u043b \u0411. \u0412\u0442\u043e\u0440\u043e\u0439 \u043f\u043e\u0442\u043e\u043a \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u0445\u043e\u0442\u0435\u043b \u0432\u0437\u044f\u0442\u044c \u043b\u043e\u043a \u043d\u0430 \u0444\u0430\u0439\u043b \u0410, \u043d\u043e \u043d\u0435 \u0441\u043c\u043e\u0433 \u2013 \u043b\u043e\u043a \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0438\u0442 \u043f\u0435\u0440\u0432\u043e\u043c\u0443 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0443. \u041e\u0436\u0438\u0434\u0430\u043d\u0438\u044f \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u043d\u0435 \u0431\u0443\u0434\u0435\u0442, lockf \u043d\u0435\u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e \u0432\u0435\u0440\u043d\u0451\u0442 \u043e\u0448\u0438\u0431\u043a\u0443, \u0432\u0435\u0434\u044c \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f <a href=\"https:\/\/github.com\/torvalds\/linux\/blob\/master\/fs\/locks.c\" rel=\"noopener noreferrer nofollow\">\u0434\u0435\u0442\u0435\u043a\u0442\u043e\u0440\u0430 \u0432\u0437\u0430\u0438\u043c\u043d\u044b\u0445 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043e\u043a \u0432 \u044f\u0434\u0440\u0435 Linux<\/a> \u043d\u0430\u0441\u0442\u0430\u043b \u043c\u043e\u043c\u0435\u043d\u0442 \u0431\u0438\u0442\u044c \u0432 \u043d\u0430\u0431\u0430\u0442!<\/p>\n<p>\u041d\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u0432\u0437\u0433\u043b\u044f\u0434, \u0442\u0443\u0442 \u043a\u0430\u043a \u0431\u0443\u0434\u0442\u043e \u0431\u044b \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0445\u0440\u0435\u0441\u0442\u043e\u043c\u0430\u0442\u0438\u0439\u043d\u044b\u0439 deadlock \u0438\u0437 \u0443\u0447\u0435\u0431\u043d\u0438\u043a\u043e\u0432 \u043f\u043e \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e\u043c\u0443 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e. \u0418\u043b\u0438 \u0432\u0441\u0451 \u0436\u0435 \u043d\u0435\u0442? \u041f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0432\u0442\u043e\u0440\u043e\u0439 \u043f\u043e\u0442\u043e\u043a \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u0441\u0442\u0430\u043b \u0431\u044b \u0436\u0434\u0430\u0442\u044c \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u043b\u043e\u043a\u0430 \u043d\u0430 \u0444\u0430\u0439\u043b \u0410. \u0412\u0441\u0442\u0430\u043b\u0438 \u0431\u044b \u043d\u0430\u043c\u0435\u0440\u0442\u0432\u043e \u0432\u0441\u0435 \u0447\u0435\u0442\u044b\u0440\u0435 \u043f\u043e\u0442\u043e\u043a\u0430 \u043e\u0431\u043e\u0438\u0445 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432? \u041f\u043e\u0447\u0442\u0438 \u043d\u0430\u0432\u0435\u0440\u043d\u044f\u043a\u0430 \u043d\u0435\u0442. \u041e\u0431\u044b\u0447\u043d\u043e \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0442\u0430\u043a, \u0447\u0442\u043e \u043a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 \u043d\u0438\u0445 \u043f\u043e\u043b\u0443\u0447\u0438\u0442 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0447\u0435\u0440\u0435\u0437 \u043a\u0430\u043a\u043e\u0435-\u0442\u043e \u0432\u0440\u0435\u043c\u044f. \u0422\u043e\u0433\u0434\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u043f\u043e\u0442\u043e\u043a \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u043c\u043e\u0433 \u0431\u044b \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0438 \u043e\u0442\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043b\u043e\u043a \u043d\u0430 \u0444\u0430\u0439\u043b \u0410, \u0442\u0435\u043c \u0441\u0430\u043c\u044b\u043c \u0434\u0430\u0432 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0432\u0437\u044f\u0442\u044c \u043b\u043e\u043a \u0432\u0442\u043e\u0440\u043e\u043c\u0443 \u043f\u043e\u0442\u043e\u043a\u0443 \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430. \u0418\u043b\u0438 \u0436\u0435 \u043f\u0435\u0440\u0432\u044b\u0439 \u043f\u043e\u0442\u043e\u043a \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435, \u043e\u0442\u043f\u0443\u0441\u0442\u0438\u0442 \u043b\u043e\u043a \u043d\u0430 \u0444\u0430\u0439\u043b \u0411, \u0442\u0435\u043c \u0441\u0430\u043c\u044b\u043c \u0434\u0430\u0432 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0432\u0437\u044f\u0442\u044c \u043b\u043e\u043a \u0432\u0442\u043e\u0440\u043e\u043c\u0443 \u043f\u043e\u0442\u043e\u043a\u0443 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430. \u041d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432 \u0432\u0437\u0430\u0438\u043c\u043d\u0430\u044f \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0430 \u043a\u0430\u043a \u0431\u0443\u0434\u0442\u043e \u0431\u044b \u0435\u0441\u0442\u044c, \u0430 \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u0435\u0451 \u043d\u0435\u0442.<\/p>\n<p>\u0422\u0430\u043a\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043c\u0435\u043d\u044f \u0443\u0434\u0438\u0432\u0438\u043b\u043e. \u042f \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0439 \u044e\u043d\u0438\u0442-\u0442\u0435\u0441\u0442 \u043d\u0430 C \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e libc, \u0438 \u043e\u043d \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u043b, \u0447\u0442\u043e \u043f\u043e\u0447\u0442\u0438 \u043d\u0430\u0432\u0435\u0440\u043d\u044f\u043a\u0430 \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u0430\u044f \u043e\u0448\u0438\u0431\u043a\u0430 \u0432\u044b\u0437\u044b\u0432\u0430\u043b\u0430\u0441\u044c \u0440\u043e\u0432\u043d\u043e \u044d\u0442\u0438\u043c. \u041a\u043e\u0434 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d \u043d\u0438\u0436\u0435. \u041a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u044f: gcc -o edeadlk .\/edeadlk.c -lpthread. \u0417\u0430\u043f\u0443\u0441\u043a: .\/edeadlk a b \u0432 \u043f\u0435\u0440\u0432\u043e\u043c \u044d\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u0435 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0430, .\/edeadlk a b \u0432\u043e \u0432\u0442\u043e\u0440\u043e\u043c \u044d\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u0435 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0430.<\/p>\n<details class=\"spoiler\">\n<summary>\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"cpp\">#include&lt;unistd.h> #include&lt;stdio.h> #include&lt;stdlib.h> #include&lt;fcntl.h> #include&lt;errno.h> #include&lt;pthread.h> #include&lt;stddef.h> #include&lt;stdint.h>  #define DIE(x)\\ {\\ fprintf(stderr, \"Assertion failed: \" #x \" file: %s, line:%d, errno:%d \", __FILE__, __LINE__, errno); \\ perror(\". Error:\");\\ fflush(stdout);\\ abort();\\ } #define ASS(x) if (!(x)) DIE(x) #define ASS1(x) ASS((x) != -1) #define ASS0(x) ASS((x) == 0)  void * deadlocker(void *arg) {     int fd = (int)(ptrdiff_t)arg;     for (;;) {         ASS1( lockf(fd, F_LOCK, 1) );         ASS1( lockf(fd, F_ULOCK, 1) );     }     return NULL; }  int main(int argc, char * argv[]) {     int fd1, fd2;     ASS( argc >= 3 );     ASS1( fd1 = creat(argv[1], 0660) );     ASS1( fd2 = creat(argv[2], 0660) );     void * thrv;     pthread_t thr1, thr2;     ASS0( pthread_create(&amp;thr1, NULL, deadlocker, (void *)(ptrdiff_t)fd2) );     ASS0( pthread_create(&amp;thr2, NULL, deadlocker, (void *)(ptrdiff_t)fd1) );     ASS0( pthread_join(thr1, &amp;thrv) );     ASS0( pthread_join(thr2, &amp;thrv) );     return 0; }<\/code><\/pre>\n<\/div>\n<\/details>\n<p>\u042f \u043f\u043e\u0433\u0440\u0443\u0437\u0438\u043b\u0441\u044f \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e. \u0421 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f libc, \u0444\u0443\u043d\u043a\u0446\u0438\u044f lockf \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432 (\u00abLocks are associated with processes\u00bb), \u043e\u043d\u0430 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0437\u043d\u0430\u0435\u0442 \u043f\u0440\u043e \u043f\u043e\u0442\u043e\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u0440\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u044c \u043a\u0430\u043a\u0438\u0435-\u0442\u043e \u043f\u0440\u043e\u0442\u0438\u0432\u043e\u0440\u0435\u0447\u0438\u044f. \u0415\u0441\u043b\u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 1 \u0432\u0437\u044f\u043b \u043b\u043e\u043a \u0410 \u0438 \u0436\u0434\u0451\u0442 \u043b\u043e\u043a \u0411, \u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 2 \u043d\u0430\u043e\u0431\u043e\u0440\u043e\u0442, \u0442\u043e \u0442\u043e\u0440\u043c\u043e\u0437\u0438\u043c \u043d\u0435\u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e. \u00abThe specified region is being locked by another process. But that process is waiting to lock a region which the current process has locked, so waiting for the lock would result in deadlock. The system does not guarantee that it will detect all such conditions, but it lets you know if it notices one.\u00bb<\/p>\n<p>POSIX \u0442\u043e\u0436\u0435 \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0435\u0442, \u0447\u0442\u043e \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0441\u0432\u043e\u0435\u0433\u043e \u0440\u043e\u0434\u0430 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0435: \u00abA potential for deadlock occurs if the threads of a process controlling a locked section are blocked by accessing a locked section of another process. If the system detects that deadlock would occur, lockf() shall fail with an [EDEADLK] error.\u00bb<\/p>\n<p>strace \u043d\u0435 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u043b \u043c\u043d\u0435 \u0432\u044b\u0437\u043e\u0432\u043e\u0432 lockf, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e lockf \u0432 glibc \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u0430 \u0447\u0435\u0440\u0435\u0437 fcntl: \u00abOn Linux, lockf() is just an interface on top of fcntl(2) locking\u00bb. \u042f \u043d\u0430\u0448\u0451\u043b \u0442\u0430\u043a\u0436\u0435 \u0442\u0430\u043a\u0438\u0435 \u0441\u043b\u043e\u0432\u0430: \u00abWhen placing locks with F_SETLKW, the kernel detects deadlocks, whereby two or more processes have their lock requests mutually blocked by locks held by the other processes. For example, suppose process A holds a write lock on byte 100 of a file, and process B holds a write lock on byte 200. If each process then attempts to lock the byte already locked by the other process using F_SETLKW, then, without deadlock detection, both processes would remain blocked indefinitely. When the kernel detects such deadlocks, it causes one of the blocking lock requests to immediately fail with the error EDEADLK; an application that encounters such an error should release some of its locks to allow other applications to proceed before attempting regain the locks that it requires. Circular deadlocks involving more than two processes are also detected. Note, however, that there are limitations to the kernel&#8217;s deadlock-detection algorithm; see BUGS.\u00bb<\/p>\n<p>\u0422\u0430\u043a-\u0442\u0430\u043a-\u0442\u0430\u043a, \u0430 \u0447\u0442\u043e \u0442\u0430\u043c? \u00abThe deadlock-detection algorithm employed by the kernel when dealing with F_SETLKW requests can yield both false negatives (failures to detect deadlocks, leaving a set of deadlocked processes blocked indefinitely) and false positives (EDEADLK errors when there is no deadlock). For example, the kernel limits the lock depth of its dependency search to 10 steps, meaning that circular deadlock chains that exceed that size will not be detected. In addition, the kernel may falsely indicate a deadlock when two or more processes created using the clone(2) CLONE_FILES flag place locks that appear (to the kernel) to conflict.\u00bb<\/p>\n<p>\u041d\u0435\u0445\u043e\u0440\u043e\u0448\u043e. \u041f\u043e\u0445\u043e\u0436\u0435, \u0442\u0443\u0442 \u043c\u044b \u043d\u0430\u0441\u0442\u0443\u043f\u0438\u043b\u0438 \u043d\u0430 \u0433\u0440\u0430\u0431\u043b\u0438, \u0438 \u0442\u0435\u043f\u0435\u0440\u044c \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043b\u043e\u0441\u044c \u043a\u0430\u043a-\u0442\u043e \u043f\u0440\u0435\u043e\u0434\u043e\u043b\u0435\u0442\u044c \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u044b\u0439 \u0444\u0430\u0442\u0430\u043b\u044c\u043d\u044b\u0439 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u043a lockf. \u042f \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u043b \u043f\u0440\u043e \u0446\u0435\u043b\u044b\u0439 \u0432\u0430\u0433\u043e\u043d \u0440\u0430\u0437\u043d\u044b\u0445 \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u043e\u0432 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u0432 *nix, \u0438 \u0441\u0430\u043c\u044b\u043c \u043d\u0430\u0434\u0451\u0436\u043d\u044b\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c \u0432 \u043c\u043e\u0435\u0439 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0439 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438 \u043c\u043d\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u0445\u043e\u0436\u0435\u0439 <a href=\"https:\/\/man7.org\/linux\/man-pages\/man2\/flock.2.html\" rel=\"noopener noreferrer nofollow\">\u0444\u0443\u043d\u043a\u0446\u0438\u0438 flock<\/a> \u0432\u043c\u0435\u0441\u0442\u043e lockf. \u041e\u043d\u0430 \u043d\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u0438\u0434\u0435\u043d\u0442\u0438\u0447\u043d\u0430 lockf, \u043c\u0435\u0436\u0434\u0443 \u043d\u0438\u043c\u0438 \u0435\u0441\u0442\u044c \u0442\u043e\u043d\u043a\u0438\u0435 \u0440\u0430\u0437\u043b\u0438\u0447\u0438\u044f, \u043d\u043e \u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u043e\u043d\u0438 \u0432 \u0446\u0435\u043b\u043e\u043c \u0441\u0445\u043e\u0436\u0438. \u041a \u0441\u0447\u0430\u0441\u0442\u044c\u044e, flock \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u0433\u043b\u0443\u0431\u043e\u043a\u043e \u043f\u043e\u0434 \u043a\u0430\u043f\u043e\u0442\u043e\u043c \u0442\u0430\u043a\u043e\u0439 \u0445\u0438\u0442\u0440\u043e\u0439 \u043b\u043e\u0433\u0438\u043a\u0438 \u043f\u043e \u0434\u0435\u0442\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e \u0432\u0437\u0430\u0438\u043c\u043d\u044b\u0445 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043e\u043a: \u00abflock() does not detect deadlock\u00bb. \u042f \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043b, \u0447\u0442\u043e \u044d\u0442\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043b\u0435\u0447\u0430\u0442 \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0439 \u044e\u043d\u0438\u0442-\u0442\u0435\u0441\u0442 \u043d\u0430 C \u0434\u043b\u044f libc, \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0439 \u044e\u043d\u0438\u0442-\u0442\u0435\u0441\u0442 \u043d\u0430 C++ \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438, \u043d\u0430\u0433\u0440\u0443\u0437\u043e\u0447\u043d\u044b\u0439 \u0442\u0435\u0441\u0442 \u043d\u0430 C# \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438, \u0437\u0430\u043a\u043e\u043c\u043c\u0438\u0442\u0438\u043b\u0441\u044f, \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043b \u043d\u043e\u0447\u043d\u044b\u0435 \u0442\u0435\u0441\u0442\u044b \u0438 \u043e\u0431\u0440\u0430\u0434\u043e\u0432\u0430\u043b\u0441\u044f.<\/p>\n<p>\u041a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0431\u044b, \u0442\u0443\u0442 \u0438 \u0441\u043a\u0430\u0437\u043e\u0447\u043a\u0435 \u043a\u043e\u043d\u0435\u0446, \u043d\u043e \u044f \u0436\u0435 \u0445\u043e\u0440\u043e\u0448\u0438\u0439 \u043f\u0430\u0440\u0435\u043d\u044c, \u043d\u0430\u0434\u043e \u0436\u0435 \u043f\u043e\u0436\u0430\u043b\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u043c\u0435\u0439\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430\u043c Linux! \u0414\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043c\u043e\u0435\u0439 \u0440\u0430\u0431\u043e\u0447\u0435\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 \u044d\u0442\u043e\u0433\u043e \u043d\u0435 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043b\u043e\u0441\u044c, \u043d\u043e \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u043c\u043e\u0435\u0433\u043e \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u043e\u0442 \u0430\u0432\u0442\u043e\u0440\u0438\u0442\u0435\u0442\u043d\u044b\u0445 \u043b\u044e\u0434\u0435\u0439, \u0430 \u0435\u0449\u0451 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0434\u043e\u0431\u0440\u043e\u0435 \u0434\u0435\u043b\u043e.<\/p>\n<p>\u0425\u043e\u0440\u043e\u0448\u043e, \u043f\u0435\u0440\u0432\u044b\u043c \u0434\u0435\u043b\u043e\u043c \u043d\u0430\u0432\u0435\u0440\u043d\u043e\u0435 \u043f\u043e\u0439\u0434\u0451\u043c \u0432 <a href=\"https:\/\/bugzilla.kernel.org\" rel=\"noopener noreferrer nofollow\">\u0431\u0430\u0433-\u0442\u0440\u0435\u043a\u0435\u0440 \u044f\u0434\u0440\u0430 Linux<\/a>. \u0427\u0442\u043e \u043c\u044b \u0442\u0430\u043c \u0432\u0438\u0434\u0438\u043c?<\/p>\n<p>\u00abPlease use your distribution&#8217;s bug tracking tools<\/p>\n<p>This bugzilla is for reporting bugs against upstream Linux kernels.<\/p>\n<p>If you did not compile your own kernel from scratch, you are probably in the wrong place.<\/p>\n<p>Please use the following links to report a bug to your distribution instead:<\/p>\n<p>Ubuntu | Fedora | Arch | Mint | Debian | Red Hat | OpenSUSE | SUSE\u00bb<\/p>\n<p>\u041c\u043e\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u043b\u0430\u0441\u044c \u043d\u0430 \u0440\u044f\u0434\u0435 \u0441\u0442\u0430\u0440\u044b\u0445 \u044f\u0434\u0435\u0440 \u0438 \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u0434\u0438\u0441\u0442\u0440\u0438\u0431\u0443\u0442\u0438\u0432\u0430\u0445, \u0438 \u044f \u0431\u044b\u043b \u043d\u0430 99% \u0443\u0432\u0435\u0440\u0435\u043d, \u0447\u0442\u043e \u0432\u0438\u0436\u0443 \u0435\u0451 \u0432 \u043a\u043e\u0434\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u0440\u0435\u0432\u0438\u0437\u0438\u0438. \u042f\u0434\u0440\u043e \u0438\u0437 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u043e\u0432 \u044f \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u0441\u043e\u0431\u0438\u0440\u0430\u043b, \u0440\u0430\u0434\u0438 \u0442\u0430\u043a\u043e\u0433\u043e \u043f\u043e\u0432\u043e\u0434\u0430 \u0434\u0430\u0436\u0435 \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c, \u043d\u043e \u0437\u0430 20 \u043c\u0438\u043d\u0443\u0442 \u043d\u0435 \u0441\u043c\u043e\u0433 \u0438 \u043f\u043e\u0442\u0435\u0440\u044f\u043b \u043c\u043e\u0442\u0438\u0432\u0430\u0446\u0438\u044e. \u041e\u043a\u0435\u0439\u2026<\/p>\n<p><a href=\"https:\/\/bugs.launchpad.net\/ubuntu\/+source\/linux\/+bug\/1926481\" rel=\"noopener noreferrer nofollow\">\u041f\u043e\u0436\u0430\u043b\u043e\u0432\u0430\u043b\u0441\u044f \u0432 \u0431\u0430\u0433-\u0442\u0440\u0435\u043a\u0435\u0440 Ubuntu<\/a>. \u0417\u0430 \u043d\u0435\u0434\u0435\u043b\u044e \u043d\u0438\u043a\u0430\u043a\u043e\u0433\u043e \u043e\u0442\u0432\u0435\u0442\u0430 \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b. \u041e\u043a\u0435\u0439\u2026<\/p>\n<p><a href=\"https:\/\/lore.kernel.org\/lkml\/CAL-cVehkm=KPdQ=1rN6hyeMDiMXa--aG3gij==Nf8mNv=XZ0sQ@mail.gmail.com\/\" rel=\"noopener noreferrer nofollow\">\u041f\u043e\u0436\u0430\u043b\u043e\u0432\u0430\u043b\u0441\u044f \u0432 \u0440\u0430\u0441\u0441\u044b\u043b\u043a\u0443 LKML<\/a>, \u0433\u043b\u0430\u0432\u043d\u0443\u044e \u0440\u0430\u0441\u0441\u044b\u043b\u043a\u0443 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u044f\u0434\u0440\u0430 Linux. \u0417\u0430 \u043d\u0435\u0434\u0435\u043b\u044e \u043d\u0438\u043a\u0430\u043a\u043e\u0433\u043e \u043e\u0442\u0432\u0435\u0442\u0430 \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b. \u041e\u043a\u0435\u0439\u2026<\/p>\n<p>\u0421\u043b\u0443\u0447\u0430\u0439\u043d\u043e \u043d\u0430\u0442\u043a\u043d\u0443\u043b\u0441\u044f \u043d\u0430 \u0444\u0430\u0439\u043b <a href=\"https:\/\/github.com\/torvalds\/linux\/blob\/master\/MAINTAINERS\" rel=\"noopener noreferrer nofollow\">MAINTAINERS<\/a> \u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0430\u0445 \u044f\u0434\u0440\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0433\u043e\u0432\u043e\u0440\u0438\u043b, \u0447\u0442\u043e \u0436\u0430\u043b\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430\u0434\u043e \u043d\u0435 \u0432 LKML, \u0430 \u0432 \u0431\u043e\u043b\u0435\u0435 \u0443\u0437\u043a\u043e\u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u0440\u0430\u0441\u0441\u044b\u043b\u043a\u0443. \u0423 \u043c\u0435\u043d\u044f \u0431\u044b\u043b\u0430 \u0436\u0430\u043b\u043e\u0431\u0430 \u043d\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044e lockf \u0438 \u043d\u0430 \u043a\u043e\u0434 \u0432 \u0444\u0430\u0439\u043b\u0435 fs\/locks.c. \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c.<\/p>\n<p><code>FILE LOCKING (flock() and fcntl()\/lockf())<\/code><\/p>\n<p><code>M:Jeff Layton &lt;jlayton@kernel.org><\/code><\/p>\n<p><code>L:linux-fsdevel@vger.kernel.org<\/code><\/p>\n<p><code>S:Maintained<\/code><\/p>\n<p><code>F:fs\/fcntl.c<\/code><\/p>\n<p><code>F:fs\/locks.c<\/code><\/p>\n<p><code>F:include\/linux\/fcntl.h<\/code><\/p>\n<p><code>F:include\/uapi\/linux\/fcntl.h<\/code><\/p>\n<p><a href=\"https:\/\/lore.kernel.org\/linux-fsdevel\/CAL-cVeifoTfbYRfOcb0YeYor+sCtPWo_2__49taprONhR+tncw@mail.gmail.com\/T\/#u\" rel=\"noopener noreferrer nofollow\">\u041f\u043e\u0436\u0430\u043b\u043e\u0432\u0430\u043b\u0441\u044f \u0432 \u0440\u0430\u0441\u0441\u044b\u043b\u043a\u0443 linux-fsdevel<\/a>. \u0417\u0430 \u043d\u0435\u0434\u0435\u043b\u044e \u043d\u0438\u043a\u0430\u043a\u043e\u0433\u043e \u043e\u0442\u0432\u0435\u0442\u0430 \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b. \u041e\u043a\u0435\u0439\u2026<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0447\u0435\u0441\u0442\u043d\u043e, \u043c\u043d\u0435 \u044d\u0442\u043e \u0443\u0436\u0435 \u043f\u043e\u0440\u044f\u0434\u043a\u043e\u043c \u043f\u043e\u0434\u043d\u0430\u0434\u043e\u0435\u043b\u043e. \u0416\u0430\u043b\u0443\u0435\u0448\u044c\u0441\u044f-\u0436\u0430\u043b\u0443\u0435\u0448\u044c\u0441\u044f, \u043d\u0430 \u0431\u043b\u044e\u0434\u0435\u0447\u043a\u0435 \u043f\u043e\u0434\u043d\u043e\u0441\u0438\u0448\u044c \u044e\u043d\u0438\u0442-\u0442\u0435\u0441\u0442, \u0443\u043c\u043e\u043b\u044f\u0435\u0448\u044c \u0441\u043a\u0430\u0437\u0430\u0442\u044c \u0445\u043e\u0442\u044f \u0431\u044b, \u0431\u0430\u0433 \u044d\u0442\u043e \u0438\u043b\u0438 \u0442\u0430\u043a\u0430\u044f \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u0430\u044f \u0444\u0438\u0447\u0430, \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043b\u0438 \u044f \u0432\u0441\u0451 \u043f\u043e\u043d\u044f\u043b, \u0430 \u0432 \u043e\u0442\u0432\u0435\u0442 \u043f\u0440\u043e\u0441\u0442\u043e \u0433\u0440\u043e\u0431\u043e\u0432\u0430\u044f \u0442\u0438\u0448\u0438\u043d\u0430. \u041f\u0435\u0447\u0430\u043b\u0438\u0442 \u044d\u0442\u043e \u0432\u0441\u0451. \u041e\u0434\u043d\u0430\u043a\u043e \u044f \u0443\u0436\u0435 \u0441\u0442\u043e\u043b\u044c\u043a\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0438 \u0441\u0438\u043b \u0432\u043b\u043e\u0436\u0438\u043b \u0432 \u0441\u0438\u0435 \u043f\u0440\u0435\u0434\u043f\u0440\u0438\u044f\u0442\u0438\u0435, \u0447\u0442\u043e \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0434\u043e\u0432\u0435\u0441\u0442\u0438 \u0435\u0433\u043e \u0434\u043e \u043a\u0430\u043a\u043e\u0433\u043e-\u0442\u043e \u043e\u0449\u0443\u0442\u0438\u043c\u043e\u0433\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430. \u0418 \u044f \u043f\u043e\u0448\u0451\u043b \u0435\u0449\u0451 \u0434\u0430\u043b\u044c\u0448\u0435.<\/p>\n<p>\u042f \u043d\u0430\u0431\u0440\u0430\u043b\u0441\u044f \u043d\u0430\u0433\u043b\u043e\u0441\u0442\u0438 \u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u043b\u0438\u0447\u043d\u043e \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0443, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0442\u0432\u0435\u0447\u0430\u043b \u0437\u0430 \u044d\u0442\u043e\u0442 \u0443\u0447\u0430\u0441\u0442\u043e\u043a \u043a\u043e\u0434\u0430 \u2013 Jeff Layton. \u0418 \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u0442\u0430\u043a \u043d\u0430\u0434\u043e \u0431\u044b\u043b\u043e \u043f\u043e\u0441\u0442\u0443\u043f\u0438\u0442\u044c \u0441 \u0441\u0430\u043c\u043e\u0433\u043e \u043d\u0430\u0447\u0430\u043b\u0430!! \u0412\u0441\u0435\u0433\u043e \u0447\u0435\u0440\u0435\u0437 \u043f\u0430\u0440\u0443 \u0447\u0430\u0441\u043e\u0432 \u0414\u0436\u0435\u0444\u0444 \u043e\u0447\u0435\u043d\u044c \u0434\u0440\u0443\u0436\u0435\u043b\u044e\u0431\u043d\u043e, \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u0438\u0432\u043d\u043e \u0438 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u043e\u0442\u0432\u0435\u0442\u0438\u043b \u043d\u0430 \u0432\u0441\u0435 \u043c\u043e\u0438 \u0432\u043e\u043f\u0440\u043e\u0441\u044b, \u0438 \u044f \u043d\u0430\u043a\u043e\u043d\u0435\u0446 \u0443\u0441\u043f\u043e\u043a\u043e\u0438\u043b\u0441\u044f. <a href=\"https:\/\/lore.kernel.org\/linux-fsdevel\/CAL-cVeifoTfbYRfOcb0YeYor+sCtPWo_2__49taprONhR+tncw@mail.gmail.com\/T\/#u\" rel=\"noopener noreferrer nofollow\">\u041d\u0430\u0448\u0430 \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u043a\u0430 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u043b\u0430 \u0432\u0441\u0451 \u0432 \u0442\u043e\u0439 \u0436\u0435 \u0440\u0430\u0441\u0441\u044b\u043b\u043a\u0435 linux-fsdevel<\/a>. \u041f\u043e \u0441\u043b\u043e\u0432\u0430\u043c \u043c\u043e\u0435\u0433\u043e \u0441\u043e\u0431\u0435\u0441\u0435\u0434\u043d\u0438\u043a\u0430, \u0432 Linux:<\/p>\n<p>\u2013 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 lockf (\u0438 fcntl \u0441 POSIX-\u043b\u043e\u043a\u0430\u043c\u0438) \u043a\u0440\u0438\u0432\u043e\u0435, \u043d\u043e \u043c\u0435\u043d\u044f\u0442\u044c \u0435\u0433\u043e \u043d\u0435 \u0431\u0443\u0434\u0443\u0442 \u0438\u0437 \u0441\u043e\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0439 \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e\u0441\u0442\u0438<\/p>\n<p>\u2013 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c flock \u0438\u043b\u0438 OFD locks \u0432\u043c\u0435\u0441\u0442\u043e lockf \u2013 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u0430\u044f \u0438\u0434\u0435\u044f<\/p>\n<p>\u2013 \u0445\u043e\u0440\u043e\u0448\u043e \u0431\u044b \u043f\u043e\u043f\u0440\u0430\u0432\u0438\u0442\u044c man-\u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443, \u0433\u0434\u0435 \u043f\u043e\u0434\u0447\u0435\u0440\u043a\u043d\u0443\u0442\u044c, \u0447\u0442\u043e lockf \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0435 \u0441\u0442\u043e\u0438\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u044b\u0445 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430\u0445<\/p>\n<p>\u0414\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u043f\u0443\u043d\u043a\u0442\u0430 \u0432\u043e \u043c\u043d\u0435 \u0443\u0436\u0435 \u043d\u0435 \u0445\u0432\u0430\u0442\u0438\u043b\u043e \u043b\u044e\u0431\u0432\u0438 \u043a Open Source, \u0438 \u044f \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b\u0441\u044f.<\/p>\n<p>\u0410 \u043f\u043e\u0442\u043e\u043c \u043e\u043f\u044f\u0442\u044c \u0437\u0430\u043c\u043e\u0442\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u043b\u0441\u044f \u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u044d\u0442\u043e\u0442 \u043f\u043e\u0441\u0442.<\/p>\n<\/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\/post\/657607\/\"> https:\/\/habr.com\/ru\/post\/657607\/<\/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_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u042f \u0440\u0430\u0431\u043e\u0442\u0430\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u043e\u043c \u0432 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 \u041a\u0440\u0438\u043f\u0442\u043e\u041f\u0440\u043e. \u041d\u0435\u0440\u0435\u0434\u043a\u043e \u043c\u043e\u0438 \u0437\u0430\u0434\u0430\u0447\u0438 \u0441\u0432\u044f\u0437\u0430\u043d\u044b \u0441 \u043e\u0448\u0438\u0431\u043a\u0430\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043b\u0435\u0436\u0430\u0442 \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u043d\u0438\u0436\u043d\u0435\u043c \u0443\u0440\u043e\u0432\u043d\u0435 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c, \u043f\u043e\u0434 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u043f\u0438\u0448\u0435\u043c \u041f\u041e. \u042f \u0445\u043e\u0447\u0443 \u043f\u043e\u0432\u0435\u0434\u0430\u0442\u044c \u0442\u0435\u0431\u0435, \u0425\u0430\u0431\u0440, \u043e\u0431 \u043e\u0434\u043d\u043e\u0439 \u0438\u0437 \u0442\u0430\u043a\u0438\u0445 \u043e\u0448\u0438\u0431\u043e\u043a \u0438 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u044f \u0436\u0430\u043b\u043e\u0432\u0430\u043b\u0441\u044f \u043d\u0430 \u043d\u0435\u0451 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c.<\/p>\n<p>\u042f \u043e\u0442\u0432\u0435\u0447\u0430\u044e \u0437\u0430 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 \u043e\u0434\u043d\u043e\u0439 \u0438\u0437 \u043d\u0430\u0448\u0438\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0441 C-\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u043c, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0439 \u043d\u0430 C \u0438 C++. \u041c\u043e\u0439 \u043a\u043e\u043b\u043b\u0435\u0433\u0430 \u0438\u0437 \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u043e\u0442\u0434\u0435\u043b\u0430 \u0441\u043e\u043e\u0431\u0449\u0438\u043b, \u0447\u0442\u043e \u0435\u0433\u043e \u043d\u0430\u0433\u0440\u0443\u0437\u043e\u0447\u043d\u044b\u0439 \u0442\u0435\u0441\u0442 \u043d\u0430\u0448\u0435\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u043d\u0430 C# \u0432 Linux \u0432\u044b\u0434\u0430\u0451\u0442 \u043e\u0448\u0438\u0431\u043a\u0443 \u0432 \u0445\u0438\u0442\u0440\u043e\u043c \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0438: \u043d\u0443\u0436\u043d\u043e \u0438\u043c\u0435\u0442\u044c \u0434\u0432\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u043f\u043e \u043f\u044f\u0442\u044c \u043f\u043e\u0442\u043e\u043a\u043e\u0432, \u0434\u0435\u043b\u0430\u044e\u0449\u0438\u0445 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0434\u0435\u043d\u0442\u0438\u0447\u043d\u044b\u0435 \u0432\u044b\u0437\u043e\u0432\u044b. \u0415\u0441\u043b\u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043e\u0434\u0438\u043d, \u0430 \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u043c\u043d\u043e\u0433\u043e, \u0442\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u043d\u0435 \u043f\u0440\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f. \u0415\u0441\u043b\u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432 \u0434\u0432\u0430, \u043d\u043e \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443 \u043f\u043e\u0442\u043e\u043a\u0443, \u0442\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u043d\u0435 \u043f\u0440\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f. \u041f\u0443\u0442\u0451\u043c \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0430 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u043e\u0432 \u043d\u0430\u0433\u0440\u0443\u0437\u043e\u0447\u043d\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0430 \u0438 \u043b\u043e\u0433\u043e\u0432 \u0440\u0430\u0431\u043e\u0442\u044b \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043f\u0435\u0440\u0435\u043d\u0435\u0441\u0442\u0438 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u0432 \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0439 \u044e\u043d\u0438\u0442-\u0442\u0435\u0441\u0442 \u043d\u0430 C++ \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043d\u0430\u0448\u0435\u0433\u043e API.<\/p>\n<p>\u0412\u0441\u043a\u0440\u044b\u043b\u043e\u0441\u044c \u043e\u0447\u0435\u043d\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0435. \u041e\u0448\u0438\u0431\u043a\u0443 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u043b\u0430 <a href=\"https:\/\/man7.org\/linux\/man-pages\/man3\/lockf.3.html\" rel=\"noopener noreferrer nofollow\">\u0444\u0443\u043d\u043a\u0446\u0438\u044f lockf<\/a>, \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0449\u0430\u044f \u0437\u0430 \u0432\u0437\u044f\u0442\u0438\u0435 \u043e\u0431\u0449\u0435\u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0439 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438 \u043d\u0430 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0439 \u0444\u0430\u0439\u043b. \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0432 \u043e\u0431\u0449\u0438\u0445 \u0447\u0435\u0440\u0442\u0430\u0445 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0442\u0430\u043a: \u0435\u0441\u043b\u0438 \u043e\u0434\u0438\u043d \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043b \u0444\u0430\u0439\u043b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e lockf, \u0442\u043e \u0434\u0440\u0443\u0433\u0438\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u044b \u043f\u0440\u0438 \u043f\u043e\u043f\u044b\u0442\u043a\u0435 \u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e lockf \u0436\u0434\u0443\u0442 \u0435\u0433\u043e \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0432\u044b\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u043c. \u0412\u0441\u0435 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0441 \u0444\u0430\u0439\u043b\u043e\u043c \u043f\u043e-\u043f\u0440\u0435\u0436\u043d\u0435\u043c\u0443 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0434\u0440\u0443\u0433\u0438\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430\u043c, \u0442\u043e \u0435\u0441\u0442\u044c \u044d\u0442\u0430 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0430 \u043d\u0435 \u043d\u0430\u0432\u044f\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u043f\u044b\u0442\u0430\u043b\u0438\u0441\u044c \u0432\u0437\u044f\u0442\u044c \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0443 \u044f\u0432\u043d\u044b\u043c \u0432\u044b\u0437\u043e\u0432\u043e\u043c lockf.<\/p>\n<p>errno \u0431\u044b\u043b\u043e \u0440\u0430\u0432\u043d\u043e 35, \u0447\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u043b\u043e \u043a\u043e\u0434 EDEADLK \u0441 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435\u043c \u00abResource deadlock avoided\u00bb. \u042f \u043f\u043e\u043b\u0435\u0437 \u0432 \u043c\u0430\u043d\u044b. \u00abAllocating a system resource would have resulted in a deadlock situation. The system does not guarantee that it will notice all such situations. This error means you got lucky and the system noticed; it might just hang.\u00bb \u0421\u0438\u0441\u0442\u0435\u043c\u0430 \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u043d\u0430\u043c: \u0435\u0441\u043b\u0438 \u043e\u043d\u0430 \u0441\u0434\u0435\u043b\u0430\u0435\u0442 \u0442\u043e, \u0447\u0442\u043e \u043c\u044b \u043f\u043e\u043f\u0440\u043e\u0441\u0438\u043b\u0438, \u0442\u043e \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0451\u0442 \u0432\u0437\u0430\u0438\u043c\u043d\u0430\u044f \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0430, \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u044d\u0442\u043e\u0433\u043e \u043d\u0435 \u0445\u043e\u0447\u0435\u0442, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u0435\u0440\u043d\u0451\u0442 \u043e\u0448\u0438\u0431\u043a\u0443. \u041d\u043e \u0447\u0442\u043e \u044d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u043b\u043e \u0432 \u043c\u043e\u0451\u043c \u0441\u043b\u0443\u0447\u0430\u0435?<\/p>\n<p>\u0414\u043b\u044f \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043e\u0448\u0438\u0431\u043a\u0438 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043b\u043e\u0441\u044c \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u0434\u0432\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u043f\u043e \u0434\u0432\u0430 \u043f\u043e\u0442\u043e\u043a\u0430 \u0432 \u043a\u0430\u0436\u0434\u043e\u043c. \u041f\u0435\u0440\u0432\u044b\u0439 \u043f\u043e\u0442\u043e\u043a \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0432\u0437\u044f\u043b \u043b\u043e\u043a \u043d\u0430 \u0444\u0430\u0439\u043b \u0410. \u041f\u0435\u0440\u0432\u044b\u0439 \u043f\u043e\u0442\u043e\u043a \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0432\u0437\u044f\u043b \u043b\u043e\u043a \u043d\u0430 \u0444\u0430\u0439\u043b \u0411. \u0412\u0442\u043e\u0440\u043e\u0439 \u043f\u043e\u0442\u043e\u043a \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u0445\u043e\u0442\u0435\u043b \u0432\u0437\u044f\u0442\u044c \u043b\u043e\u043a \u043d\u0430 \u0444\u0430\u0439\u043b \u0411, \u043d\u043e \u043d\u0435 \u0441\u043c\u043e\u0433 \u2013 \u043b\u043e\u043a \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0438\u0442 \u0432\u0442\u043e\u0440\u043e\u043c\u0443 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0443. \u041e\u043d \u0436\u0434\u0451\u0442 \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u043b\u043e\u043a\u0430 \u043d\u0430 \u0444\u0430\u0439\u043b \u0411. \u0412\u0442\u043e\u0440\u043e\u0439 \u043f\u043e\u0442\u043e\u043a \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u0445\u043e\u0442\u0435\u043b \u0432\u0437\u044f\u0442\u044c \u043b\u043e\u043a \u043d\u0430 \u0444\u0430\u0439\u043b \u0410, \u043d\u043e \u043d\u0435 \u0441\u043c\u043e\u0433 \u2013 \u043b\u043e\u043a \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0438\u0442 \u043f\u0435\u0440\u0432\u043e\u043c\u0443 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0443. \u041e\u0436\u0438\u0434\u0430\u043d\u0438\u044f \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u043d\u0435 \u0431\u0443\u0434\u0435\u0442, lockf \u043d\u0435\u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e \u0432\u0435\u0440\u043d\u0451\u0442 \u043e\u0448\u0438\u0431\u043a\u0443, \u0432\u0435\u0434\u044c \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f <a href=\"https:\/\/github.com\/torvalds\/linux\/blob\/master\/fs\/locks.c\" rel=\"noopener noreferrer nofollow\">\u0434\u0435\u0442\u0435\u043a\u0442\u043e\u0440\u0430 \u0432\u0437\u0430\u0438\u043c\u043d\u044b\u0445 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043e\u043a \u0432 \u044f\u0434\u0440\u0435 Linux<\/a> \u043d\u0430\u0441\u0442\u0430\u043b \u043c\u043e\u043c\u0435\u043d\u0442 \u0431\u0438\u0442\u044c \u0432 \u043d\u0430\u0431\u0430\u0442!<\/p>\n<p>\u041d\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u0432\u0437\u0433\u043b\u044f\u0434, \u0442\u0443\u0442 \u043a\u0430\u043a \u0431\u0443\u0434\u0442\u043e \u0431\u044b \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0445\u0440\u0435\u0441\u0442\u043e\u043c\u0430\u0442\u0438\u0439\u043d\u044b\u0439 deadlock \u0438\u0437 \u0443\u0447\u0435\u0431\u043d\u0438\u043a\u043e\u0432 \u043f\u043e \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e\u043c\u0443 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e. \u0418\u043b\u0438 \u0432\u0441\u0451 \u0436\u0435 \u043d\u0435\u0442? \u041f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0432\u0442\u043e\u0440\u043e\u0439 \u043f\u043e\u0442\u043e\u043a \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u0441\u0442\u0430\u043b \u0431\u044b \u0436\u0434\u0430\u0442\u044c \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u043b\u043e\u043a\u0430 \u043d\u0430 \u0444\u0430\u0439\u043b \u0410. \u0412\u0441\u0442\u0430\u043b\u0438 \u0431\u044b \u043d\u0430\u043c\u0435\u0440\u0442\u0432\u043e \u0432\u0441\u0435 \u0447\u0435\u0442\u044b\u0440\u0435 \u043f\u043e\u0442\u043e\u043a\u0430 \u043e\u0431\u043e\u0438\u0445 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432? \u041f\u043e\u0447\u0442\u0438 \u043d\u0430\u0432\u0435\u0440\u043d\u044f\u043a\u0430 \u043d\u0435\u0442. \u041e\u0431\u044b\u0447\u043d\u043e \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0442\u0430\u043a, \u0447\u0442\u043e \u043a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 \u043d\u0438\u0445 \u043f\u043e\u043b\u0443\u0447\u0438\u0442 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0447\u0435\u0440\u0435\u0437 \u043a\u0430\u043a\u043e\u0435-\u0442\u043e \u0432\u0440\u0435\u043c\u044f. \u0422\u043e\u0433\u0434\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u043f\u043e\u0442\u043e\u043a \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u043c\u043e\u0433 \u0431\u044b \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0438 \u043e\u0442\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043b\u043e\u043a \u043d\u0430 \u0444\u0430\u0439\u043b \u0410, \u0442\u0435\u043c \u0441\u0430\u043c\u044b\u043c \u0434\u0430\u0432 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0432\u0437\u044f\u0442\u044c \u043b\u043e\u043a \u0432\u0442\u043e\u0440\u043e\u043c\u0443 \u043f\u043e\u0442\u043e\u043a\u0443 \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430. \u0418\u043b\u0438 \u0436\u0435 \u043f\u0435\u0440\u0432\u044b\u0439 \u043f\u043e\u0442\u043e\u043a \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435, \u043e\u0442\u043f\u0443\u0441\u0442\u0438\u0442 \u043b\u043e\u043a \u043d\u0430 \u0444\u0430\u0439\u043b \u0411, \u0442\u0435\u043c \u0441\u0430\u043c\u044b\u043c \u0434\u0430\u0432 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0432\u0437\u044f\u0442\u044c \u043b\u043e\u043a \u0432\u0442\u043e\u0440\u043e\u043c\u0443 \u043f\u043e\u0442\u043e\u043a\u0443 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430. \u041d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432 \u0432\u0437\u0430\u0438\u043c\u043d\u0430\u044f \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0430 \u043a\u0430\u043a \u0431\u0443\u0434\u0442\u043e \u0431\u044b \u0435\u0441\u0442\u044c, \u0430 \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u0435\u0451 \u043d\u0435\u0442.<\/p>\n<p>\u0422\u0430\u043a\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043c\u0435\u043d\u044f \u0443\u0434\u0438\u0432\u0438\u043b\u043e. \u042f \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0439 \u044e\u043d\u0438\u0442-\u0442\u0435\u0441\u0442 \u043d\u0430 C \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e libc, \u0438 \u043e\u043d \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u043b, \u0447\u0442\u043e \u043f\u043e\u0447\u0442\u0438 \u043d\u0430\u0432\u0435\u0440\u043d\u044f\u043a\u0430 \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u0430\u044f \u043e\u0448\u0438\u0431\u043a\u0430 \u0432\u044b\u0437\u044b\u0432\u0430\u043b\u0430\u0441\u044c \u0440\u043e\u0432\u043d\u043e \u044d\u0442\u0438\u043c. \u041a\u043e\u0434 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d \u043d\u0438\u0436\u0435. \u041a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u044f: gcc -o edeadlk .\/edeadlk.c -lpthread. \u0417\u0430\u043f\u0443\u0441\u043a: .\/edeadlk a b \u0432 \u043f\u0435\u0440\u0432\u043e\u043c \u044d\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u0435 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0430, .\/edeadlk a b \u0432\u043e \u0432\u0442\u043e\u0440\u043e\u043c \u044d\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u0435 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0430.<\/p>\n<details class=\"spoiler\">\n<summary>\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"cpp\">#include&lt;unistd.h> #include&lt;stdio.h> #include&lt;stdlib.h> #include&lt;fcntl.h> #include&lt;errno.h> #include&lt;pthread.h> #include&lt;stddef.h> #include&lt;stdint.h>  #define DIE(x)\\ {\\ fprintf(stderr, \"Assertion failed: \" #x \" file: %s, line:%d, errno:%d \", __FILE__, __LINE__, errno); \\ perror(\". Error:\");\\ fflush(stdout);\\ abort();\\ } #define ASS(x) if (!(x)) DIE(x) #define ASS1(x) ASS((x) != -1) #define ASS0(x) ASS((x) == 0)  void * deadlocker(void *arg) {     int fd = (int)(ptrdiff_t)arg;     for (;;) {         ASS1( lockf(fd, F_LOCK, 1) );         ASS1( lockf(fd, F_ULOCK, 1) );     }     return NULL; }  int main(int argc, char * argv[]) {     int fd1, fd2;     ASS( argc >= 3 );     ASS1( fd1 = creat(argv[1], 0660) );     ASS1( fd2 = creat(argv[2], 0660) );     void * thrv;     pthread_t thr1, thr2;     ASS0( pthread_create(&amp;thr1, NULL, deadlocker, (void *)(ptrdiff_t)fd2) );     ASS0( pthread_create(&amp;thr2, NULL, deadlocker, (void *)(ptrdiff_t)fd1) );     ASS0( pthread_join(thr1, &amp;thrv) );     ASS0( pthread_join(thr2, &amp;thrv) );     return 0; }<\/code><\/pre>\n<\/div>\n<\/details>\n<p>\u042f \u043f\u043e\u0433\u0440\u0443\u0437\u0438\u043b\u0441\u044f \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e. \u0421 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f libc, \u0444\u0443\u043d\u043a\u0446\u0438\u044f lockf \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432 (\u00abLocks are associated with processes\u00bb), \u043e\u043d\u0430 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0437\u043d\u0430\u0435\u0442 \u043f\u0440\u043e \u043f\u043e\u0442\u043e\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u0440\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u044c \u043a\u0430\u043a\u0438\u0435-\u0442\u043e \u043f\u0440\u043e\u0442\u0438\u0432\u043e\u0440\u0435\u0447\u0438\u044f. \u0415\u0441\u043b\u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 1 \u0432\u0437\u044f\u043b \u043b\u043e\u043a \u0410 \u0438 \u0436\u0434\u0451\u0442 \u043b\u043e\u043a \u0411, \u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 2 \u043d\u0430\u043e\u0431\u043e\u0440\u043e\u0442, \u0442\u043e \u0442\u043e\u0440\u043c\u043e\u0437\u0438\u043c \u043d\u0435\u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e. \u00abThe specified region is being locked by another process. But that process is waiting to lock a region which the current process has locked, so waiting for the lock would result in deadlock. The system does not guarantee that it will detect all such conditions, but it lets you know if it notices one.\u00bb<\/p>\n<p>POSIX \u0442\u043e\u0436\u0435 \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0435\u0442, \u0447\u0442\u043e \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0441\u0432\u043e\u0435\u0433\u043e \u0440\u043e\u0434\u0430 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0435: \u00abA potential for deadlock occurs if the threads of a process controlling a locked section are blocked by accessing a locked section of another process. If the system detects that deadlock would occur, lockf() shall fail with an [EDEADLK] error.\u00bb<\/p>\n<p>strace \u043d\u0435 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u043b \u043c\u043d\u0435 \u0432\u044b\u0437\u043e\u0432\u043e\u0432 lockf, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e lockf \u0432 glibc \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u0430 \u0447\u0435\u0440\u0435\u0437 fcntl: \u00abOn Linux, lockf() is just an interface on top of fcntl(2) locking\u00bb. \u042f \u043d\u0430\u0448\u0451\u043b \u0442\u0430\u043a\u0436\u0435 \u0442\u0430\u043a\u0438\u0435 \u0441\u043b\u043e\u0432\u0430: \u00abWhen placing locks with F_SETLKW, the kernel detects deadlocks, whereby two or more processes have their lock requests mutually blocked by locks held by the other processes. For example, suppose process A holds a write lock on byte 100 of a file, and process B holds a write lock on byte 200. If each process then attempts to lock the byte already locked by the other process using F_SETLKW, then, without deadlock detection, both processes would remain blocked indefinitely. When the kernel detects such deadlocks, it causes one of the blocking lock requests to immediately fail with the error EDEADLK; an application that encounters such an error should release some of its locks to allow other applications to proceed before attempting regain the locks that it requires. Circular deadlocks involving more than two processes are also detected. Note, however, that there are limitations to the kernel&#8217;s deadlock-detection algorithm; see BUGS.\u00bb<\/p>\n<p>\u0422\u0430\u043a-\u0442\u0430\u043a-\u0442\u0430\u043a, \u0430 \u0447\u0442\u043e \u0442\u0430\u043c? \u00abThe deadlock-detection algorithm employed by the kernel when dealing with F_SETLKW requests can yield both false negatives (failures to detect deadlocks, leaving a set of deadlocked processes blocked indefinitely) and false positives (EDEADLK errors when there is no deadlock). For example, the kernel limits the lock depth of its dependency search to 10 steps, meaning that circular deadlock chains that exceed that size will not be detected. In addition, the kernel may falsely indicate a deadlock when two or more processes created using the clone(2) CLONE_FILES flag place locks that appear (to the kernel) to conflict.\u00bb<\/p>\n<p>\u041d\u0435\u0445\u043e\u0440\u043e\u0448\u043e. \u041f\u043e\u0445\u043e\u0436\u0435, \u0442\u0443\u0442 \u043c\u044b \u043d\u0430\u0441\u0442\u0443\u043f\u0438\u043b\u0438 \u043d\u0430 \u0433\u0440\u0430\u0431\u043b\u0438, \u0438 \u0442\u0435\u043f\u0435\u0440\u044c \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043b\u043e\u0441\u044c \u043a\u0430\u043a-\u0442\u043e \u043f\u0440\u0435\u043e\u0434\u043e\u043b\u0435\u0442\u044c \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u044b\u0439 \u0444\u0430\u0442\u0430\u043b\u044c\u043d\u044b\u0439 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u043a lockf. \u042f \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u043b \u043f\u0440\u043e \u0446\u0435\u043b\u044b\u0439 \u0432\u0430\u0433\u043e\u043d \u0440\u0430\u0437\u043d\u044b\u0445 \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u043e\u0432 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u0432 *nix, \u0438 \u0441\u0430\u043c\u044b\u043c \u043d\u0430\u0434\u0451\u0436\u043d\u044b\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c \u0432 \u043c\u043e\u0435\u0439 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0439 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438 \u043c\u043d\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u0445\u043e\u0436\u0435\u0439 <a href=\"https:\/\/man7.org\/linux\/man-pages\/man2\/flock.2.html\" rel=\"noopener noreferrer nofollow\">\u0444\u0443\u043d\u043a\u0446\u0438\u0438 flock<\/a> \u0432\u043c\u0435\u0441\u0442\u043e lockf. \u041e\u043d\u0430 \u043d\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u0438\u0434\u0435\u043d\u0442\u0438\u0447\u043d\u0430 lockf, \u043c\u0435\u0436\u0434\u0443 \u043d\u0438\u043c\u0438 \u0435\u0441\u0442\u044c \u0442\u043e\u043d\u043a\u0438\u0435 \u0440\u0430\u0437\u043b\u0438\u0447\u0438\u044f, \u043d\u043e \u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u043e\u043d\u0438 \u0432 \u0446\u0435\u043b\u043e\u043c \u0441\u0445\u043e\u0436\u0438. \u041a \u0441\u0447\u0430\u0441\u0442\u044c\u044e, flock \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u0433\u043b\u0443\u0431\u043e\u043a\u043e \u043f\u043e\u0434 \u043a\u0430\u043f\u043e\u0442\u043e\u043c \u0442\u0430\u043a\u043e\u0439 \u0445\u0438\u0442\u0440\u043e\u0439 \u043b\u043e\u0433\u0438\u043a\u0438 \u043f\u043e \u0434\u0435\u0442\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e \u0432\u0437\u0430\u0438\u043c\u043d\u044b\u0445 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043e\u043a: \u00abflock() does not detect deadlock\u00bb. \u042f \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043b, \u0447\u0442\u043e \u044d\u0442\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043b\u0435\u0447\u0430\u0442 \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0439 \u044e\u043d\u0438\u0442-\u0442\u0435\u0441\u0442 \u043d\u0430 C \u0434\u043b\u044f libc, \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0439 \u044e\u043d\u0438\u0442-\u0442\u0435\u0441\u0442 \u043d\u0430 C++ \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438, \u043d\u0430\u0433\u0440\u0443\u0437\u043e\u0447\u043d\u044b\u0439 \u0442\u0435\u0441\u0442 \u043d\u0430 C# \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438, \u0437\u0430\u043a\u043e\u043c\u043c\u0438\u0442\u0438\u043b\u0441\u044f, \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043b \u043d\u043e\u0447\u043d\u044b\u0435 \u0442\u0435\u0441\u0442\u044b \u0438 \u043e\u0431\u0440\u0430\u0434\u043e\u0432\u0430\u043b\u0441\u044f.<\/p>\n<p>\u041a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0431\u044b, \u0442\u0443\u0442 \u0438 \u0441\u043a\u0430\u0437\u043e\u0447\u043a\u0435 \u043a\u043e\u043d\u0435\u0446, \u043d\u043e \u044f \u0436\u0435 \u0445\u043e\u0440\u043e\u0448\u0438\u0439 \u043f\u0430\u0440\u0435\u043d\u044c, \u043d\u0430\u0434\u043e \u0436\u0435 \u043f\u043e\u0436\u0430\u043b\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u043c\u0435\u0439\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430\u043c Linux! \u0414\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043c\u043e\u0435\u0439 \u0440\u0430\u0431\u043e\u0447\u0435\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 \u044d\u0442\u043e\u0433\u043e \u043d\u0435 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043b\u043e\u0441\u044c, \u043d\u043e \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u043c\u043e\u0435\u0433\u043e \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u043e\u0442 \u0430\u0432\u0442\u043e\u0440\u0438\u0442\u0435\u0442\u043d\u044b\u0445 \u043b\u044e\u0434\u0435\u0439, \u0430 \u0435\u0449\u0451 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0434\u043e\u0431\u0440\u043e\u0435 \u0434\u0435\u043b\u043e.<\/p>\n<p>\u0425\u043e\u0440\u043e\u0448\u043e, \u043f\u0435\u0440\u0432\u044b\u043c \u0434\u0435\u043b\u043e\u043c \u043d\u0430\u0432\u0435\u0440\u043d\u043e\u0435 \u043f\u043e\u0439\u0434\u0451\u043c \u0432 <a href=\"https:\/\/bugzilla.kernel.org\" rel=\"noopener noreferrer nofollow\">\u0431\u0430\u0433-\u0442\u0440\u0435\u043a\u0435\u0440 \u044f\u0434\u0440\u0430 Linux<\/a>. \u0427\u0442\u043e \u043c\u044b \u0442\u0430\u043c \u0432\u0438\u0434\u0438\u043c?<\/p>\n<p>\u00abPlease use your distribution&#8217;s bug tracking tools<\/p>\n<p>This bugzilla is for reporting bugs against upstream Linux kernels.<\/p>\n<p>If you did not compile your own kernel from scratch, you are probably in the wrong place.<\/p>\n<p>Please use the following links to report a bug to your distribution instead:<\/p>\n<p>Ubuntu | Fedora | Arch | Mint | Debian | Red Hat | OpenSUSE | SUSE\u00bb<\/p>\n<p>\u041c\u043e\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u043b\u0430\u0441\u044c \u043d\u0430 \u0440\u044f\u0434\u0435 \u0441\u0442\u0430\u0440\u044b\u0445 \u044f\u0434\u0435\u0440 \u0438 \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u0434\u0438\u0441\u0442\u0440\u0438\u0431\u0443\u0442\u0438\u0432\u0430\u0445, \u0438 \u044f \u0431\u044b\u043b \u043d\u0430 99% \u0443\u0432\u0435\u0440\u0435\u043d, \u0447\u0442\u043e \u0432\u0438\u0436\u0443 \u0435\u0451 \u0432 \u043a\u043e\u0434\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u0440\u0435\u0432\u0438\u0437\u0438\u0438. \u042f\u0434\u0440\u043e \u0438\u0437 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u043e\u0432 \u044f \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u0441\u043e\u0431\u0438\u0440\u0430\u043b, \u0440\u0430\u0434\u0438 \u0442\u0430\u043a\u043e\u0433\u043e \u043f\u043e\u0432\u043e\u0434\u0430 \u0434\u0430\u0436\u0435 \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c, \u043d\u043e \u0437\u0430 20 \u043c\u0438\u043d\u0443\u0442 \u043d\u0435 \u0441\u043c\u043e\u0433 \u0438 \u043f\u043e\u0442\u0435\u0440\u044f\u043b \u043c\u043e\u0442\u0438\u0432\u0430\u0446\u0438\u044e. \u041e\u043a\u0435\u0439\u2026<\/p>\n<p><a href=\"https:\/\/bugs.launchpad.net\/ubuntu\/+source\/linux\/+bug\/1926481\" rel=\"noopener noreferrer nofollow\">\u041f\u043e\u0436\u0430\u043b\u043e\u0432\u0430\u043b\u0441\u044f \u0432 \u0431\u0430\u0433-\u0442\u0440\u0435\u043a\u0435\u0440 Ubuntu<\/a>. \u0417\u0430 \u043d\u0435\u0434\u0435\u043b\u044e \u043d\u0438\u043a\u0430\u043a\u043e\u0433\u043e \u043e\u0442\u0432\u0435\u0442\u0430 \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b. \u041e\u043a\u0435\u0439\u2026<\/p>\n<p><a href=\"https:\/\/lore.kernel.org\/lkml\/CAL-cVehkm=KPdQ=1rN6hyeMDiMXa--aG3gij==Nf8mNv=XZ0sQ@mail.gmail.com\/\" rel=\"noopener noreferrer nofollow\">\u041f\u043e\u0436\u0430\u043b\u043e\u0432\u0430\u043b\u0441\u044f \u0432 \u0440\u0430\u0441\u0441\u044b\u043b\u043a\u0443 LKML<\/a>, \u0433\u043b\u0430\u0432\u043d\u0443\u044e \u0440\u0430\u0441\u0441\u044b\u043b\u043a\u0443 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u044f\u0434\u0440\u0430 Linux. \u0417\u0430 \u043d\u0435\u0434\u0435\u043b\u044e \u043d\u0438\u043a\u0430\u043a\u043e\u0433\u043e \u043e\u0442\u0432\u0435\u0442\u0430 \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b. \u041e\u043a\u0435\u0439\u2026<\/p>\n<p>\u0421\u043b\u0443\u0447\u0430\u0439\u043d\u043e \u043d\u0430\u0442\u043a\u043d\u0443\u043b\u0441\u044f \u043d\u0430 \u0444\u0430\u0439\u043b <a href=\"https:\/\/github.com\/torvalds\/linux\/blob\/master\/MAINTAINERS\" rel=\"noopener noreferrer nofollow\">MAINTAINERS<\/a> \u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0430\u0445 \u044f\u0434\u0440\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0433\u043e\u0432\u043e\u0440\u0438\u043b, \u0447\u0442\u043e \u0436\u0430\u043b\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430\u0434\u043e \u043d\u0435 \u0432 LKML, \u0430 \u0432 \u0431\u043e\u043b\u0435\u0435 \u0443\u0437\u043a\u043e\u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u0440\u0430\u0441\u0441\u044b\u043b\u043a\u0443. \u0423 \u043c\u0435\u043d\u044f \u0431\u044b\u043b\u0430 \u0436\u0430\u043b\u043e\u0431\u0430 \u043d\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044e lockf \u0438 \u043d\u0430 \u043a\u043e\u0434 \u0432 \u0444\u0430\u0439\u043b\u0435 fs\/locks.c. \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c.<\/p>\n<p><code>FILE LOCKING (flock() and fcntl()\/lockf())<\/code><\/p>\n<p><code>M:Jeff Layton &lt;jlayton@kernel.org><\/code><\/p>\n<p><code>L:linux-fsdevel@vger.kernel.org<\/code><\/p>\n<p><code>S:Maintained<\/code><\/p>\n<p><code>F:fs\/fcntl.c<\/code><\/p>\n<p><code>F:fs\/locks.c<\/code><\/p>\n<p><code>F:include\/linux\/fcntl.h<\/code><\/p>\n<p><code>F:include\/uapi\/linux\/fcntl.h<\/code><\/p>\n<p><a href=\"https:\/\/lore.kernel.org\/linux-fsdevel\/CAL-cVeifoTfbYRfOcb0YeYor+sCtPWo_2__49taprONhR+tncw@mail.gmail.com\/T\/#u\" rel=\"noopener noreferrer nofollow\">\u041f\u043e\u0436\u0430\u043b\u043e\u0432\u0430\u043b\u0441\u044f \u0432 \u0440\u0430\u0441\u0441\u044b\u043b\u043a\u0443 linux-fsdevel<\/a>. \u0417\u0430 \u043d\u0435\u0434\u0435\u043b\u044e \u043d\u0438\u043a\u0430\u043a\u043e\u0433\u043e \u043e\u0442\u0432\u0435\u0442\u0430 \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b. \u041e\u043a\u0435\u0439\u2026<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0447\u0435\u0441\u0442\u043d\u043e, \u043c\u043d\u0435 \u044d\u0442\u043e \u0443\u0436\u0435 \u043f\u043e\u0440\u044f\u0434\u043a\u043e\u043c \u043f\u043e\u0434\u043d\u0430\u0434\u043e\u0435\u043b\u043e. \u0416\u0430\u043b\u0443\u0435\u0448\u044c\u0441\u044f-\u0436\u0430\u043b\u0443\u0435\u0448\u044c\u0441\u044f, \u043d\u0430 \u0431\u043b\u044e\u0434\u0435\u0447\u043a\u0435 \u043f\u043e\u0434\u043d\u043e\u0441\u0438\u0448\u044c<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\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-331101","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/331101","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=331101"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/331101\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=331101"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=331101"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=331101"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}