X-Git-Url: https://scm.lunaixsky.com/lunaix-os.git/blobdiff_plain/1025235c72c31f7fa7b648c0e32ddcaa68a8f66a..abb53006508723db0e1e13fb643240f688ddb8f0:/lunaix-os/LConfig diff --git a/lunaix-os/LConfig b/lunaix-os/LConfig index 3d0a179..65cfb07 100644 --- a/lunaix-os/LConfig +++ b/lunaix-os/LConfig @@ -1,32 +1,68 @@ -import time +from datetime import datetime, date -include("kernel/LConfig") -include("arch/LConfig") +from . import kernel, arch, hal -@Term("Version") -@ReadOnly -def lunaix_ver(): +@native +def get_patch_seq(): + today = date.today() + year = today.year + start_of_year = datetime(year, 1, 1).date() + seq_num = (today - start_of_year).days + + return "%d%d"%(year - 2000, seq_num) + +@"Kernel Version" +@readonly +def lunaix_ver() -> str: """ Lunaix kernel version """ - - type(str) - seq_num = int(time.time() / 3600) - default("dev-2024_%d"%(seq_num)) + return f"{arch.val} v0.0.{get_patch_seq()}" -@Collection +@"Kernel Debug and Testing" def debug_and_testing(): """ General settings for kernel debugging feature """ - @Term("Supress assertion") - def no_assert(): + @"Supress assertion" + def no_assert() -> bool: """ Supress all assertion fail activity. Note: Enable this is highly NOT recommended and would result system extermly unstable """ - type(bool) - default(False) \ No newline at end of file + + return False + + @"Report on stalled thread" + def check_stall() -> bool: + """ + Check and report on any thread that spend too much time in kernel. + """ + + return True + + @"Max kernel time allowance" + def stall_timeout() -> int: + """ + Set the maximum time (in seconds) spent in kernel before considered + to be stalled. + """ + require (check_stall) + + return 10 + + @"Max number of preemptions" + def stall_max_preempts() -> int: + """ + Set the maximum number of preemptions that a task can take + before it is considered to be stucked in some loops. + + Setting it to 0 disable this check + """ + require (check_stall) + + return 0 +