my Ryzen 7750X:
is_computer_on(); // 1
a cache corrupting i7 14700k:
is_computer_on(); // 153
is_intel_outside()
@peter, it's still there in (at least) current Linux.
On a status check, “lp0 on fire” (for appropriate values of 0) may be logged; on opening the device file, “lp0 printer error” will be logged instead given the same error condition. It's specific to an error condition reported via the 8255 status port.
This is a true masterwork of wrongness.
Okay, I just googled it and it's real. I don't know whether to be delighted or horrified.
Also (and sorry for the monologuing), I once witnessed a demo of the original dual-processor BeBox where the presenter showed how to turn off one or the other of the cores from the settings interface. He then turned off both of the cores, and it did exactly what you'd expect. While the computer rebooted, he segued on to how robust the filesystem was.
So, on reflection, this seems pretty on-brand for them.
That makes sense. My idle speculation was that they were there as the entry points to the hardware or kernel equivalents of debugging printfs, FWIW.
int32 is_computer_on ()
{
return 1;
}
"DEVICE NUMBER GRATER" ???
@nixCraft
I ran this function here. It returned a number that seemed a memory address. I checked the address and there was a string there: "I am."
What does this mean? What does this mean???
It's a perfectly decent function... just a *partial* function, i.e., not defined on all its inputs.
Perfectly decent thing to be.
If the computer isn't on, the value returned by this function is undefined.
goddamnit undefined behavior has gone too far
@nixCraft It's not much use without the companion functions
well_turn_it_on_then() and
sheesh_why_do_I_have_to_think_of_everything_myself_around_here()
@nixCraft This is from the BeOS manual. As I recall, there is also an is_computer_on_fire() function, though I believe it always returned false in shipping versions.
EDIT: I forgot how silly the second one is. It's defined to return the temperature if the computer is on fire and some other value if not.
@nixCraft a close runner-up for "perfect function" from BeOS.
It’d be better if it returned a boolean.
@nixCraft
bool is_computer();
// returns true if executed on a computer
// never returns when not executed on a computer
PS.: <pre> tag when, Mastodon?
@nixCraft
The good old "lp0 on fire" error dating back to ancient times of yore is still a thing. And yes, it can still be thrown when the 8255 kicks an INTR-A.
It's in lp_check_status(), which is very much in the hot code path for local printing.
I'm not sure a function is sufficient, this requires at least a library, if not a bloated trendy framework.
@nixCraft uhhh, undefined means it could return 1, so you can’t even guarantee that a return value of 1 means that the computer is on.
Software is hard.