{"action":"created","issue":{"url":"https://api.github.com/repos/lxc/lxc/issues/923","repository_url":"https://api.github.com/repos/lxc/lxc","labels_url":"https://api.github.com/repos/lxc/lxc/issues/923/labels{/name}","comments_url":"https://api.github.com/repos/lxc/lxc/issues/923/comments","events_url":"https://api.github.com/repos/lxc/lxc/issues/923/events","html_url":"https://github.com/lxc/lxc/pull/923","id":143681840,"number":923,"title":"[WIP] add functions to mmap() file to \\0-terminated str","user":{"login":"brauner","id":7353573,"avatar_url":"https://avatars.githubusercontent.com/u/7353573?v=3","gravatar_id":"","url":"https://api.github.com/users/brauner","html_url":"https://github.com/brauner","followers_url":"https://api.github.com/users/brauner/followers","following_url":"https://api.github.com/users/brauner/following{/other_user}","gists_url":"https://api.github.com/users/brauner/gists{/gist_id}","starred_url":"https://api.github.com/users/brauner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brauner/subscriptions","organizations_url":"https://api.github.com/users/brauner/orgs","repos_url":"https://api.github.com/users/brauner/repos","events_url":"https://api.github.com/users/brauner/events{/privacy}","received_events_url":"https://api.github.com/users/brauner/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2016-03-26T09:15:13Z","updated_at":"2016-03-27T13:38:20Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/lxc/lxc/pulls/923","html_url":"https://github.com/lxc/lxc/pull/923","diff_url":"https://github.com/lxc/lxc/pull/923.diff","patch_url":"https://github.com/lxc/lxc/pull/923.patch"},"body":"The functions lxc_mmap_str() and lxc_munmap_str() mmap() a file as a\r\n\\0-terminated string.\r\nmmap() memory is only \\0-terminated when the size of the file is not a multiple\r\nof the pagesize. lxc_mmap_str() will guarantee that the mapping is\r\n\\0-terminated by writing a \\0-byte to the underlying file prior to establishing\r\nthe mapping. Hence, the file descriptor must refer to a writeable file.\r\nlxc_munmap_str() will take care of unmapping the file and truncating it to its\r\noriginal size.\r\n\r\nTests for lxc_mmap_str() are included.\r\n\r\nSigned-off-by: Christian Brauner <christian.brauner@mailbox.org>"},"comment":{"url":"https://api.github.com/repos/lxc/lxc/issues/comments/202065287","html_url":"https://github.com/lxc/lxc/pull/923#issuecomment-202065287","issue_url":"https://api.github.com/repos/lxc/lxc/issues/923","id":202065287,"user":{"login":"brauner","id":7353573,"avatar_url":"https://avatars.githubusercontent.com/u/7353573?v=3","gravatar_id":"","url":"https://api.github.com/users/brauner","html_url":"https://github.com/brauner","followers_url":"https://api.github.com/users/brauner/followers","following_url":"https://api.github.com/users/brauner/following{/other_user}","gists_url":"https://api.github.com/users/brauner/gists{/gist_id}","starred_url":"https://api.github.com/users/brauner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brauner/subscriptions","organizations_url":"https://api.github.com/users/brauner/orgs","repos_url":"https://api.github.com/users/brauner/repos","events_url":"https://api.github.com/users/brauner/events{/privacy}","received_events_url":"https://api.github.com/users/brauner/received_events","type":"User","site_admin":false},"created_at":"2016-03-27T13:38:20Z","updated_at":"2016-03-27T13:38:20Z","body":"I think I might be able to do this a lot smarter and less invasive."}}