New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
x/sys/unix: Reboot takes int but LINUX_REBOOT_CMD_HALT overflows int #9584
Comments
you need to cast it to an int. When generating the constants, there is no way to know whether it's You might argue that we can change the constants to int, but please And in this case, if the constant were signed, compiler would warn about A more realistic change would be to change unix.Reboot to take a |
Actually, that can't even be converted to int conveniently; the compiler is too smart, and sees the large constant. Jumping through hoops is required: h := uint(unix.LINUX_REBOOT_CMD_HALT)
unix.Reboot(int(h)) |
If we make the const signed, then using Syscall will require the same |
const c = unix.LINUX_REBOOT_CMD_HALT :-) |
Cool! |
Why does Reboot have to take an int? I understand it's currently just machine generated, but sys/unix has human-written code already. And if you're saying this kind of Go-friendliness doesn't belong in sys/unix that's just really raw syscalls, well where does it belong? |
The consts are machine generated, but Reboot function is manually defined The question is really whether we should make a breaking change for |
The text was updated successfully, but these errors were encountered: