Files
jsix_import/scripts/sysconf.py
Justin C. Miller b3aaddadc8 [kernel] Expose a sysconf page to userspace
A structure, system_config, which is dynamically defined by the
definitions/sysconf.yaml config, is now mapped into every user address
space. The kernel fills this with information about itself and the
running machine.

User programs access this through the new j6_sysconf fake syscall in
libj6.

See: Github bug #242
See: [frobozz blog post](https://jsix.dev/posts/frobozz/)

Tags:
2022-01-13 22:08:35 -08:00

18 lines
482 B
Python

class Sysconf:
from collections import namedtuple
Var = namedtuple("Var", ("name", "section", "type"))
def __init__(self, path):
from yaml import safe_load
sys_vars = []
with open(path, 'r') as infile:
data = safe_load(infile.read())
self.address = data["address"]
for v in data["vars"]:
sys_vars.append(Sysconf.Var(v["name"], v["section"], v["type"]))
self.vars = tuple(sys_vars)