ChibraxOS 2
Changes: - kernel 6.0.2 - Broken init scripts - Switch to bun for better peroformance an easier ffi - Removed grup - Efi support without graphics (at least graphics werent tested) - Suppression de toutes les dépendance non libc - new splash - broken audio - typescript support - ls rewritten to be more reliable
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
//@ts-check
|
||||
import { dlopen, FFIType } from 'bun:ffi';
|
||||
|
||||
/* Perform a hard reset now. */
|
||||
const RB_AUTOBOOT = 0x01234567
|
||||
|
||||
@@ -20,37 +22,40 @@ const RB_SW_SUSPEND = 0xd000fce2
|
||||
/* Reboot system into new kernel. */ //no idea how to use that but hey
|
||||
const RB_KEXEC = 0x45584543
|
||||
|
||||
/**
|
||||
@type {{
|
||||
reboot: (rebootid: number) => void //https://unix.superglobalmegacorp.com/Net2/newsrc/sys/syscall.h.html
|
||||
syscall: (syscallid: number) => void
|
||||
}}
|
||||
*///@ts-expect-error
|
||||
const syscalls = require('./syscall.node')
|
||||
|
||||
function disableCtrlAltSupr() {
|
||||
syscalls.reboot(RB_DISABLE_CAD)
|
||||
const {
|
||||
symbols: {
|
||||
reboot,
|
||||
},
|
||||
} = dlopen('/usr/lib/libc.so.6', {
|
||||
reboot: {
|
||||
args: [ FFIType.int ],
|
||||
returns: FFIType.int,
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
|
||||
export function disableCtrlAltSupr() {
|
||||
reboot(RB_DISABLE_CAD)
|
||||
}
|
||||
|
||||
function enableCtrlAltSupr() {
|
||||
syscalls.reboot(RB_ENABLE_CAD)
|
||||
export function enableCtrlAltSupr() {
|
||||
reboot(RB_ENABLE_CAD)
|
||||
}
|
||||
|
||||
function halt() {
|
||||
syscalls.reboot(RB_HALT_SYSTEM)
|
||||
export function halt() {
|
||||
reboot(RB_HALT_SYSTEM)
|
||||
}
|
||||
|
||||
function reboot() {
|
||||
syscalls.reboot(RB_AUTOBOOT)
|
||||
export function classicReboot() {
|
||||
reboot(RB_AUTOBOOT)
|
||||
}
|
||||
|
||||
function powerOff() {
|
||||
syscalls.reboot(RB_POWER_OFF)
|
||||
export function powerOff() {
|
||||
reboot(RB_POWER_OFF)
|
||||
}
|
||||
|
||||
function suspend() {
|
||||
syscalls.reboot(RB_SW_SUSPEND)
|
||||
export function suspend() {
|
||||
reboot(RB_SW_SUSPEND)
|
||||
}
|
||||
|
||||
|
||||
module.exports = { disableCtrlAltSupr, enableCtrlAltSupr, halt, reboot, powerOff, suspend }
|
||||
Reference in New Issue
Block a user