{"action":"created","comment":{"url":"https://api.github.com/repos/hestela/rust-psm/pulls/comments/67081375","id":67081375,"diff_hunk":"@@ -1,24 +1,31 @@\n+#![macro_use]\n+\n extern crate libc;\n+\n use std::ffi::CString;\n+use std::ffi::CStr;\n use std::os::raw::c_char;\n use libc::c_int;\n use fileops::open;\n \n-pub fn strerrer(errno: c_int) -> String {\n+pub fn strerror(errno: c_int) -> String {\n   unsafe {\n-    let c_err_str = libc::strerror(errno);\n-    CString::from_raw(c_err_str).into_string()\n-      .unwrap_or(String::from(\"Unknown errno\"))\n+    CStr::from_ptr(libc::strerror(errno)).to_string_lossy().into_owned()\n   }\n }\n \n pub fn errno() -> c_int {\n   unsafe { *libc::__errno_location() }\n }\n \n+macro_rules! dump_errno_str {\n+  () => (format!(\"errno: {}, errno str {}\", errno(), strerror(errno())))","path":"src/errno.rs","position":null,"original_position":26,"commit_id":"1eca876128a77db2ddb158df4715561014c9332a","original_commit_id":"01180147f5087c0229b40fa5da8c4100ddabfb34","user":{"login":"hestela","id":3790807,"avatar_url":"https://avatars.githubusercontent.com/u/3790807?v=3","gravatar_id":"","url":"https://api.github.com/users/hestela","html_url":"https://github.com/hestela","followers_url":"https://api.github.com/users/hestela/followers","following_url":"https://api.github.com/users/hestela/following{/other_user}","gists_url":"https://api.github.com/users/hestela/gists{/gist_id}","starred_url":"https://api.github.com/users/hestela/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hestela/subscriptions","organizations_url":"https://api.github.com/users/hestela/orgs","repos_url":"https://api.github.com/users/hestela/repos","events_url":"https://api.github.com/users/hestela/events{/privacy}","received_events_url":"https://api.github.com/users/hestela/received_events","type":"User","site_admin":false},"body":"i did use it outside the module, src/ipath/service.rs, did the `use errno::*` make a difference?\r\ni did `panic!(dump_errno_str!())`, was working","created_at":"2016-06-15T00:24:08Z","updated_at":"2016-06-15T00:24:08Z","html_url":"https://github.com/hestela/rust-psm/pull/10#discussion_r67081375","pull_request_url":"https://api.github.com/repos/hestela/rust-psm/pulls/10","_links":{"self":{"href":"https://api.github.com/repos/hestela/rust-psm/pulls/comments/67081375"},"html":{"href":"https://github.com/hestela/rust-psm/pull/10#discussion_r67081375"},"pull_request":{"href":"https://api.github.com/repos/hestela/rust-psm/pulls/10"}}},"pull_request":{"url":"https://api.github.com/repos/hestela/rust-psm/pulls/10","id":73806493,"html_url":"https://github.com/hestela/rust-psm/pull/10","diff_url":"https://github.com/hestela/rust-psm/pull/10.diff","patch_url":"https://github.com/hestela/rust-psm/pull/10.patch","issue_url":"https://api.github.com/repos/hestela/rust-psm/issues/10","number":10,"state":"open","locked":false,"title":"Add context open fn and supporting mods","user":{"login":"hestela","id":3790807,"avatar_url":"https://avatars.githubusercontent.com/u/3790807?v=3","gravatar_id":"","url":"https://api.github.com/users/hestela","html_url":"https://github.com/hestela","followers_url":"https://api.github.com/users/hestela/followers","following_url":"https://api.github.com/users/hestela/following{/other_user}","gists_url":"https://api.github.com/users/hestela/gists{/gist_id}","starred_url":"https://api.github.com/users/hestela/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hestela/subscriptions","organizations_url":"https://api.github.com/users/hestela/orgs","repos_url":"https://api.github.com/users/hestela/repos","events_url":"https://api.github.com/users/hestela/events{/privacy}","received_events_url":"https://api.github.com/users/hestela/received_events","type":"User","site_admin":false},"body":"Fileops contains open and close wrappers from libc. fnctl is not needed\r\nin this mod as it is already a simple function and needs no type casts\r\nor special tricks. Also, rust does not have support for the ... argument\r\nlist outside of the ffi mod.\r\n\r\nErrno contains errno and strerror, errno is not provded by libc. errno\r\nfn in the Errno mod provides the error number like with C errno().\r\nlibc::__errno_location is used to access the error number.\r\n\r\nThe file descriptor of a /dev/ipath device can now  be obtained using\r\nipath_context_open.\r\n\r\ncargo test was added to the .travis.yml, however tests that require /dev/ipath to exist will have the #[ignore] attribute so that travis can do tests without correct infiniband hardware.","created_at":"2016-06-14T20:18:31Z","updated_at":"2016-06-15T00:24:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e4b454dc7f4770f26289394f4725cbceeab13f87","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/hestela/rust-psm/pulls/10/commits","review_comments_url":"https://api.github.com/repos/hestela/rust-psm/pulls/10/comments","review_comment_url":"https://api.github.com/repos/hestela/rust-psm/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hestela/rust-psm/issues/10/comments","statuses_url":"https://api.github.com/repos/hestela/rust-psm/statuses/1eca876128a77db2ddb158df4715561014c9332a","head":{"label":"hestela:ipath-context-open","ref":"ipath-context-open","sha":"1eca876128a77db2ddb158df4715561014c9332a","user":{"login":"hestela","id":3790807,"avatar_url":"https://avatars.githubusercontent.com/u/3790807?v=3","gravatar_id":"","url":"https://api.github.com/users/hestela","html_url":"https://github.com/hestela","followers_url":"https://api.github.com/users/hestela/followers","following_url":"https://api.github.com/users/hestela/following{/other_user}","gists_url":"https://api.github.com/users/hestela/gists{/gist_id}","starred_url":"https://api.github.com/users/hestela/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hestela/subscriptions","organizations_url":"https://api.github.com/users/hestela/orgs","repos_url":"https://api.github.com/users/hestela/repos","events_url":"https://api.github.com/users/hestela/events{/privacy}","received_events_url":"https://api.github.com/users/hestela/received_events","type":"User","site_admin":false},"repo":{"id":31051716,"name":"rust-psm","full_name":"hestela/rust-psm","owner":{"login":"hestela","id":3790807,"avatar_url":"https://avatars.githubusercontent.com/u/3790807?v=3","gravatar_id":"","url":"https://api.github.com/users/hestela","html_url":"https://github.com/hestela","followers_url":"https://api.github.com/users/hestela/followers","following_url":"https://api.github.com/users/hestela/following{/other_user}","gists_url":"https://api.github.com/users/hestela/gists{/gist_id}","starred_url":"https://api.github.com/users/hestela/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hestela/subscriptions","organizations_url":"https://api.github.com/users/hestela/orgs","repos_url":"https://api.github.com/users/hestela/repos","events_url":"https://api.github.com/users/hestela/events{/privacy}","received_events_url":"https://api.github.com/users/hestela/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/hestela/rust-psm","description":"A Rust implementation of Intel's Performance Scaled Messaging library","fork":false,"url":"https://api.github.com/repos/hestela/rust-psm","forks_url":"https://api.github.com/repos/hestela/rust-psm/forks","keys_url":"https://api.github.com/repos/hestela/rust-psm/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hestela/rust-psm/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hestela/rust-psm/teams","hooks_url":"https://api.github.com/repos/hestela/rust-psm/hooks","issue_events_url":"https://api.github.com/repos/hestela/rust-psm/issues/events{/number}","events_url":"https://api.github.com/repos/hestela/rust-psm/events","assignees_url":"https://api.github.com/repos/hestela/rust-psm/assignees{/user}","branches_url":"https://api.github.com/repos/hestela/rust-psm/branches{/branch}","tags_url":"https://api.github.com/repos/hestela/rust-psm/tags","blobs_url":"https://api.github.com/repos/hestela/rust-psm/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hestela/rust-psm/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hestela/rust-psm/git/refs{/sha}","trees_url":"https://api.github.com/repos/hestela/rust-psm/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hestela/rust-psm/statuses/{sha}","languages_url":"https://api.github.com/repos/hestela/rust-psm/languages","stargazers_url":"https://api.github.com/repos/hestela/rust-psm/stargazers","contributors_url":"https://api.github.com/repos/hestela/rust-psm/contributors","subscribers_url":"https://api.github.com/repos/hestela/rust-psm/subscribers","subscription_url":"https://api.github.com/repos/hestela/rust-psm/subscription","commits_url":"https://api.github.com/repos/hestela/rust-psm/commits{/sha}","git_commits_url":"https://api.github.com/repos/hestela/rust-psm/git/commits{/sha}","comments_url":"https://api.github.com/repos/hestela/rust-psm/comments{/number}","issue_comment_url":"https://api.github.com/repos/hestela/rust-psm/issues/comments{/number}","contents_url":"https://api.github.com/repos/hestela/rust-psm/contents/{+path}","compare_url":"https://api.github.com/repos/hestela/rust-psm/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hestela/rust-psm/merges","archive_url":"https://api.github.com/repos/hestela/rust-psm/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hestela/rust-psm/downloads","issues_url":"https://api.github.com/repos/hestela/rust-psm/issues{/number}","pulls_url":"https://api.github.com/repos/hestela/rust-psm/pulls{/number}","milestones_url":"https://api.github.com/repos/hestela/rust-psm/milestones{/number}","notifications_url":"https://api.github.com/repos/hestela/rust-psm/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hestela/rust-psm/labels{/name}","releases_url":"https://api.github.com/repos/hestela/rust-psm/releases{/id}","deployments_url":"https://api.github.com/repos/hestela/rust-psm/deployments","created_at":"2015-02-20T05:02:09Z","updated_at":"2016-06-10T21:48:12Z","pushed_at":"2016-06-15T00:14:56Z","git_url":"git://github.com/hestela/rust-psm.git","ssh_url":"git@github.com:hestela/rust-psm.git","clone_url":"https://github.com/hestela/rust-psm.git","svn_url":"https://github.com/hestela/rust-psm","homepage":null,"size":37,"stargazers_count":0,"watchers_count":0,"language":"Rust","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":5,"forks":0,"open_issues":5,"watchers":0,"default_branch":"master"}},"base":{"label":"hestela:master","ref":"master","sha":"551c08d5275342438da437beb65c7d56afac5c33","user":{"login":"hestela","id":3790807,"avatar_url":"https://avatars.githubusercontent.com/u/3790807?v=3","gravatar_id":"","url":"https://api.github.com/users/hestela","html_url":"https://github.com/hestela","followers_url":"https://api.github.com/users/hestela/followers","following_url":"https://api.github.com/users/hestela/following{/other_user}","gists_url":"https://api.github.com/users/hestela/gists{/gist_id}","starred_url":"https://api.github.com/users/hestela/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hestela/subscriptions","organizations_url":"https://api.github.com/users/hestela/orgs","repos_url":"https://api.github.com/users/hestela/repos","events_url":"https://api.github.com/users/hestela/events{/privacy}","received_events_url":"https://api.github.com/users/hestela/received_events","type":"User","site_admin":false},"repo":{"id":31051716,"name":"rust-psm","full_name":"hestela/rust-psm","owner":{"login":"hestela","id":3790807,"avatar_url":"https://avatars.githubusercontent.com/u/3790807?v=3","gravatar_id":"","url":"https://api.github.com/users/hestela","html_url":"https://github.com/hestela","followers_url":"https://api.github.com/users/hestela/followers","following_url":"https://api.github.com/users/hestela/following{/other_user}","gists_url":"https://api.github.com/users/hestela/gists{/gist_id}","starred_url":"https://api.github.com/users/hestela/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hestela/subscriptions","organizations_url":"https://api.github.com/users/hestela/orgs","repos_url":"https://api.github.com/users/hestela/repos","events_url":"https://api.github.com/users/hestela/events{/privacy}","received_events_url":"https://api.github.com/users/hestela/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/hestela/rust-psm","description":"A Rust implementation of Intel's Performance Scaled Messaging library","fork":false,"url":"https://api.github.com/repos/hestela/rust-psm","forks_url":"https://api.github.com/repos/hestela/rust-psm/forks","keys_url":"https://api.github.com/repos/hestela/rust-psm/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hestela/rust-psm/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hestela/rust-psm/teams","hooks_url":"https://api.github.com/repos/hestela/rust-psm/hooks","issue_events_url":"https://api.github.com/repos/hestela/rust-psm/issues/events{/number}","events_url":"https://api.github.com/repos/hestela/rust-psm/events","assignees_url":"https://api.github.com/repos/hestela/rust-psm/assignees{/user}","branches_url":"https://api.github.com/repos/hestela/rust-psm/branches{/branch}","tags_url":"https://api.github.com/repos/hestela/rust-psm/tags","blobs_url":"https://api.github.com/repos/hestela/rust-psm/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hestela/rust-psm/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hestela/rust-psm/git/refs{/sha}","trees_url":"https://api.github.com/repos/hestela/rust-psm/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hestela/rust-psm/statuses/{sha}","languages_url":"https://api.github.com/repos/hestela/rust-psm/languages","stargazers_url":"https://api.github.com/repos/hestela/rust-psm/stargazers","contributors_url":"https://api.github.com/repos/hestela/rust-psm/contributors","subscribers_url":"https://api.github.com/repos/hestela/rust-psm/subscribers","subscription_url":"https://api.github.com/repos/hestela/rust-psm/subscription","commits_url":"https://api.github.com/repos/hestela/rust-psm/commits{/sha}","git_commits_url":"https://api.github.com/repos/hestela/rust-psm/git/commits{/sha}","comments_url":"https://api.github.com/repos/hestela/rust-psm/comments{/number}","issue_comment_url":"https://api.github.com/repos/hestela/rust-psm/issues/comments{/number}","contents_url":"https://api.github.com/repos/hestela/rust-psm/contents/{+path}","compare_url":"https://api.github.com/repos/hestela/rust-psm/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hestela/rust-psm/merges","archive_url":"https://api.github.com/repos/hestela/rust-psm/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hestela/rust-psm/downloads","issues_url":"https://api.github.com/repos/hestela/rust-psm/issues{/number}","pulls_url":"https://api.github.com/repos/hestela/rust-psm/pulls{/number}","milestones_url":"https://api.github.com/repos/hestela/rust-psm/milestones{/number}","notifications_url":"https://api.github.com/repos/hestela/rust-psm/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hestela/rust-psm/labels{/name}","releases_url":"https://api.github.com/repos/hestela/rust-psm/releases{/id}","deployments_url":"https://api.github.com/repos/hestela/rust-psm/deployments","created_at":"2015-02-20T05:02:09Z","updated_at":"2016-06-10T21:48:12Z","pushed_at":"2016-06-15T00:14:56Z","git_url":"git://github.com/hestela/rust-psm.git","ssh_url":"git@github.com:hestela/rust-psm.git","clone_url":"https://github.com/hestela/rust-psm.git","svn_url":"https://github.com/hestela/rust-psm","homepage":null,"size":37,"stargazers_count":0,"watchers_count":0,"language":"Rust","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":5,"forks":0,"open_issues":5,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hestela/rust-psm/pulls/10"},"html":{"href":"https://github.com/hestela/rust-psm/pull/10"},"issue":{"href":"https://api.github.com/repos/hestela/rust-psm/issues/10"},"comments":{"href":"https://api.github.com/repos/hestela/rust-psm/issues/10/comments"},"review_comments":{"href":"https://api.github.com/repos/hestela/rust-psm/pulls/10/comments"},"review_comment":{"href":"https://api.github.com/repos/hestela/rust-psm/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hestela/rust-psm/pulls/10/commits"},"statuses":{"href":"https://api.github.com/repos/hestela/rust-psm/statuses/1eca876128a77db2ddb158df4715561014c9332a"}}}}
{"actor":{"display_login":"hestela"}}