{"id":3449,"date":"2012-11-01T10:07:21","date_gmt":"2012-11-01T01:07:21","guid":{"rendered":"http:\/\/umezawa.dyndns.info\/wordpress\/?p=3449"},"modified":"2012-11-01T15:54:45","modified_gmt":"2012-11-01T06:54:45","slug":"kqueue-%e3%81%af%e3%83%97%e3%83%ad%e3%82%bb%e3%82%b9%e9%96%93%e3%81%a7%e5%85%b1%e6%9c%89%e3%81%a7%e3%81%8d%e3%81%aa%e3%81%84","status":"publish","type":"post","link":"http:\/\/umezawa.dyndns.info\/wordpress\/?p=3449","title":{"rendered":"kqueue \u306f\u30d7\u30ed\u30bb\u30b9\u9593\u3067\u5171\u6709\u3067\u304d\u306a\u3044"},"content":{"rendered":"<p>OpenBSD \u3067\u30c7\u30fc\u30e2\u30f3\u3092\u66f8\u3044\u3066\u3066\u6c17\u3065\u3044\u305f\u3093\u3067\u3059\u304c\u3001kqueue \u306e\u30d5\u30a1\u30a4\u30eb\u30c7\u30b9\u30af\u30ea\u30d7\u30bf\u306f\u30d7\u30ed\u30bb\u30b9\u9593\u3067\u5171\u6709\u3067\u304d\u306a\u3044\u3001\u3064\u307e\u308a\u3001fork(2) \u3067\u5b50\u30d7\u30ed\u30bb\u30b9\u306b\u7d99\u627f\u3055\u308c\u305f\u308a SCM_RIGHTS \u3067\u6295\u3052\u3064\u3051\u305f\u308a\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u306a\u3044\u3093\u3067\u3059\u306d\u3002<\/p>\n<p><!--more--><\/p>\n<p>OpenBSD 5.2 \u306e kqueue(2) man \u30da\u30fc\u30b8\u306b\u306f<\/p>\n<blockquote><p>\nkqueue() creates a new kernel event queue and returns a descriptor. The queue is not inherited by a child created with fork(2). Similarly, kqueues cannot be passed across UNIX-domain sockets.\n<\/p><\/blockquote>\n<p>\u3068\u3042\u308a\u307e\u3059\u3002\u30a4\u30d9\u30f3\u30c8\u304c\u3082\u3089\u3048\u3066\u3082\u30d5\u30a1\u30a4\u30eb\u30c7\u30b9\u30af\u30ea\u30d7\u30bf\u30c6\u30fc\u30d6\u30eb\u306f\u5225\u306a\u306e\u3067 kqueue \u306e\u30d5\u30a1\u30a4\u30eb\u30c7\u30b9\u30af\u30ea\u30d7\u30bf\u3060\u3051\u6301\u3063\u3066\u3066\u3082\u3057\u3087\u3046\u304c\u306a\u3044\u3067\u3059\u306d\u3002<\/p>\n<p>kqueue \u3092\u76f4\u63a5\u4f7f\u3046\u306e\u3067\u306f\u306a\u304f libevent \u7d4c\u7531\u3067\u4f7f\u3063\u3066\u3044\u305f\u306e\u3067\u3059\u304c\u3001libevent \u304c kqueue \u3092\u4f7f\u3046\u74b0\u5883\u3067 daemon(3) \u3092\u547c\u3076\u524d\u306b event_base_new() \u3092\u547c\u3076\u3068\u3053\u306e\u5236\u9650\u306b\u5f15\u3063\u304b\u304b\u3063\u3066\u671f\u5f85\u3057\u305f\u52d5\u4f5c\u3092\u3057\u306a\u304f\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>FreeBSD \u3067\u306f\u3069\u3046\u304b\u3068\u3044\u3046\u3068\u3001OpenBSD \u3068\u57fa\u672c\u7684\u306b\u306f\u540c\u3058\u3067\u3059\u304c\u3001rfork(2) \u3068\u3044\u3046\u300cfork() \u3059\u308b\u3051\u3069\u5b50\u30d7\u30ed\u30bb\u30b9\u3068\u3044\u304f\u3064\u304b\u306e\u30ea\u30bd\u30fc\u30b9\u3092\u5171\u6709\u3059\u308b\u300d\u30b7\u30b9\u30c6\u30e0\u30b3\u30fc\u30eb\u304c\u3042\u3063\u3066\u3001\u305d\u308c\u3067\u30d5\u30a1\u30a4\u30eb\u30c7\u30b9\u30af\u30ea\u30d7\u30bf\u30c6\u30fc\u30d6\u30eb\u3092\u5171\u6709\u3059\u308b\u3088\u3046\u306b\u3057\u305f\u5834\u5408\u306f kqueue \u3082\u5171\u6709\u3055\u308c\u308b\u3088\u3046\u3067\u3059\u3002\u5b9f\u969b\u306b\u6319\u52d5\u3092\u78ba\u304b\u3081\u3066\u306f\u3044\u307e\u305b\u3093\u3002<\/p>\n<p>Linux \u306b\u306f\u4f3c\u305f\u6a5f\u69cb\u3068\u3057\u3066 epoll(2) \u304c\u3042\u308a\u307e\u3059\u304c\u3001\u3053\u3063\u3061\u306f epoll \u306e\u30d5\u30a1\u30a4\u30eb\u30c7\u30b9\u30af\u30ea\u30d7\u30bf\u81ea\u4f53\u306f\u5171\u6709\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u3088\u3046\u3067\u3059\u3002\u305f\u3060\u3057\u3001\u300c\u610f\u5473\u304c\u306a\u3044\u300d\u3068\u66f8\u304b\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<blockquote>\n<dl>\n<dt>Q5<\/dt>\n<dd>Can I send an epoll file descriptor over a Unix domain socket to another process?<\/dd>\n<dt>A5<\/dt>\n<dd>Yes, but it does not make sense to do this, since the receiving process would not have copies of the file descriptors in the epoll set.<\/dd>\n<\/dl>\n<\/blockquote>\n<p>\u3068\u3044\u3046\u308f\u3051\u3067\u3001event_base_new() \u306f daemon(3) \u306e\u5f8c\u306b\u547c\u3076\u5fc5\u8981\u304c\u3042\u308b\u308f\u3051\u3067\u3059\u304c\u3001\u30d7\u30ed\u30b0\u30e9\u30e0\u5185\u3067\u3044\u308d\u3044\u308d\u3068\u4f9d\u5b58\u95a2\u4fc2\u304c\u3042\u308a\u307e\u3057\u3066\u3001\u3055\u3066\u3069\u3046\u3057\u3088\u3046\u304b\u306a\u3002<\/p>\n<p># select \u3084 poll \u3092\u4f7f\u3046\u3088\u3046\u306b\u8a2d\u5b9a\u3059\u308b\u3068\u3044\u3046\u306e\u306f\u30ca\u30b7\u3067<\/p>\n","protected":false},"excerpt":{"rendered":"<p>OpenBSD \u3067\u30c7\u30fc\u30e2\u30f3\u3092\u66f8\u3044\u3066\u3066\u6c17\u3065\u3044\u305f\u3093\u3067\u3059\u304c\u3001kqueue \u306e\u30d5\u30a1\u30a4\u30eb\u30c7\u30b9\u30af\u30ea\u30d7\u30bf\u306f\u30d7\u30ed\u30bb\u30b9\u9593\u3067\u5171\u6709\u3067\u304d\u306a\u3044\u3001\u3064\u307e\u308a\u3001fork(2) \u3067\u5b50\u30d7\u30ed\u30bb\u30b9\u306b\u7d99\u627f\u3055\u308c\u305f\u308a SCM_RIGHTS \u3067\u6295\u3052\u3064\u3051\u305f\u308a\u3059\u308b\u3053\u3068\u306f\u3067\u304d [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[27],"tags":[],"class_list":["post-3449","post","type-post","status-publish","format-standard","hentry","category-technology"],"_links":{"self":[{"href":"http:\/\/umezawa.dyndns.info\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/3449","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/umezawa.dyndns.info\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/umezawa.dyndns.info\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/umezawa.dyndns.info\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/umezawa.dyndns.info\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3449"}],"version-history":[{"count":4,"href":"http:\/\/umezawa.dyndns.info\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/3449\/revisions"}],"predecessor-version":[{"id":3453,"href":"http:\/\/umezawa.dyndns.info\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/3449\/revisions\/3453"}],"wp:attachment":[{"href":"http:\/\/umezawa.dyndns.info\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3449"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/umezawa.dyndns.info\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3449"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/umezawa.dyndns.info\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3449"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}