4 ms·
I wonder how they implement is_computer_on() under Linux? (https://www.haiku-os.org/legacy-docs/bebook/TheKernelKit_SystemInfo.html https://www.haiku-os.org/le
by jesperwe 5mo ago
I wonder how they implement is_computer_on() under Linux?
(https://www.haiku-os.org/legacy-docs/bebook/TheKernelKit_SystemInfo.html https://www.haiku-os.org/legacy-docs/bebook/TheKernelKit_Sys...)
- dleslie 5mo agoIn the simplest way. More interesting is the result for is_computer_on_fire() https://github.com/VitruvianOS/Vitruvian/blob/0e4c6e33ab235b6b4139a400848b561f20375b74/src/system/libroot2/system_info.c#L22-L33 https://github.com/VitruvianOS/Vitruvian/blob/0e4c6e33ab235b...
- jesperwe 5mo agoCheating. Not involving the kernel at all.
- MBCook 5mo agoWhy does it return a double?
- dleslie 5mo agoPer the BeBook: > Returns the temperature of the motherboard if the computer is currently on fire.
- MegaDeKay 5mo agoI was wondering about the significance of the returned value 0.63739. Best explanation I found was this HN post [0]: "Referencing a US telephone keypad, it spells NERDY" https://news.ycombinator.com/item?id=29292424 https://news.ycombinator.com/item?id=29292424
- smallstepforman 5mo agoTest the API kernel calling convention when dealing with 64 bit IEE754 doubles on a 32 bit CPU, especially when dealing with MSB vs LSB processors. Also, a long time ago (pre 486DX), processors did not have FPU circuitry instead it was a FPU coprocessor. When dealing with a kernel context switch, you'd have to copy all registers to a stack. With a coprocessor, you'd have to make sure those registers got copied as well. Which was slower with coprocessors ... So for a time some real time kernels did not allow context switching of FPU. To support that, you'd get the performance hit. These days its all integrated so you dont have to worry about it ...
- fragmede 5mo agoon fire > The following functions, types, and structures are used to convey basic information about the system, such as the number of CPUs, when the kernel was built, what time it is now and whether your computer is on fire.
- cestith 5mo agoThat’s sometimes a handy diagnostic if it’s a remote, headless system.