{"action":"created","issue":{"url":"https://api.github.com/repos/nix-rust/nix/issues/386","repository_url":"https://api.github.com/repos/nix-rust/nix","labels_url":"https://api.github.com/repos/nix-rust/nix/issues/386/labels{/name}","comments_url":"https://api.github.com/repos/nix-rust/nix/issues/386/comments","events_url":"https://api.github.com/repos/nix-rust/nix/issues/386/events","html_url":"https://github.com/nix-rust/nix/pull/386","id":164897055,"number":386,"title":"Add reboot() support on Linux","user":{"login":"bugaevc","id":10091584,"avatar_url":"https://avatars.githubusercontent.com/u/10091584?v=3","gravatar_id":"","url":"https://api.github.com/users/bugaevc","html_url":"https://github.com/bugaevc","followers_url":"https://api.github.com/users/bugaevc/followers","following_url":"https://api.github.com/users/bugaevc/following{/other_user}","gists_url":"https://api.github.com/users/bugaevc/gists{/gist_id}","starred_url":"https://api.github.com/users/bugaevc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bugaevc/subscriptions","organizations_url":"https://api.github.com/users/bugaevc/orgs","repos_url":"https://api.github.com/users/bugaevc/repos","events_url":"https://api.github.com/users/bugaevc/events{/privacy}","received_events_url":"https://api.github.com/users/bugaevc/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-07-11T17:58:53Z","updated_at":"2016-07-12T07:45:55Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/nix-rust/nix/pulls/386","html_url":"https://github.com/nix-rust/nix/pull/386","diff_url":"https://github.com/nix-rust/nix/pull/386.diff","patch_url":"https://github.com/nix-rust/nix/pull/386.patch"},"body":"This adds support for calling [reboot(2)](http://linux.die.net/man/2/reboot) on Linux (useful for implementing PID 1!).\r\n\r\n* **Testing**: I can't imagine how this could be tested other than manually, which is what I did to ensure it works.\r\n* **libc**: for some reason libc includes neither `reboot()` function, nor `RB_*` constants, so I had to hack-define them here. Should I open a bug/PR against the libc crate?\r\n* **API**: I went with `reboot()` function for restarting, powering off, halting, etc. and an additional `set_cad_enabled()` function for enabling/disabling Ctrl-Alt-Delete, which still corresponds to `reboot()` C call, but has different semantics and return type. (But I'm open to suggestions here -- maybe it would be better to separate each action into its own function, i.e. `restart()`, `poweroff()`, `halt()`?)\r\n* **Documentation**: I see most of the things in nix are undocumented, so I didn't document anything except for the `set_cad_enabled()` function, which obviously uses a non-standard name.\r\n* **Portability**: I implemented the Linux version as I'm not familiar with anything else, but there surely are others (ex. [BSD](http://www.freebsd.org/cgi/man.cgi?reboot(2))). If I didn't mess up anything, the new code is only compiled on Linux/Android, so it should be straightforward to implement the other versions too."},"comment":{"url":"https://api.github.com/repos/nix-rust/nix/issues/comments/231963639","html_url":"https://github.com/nix-rust/nix/pull/386#issuecomment-231963639","issue_url":"https://api.github.com/repos/nix-rust/nix/issues/386","id":231963639,"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},"created_at":"2016-07-12T07:45:55Z","updated_at":"2016-07-12T07:45:55Z","body":"First of all, sorry about the `sys/reboot.rs` mixup. I made a mistake there.\r\n\r\nRegarding your third point: If something from a libc-header or `sys/` header is mising from libc, there is probably no other reason, than that no one has bothered to add it yet. Given that musl and glibc provide the reboot method as well as associated constants, that should be no problem.\r\n\r\n"}}
{"actor":{"display_login":"fiveop"}}