{"action":"created","comment":{"url":"https://api.github.com/repos/servo/ipc-channel/pulls/comments/85634124","pull_request_review_id":6342185,"id":85634124,"diff_hunk":"@@ -0,0 +1,1479 @@\n+// Copyright 2015 The Servo Project Developers. See the COPYRIGHT\n+// file at the top-level directory of this distribution.\n+//\n+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or\n+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license\n+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your\n+// option. This file may not be copied, modified, or distributed\n+// except according to those terms.\n+\n+use std::cell::RefCell;\n+use std::cmp::PartialEq;\n+use std::default::Default;\n+use std::ffi::CString;\n+use std::io::{Error, ErrorKind};\n+use std::marker::{Send, Sync};\n+use std::mem;\n+use std::ops::Deref;\n+use std::env;\n+use std::ptr;\n+use std::slice;\n+\n+use libc::{intptr_t, memcmp};\n+\n+use uuid::Uuid;\n+\n+use serde;\n+use bincode;\n+use bincode::serde::DeserializeError;\n+\n+use winapi;\n+use winapi::{HANDLE, INVALID_HANDLE_VALUE, LPVOID};\n+use kernel32;\n+\n+lazy_static! {\n+    static ref CURRENT_PROCESS_ID: winapi::ULONG = unsafe { kernel32::GetCurrentProcessId() };\n+    static ref CURRENT_PROCESS_HANDLE: intptr_t = unsafe { kernel32::GetCurrentProcess() as intptr_t };\n+\n+    static ref DD_ENABLED: bool = match env::var_os(\"DD\") {\n+        Some(_) => true,\n+        None => false,\n+    };\n+    static ref DD2_ENABLED: bool = match env::var_os(\"DD2\") {\n+        Some(_) => true,\n+        None => false,\n+    };\n+}\n+\n+macro_rules! dd { ($($rest:tt)*) => { if *DD_ENABLED { println!($($rest)*); } } }\n+macro_rules! dd2 { ($($rest:tt)*) => { if *DD_ENABLED || *DD2_ENABLED { println!($($rest)*); } } }\n+\n+// We stick these in WinErrors to indicate various things\n+// that aren't quite errors.\n+const MAGIC_CODE_BASE: u32 = 0xdeadbee0u32;\n+const MAGIC_NO_OUTSTANDING_DATA_CODE: u32 = MAGIC_CODE_BASE + 0;\n+const MAGIC_CHANNEL_CLOSED_CODE: u32 = MAGIC_CODE_BASE + 1;","path":"src/platform/windows/mod.rs","position":50,"original_position":55,"commit_id":"1476fbce7d6132e1dfe7df985440d6ff7abd0919","original_commit_id":"d2f9e3ba31f81fa0f6650f4bdf94c202adf1e898","user":{"login":"antrik","id":19555,"avatar_url":"https://avatars.githubusercontent.com/u/19555?v=3","gravatar_id":"","url":"https://api.github.com/users/antrik","html_url":"https://github.com/antrik","followers_url":"https://api.github.com/users/antrik/followers","following_url":"https://api.github.com/users/antrik/following{/other_user}","gists_url":"https://api.github.com/users/antrik/gists{/gist_id}","starred_url":"https://api.github.com/users/antrik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/antrik/subscriptions","organizations_url":"https://api.github.com/users/antrik/orgs","repos_url":"https://api.github.com/users/antrik/repos","events_url":"https://api.github.com/users/antrik/events{/privacy}","received_events_url":"https://api.github.com/users/antrik/received_events","type":"User","site_admin":false},"body":"That's indeed what I was thinking of :-)\r\n\r\n(I wonder though whether it might be a tick confusing to keep calling it `WinError`?... Not sure.)","created_at":"2016-10-29T05:04:15Z","updated_at":"2016-10-29T05:04:15Z","html_url":"https://github.com/servo/ipc-channel/pull/108#discussion_r85634124","pull_request_url":"https://api.github.com/repos/servo/ipc-channel/pulls/108","_links":{"self":{"href":"https://api.github.com/repos/servo/ipc-channel/pulls/comments/85634124"},"html":{"href":"https://github.com/servo/ipc-channel/pull/108#discussion_r85634124"},"pull_request":{"href":"https://api.github.com/repos/servo/ipc-channel/pulls/108"}}},"pull_request":{"url":"https://api.github.com/repos/servo/ipc-channel/pulls/108","id":88001841,"html_url":"https://github.com/servo/ipc-channel/pull/108","diff_url":"https://github.com/servo/ipc-channel/pull/108.diff","patch_url":"https://github.com/servo/ipc-channel/pull/108.patch","issue_url":"https://api.github.com/repos/servo/ipc-channel/issues/108","number":108,"state":"open","locked":false,"title":"Implement ipc-channel on Windows","user":{"login":"vvuk","id":194965,"avatar_url":"https://avatars.githubusercontent.com/u/194965?v=3","gravatar_id":"","url":"https://api.github.com/users/vvuk","html_url":"https://github.com/vvuk","followers_url":"https://api.github.com/users/vvuk/followers","following_url":"https://api.github.com/users/vvuk/following{/other_user}","gists_url":"https://api.github.com/users/vvuk/gists{/gist_id}","starred_url":"https://api.github.com/users/vvuk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vvuk/subscriptions","organizations_url":"https://api.github.com/users/vvuk/orgs","repos_url":"https://api.github.com/users/vvuk/repos","events_url":"https://api.github.com/users/vvuk/events{/privacy}","received_events_url":"https://api.github.com/users/vvuk/received_events","type":"User","site_admin":false},"body":"This implementation uses named pipes on Windows, with auto-generated uuid\r\nnames.  It takes advantage of DuplicateHandle to clone handles to target\r\nprocesses when sending handles cross-process.  Shared memory is implemented\r\nusing anonymous file mappings.  select() and friends are implemented using\r\nIO Completion Ports.  I learned a lot about Windows IO doing this, more than I wanted to :)\r\n\r\nAll the current tests pass.  I have not tried actually running servo with multiprocess ipc -- that's next, but I wanted to get this up for review first.  There's a branch (win32-unsquashed) that has a large sequence of commits that led to this, in case that's interesting to anyone... it contains a couple of abandoned approaches early on though.","created_at":"2016-10-05T01:11:08Z","updated_at":"2016-10-29T05:04:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a915726c5e3362f4dac42a664930656dcb315b96","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/servo/ipc-channel/pulls/108/commits","review_comments_url":"https://api.github.com/repos/servo/ipc-channel/pulls/108/comments","review_comment_url":"https://api.github.com/repos/servo/ipc-channel/pulls/comments{/number}","comments_url":"https://api.github.com/repos/servo/ipc-channel/issues/108/comments","statuses_url":"https://api.github.com/repos/servo/ipc-channel/statuses/1476fbce7d6132e1dfe7df985440d6ff7abd0919","head":{"label":"vvuk:win32","ref":"win32","sha":"1476fbce7d6132e1dfe7df985440d6ff7abd0919","user":{"login":"vvuk","id":194965,"avatar_url":"https://avatars.githubusercontent.com/u/194965?v=3","gravatar_id":"","url":"https://api.github.com/users/vvuk","html_url":"https://github.com/vvuk","followers_url":"https://api.github.com/users/vvuk/followers","following_url":"https://api.github.com/users/vvuk/following{/other_user}","gists_url":"https://api.github.com/users/vvuk/gists{/gist_id}","starred_url":"https://api.github.com/users/vvuk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vvuk/subscriptions","organizations_url":"https://api.github.com/users/vvuk/orgs","repos_url":"https://api.github.com/users/vvuk/repos","events_url":"https://api.github.com/users/vvuk/events{/privacy}","received_events_url":"https://api.github.com/users/vvuk/received_events","type":"User","site_admin":false},"repo":{"id":42744189,"name":"ipc-channel","full_name":"vvuk/ipc-channel","owner":{"login":"vvuk","id":194965,"avatar_url":"https://avatars.githubusercontent.com/u/194965?v=3","gravatar_id":"","url":"https://api.github.com/users/vvuk","html_url":"https://github.com/vvuk","followers_url":"https://api.github.com/users/vvuk/followers","following_url":"https://api.github.com/users/vvuk/following{/other_user}","gists_url":"https://api.github.com/users/vvuk/gists{/gist_id}","starred_url":"https://api.github.com/users/vvuk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vvuk/subscriptions","organizations_url":"https://api.github.com/users/vvuk/orgs","repos_url":"https://api.github.com/users/vvuk/repos","events_url":"https://api.github.com/users/vvuk/events{/privacy}","received_events_url":"https://api.github.com/users/vvuk/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/vvuk/ipc-channel","description":"A multiprocess drop-in replacement for Rust channels","fork":true,"url":"https://api.github.com/repos/vvuk/ipc-channel","forks_url":"https://api.github.com/repos/vvuk/ipc-channel/forks","keys_url":"https://api.github.com/repos/vvuk/ipc-channel/keys{/key_id}","collaborators_url":"https://api.github.com/repos/vvuk/ipc-channel/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/vvuk/ipc-channel/teams","hooks_url":"https://api.github.com/repos/vvuk/ipc-channel/hooks","issue_events_url":"https://api.github.com/repos/vvuk/ipc-channel/issues/events{/number}","events_url":"https://api.github.com/repos/vvuk/ipc-channel/events","assignees_url":"https://api.github.com/repos/vvuk/ipc-channel/assignees{/user}","branches_url":"https://api.github.com/repos/vvuk/ipc-channel/branches{/branch}","tags_url":"https://api.github.com/repos/vvuk/ipc-channel/tags","blobs_url":"https://api.github.com/repos/vvuk/ipc-channel/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/vvuk/ipc-channel/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/vvuk/ipc-channel/git/refs{/sha}","trees_url":"https://api.github.com/repos/vvuk/ipc-channel/git/trees{/sha}","statuses_url":"https://api.github.com/repos/vvuk/ipc-channel/statuses/{sha}","languages_url":"https://api.github.com/repos/vvuk/ipc-channel/languages","stargazers_url":"https://api.github.com/repos/vvuk/ipc-channel/stargazers","contributors_url":"https://api.github.com/repos/vvuk/ipc-channel/contributors","subscribers_url":"https://api.github.com/repos/vvuk/ipc-channel/subscribers","subscription_url":"https://api.github.com/repos/vvuk/ipc-channel/subscription","commits_url":"https://api.github.com/repos/vvuk/ipc-channel/commits{/sha}","git_commits_url":"https://api.github.com/repos/vvuk/ipc-channel/git/commits{/sha}","comments_url":"https://api.github.com/repos/vvuk/ipc-channel/comments{/number}","issue_comment_url":"https://api.github.com/repos/vvuk/ipc-channel/issues/comments{/number}","contents_url":"https://api.github.com/repos/vvuk/ipc-channel/contents/{+path}","compare_url":"https://api.github.com/repos/vvuk/ipc-channel/compare/{base}...{head}","merges_url":"https://api.github.com/repos/vvuk/ipc-channel/merges","archive_url":"https://api.github.com/repos/vvuk/ipc-channel/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/vvuk/ipc-channel/downloads","issues_url":"https://api.github.com/repos/vvuk/ipc-channel/issues{/number}","pulls_url":"https://api.github.com/repos/vvuk/ipc-channel/pulls{/number}","milestones_url":"https://api.github.com/repos/vvuk/ipc-channel/milestones{/number}","notifications_url":"https://api.github.com/repos/vvuk/ipc-channel/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/vvuk/ipc-channel/labels{/name}","releases_url":"https://api.github.com/repos/vvuk/ipc-channel/releases{/id}","deployments_url":"https://api.github.com/repos/vvuk/ipc-channel/deployments","created_at":"2015-09-18T19:54:22Z","updated_at":"2015-09-18T19:54:22Z","pushed_at":"2016-10-27T02:01:27Z","git_url":"git://github.com/vvuk/ipc-channel.git","ssh_url":"git@github.com:vvuk/ipc-channel.git","clone_url":"https://github.com/vvuk/ipc-channel.git","svn_url":"https://github.com/vvuk/ipc-channel","homepage":"","size":470,"stargazers_count":0,"watchers_count":0,"language":"Rust","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"servo:master","ref":"master","sha":"3250a6030ce5ce2a02d59d274953fb39b88d8e4c","user":{"login":"servo","id":2566135,"avatar_url":"https://avatars.githubusercontent.com/u/2566135?v=3","gravatar_id":"","url":"https://api.github.com/users/servo","html_url":"https://github.com/servo","followers_url":"https://api.github.com/users/servo/followers","following_url":"https://api.github.com/users/servo/following{/other_user}","gists_url":"https://api.github.com/users/servo/gists{/gist_id}","starred_url":"https://api.github.com/users/servo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/servo/subscriptions","organizations_url":"https://api.github.com/users/servo/orgs","repos_url":"https://api.github.com/users/servo/repos","events_url":"https://api.github.com/users/servo/events{/privacy}","received_events_url":"https://api.github.com/users/servo/received_events","type":"Organization","site_admin":false},"repo":{"id":37943142,"name":"ipc-channel","full_name":"servo/ipc-channel","owner":{"login":"servo","id":2566135,"avatar_url":"https://avatars.githubusercontent.com/u/2566135?v=3","gravatar_id":"","url":"https://api.github.com/users/servo","html_url":"https://github.com/servo","followers_url":"https://api.github.com/users/servo/followers","following_url":"https://api.github.com/users/servo/following{/other_user}","gists_url":"https://api.github.com/users/servo/gists{/gist_id}","starred_url":"https://api.github.com/users/servo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/servo/subscriptions","organizations_url":"https://api.github.com/users/servo/orgs","repos_url":"https://api.github.com/users/servo/repos","events_url":"https://api.github.com/users/servo/events{/privacy}","received_events_url":"https://api.github.com/users/servo/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/servo/ipc-channel","description":"A multiprocess drop-in replacement for Rust channels","fork":false,"url":"https://api.github.com/repos/servo/ipc-channel","forks_url":"https://api.github.com/repos/servo/ipc-channel/forks","keys_url":"https://api.github.com/repos/servo/ipc-channel/keys{/key_id}","collaborators_url":"https://api.github.com/repos/servo/ipc-channel/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/servo/ipc-channel/teams","hooks_url":"https://api.github.com/repos/servo/ipc-channel/hooks","issue_events_url":"https://api.github.com/repos/servo/ipc-channel/issues/events{/number}","events_url":"https://api.github.com/repos/servo/ipc-channel/events","assignees_url":"https://api.github.com/repos/servo/ipc-channel/assignees{/user}","branches_url":"https://api.github.com/repos/servo/ipc-channel/branches{/branch}","tags_url":"https://api.github.com/repos/servo/ipc-channel/tags","blobs_url":"https://api.github.com/repos/servo/ipc-channel/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/servo/ipc-channel/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/servo/ipc-channel/git/refs{/sha}","trees_url":"https://api.github.com/repos/servo/ipc-channel/git/trees{/sha}","statuses_url":"https://api.github.com/repos/servo/ipc-channel/statuses/{sha}","languages_url":"https://api.github.com/repos/servo/ipc-channel/languages","stargazers_url":"https://api.github.com/repos/servo/ipc-channel/stargazers","contributors_url":"https://api.github.com/repos/servo/ipc-channel/contributors","subscribers_url":"https://api.github.com/repos/servo/ipc-channel/subscribers","subscription_url":"https://api.github.com/repos/servo/ipc-channel/subscription","commits_url":"https://api.github.com/repos/servo/ipc-channel/commits{/sha}","git_commits_url":"https://api.github.com/repos/servo/ipc-channel/git/commits{/sha}","comments_url":"https://api.github.com/repos/servo/ipc-channel/comments{/number}","issue_comment_url":"https://api.github.com/repos/servo/ipc-channel/issues/comments{/number}","contents_url":"https://api.github.com/repos/servo/ipc-channel/contents/{+path}","compare_url":"https://api.github.com/repos/servo/ipc-channel/compare/{base}...{head}","merges_url":"https://api.github.com/repos/servo/ipc-channel/merges","archive_url":"https://api.github.com/repos/servo/ipc-channel/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/servo/ipc-channel/downloads","issues_url":"https://api.github.com/repos/servo/ipc-channel/issues{/number}","pulls_url":"https://api.github.com/repos/servo/ipc-channel/pulls{/number}","milestones_url":"https://api.github.com/repos/servo/ipc-channel/milestones{/number}","notifications_url":"https://api.github.com/repos/servo/ipc-channel/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/servo/ipc-channel/labels{/name}","releases_url":"https://api.github.com/repos/servo/ipc-channel/releases{/id}","deployments_url":"https://api.github.com/repos/servo/ipc-channel/deployments","created_at":"2015-06-23T20:28:18Z","updated_at":"2016-10-27T19:20:34Z","pushed_at":"2016-10-27T10:56:26Z","git_url":"git://github.com/servo/ipc-channel.git","ssh_url":"git@github.com:servo/ipc-channel.git","clone_url":"https://github.com/servo/ipc-channel.git","svn_url":"https://github.com/servo/ipc-channel","homepage":"","size":503,"stargazers_count":116,"watchers_count":116,"language":"Rust","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":26,"mirror_url":null,"open_issues_count":23,"forks":26,"open_issues":23,"watchers":116,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/servo/ipc-channel/pulls/108"},"html":{"href":"https://github.com/servo/ipc-channel/pull/108"},"issue":{"href":"https://api.github.com/repos/servo/ipc-channel/issues/108"},"comments":{"href":"https://api.github.com/repos/servo/ipc-channel/issues/108/comments"},"review_comments":{"href":"https://api.github.com/repos/servo/ipc-channel/pulls/108/comments"},"review_comment":{"href":"https://api.github.com/repos/servo/ipc-channel/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/servo/ipc-channel/pulls/108/commits"},"statuses":{"href":"https://api.github.com/repos/servo/ipc-channel/statuses/1476fbce7d6132e1dfe7df985440d6ff7abd0919"}}}}
{"actor":{"display_login":"antrik"}}