{"action":"created","comment":{"url":"https://api.github.com/repos/nix-rust/nix/pulls/comments/61687116","id":61687116,"diff_hunk":"@@ -6,44 +6,125 @@ use {Errno, Result};\n use std::mem;\n use std::ptr;\n \n-pub use libc::{\n-    SIGHUP,\n-    SIGINT,\n-    SIGQUIT,\n-    SIGILL,\n-    SIGABRT,\n-    SIGFPE,\n-    SIGKILL,\n-    SIGSEGV,\n-    SIGPIPE,\n-    SIGALRM,\n-    SIGTERM,\n-    SIGTRAP,\n-    SIGIOT,\n-    SIGBUS,\n-    SIGSYS,\n-    SIGURG,\n-    SIGSTOP,\n-    SIGTSTP,\n-    SIGCONT,\n-    SIGCHLD,\n-    SIGTTIN,\n-    SIGTTOU,\n-    SIGIO,\n-    SIGXCPU,\n-    SIGXFSZ,\n-    SIGVTALRM,\n-    SIGPROF,\n-    SIGWINCH,\n-    SIGUSR1,\n-    SIGUSR2,\n-};\n-\n-// This doesn't always exist, but when it does, it's 7\n-pub const SIGEMT: libc::c_int = 7;\n+#[derive(Clone, Copy, Debug, Eq, PartialEq)]\n+pub enum Signal {\n+    SIGHUP = libc::SIGHUP as isize,\n+    SIGINT = libc::SIGINT as isize,\n+    SIGQUIT = libc::SIGQUIT as isize,\n+    SIGILL = libc::SIGILL as isize,\n+    SIGTRAP = libc::SIGTRAP as isize,\n+    SIGABRT = libc::SIGABRT as isize,\n+    SIGBUS = libc::SIGBUS as isize,\n+    SIGFPE = libc::SIGFPE as isize,\n+    SIGKILL = libc::SIGKILL as isize,\n+    SIGUSR1 = libc::SIGUSR1 as isize,\n+    SIGSEGV = libc::SIGSEGV as isize,\n+    SIGUSR2 = libc::SIGUSR2 as isize,\n+    SIGPIPE = libc::SIGPIPE as isize,\n+    SIGALRM = libc::SIGALRM as isize,\n+    SIGTERM = libc::SIGTERM as isize,\n+    #[cfg(not(target_os = \"macos\"))]\n+    SIGSTKFLT = libc::SIGSTKFLT as isize,\n+    SIGCHLD = libc::SIGCHLD as isize,\n+    SIGCONT = libc::SIGCONT as isize,\n+    SIGSTOP = libc::SIGSTOP as isize,\n+    SIGTSTP = libc::SIGTSTP as isize,\n+    SIGTTIN = libc::SIGTTIN as isize,\n+    SIGTTOU = libc::SIGTTOU as isize,\n+    SIGURG = libc::SIGURG as isize,\n+    SIGXCPU = libc::SIGXCPU as isize,\n+    SIGXFSZ = libc::SIGXFSZ as isize,\n+    SIGVTALRM = libc::SIGVTALRM as isize,\n+    SIGPROF = libc::SIGPROF as isize,\n+    SIGWINCH = libc::SIGWINCH as isize,\n+    SIGIO = libc::SIGIO as isize,\n+    #[cfg(not(target_os = \"macos\"))]\n+    SIGPWR = libc::SIGPWR as isize,\n+    SIGSYS = libc::SIGSYS as isize,\n+    #[cfg(target_os = \"macos\")]\n+    SIGEMT = libc::SIGEMT as isize,\n+    #[cfg(target_os = \"macos\")]\n+    SIGINFO = libc::SIGEMT as isize,\n+}\n+\n+// TODO: NOT PUBLIC :/\n+pub type SigNum = libc::c_int;\n+\n+// TODO: NOT PUBLIC :/\n+pub fn signal_from(signum: SigNum) -> Signal {\n+    match signum {\n+        libc::SIGHUP => SIGHUP,\n+        libc::SIGINT => SIGINT,\n+        libc::SIGQUIT => SIGQUIT,\n+        libc::SIGILL => SIGILL,\n+        libc::SIGTRAP => SIGTRAP,\n+        libc::SIGABRT => SIGABRT,\n+        libc::SIGBUS => SIGBUS,\n+        libc::SIGFPE => SIGFPE,\n+        libc::SIGKILL => SIGKILL,\n+        libc::SIGUSR1 => SIGUSR1,\n+        libc::SIGSEGV => SIGSEGV,\n+        libc::SIGUSR2 => SIGUSR2,\n+        libc::SIGPIPE => SIGPIPE,\n+        libc::SIGALRM => SIGALRM,\n+        libc::SIGTERM => SIGTERM,\n+        libc::SIGCHLD => SIGCHLD,\n+        libc::SIGCONT => SIGCONT,\n+        libc::SIGSTOP => SIGSTOP,\n+        libc::SIGTSTP => SIGTSTP,\n+        libc::SIGTTIN => SIGTTIN,\n+        libc::SIGTTOU => SIGTTOU,\n+        libc::SIGURG => SIGURG,\n+        libc::SIGXCPU => SIGXCPU,\n+        libc::SIGXFSZ => SIGXFSZ,\n+        libc::SIGVTALRM => SIGVTALRM,\n+        libc::SIGPROF => SIGPROF,\n+        libc::SIGWINCH => SIGWINCH,\n+        libc::SIGIO => SIGIO,\n+        libc::SIGSYS => SIGSYS,\n+        #[cfg(not(target_os = \"macos\"))]\n+        libc::SIGPWR => SIGPWR,\n+        #[cfg(not(target_os = \"macos\"))]\n+        libc::SIGSTKFLT => SIGSTKFLT,\n+        #[cfg(target_os = \"macos\")]\n+        libc::SIGEMT => SIGEMT,\n+        #[cfg(target_os = \"macos\")]\n+        libc::SIGINFO => SIGINFO,\n+        _ => panic!(\"There is no signal represented by {}.\", signum),\n+    }\n+}\n+\n+\n+pub use self::Signal::*;\n+\n+pub const SIGIOT : Signal = SIGABRT;\n+pub const SIGPOLL : Signal = SIGIO;\n+pub const SIGUNUSED : Signal = SIGSYS;\n \n pub const NSIG: libc::c_int = 32;\n \n+struct SignalIterator {\n+    signum : libc::c_int,\n+}\n+\n+impl Iterator for SignalIterator {\n+    type Item = Signal;\n+    fn next(&mut self) -> Option<Signal> {\n+        if self.signum < NSIG - 1 {\n+            self.signum += 1;\n+            Some(signal_from(self.signum))\n+        } else {\n+            None\n+        }\n+    }\n+}\n+\n+impl Signal {\n+    fn iterator() -> SignalIterator {","path":"src/sys/signal.rs","position":153,"original_position":153,"commit_id":"8cce6c48add9b02007848f514b729cb97221ab51","original_commit_id":"8cce6c48add9b02007848f514b729cb97221ab51","user":{"login":"fiveop","id":65829,"avatar_url":"https://avatars.githubusercontent.com/u/65829?v=3","gravatar_id":"","url":"https://api.github.com/users/fiveop","html_url":"https://github.com/fiveop","followers_url":"https://api.github.com/users/fiveop/followers","following_url":"https://api.github.com/users/fiveop/following{/other_user}","gists_url":"https://api.github.com/users/fiveop/gists{/gist_id}","starred_url":"https://api.github.com/users/fiveop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fiveop/subscriptions","organizations_url":"https://api.github.com/users/fiveop/orgs","repos_url":"https://api.github.com/users/fiveop/repos","events_url":"https://api.github.com/users/fiveop/events{/privacy}","received_events_url":"https://api.github.com/users/fiveop/received_events","type":"User","site_admin":false},"body":"I thought about the name as well, though I think iterator is pretty descriptive.","created_at":"2016-05-01T13:32:38Z","updated_at":"2016-05-01T13:32:38Z","html_url":"https://github.com/nix-rust/nix/pull/362#discussion_r61687116","pull_request_url":"https://api.github.com/repos/nix-rust/nix/pulls/362","_links":{"self":{"href":"https://api.github.com/repos/nix-rust/nix/pulls/comments/61687116"},"html":{"href":"https://github.com/nix-rust/nix/pull/362#discussion_r61687116"},"pull_request":{"href":"https://api.github.com/repos/nix-rust/nix/pulls/362"}}},"pull_request":{"url":"https://api.github.com/repos/nix-rust/nix/pulls/362","id":67744697,"html_url":"https://github.com/nix-rust/nix/pull/362","diff_url":"https://github.com/nix-rust/nix/pull/362.diff","patch_url":"https://github.com/nix-rust/nix/pull/362.patch","issue_url":"https://api.github.com/repos/nix-rust/nix/issues/362","number":362,"state":"open","locked":false,"title":"Signal enum","user":{"login":"fiveop","id":65829,"avatar_url":"https://avatars.githubusercontent.com/u/65829?v=3","gravatar_id":"","url":"https://api.github.com/users/fiveop","html_url":"https://github.com/fiveop","followers_url":"https://api.github.com/users/fiveop/followers","following_url":"https://api.github.com/users/fiveop/following{/other_user}","gists_url":"https://api.github.com/users/fiveop/gists{/gist_id}","starred_url":"https://api.github.com/users/fiveop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fiveop/subscriptions","organizations_url":"https://api.github.com/users/fiveop/orgs","repos_url":"https://api.github.com/users/fiveop/repos","events_url":"https://api.github.com/users/fiveop/events{/privacy}","received_events_url":"https://api.github.com/users/fiveop/received_events","type":"User","site_admin":false},"body":"This is work in progress. I post this pull request as a request for discussion. I mark the lines I have doubts or ideas about.\r\n\r\nIgnore the first commit. It is the same as PR #361, which I wanted to base this change off.","created_at":"2016-04-25T16:00:12Z","updated_at":"2016-05-01T13:32:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9cdcaf06742d033360472919f4313b322c732fd2","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/nix-rust/nix/pulls/362/commits","review_comments_url":"https://api.github.com/repos/nix-rust/nix/pulls/362/comments","review_comment_url":"https://api.github.com/repos/nix-rust/nix/pulls/comments{/number}","comments_url":"https://api.github.com/repos/nix-rust/nix/issues/362/comments","statuses_url":"https://api.github.com/repos/nix-rust/nix/statuses/8cce6c48add9b02007848f514b729cb97221ab51","head":{"label":"fiveop:signal_enum","ref":"signal_enum","sha":"8cce6c48add9b02007848f514b729cb97221ab51","user":{"login":"fiveop","id":65829,"avatar_url":"https://avatars.githubusercontent.com/u/65829?v=3","gravatar_id":"","url":"https://api.github.com/users/fiveop","html_url":"https://github.com/fiveop","followers_url":"https://api.github.com/users/fiveop/followers","following_url":"https://api.github.com/users/fiveop/following{/other_user}","gists_url":"https://api.github.com/users/fiveop/gists{/gist_id}","starred_url":"https://api.github.com/users/fiveop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fiveop/subscriptions","organizations_url":"https://api.github.com/users/fiveop/orgs","repos_url":"https://api.github.com/users/fiveop/repos","events_url":"https://api.github.com/users/fiveop/events{/privacy}","received_events_url":"https://api.github.com/users/fiveop/received_events","type":"User","site_admin":false},"repo":{"id":50050918,"name":"nix-rust","full_name":"fiveop/nix-rust","owner":{"login":"fiveop","id":65829,"avatar_url":"https://avatars.githubusercontent.com/u/65829?v=3","gravatar_id":"","url":"https://api.github.com/users/fiveop","html_url":"https://github.com/fiveop","followers_url":"https://api.github.com/users/fiveop/followers","following_url":"https://api.github.com/users/fiveop/following{/other_user}","gists_url":"https://api.github.com/users/fiveop/gists{/gist_id}","starred_url":"https://api.github.com/users/fiveop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fiveop/subscriptions","organizations_url":"https://api.github.com/users/fiveop/orgs","repos_url":"https://api.github.com/users/fiveop/repos","events_url":"https://api.github.com/users/fiveop/events{/privacy}","received_events_url":"https://api.github.com/users/fiveop/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/fiveop/nix-rust","description":"Rust friendly bindings to *nix APIs","fork":true,"url":"https://api.github.com/repos/fiveop/nix-rust","forks_url":"https://api.github.com/repos/fiveop/nix-rust/forks","keys_url":"https://api.github.com/repos/fiveop/nix-rust/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fiveop/nix-rust/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fiveop/nix-rust/teams","hooks_url":"https://api.github.com/repos/fiveop/nix-rust/hooks","issue_events_url":"https://api.github.com/repos/fiveop/nix-rust/issues/events{/number}","events_url":"https://api.github.com/repos/fiveop/nix-rust/events","assignees_url":"https://api.github.com/repos/fiveop/nix-rust/assignees{/user}","branches_url":"https://api.github.com/repos/fiveop/nix-rust/branches{/branch}","tags_url":"https://api.github.com/repos/fiveop/nix-rust/tags","blobs_url":"https://api.github.com/repos/fiveop/nix-rust/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fiveop/nix-rust/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fiveop/nix-rust/git/refs{/sha}","trees_url":"https://api.github.com/repos/fiveop/nix-rust/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fiveop/nix-rust/statuses/{sha}","languages_url":"https://api.github.com/repos/fiveop/nix-rust/languages","stargazers_url":"https://api.github.com/repos/fiveop/nix-rust/stargazers","contributors_url":"https://api.github.com/repos/fiveop/nix-rust/contributors","subscribers_url":"https://api.github.com/repos/fiveop/nix-rust/subscribers","subscription_url":"https://api.github.com/repos/fiveop/nix-rust/subscription","commits_url":"https://api.github.com/repos/fiveop/nix-rust/commits{/sha}","git_commits_url":"https://api.github.com/repos/fiveop/nix-rust/git/commits{/sha}","comments_url":"https://api.github.com/repos/fiveop/nix-rust/comments{/number}","issue_comment_url":"https://api.github.com/repos/fiveop/nix-rust/issues/comments{/number}","contents_url":"https://api.github.com/repos/fiveop/nix-rust/contents/{+path}","compare_url":"https://api.github.com/repos/fiveop/nix-rust/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fiveop/nix-rust/merges","archive_url":"https://api.github.com/repos/fiveop/nix-rust/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fiveop/nix-rust/downloads","issues_url":"https://api.github.com/repos/fiveop/nix-rust/issues{/number}","pulls_url":"https://api.github.com/repos/fiveop/nix-rust/pulls{/number}","milestones_url":"https://api.github.com/repos/fiveop/nix-rust/milestones{/number}","notifications_url":"https://api.github.com/repos/fiveop/nix-rust/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fiveop/nix-rust/labels{/name}","releases_url":"https://api.github.com/repos/fiveop/nix-rust/releases{/id}","deployments_url":"https://api.github.com/repos/fiveop/nix-rust/deployments","created_at":"2016-01-20T18:30:02Z","updated_at":"2016-01-20T18:30:03Z","pushed_at":"2016-04-25T15:22:26Z","git_url":"git://github.com/fiveop/nix-rust.git","ssh_url":"git@github.com:fiveop/nix-rust.git","clone_url":"https://github.com/fiveop/nix-rust.git","svn_url":"https://github.com/fiveop/nix-rust","homepage":"","size":777,"stargazers_count":0,"watchers_count":0,"language":"Rust","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"nix-rust:master","ref":"master","sha":"5fa5fd49fb7c9655dc71f2bdb272cb85df317bfb","user":{"login":"nix-rust","id":17190941,"avatar_url":"https://avatars.githubusercontent.com/u/17190941?v=3","gravatar_id":"","url":"https://api.github.com/users/nix-rust","html_url":"https://github.com/nix-rust","followers_url":"https://api.github.com/users/nix-rust/followers","following_url":"https://api.github.com/users/nix-rust/following{/other_user}","gists_url":"https://api.github.com/users/nix-rust/gists{/gist_id}","starred_url":"https://api.github.com/users/nix-rust/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nix-rust/subscriptions","organizations_url":"https://api.github.com/users/nix-rust/orgs","repos_url":"https://api.github.com/users/nix-rust/repos","events_url":"https://api.github.com/users/nix-rust/events{/privacy}","received_events_url":"https://api.github.com/users/nix-rust/received_events","type":"Organization","site_admin":false},"repo":{"id":22734848,"name":"nix","full_name":"nix-rust/nix","owner":{"login":"nix-rust","id":17190941,"avatar_url":"https://avatars.githubusercontent.com/u/17190941?v=3","gravatar_id":"","url":"https://api.github.com/users/nix-rust","html_url":"https://github.com/nix-rust","followers_url":"https://api.github.com/users/nix-rust/followers","following_url":"https://api.github.com/users/nix-rust/following{/other_user}","gists_url":"https://api.github.com/users/nix-rust/gists{/gist_id}","starred_url":"https://api.github.com/users/nix-rust/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nix-rust/subscriptions","organizations_url":"https://api.github.com/users/nix-rust/orgs","repos_url":"https://api.github.com/users/nix-rust/repos","events_url":"https://api.github.com/users/nix-rust/events{/privacy}","received_events_url":"https://api.github.com/users/nix-rust/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/nix-rust/nix","description":"Rust friendly bindings to *nix APIs","fork":false,"url":"https://api.github.com/repos/nix-rust/nix","forks_url":"https://api.github.com/repos/nix-rust/nix/forks","keys_url":"https://api.github.com/repos/nix-rust/nix/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nix-rust/nix/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nix-rust/nix/teams","hooks_url":"https://api.github.com/repos/nix-rust/nix/hooks","issue_events_url":"https://api.github.com/repos/nix-rust/nix/issues/events{/number}","events_url":"https://api.github.com/repos/nix-rust/nix/events","assignees_url":"https://api.github.com/repos/nix-rust/nix/assignees{/user}","branches_url":"https://api.github.com/repos/nix-rust/nix/branches{/branch}","tags_url":"https://api.github.com/repos/nix-rust/nix/tags","blobs_url":"https://api.github.com/repos/nix-rust/nix/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nix-rust/nix/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nix-rust/nix/git/refs{/sha}","trees_url":"https://api.github.com/repos/nix-rust/nix/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nix-rust/nix/statuses/{sha}","languages_url":"https://api.github.com/repos/nix-rust/nix/languages","stargazers_url":"https://api.github.com/repos/nix-rust/nix/stargazers","contributors_url":"https://api.github.com/repos/nix-rust/nix/contributors","subscribers_url":"https://api.github.com/repos/nix-rust/nix/subscribers","subscription_url":"https://api.github.com/repos/nix-rust/nix/subscription","commits_url":"https://api.github.com/repos/nix-rust/nix/commits{/sha}","git_commits_url":"https://api.github.com/repos/nix-rust/nix/git/commits{/sha}","comments_url":"https://api.github.com/repos/nix-rust/nix/comments{/number}","issue_comment_url":"https://api.github.com/repos/nix-rust/nix/issues/comments{/number}","contents_url":"https://api.github.com/repos/nix-rust/nix/contents/{+path}","compare_url":"https://api.github.com/repos/nix-rust/nix/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nix-rust/nix/merges","archive_url":"https://api.github.com/repos/nix-rust/nix/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nix-rust/nix/downloads","issues_url":"https://api.github.com/repos/nix-rust/nix/issues{/number}","pulls_url":"https://api.github.com/repos/nix-rust/nix/pulls{/number}","milestones_url":"https://api.github.com/repos/nix-rust/nix/milestones{/number}","notifications_url":"https://api.github.com/repos/nix-rust/nix/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nix-rust/nix/labels{/name}","releases_url":"https://api.github.com/repos/nix-rust/nix/releases{/id}","deployments_url":"https://api.github.com/repos/nix-rust/nix/deployments","created_at":"2014-08-07T20:03:36Z","updated_at":"2016-04-30T19:56:13Z","pushed_at":"2016-04-30T21:46:24Z","git_url":"git://github.com/nix-rust/nix.git","ssh_url":"git@github.com:nix-rust/nix.git","clone_url":"https://github.com/nix-rust/nix.git","svn_url":"https://github.com/nix-rust/nix","homepage":"","size":1014,"stargazers_count":299,"watchers_count":299,"language":"Rust","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":95,"mirror_url":null,"open_issues_count":48,"forks":95,"open_issues":48,"watchers":299,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/nix-rust/nix/pulls/362"},"html":{"href":"https://github.com/nix-rust/nix/pull/362"},"issue":{"href":"https://api.github.com/repos/nix-rust/nix/issues/362"},"comments":{"href":"https://api.github.com/repos/nix-rust/nix/issues/362/comments"},"review_comments":{"href":"https://api.github.com/repos/nix-rust/nix/pulls/362/comments"},"review_comment":{"href":"https://api.github.com/repos/nix-rust/nix/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/nix-rust/nix/pulls/362/commits"},"statuses":{"href":"https://api.github.com/repos/nix-rust/nix/statuses/8cce6c48add9b02007848f514b729cb97221ab51"}}}}