Why would is_computer_on_fire() return a double and not true/false? Even for a joke function, this seems like bad practice. If the function is named is_state(), I expect a boolean return. > Returns the temperature of the motherboard if the computer is currently on fire. Smoldering doesn't count. If the computer isn't on fire, the function returns some other value.
How to programmatically find out if computer is on
131–140 of 197 posts
Re: How to programmatically find out if computer is on
#132Why would is_computer_on_fire() return a double and not true/false? Even for a joke function, this seems like bad practice. If the function is named is_state(), I expect a boolean return. > Returns the temperature of the motherboard if the computer is currently on fire. Smoldering doesn't count. If the computer isn't on fire, the function returns some other value.
https://en.wikipedia.org/wiki/Halt_and_Catch_Fire_(computing...
Re: How to programmatically find out if computer is on
#133I'm curious if there's any significance in number 0.63739 in this implementation double is_computer_on_fire(void) { return 0.63739; } https://github.com/haiku/haiku/blob/8f16317a5b6db5c672f33181...
Re: How to programmatically find out if computer is on
#134Earlier quoted context omitted.
Nah. Just bump that responsibility to the caller, and power supply manufacturer. Have the caller call power_on_computer() first always. This will ensure you always get defined state! ...What do you mean not every power supply manufacturer implements the power_on_computer() function as a NOOP if the computer is already on?!
I know that at least Solaris implemented SIGPWR signal to inform programs of a power failure: https://community.bmc.com/s/article/Inquira-KA334556
Re: How to programmatically find out if computer is on
#135Earlier quoted context omitted.
I've often wondered why WOL is so poorly designed. WOL should be a function of the NIC, completely independent of the OS and capable of returning status codes even if the computer is "off".
Is... this not how your WoL works? Hitting the NIC is equivalent to pressing the on button, boots the OS, etc. I've been using this for years to wake hosts at home when I'm abroad. It's invaluable.
Re: How to programmatically find out if computer is on
#136Earlier quoted context omitted.
I've often wondered why WOL is so poorly designed. WOL should be a function of the NIC, completely independent of the OS and capable of returning status codes even if the computer is "off".
Is... this not how your WoL works? Hitting the NIC is equivalent to pressing the on button, boots the OS, etc. I've been using this for years to wake hosts at home when I'm abroad. It's invaluable.
I wonder if that could be implemented solely by the motherboard. After all, it could supply a small amount of power to the NIC while shutdown and embed a minimal NIC driver to monitor incoming packets without the need for the NIC to do the monitoring itself.
Re: How to programmatically find out if computer is on
#137https://github.com/haiku/haiku/blob/8f16317a5b6db5c672f33181...
Re: How to programmatically find out if computer is on
#138Better description would be:
Returns 1 if the computer is on. If the computer isn't on, the value returned by this function is not computable.
Re: How to programmatically find out if computer is on
#139> is_computer_on() How does this relate to computer being in Halt state, which is quite valid state for servers (there could be even a dedicated Halt button)? Technically computer hardware is ON. I remember that in such state it shows a "carrot" prompt (>>>) from the SRE console. By the way, there is also HCF instruction (Halt and Catch Fire). https://en.wikipedia.org/wiki/Halt_and_Catch_Fire_(computing...
I’ve wondered what Go APIs involving channels should do when the computer is put to sleep and later on wakes up.
Re: How to programmatically find out if computer is on
#140Earlier quoted context omitted.
Is... this not how your WoL works? Hitting the NIC is equivalent to pressing the on button, boots the OS, etc. I've been using this for years to wake hosts at home when I'm abroad. It's invaluable.
I think the parent means that you should be able to talk to the NIC about the computer, without the NIC needing to get the CPU powered on so that the CPU can tell the NIC what to do. Like a very-minimally-functional BMC.