[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:
This commit is contained in:
17
scripts/sysconf.py
Normal file
17
scripts/sysconf.py
Normal file
@@ -0,0 +1,17 @@
|
||||
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)
|
||||
Reference in New Issue
Block a user