diff --git a/src/main/resources/assets/opencomputers/loot/Plan9k/bin/dmesg.lua b/src/main/resources/assets/opencomputers/loot/Plan9k/bin/dmesg.lua index 2fd49e048..840a49430 100644 --- a/src/main/resources/assets/opencomputers/loot/Plan9k/bin/dmesg.lua +++ b/src/main/resources/assets/opencomputers/loot/Plan9k/bin/dmesg.lua @@ -32,13 +32,13 @@ local mcnetTransportTypes = { local mcnetTypes = { ["H"] = function(localAddress, remoteAddress, data) - local ttl, age, n = string.unpack(">BH", data) + local ttl, age, dist, n = string.unpack(">BHB", data) local host = data:sub(n) - print("\t>> L2 mcnet HOST_FOUND ttl=" .. ttl .. " age=" .. age .. " host=" .. host) + print("\t>> L2 mcnet HOST_FOUND ttl=" .. ttl .. " age=" .. age .. " dist=" .. dist .. " host=" .. normLine(host)) end, ["R"] = function(localAddress, remoteAddress, data) local ttl, dest, age = string.unpack(">Bs1H", data) - print("\t>> L2 mcnet SEEK_ROUTE ttl=" .. ttl .. " age=" .. age .. " dest=" .. dest) + print("\t>> L2 mcnet SEEK_ROUTE ttl=" .. ttl .. " age=" .. age .. " dest=" .. normLine(dest)) end, ["D"] = function(localAddress, remoteAddress, data) local ttl = string.unpack(">B", data) @@ -52,7 +52,7 @@ local mcnetTypes = { ["E"] = function(localAddress, remoteAddress, data) local ttl, dest, orig, dstart = string.unpack(">Bs1s1", data) local dat = data:sub(dstart) - print("\t>> L2 mcnet ROUTED_DATA ttl=" .. ttl .. " dest=" .. dest .. " origin=" .. orig) + print("\t>> L2 mcnet ROUTED_DATA ttl=" .. ttl .. " dest=" .. normLine(dest) .. " origin=" .. orig) if mcnetTransportTypes[dat:sub(1,1)] then mcnetTransportTypes[dat:sub(1,1)](localAddress, remoteAddress, dat:sub(2)) else @@ -62,7 +62,10 @@ local mcnetTypes = { } local ethTypes = { - ["\0"] = function(localAddress, remoteAddress, msg) --PKT_BEACON + ["\0"] = function(localAddress, remoteAddress, msg) --PKT_BEACON_OLD + print("\t> L1 PKT_OLD_BEACON remote=" .. remoteAddress) + end, + ["\32"] = function(localAddress, remoteAddress, msg) --PKT_BEACON print("\t> L1 PKT_BEACON remote=" .. remoteAddress) end, ["\1"] = function(localAddress, remoteAddress, msg) --PKT_REGISTER @@ -82,6 +85,7 @@ local ethTypes = { ["\3"] = function(localAddress, remoteAddress, msg) --PKT_QUIT print("\t> L1 PKT_QUIT remote=" .. remoteAddress) end, + } function dataExpanders.modem_message(_, localAddress, remoteAddress, port, distance, msg) diff --git a/src/main/resources/assets/opencomputers/loot/Plan9k/bin/getty.lua b/src/main/resources/assets/opencomputers/loot/Plan9k/bin/getty.lua index 61f7e4403..f298d3c8e 100644 --- a/src/main/resources/assets/opencomputers/loot/Plan9k/bin/getty.lua +++ b/src/main/resources/assets/opencomputers/loot/Plan9k/bin/getty.lua @@ -320,11 +320,12 @@ end control["!"] = function(char) --Disable if commandMode == "9" then charHandlers.active = function(c) - if c == "\255" then + if c == "\255" or c == "!" then commandList = {} commandBuf = "" commandMode = "" charHandlers.active = charHandlers.base + blink = true end end blink = false diff --git a/src/main/resources/assets/opencomputers/loot/Plan9k/bin/install.lua b/src/main/resources/assets/opencomputers/loot/Plan9k/bin/install.lua index 7335c8ad0..91a17672e 100644 --- a/src/main/resources/assets/opencomputers/loot/Plan9k/bin/install.lua +++ b/src/main/resources/assets/opencomputers/loot/Plan9k/bin/install.lua @@ -66,6 +66,7 @@ local distros = { {desc = "[online] Plan9k - lightest, experimental", params = {"-SYy", "plan9k"}}, {desc = "[online] Plan9k-extra - experimental, contains tools, docs", params = {"-SYy", "plan9k-extra", "plan9k-docs"}}, {desc = "[online] StarOS - Plan9k-extra distro with additional tools", params = {"-SYy", "staros"}}, + {desc = "[online] Update - update installed system", params = {"--mirror=/", "-uyY"}}, } for n, dist in pairs(distros) do diff --git a/src/main/resources/assets/opencomputers/loot/Plan9k/bin/route.lua b/src/main/resources/assets/opencomputers/loot/Plan9k/bin/route.lua index e034d9408..1a35e3954 100644 --- a/src/main/resources/assets/opencomputers/loot/Plan9k/bin/route.lua +++ b/src/main/resources/assets/opencomputers/loot/Plan9k/bin/route.lua @@ -7,26 +7,38 @@ local function fillText(text, n) return text end +local function normLine(data) + local res = "" + for c in data:gmatch(".") do + if c == "\n" or c == "\r" then c = "\x1b[31m.\x1b[39m" end + res = res .. (c:match("[%g%s]") or "\x1b[31m.\x1b[39m") + end + return res +end + print("MCNET routing table") local routes = network.info.getRoutes() -local maxlen = {12, 8, 6, 4} +local maxlen = {12, 8, 6, 4, 5} for host, route in pairs(routes) do - maxlen[1] = maxlen[1] < #host+1 and #host+1 or maxlen[1] + maxlen[1] = maxlen[1] < #normLine(host)+1 and #normLine(host)+1 or maxlen[1] maxlen[2] = maxlen[2] < #route.router+1 and #route.router+1 or maxlen[2] maxlen[3] = maxlen[3] < #route.interface+1 and #route.interface+1 or maxlen[3] maxlen[4] = maxlen[4] < #tostring(route.age)+1 and #tostring(route.age)+1 or maxlen[4] + maxlen[5] = maxlen[5] < #tostring(route.dist)+1 and #tostring(route.dist)+1 or maxlen[5] end print(fillText("Destination", maxlen[1]).. fillText("Gateway", maxlen[2]).. fillText("Iface", maxlen[3]).. - fillText("Age", maxlen[4])) + fillText("Age", maxlen[4]).. + fillText("Dist", maxlen[5])) for host, route in pairs(routes) do - print(fillText(host, maxlen[1]).. + print(fillText(normLine(host), maxlen[1]).. fillText(route.router, maxlen[2]).. fillText(route.interface, maxlen[3]).. - fillText(tostring(route.age), maxlen[4])) + fillText(tostring(route.age), maxlen[4]).. + fillText(tostring(route.dist), maxlen[5])) end diff --git a/src/main/resources/assets/opencomputers/loot/Plan9k/bin/sandbox.lua b/src/main/resources/assets/opencomputers/loot/Plan9k/bin/sandbox.lua index bc8e3ae7c..4a1301e75 100644 --- a/src/main/resources/assets/opencomputers/loot/Plan9k/bin/sandbox.lua +++ b/src/main/resources/assets/opencomputers/loot/Plan9k/bin/sandbox.lua @@ -1,18 +1,48 @@ local shell = require("shell") local kernel = require("pipes") +local component = require("component") -local args, options = shell.parse(...) +local args = {...} +local options = {} + +for _, v in ipairs(args) do + if v:sub(1,2) == "--" then + options[v:sub(3)] = true + elseif v:sub(1,1) == "-" then + options[v:sub(2)] = true + end +end if options.h or options.help then - print([[sandbox {-m,-s} [file] - Sandbox a process - -m, --module - sandbox modules - -s, --signal - sandbox signals + print([[sandbox [flow] [spawn [file] [args Nargs ...] ]... + Sandbox a processes/process tree + Options: + -h --help - this help + Commands: + spawn file [args Nargs ...] - spawn process + join - wait for last process to finish + module - create module cgroup + component - create component cgroup + befor this command put: + wl [addr] - whitelist a component + bl [addr] - blacklist a component + quietin, quietout, quieterr - disable stdin/out/err + Example usages: + sandbox module spawn /usr/bin/myprog.lua args 3 hello 123 world join + - Spawns myprog in new module cgroup with 3 arguments and wait for it + sandbox module spawn /bin/a.lua spawn /bin/b.lua + - Spawns 2 programs in new common module cgroup + sandbox bl 0ab component spawn /bin/a.lua + - Spawn process with disallowed access to componet starting with address 0ab + sandbox wl fc0 wl fcd component spawn /bin/a.lua + - Spawns process wich can only acces 2 specified components + sandbox -b quietin quietout /bin/a.lua + - Spawns process in background ]]) return end - +--[[ local program = os.getenv("SHELL") or "/bin/sh.lua" if #args > 0 then @@ -27,3 +57,55 @@ end local pid = os.spawn(program, table.unpack(args)) kernel.joinThread(pid) +]] + +local lastpid = nil +local stdin = io.stdin +local stdout = io.stdout +local stderr = io.stderr + +local module +local componentcg +local wl = nil +local bl = nil +local n =1 +while n <= #args do + if args[n]:sub(1,1) == "-" then + elseif args[n] == "spawn" then + local name = args[n + 1] + local arg = {} + if args[n+2] == "args" then + local narg = tonumber(args[n + 3]) + for i = 1, narg do + arg[#arg + 1]= args[n + 3 + i] + end + n = n + 2 + narg + end + n = n + 1 + lastpid = os.spawnp(name, stdin, stdout, stderr, table.unpack(arg)) + elseif args[n] == "join" then + kernel.joinThread(lastpid) + elseif args[n] == "quietin" then + stdin = io.open("/dev/null", "r") + elseif args[n] == "quietout" then + stdout = io.open("/dev/null", "w") + elseif args[n] == "quieterr" then + stderr = io.open("/dev/null", "w") + elseif args[n] == "module" then + module = kernel.setns(kernel.getPid(), "module") + elseif args[n] == "wl" then + if not wl then wl = {} end + wl[component.get(args[n + 1])] = true + n = n + 1 + elseif args[n] == "bl" then + if not bl then bl = {} end + bl[component.get(args[n + 1])] = true + n = n + 1 + elseif args[n] == "component" then + componentcg = kernel.setns(kernel.getPid(), "component", wl, bl) + else + print("Unknown command '"..args[n] .."'") + return + end + n = n + 1 +end diff --git a/src/main/resources/assets/opencomputers/loot/Plan9k/bin/sh.lua b/src/main/resources/assets/opencomputers/loot/Plan9k/bin/sh.lua index 09aee672a..8a245c296 100644 --- a/src/main/resources/assets/opencomputers/loot/Plan9k/bin/sh.lua +++ b/src/main/resources/assets/opencomputers/loot/Plan9k/bin/sh.lua @@ -310,6 +310,12 @@ builtin.alias("....", "cd", "../../..") ------------------- -- Main loop +if fs.exists("~/.shrc") then + for line in io.lines("~/.shrc") do + execute(line) + end +end + while run do --if term.getCursor() > 1 then -- io.write("\n") diff --git a/src/main/resources/assets/opencomputers/loot/Plan9k/etc/rc.cfg b/src/main/resources/assets/opencomputers/loot/Plan9k/etc/rc.cfg deleted file mode 100644 index b7ddd2e35..000000000 --- a/src/main/resources/assets/opencomputers/loot/Plan9k/etc/rc.cfg +++ /dev/null @@ -1 +0,0 @@ -enabled = {} diff --git a/src/main/resources/assets/opencomputers/loot/Plan9k/lib/modules/base/16_component.lua b/src/main/resources/assets/opencomputers/loot/Plan9k/lib/modules/base/16_component.lua index 00705f27a..4d544228e 100644 --- a/src/main/resources/assets/opencomputers/loot/Plan9k/lib/modules/base/16_component.lua +++ b/src/main/resources/assets/opencomputers/loot/Plan9k/lib/modules/base/16_component.lua @@ -1,8 +1,99 @@ -local component = kernel._K.component +local rawComponent = kernel._K.component +component = {} -local adding = {} -local removing = {} -local primaries = {} +kernel.userspace.component = component +kernel._K.component = component + +kernelGroup = { + adding = {}, + removing = {}, + primaries = {}, +} + +local function getGroup() + return kernel.modules.threading.currentThread and kernel.modules.threading.currentThread.cgroups.component or kernelGroup +end + +local function allow(addr) + if not kernel.modules.threading then return true end + return not kernel.modules.threading.currentThread or kernel.modules.threading.currentThread.cgroups.component.allow(addr) +end + +component.doc = function(addr, method) + if allow(addr) then + return rawComponent.doc(addr, method) + else + error("no such component") + end +end + +component.invoke = function(addr, ...) + if allow(addr) then + return rawComponent.invoke(addr, ...) + else + error("no such component") + end +end + +component.list = function(filter, exact) + local list = {} + for k, v in pairs(rawComponent.list(filter, not not exact)) do + if allow(k) then + list[k] = v + end + end + local key = nil + return setmetatable(list, {__call=function() + key = next(list, key) + if key then + return key, list[key] + end + end}) +end + +component.methods = function(addr) + if allow(addr) then + return rawComponent.methods(addr) + else + return nil, "no such component" + end +end + +component.fields = function(addr) + if allow(addr) then + return rawComponent.fields(addr) + else + return nil, "no such component" + end +end + +component.proxy = function(addr) + if allow(addr) then + return rawComponent.proxy(addr) + else + return nil, "no such component" + end +end + +component.type = function(addr) + if allow(addr) then + return rawComponent.type(addr) + else + return nil, "no such component" + end +end + +component.slot = function(addr) + if allow(addr) then + return rawComponent.slot(addr) + else + return nil, "no such component" + end +end + +--local adding = {} +--local removing = {} +--local primaries = {} ------------------------------------------------------------------------------- @@ -16,12 +107,12 @@ setmetatable(component, { local parent = false return function(_, key) if parent then - return next(primaries, key) + return next(getGroup().primaries, key) else local k, v = next(self, key) if not k then parent = true - return next(primaries) + return next(getGroup().primaries) else return k, v end @@ -43,20 +134,20 @@ end function component.isAvailable(componentType) checkArg(1, componentType, "string") - if not primaries[componentType] and not adding[componentType] then + if not getGroup().primaries[componentType] and not getGroup().adding[componentType] then -- This is mostly to avoid out of memory errors preventing proxy -- creation cause confusion by trying to create the proxy again, -- causing the oom error to be thrown again. component.setPrimary(componentType, component.list(componentType, true)()) end - return primaries[componentType] ~= nil + return getGroup().primaries[componentType] ~= nil end function component.isPrimary(address) local componentType = component.type(address) if componentType then if component.isAvailable(componentType) then - return primaries[componentType].address == address + return getGroup().primaries[componentType].address == address end end return false @@ -66,7 +157,7 @@ function component.getPrimary(componentType) checkArg(1, componentType, "string") assert(component.isAvailable(componentType), "no primary '" .. componentType .. "' available") - return primaries[componentType] + return getGroup().primaries[componentType] end function component.setPrimary(componentType, address) @@ -77,19 +168,19 @@ function component.setPrimary(componentType, address) assert(address, "no such component") end - local wasAvailable = primaries[componentType] + local wasAvailable = getGroup().primaries[componentType] if wasAvailable and address == wasAvailable.address then return end - local wasAdding = adding[componentType] + local wasAdding = getGroup().adding[componentType] if wasAdding and address == wasAdding.address then return end if wasAdding then kernel.modules.timer.remove(wasAdding.timer) end - primaries[componentType] = nil - adding[componentType] = nil + getGroup().primaries[componentType] = nil + getGroup().adding[componentType] = nil local primary = address and component.proxy(address) or nil if wasAvailable then @@ -97,16 +188,16 @@ function component.setPrimary(componentType, address) end if primary then if wasAvailable or wasAdding then - adding[componentType] = { + getGroup().adding[componentType] = { address=address, timer=kernel.modules.timer.add(function() - adding[componentType] = nil - primaries[componentType] = primary + getGroup().adding[componentType] = nil + getGroup().primaries[componentType] = primary --computer.pushSignal("component_available", componentType) end, 0.1) } else - primaries[componentType] = primary + getGroup().primaries[componentType] = primary computer.pushSignal("component_available", componentType) end end @@ -124,14 +215,14 @@ function start() end local function onComponentAdded(_, address, componentType) - if not (primaries[componentType] or adding[componentType]) then + if not (getGroup().primaries[componentType] or getGroup().adding[componentType]) then component.setPrimary(componentType, address) end end local function onComponentRemoved(_, address, componentType) - if primaries[componentType] and primaries[componentType].address == address or - adding[componentType] and adding[componentType].address == address + if getGroup().primaries[componentType] and getGroup().primaries[componentType].address == address or + getGroup().adding[componentType] and getGroup().adding[componentType].address == address then component.setPrimary(componentType, component.list(componentType, true)()) end diff --git a/src/main/resources/assets/opencomputers/loot/Plan9k/lib/modules/base/17_io.lua b/src/main/resources/assets/opencomputers/loot/Plan9k/lib/modules/base/17_io.lua index 179434f65..050a4c8ae 100644 --- a/src/main/resources/assets/opencomputers/loot/Plan9k/lib/modules/base/17_io.lua +++ b/src/main/resources/assets/opencomputers/loot/Plan9k/lib/modules/base/17_io.lua @@ -192,7 +192,7 @@ kernel.userspace.io = io setmetatable(io, {__index = function(_, k) if k == "stdout" then return io.output() - elseif k == "stdout" then return io.output() + elseif k == "stdin" then return io.input() elseif k == "stderr" then return kernel.modules.threading.currentThread.io_error end end}) diff --git a/src/main/resources/assets/opencomputers/loot/Plan9k/lib/modules/base/17_network.lua b/src/main/resources/assets/opencomputers/loot/Plan9k/lib/modules/base/17_network.lua index 74f1f91c5..bad955997 100644 --- a/src/main/resources/assets/opencomputers/loot/Plan9k/lib/modules/base/17_network.lua +++ b/src/main/resources/assets/opencomputers/loot/Plan9k/lib/modules/base/17_network.lua @@ -178,10 +178,10 @@ startNetwork = function() sent = nil end - local function sendHostFound(dest, age, addr)--H[ttl-byte][age-short][Found host] + local function sendHostFound(dest, age, addr, dist)--H[ttl-byte][age-short][distance][Found host] --kernel.io.println("found "..addr.." for "..dest) if dest ~= "localhost" then - return rawSend(dest, "H"..string.pack(">BH", cfg.ttl, math.floor(age + cfg.route_relayage))..addr) + return rawSend(dest, "H"..string.pack(">BHB", cfg.ttl, math.floor(age + cfg.route_relayage), dist)..addr) end end @@ -218,7 +218,7 @@ startNetwork = function() end end - local function processRouteRequests(host, age) + local function processRouteRequests(host, age, dist) if routeRequests[host] then age = age or (computer.uptime() - routeRequests[host].timeout) for t, request in pairs(routeRequests[host]) do @@ -230,7 +230,7 @@ startNetwork = function() sendRoutedDataAs(host, request.origin, request.data, request.ttl) end elseif request.type == "R" then - sendHostFound(request.host, age, host) + sendHostFound(request.host, age, host, dist or 1) end end end @@ -249,8 +249,8 @@ startNetwork = function() end bindAddr = function(addr) - routes[addr] = {thisHost=true} - processRouteRequests(addr, 0) + routes[addr] = {thisHost=true, dist = 0} + processRouteRequests(addr, 0, 1) end kernel.modules.keventd.listen("hostname", function(_, name) bindAddr(name)end) @@ -307,7 +307,7 @@ startNetwork = function() for host in pairs(n.hosts)do if host == dest then --Found it! - sendHostFound(origin, 0, dest) + sendHostFound(origin, 0, dest, 1) return end end @@ -318,9 +318,9 @@ startNetwork = function() if routes[dest] then if routes[dest].thisHost then --sendHostFound(origin, nodes[node].selfAddr) - sendHostFound(origin, 0 ,dest) + sendHostFound(origin, 0 , dest, 1) elseif routes[dest].router ~= origin then--Router might have rebooted and is asking about route - sendHostFound(origin, computer.uptime() - routes[dest].age, dest) + sendHostFound(origin, computer.uptime() - routes[dest].age, dest, routes[dest].dist + 1) --routes[dest].active = computer.uptime() end return @@ -367,16 +367,31 @@ startNetwork = function() routeRequests[dest][#routeRequests[dest]+1] = {type = "R", host = origin} end elseif data:sub(1,1) == "H" then --Host found - local nttl, age, n = string.unpack(">BH", data, 2) + local nttl, age, dist, n = string.unpack(">BHB", data, 2) local host = data:sub(n) if not isAccessible(host) then if not routes[host] then - routes[host] = {router = origin, node = node, age = computer.uptime() - age, active = computer.uptime()} - processRouteRequests(host, age) - elseif routes[host].age < computer.uptime() - age then - routes[host] = {router = origin, node = node, age = computer.uptime() - age, active = routes[host].active} - end + routes[host] = { + router = origin, + node = node, + age = computer.uptime() - age, + active = computer.uptime(), + dist = dist + } + processRouteRequests(host, age, dist + 1) + else + if (routes[host].dist > dist) or + ((routes[host].age < computer.uptime() - age) and (routes[host].dist >= dist)) then + routes[host] = { + router = origin, + node = node, + age = computer.uptime() - age, + active = routes[host].active, + dist = dist + } + end + end end end end @@ -402,14 +417,14 @@ startNetwork = function() local now = computer.uptime() for k,v in pairs(routeRequests) do - res[k] = {router = "", interface = "", age = now - v.timeout} + res[k] = {router = "", interface = "", age = now - v.timeout, dist = 0} end for k,v in pairs(routes) do if v.router then - res[k] = {router = v.router, interface = v.node, age = now - v.age} + res[k] = {router = v.router, interface = v.node, age = now - v.age, dist = v.dist} elseif v.thisHost then - res[k] = {router = computer.address(), interface = "lo", age = 0} + res[k] = {router = computer.address(), interface = "lo", age = 0, dist = 0} end end return res @@ -436,7 +451,7 @@ startNetwork = function() for host, request in pairs(routeRequests) do if now - request.update >= cfg.routereq_retry then if routes[host] then - processRouteRequests(host, now - routes[host].age) + processRouteRequests(host, now - routes[host].age, routes[host].dist + 1) else sendRouteRequest(host, now - request.update) request.update = computer.uptime() diff --git a/src/main/resources/assets/opencomputers/loot/Plan9k/lib/modules/base/19_cgroups.lua b/src/main/resources/assets/opencomputers/loot/Plan9k/lib/modules/base/19_cgroups.lua index bc1be6759..c8bc0d435 100644 --- a/src/main/resources/assets/opencomputers/loot/Plan9k/lib/modules/base/19_cgroups.lua +++ b/src/main/resources/assets/opencomputers/loot/Plan9k/lib/modules/base/19_cgroups.lua @@ -29,13 +29,41 @@ end groupConstructors.module = function() local group = newGroup() - group.preload = {} + + group.preload = { + package = kernel.userspace.package, --TODO TODO TODO: METATABLE THIZ!!!!!!!! + filesystem = setmetatable({}, {__index = kernel.modules.vfs}), + buffer = setmetatable({}, {__index = kernel.modules.buffer}), + bit32 = setmetatable({}, {__index = kernel.userspace.bit32}), + component = setmetatable({}, {__index = kernel.userspace.component}), + computer = setmetatable({}, {__index = kernel.userspace.computer}), + io = setmetatable({}, {__index = kernel.modules.io.io}), + unicode = setmetatable({}, {__index = kernel.userspace.unicode}), + } group.loaded = {} group.loading = {} group.searchers = {} return group end +groupConstructors.component = function(parent, wl, bl) + local group = newGroup() + group.parent = parent + group.whitelist = wl + group.blacklist = bl + group.adding = not parent and kernel.modules.component.kernelGroup.adding or {} + group.removing = not parent and kernel.modules.component.kernelGroup.removing or {} + group.primaries = not parent and kernel.modules.component.kernelGroup.primaries or {} + group.allow = function(addr) + if not group.parent or group.parent.allow(addr) then + return (not group.whitelist or group.whitelist[addr]) and (not group.blacklist or (not group.blacklist[addr])) + end + end + return group +end + +------------------------------ + spawnGroupGetters.signal = function() if not kernel.modules.threading.currentThread then return groupConstructors.signal(true) @@ -68,6 +96,15 @@ spawnGroupGetters.module = function() end end +spawnGroupGetters.component = function() + if not kernel.modules.threading.currentThread then + return groupConstructors.component() + else + return kernel.modules.threading.currentThread.cgroups.component + end +end + +------------------------------ --Signal group functions function pushSignal(...) @@ -76,12 +113,20 @@ function pushSignal(...) end end +------------------------------ + userConstructors = {} function userConstructors.module() return groupConstructors.module() end +function userConstructors.component(wl, bl) + return groupConstructors.component(kernel.modules.threading.currentThread and kernel.modules.threading.currentThread.cgroups.component, wl, bl) +end + +------------------------------ + function new(pid, name, ...) if kernel.modules.threading.currentThread.pid ~= pid and (not kernel.modules.threading.threads[pid] or diff --git a/src/main/resources/assets/opencomputers/loot/Plan9k/lib/modules/base/20_threading.lua b/src/main/resources/assets/opencomputers/loot/Plan9k/lib/modules/base/20_threading.lua index fa2839f22..b146b8638 100644 --- a/src/main/resources/assets/opencomputers/loot/Plan9k/lib/modules/base/20_threading.lua +++ b/src/main/resources/assets/opencomputers/loot/Plan9k/lib/modules/base/20_threading.lua @@ -90,7 +90,8 @@ function spawn(exec, child, name, isthread, _, ...) signal = kernel.modules.cgroups.spawnGroupGetters["signal"](), network = kernel.modules.cgroups.spawnGroupGetters["network"](), filesystem = kernel.modules.cgroups.spawnGroupGetters["filesystem"](), - module = kernel.modules.cgroups.spawnGroupGetters["module"]() + module = kernel.modules.cgroups.spawnGroupGetters["module"](), + component = kernel.modules.cgroups.spawnGroupGetters["component"](), } } diff --git a/src/main/resources/assets/opencomputers/loot/Plan9k/lib/modules/network/modem.lua b/src/main/resources/assets/opencomputers/loot/Plan9k/lib/modules/network/modem.lua index cde7cd461..57e9bb7c4 100644 --- a/src/main/resources/assets/opencomputers/loot/Plan9k/lib/modules/network/modem.lua +++ b/src/main/resources/assets/opencomputers/loot/Plan9k/lib/modules/network/modem.lua @@ -12,7 +12,7 @@ local driver = {} local nodes = {} local eventHnd -local PKT_BEACON = "\0" +local PKT_BEACON = "\32" local PKT_REGISTER = "\1" local PKT_REGISTER_ACK = "\2" local PKT_QUIT = "\3" diff --git a/src/main/resources/assets/opencomputers/loot/Plan9k/var/lib/mpt/config.db b/src/main/resources/assets/opencomputers/loot/Plan9k/var/lib/mpt/config.db index 15bd8410d..1297bda91 100644 --- a/src/main/resources/assets/opencomputers/loot/Plan9k/var/lib/mpt/config.db +++ b/src/main/resources/assets/opencomputers/loot/Plan9k/var/lib/mpt/config.db @@ -1 +1 @@ -{cacheDir="/var/lib/mpt/cache/",frontend={mpt={api="http://mpt.magik6k.net/api/"}},database="/var/lib/mpt/base.db"} \ No newline at end of file +{database="/var/lib/mpt/base.db",frontend={mpt={api="http://mpt.magik6k.net/api/"}},cacheDir="/var/lib/mpt/cache/"} \ No newline at end of file diff --git a/src/main/resources/assets/opencomputers/loot/Plan9k/var/lib/mpt/mpt.db b/src/main/resources/assets/opencomputers/loot/Plan9k/var/lib/mpt/mpt.db index e70eecaae..937fb20b1 100644 --- a/src/main/resources/assets/opencomputers/loot/Plan9k/var/lib/mpt/mpt.db +++ b/src/main/resources/assets/opencomputers/loot/Plan9k/var/lib/mpt/mpt.db @@ -1 +1 @@ -{oppm={repos={},packages={}},installed={pipes={deps={"openloader-init"},frontend="MPT",data={checksum="2808b5aed66cb5f8dcf067f30310b6c7",files={"/boot/kernel/pipes","/lib/modules/base/05_vfs.lua","/lib/modules/base/20_threading.lua","/lib/modules/base/19_manageg.lua","/lib/modules/base/25_init.lua","/lib/modules/base/15_userspace.lua","/usr/man/pipes","/lib/modules/base/16_buffer.lua","/lib/modules/base/17_io.lua","/lib/modules/base/16_require.lua","/lib/modules/base/18_syscall.lua","/lib/modules/base/21_threadUtil.lua","/lib/modules/base/21_timer.lua","/lib/modules/base/16_component.lua","/lib/modules/base/15_keventd.lua","/lib/modules/base/10_procfs.lua","/lib/modules/base/01_util.lua","/lib/modules/base/10_devfs.lua","/lib/modules/base/18_pty.lua","/lib/modules/base/17_keyboard.lua","/lib/modules/base/06_cowfs.lua","/lib/modules/base/09_rootfs.lua","/lib/modules/base/01_gc.lua","/lib/modules/base/17_ipc.lua","/lib/modules/base/19_cgroups.lua","/lib/modules/base/02_cmd.lua"},repo="plan9k",name="pipes",dependencies={"openloader-init"}}},["plan9k-edit"]={deps={},frontend="MPT",data={checksum="34b1046ac9b7a87a1cdd74f8c03f27ea",files={"/bin/edit.lua"},repo="plan9k",name="plan9k-edit",dependencies={}}},mpt={deps={},frontend="MPT",data={checksum="-4bef26a6a1a0b78056600ce9487fe735",files={"/usr/bin/mpt.lua"},repo="mpt",name="mpt",dependencies={}}},["plan9k-containers"]={deps={},frontend="MPT",data={checksum="788cd3b2b36062cce2700f427b629ab0",files={"/bin/sandbox.lua"},repo="plan9k",name="plan9k-containers",dependencies={}}},["plan9k-coreutil"]={deps={"plan9k-corelibs","plan9k-fsutil"},frontend="MPT",data={checksum="7f6d7dd410995dd6edbf33f7ccb044a5",files={"/bin/echo.lua","/bin/wc.lua","/bin/ps.lua","/bin/lua.lua","/bin/kill.lua","/bin/reboot.lua","/bin/sleep.lua","/bin/clear.lua","/bin/components.lua","/bin/hostname.lua","/bin/dmesg.lua","/bin/shutdown.lua","/bin/label.lua","/bin/uptime.lua","/bin/resolution.lua","/bin/watch.lua","/bin/passwd.lua"},repo="plan9k",name="plan9k-coreutil",dependencies={"plan9k-corelibs","plan9k-fsutil"}}},["openloader-init"]={deps={},frontend="MPT",data={checksum="-45e6d7b1e41468c1d335952ee3b89e13",files={"/init.lua"},repo="disks",name="openloader-init",dependencies={}}},["plan9k-extra"]={deps={"plan9k-ssh","plan9k-containers","plan9k-filesystems","plan9k","mpt"},frontend="MPT",data={checksum="42acf5b6b26058654c4ef359a6e19d14",files={"/etc/rc.d/autoupdate.lua"},repo="plan9k",name="plan9k-extra",dependencies={"plan9k-ssh","plan9k-containers","plan9k-filesystems","plan9k","mpt"}}},["plan9k-filesystems"]={deps={},frontend="MPT",data={checksum="-50d8cc1c5928bec760f210185cccfafd",files={"/lib/msdosfs.lua","/bin/mount.msdos.lua","/usr/bin/mkdosfs.lua"},repo="plan9k",name="plan9k-filesystems",dependencies={}}},["plan9k-network"]={deps={},frontend="MPT",data={checksum="-10a4299caea629c766ae95a3db186a98",files={"/lib/internet.lua","/bin/pastebin.lua","/bin/wget.lua","/lib/modules/base/17_network.lua","/lib/modules/base/19_libnetwork.lua","/bin/arp.lua","/bin/ifconfig.lua","/bin/ping.lua","/bin/route.lua","/lib/modules/network/loopback.lua","/lib/modules/network/modem.lua","/usr/bin/nc.lua","/lib/modules/network/tunnel.lua"},repo="plan9k",name="plan9k-network",dependencies={}}},["plan9k-installer"]={deps={"plan9k","mpt","plan9k-extra"},frontend="MPT",data={checksum="-3d9486840c93c231e26da768a9ab889c",files={"/bin/install.lua"},repo="plan9k",name="plan9k-installer",dependencies={"plan9k","mpt","plan9k-extra"}}},["plan9k-drivers"]={deps={},frontend="MPT",data={checksum="-3f839e5e5c38f81bbd03e6a6438ac15f",files={"/lib/modules/base/17_tape.lua","/lib/modules/base/17_eeprom.lua","/lib/modules/base/17_nfc.lua","/lib/modules/base/17_chatbox.lua","/lib/modules/base/17_data.lua","/lib/modules/base/17_drive.lua"},repo="plan9k",name="plan9k-drivers",dependencies={}}},plan9k={deps={"plan9k-core","plan9k-network","plan9k-drivers","plan9k-edit","plan9k-data"},frontend="MPT",data={checksum="-2d8f4b84ea60b0c9d5846f57e9f1691c",files={},repo="plan9k",name="plan9k",dependencies={"plan9k-core","plan9k-network","plan9k-drivers","plan9k-edit","plan9k-data"}}},["plan9k-fsutil"]={deps={"plan9k-corelibs"},frontend="MPT",data={checksum="-3e5ba058562df4c95858b2992e90365d",files={"/bin/cat.lua","/bin/ln.lua","/bin/ls.lua","/bin/mv.lua","/bin/rm.lua","/bin/tee.lua","/bin/df.lua","/bin/dd.lua","/bin/cp.lua","/bin/touch.lua","/bin/mount.lua","/bin/mount.cow.lua","/bin/mkdir.lua","/bin/pwd.lua","/bin/more.lua","/bin/du.lua"},repo="plan9k",name="plan9k-fsutil",dependencies={"plan9k-corelibs"}}},["plan9k-corelibs"]={deps={},frontend="MPT",data={checksum="-6d48e158051e4ffa3ab82ed97dffa830",files={"/lib/serialization.lua","/lib/term.lua","/lib/text.lua","/lib/shell.lua","/lib/event.lua"},repo="plan9k",name="plan9k-corelibs",dependencies={}}},["plan9k-ssh"]={deps={},frontend="MPT",data={checksum="-2fc28a9bdd608182c931a126ca8150d",files={"/etc/rc.d/sshd.lua","/bin/sshd.lua","/usr/sbin/sshsession.lua","/usr/bin/ssh.lua"},repo="plan9k",name="plan9k-ssh",dependencies={}}},["plan9k-data"]={deps={},frontend="MPT",data={checksum="480a898a741b2bf424f9e0e86e5072ba",files={"/usr/bin/base64.lua","/usr/lib/data.lua","/usr/bin/deflate.lua","/usr/bin/inflate.lua","/usr/bin/md5sum.lua","/usr/bin/sha256sum.lua","/usr/bin/gpg.lua"},repo="plan9k",name="plan9k-data",dependencies={}}},["plan9k-core"]={deps={"pipes","plan9k-coreutil","plan9k-shell"},frontend="MPT",data={checksum="5a78a5611d16f17300ebe89ca09f0a62",files={"/bin/init.lua","/bin/getty.lua","/bin/readkey.lua","/lib/rc.lua","/bin/rc.lua"},repo="plan9k",name="plan9k-core",dependencies={"pipes","plan9k-coreutil","plan9k-shell"}}},["plan9k-shell"]={deps={},frontend="MPT",data={checksum="-2b9f90d0887e228b08939f42af48e957",files={"/bin/sh.lua"},repo="plan9k",name="plan9k-shell",dependencies={}}}}} \ No newline at end of file +{installed={["plan9k-drivers"]={frontend="MPT",data={repo="plan9k",dependencies={},files={"/lib/modules/base/17_tape.lua","/lib/modules/base/17_eeprom.lua","/lib/modules/base/17_nfc.lua","/lib/modules/base/17_chatbox.lua","/lib/modules/base/17_data.lua","/lib/modules/base/17_drive.lua"},checksum="-3f839e5e5c38f81bbd03e6a6438ac15f",name="plan9k-drivers"},deps={}},["plan9k-filesystems"]={frontend="MPT",data={repo="plan9k",dependencies={},files={"/lib/msdosfs.lua","/bin/mount.msdos.lua","/usr/bin/mkdosfs.lua"},checksum="-50d8cc1c5928bec760f210185cccfafd",name="plan9k-filesystems"},deps={}},["plan9k-installer"]={frontend="MPT",data={repo="plan9k",dependencies={"plan9k","mpt","plan9k-extra"},files={"/bin/install.lua"},checksum="-31228542b8cc1190aa9d8be7ea4ff56c",name="plan9k-installer"},deps={"plan9k","mpt","plan9k-extra"}},["plan9k-network"]={frontend="MPT",data={repo="plan9k",dependencies={},files={"/lib/internet.lua","/bin/pastebin.lua","/bin/wget.lua","/lib/modules/base/17_network.lua","/lib/modules/base/19_libnetwork.lua","/bin/arp.lua","/bin/ifconfig.lua","/bin/ping.lua","/bin/route.lua","/lib/modules/network/loopback.lua","/lib/modules/network/modem.lua","/usr/bin/nc.lua","/lib/modules/network/tunnel.lua"},checksum="-3310268a428bf449c821cbc8ac140ca5",name="plan9k-network"},deps={}},["plan9k-coreutil"]={frontend="MPT",data={repo="plan9k",dependencies={"plan9k-corelibs","plan9k-fsutil"},files={"/bin/echo.lua","/bin/wc.lua","/bin/ps.lua","/bin/lua.lua","/bin/kill.lua","/bin/reboot.lua","/bin/sleep.lua","/bin/clear.lua","/bin/components.lua","/bin/hostname.lua","/bin/dmesg.lua","/bin/shutdown.lua","/bin/label.lua","/bin/uptime.lua","/bin/resolution.lua","/bin/watch.lua","/bin/passwd.lua"},checksum="-2e3257235e131ffaf5ba1a9fd77ba946",name="plan9k-coreutil"},deps={"plan9k-corelibs","plan9k-fsutil"}},mpt={frontend="MPT",data={repo="mpt",dependencies={},files={"/usr/bin/mpt.lua"},checksum="-4bef26a6a1a0b78056600ce9487fe735",name="mpt"},deps={}},["plan9k-core"]={frontend="MPT",data={repo="plan9k",dependencies={"pipes","plan9k-coreutil","plan9k-shell"},files={"/bin/init.lua","/bin/getty.lua","/bin/readkey.lua","/lib/rc.lua","/bin/rc.lua"},checksum="6950ff30af0231e69b1ae8d0b5b8ad77",name="plan9k-core"},deps={"pipes","plan9k-coreutil","plan9k-shell"}},["plan9k-containers"]={frontend="MPT",data={repo="plan9k",dependencies={},files={"/bin/sandbox.lua"},checksum="-5ff36b0bde938782f3821bca52931c06",name="plan9k-containers"},deps={}},["openloader-init"]={frontend="MPT",data={repo="disks",dependencies={},files={"/init.lua"},checksum="-45e6d7b1e41468c1d335952ee3b89e13",name="openloader-init"},deps={}},["plan9k-ssh"]={frontend="MPT",data={repo="plan9k",dependencies={},files={"/etc/rc.d/sshd.lua","/bin/sshd.lua","/usr/sbin/sshsession.lua","/usr/bin/ssh.lua"},checksum="-2fc28a9bdd608182c931a126ca8150d",name="plan9k-ssh"},deps={}},["plan9k-shell"]={frontend="MPT",data={repo="plan9k",dependencies={},files={"/bin/sh.lua"},checksum="-7a6e50038841f4529feab7ebf0971fcb",name="plan9k-shell"},deps={}},["plan9k-extra"]={frontend="MPT",data={repo="plan9k",dependencies={"plan9k-ssh","plan9k-containers","plan9k-filesystems","plan9k","mpt"},files={"/etc/rc.d/autoupdate.lua"},checksum="42acf5b6b26058654c4ef359a6e19d14",name="plan9k-extra"},deps={"plan9k-ssh","plan9k-containers","plan9k-filesystems","plan9k","mpt"}},["plan9k-fsutil"]={frontend="MPT",data={repo="plan9k",dependencies={"plan9k-corelibs"},files={"/bin/cat.lua","/bin/ln.lua","/bin/ls.lua","/bin/mv.lua","/bin/rm.lua","/bin/tee.lua","/bin/df.lua","/bin/dd.lua","/bin/cp.lua","/bin/touch.lua","/bin/mount.lua","/bin/mount.cow.lua","/bin/mkdir.lua","/bin/pwd.lua","/bin/more.lua","/bin/du.lua"},checksum="-3e5ba058562df4c95858b2992e90365d",name="plan9k-fsutil"},deps={"plan9k-corelibs"}},["plan9k-corelibs"]={frontend="MPT",data={repo="plan9k",dependencies={},files={"/lib/serialization.lua","/lib/term.lua","/lib/text.lua","/lib/shell.lua","/lib/event.lua"},checksum="-6d48e158051e4ffa3ab82ed97dffa830",name="plan9k-corelibs"},deps={}},plan9k={frontend="MPT",data={repo="plan9k",dependencies={"plan9k-core","plan9k-network","plan9k-drivers","plan9k-edit","plan9k-data"},files={},checksum="-2d8f4b84ea60b0c9d5846f57e9f1691c",name="plan9k"},deps={"plan9k-core","plan9k-network","plan9k-drivers","plan9k-edit","plan9k-data"}},pipes={frontend="MPT",data={repo="plan9k",dependencies={"openloader-init"},files={"/boot/kernel/pipes","/lib/modules/base/05_vfs.lua","/lib/modules/base/20_threading.lua","/lib/modules/base/19_manageg.lua","/lib/modules/base/25_init.lua","/lib/modules/base/15_userspace.lua","/usr/man/pipes","/lib/modules/base/16_buffer.lua","/lib/modules/base/17_io.lua","/lib/modules/base/16_require.lua","/lib/modules/base/18_syscall.lua","/lib/modules/base/21_threadUtil.lua","/lib/modules/base/21_timer.lua","/lib/modules/base/16_component.lua","/lib/modules/base/15_keventd.lua","/lib/modules/base/10_procfs.lua","/lib/modules/base/01_util.lua","/lib/modules/base/10_devfs.lua","/lib/modules/base/18_pty.lua","/lib/modules/base/17_keyboard.lua","/lib/modules/base/06_cowfs.lua","/lib/modules/base/09_rootfs.lua","/lib/modules/base/01_gc.lua","/lib/modules/base/17_ipc.lua","/lib/modules/base/19_cgroups.lua","/lib/modules/base/02_cmd.lua"},name="pipes",checksum="-1db1c9d0e65ad1a3467e849d8b1d2709"},deps={"openloader-init"}},["plan9k-data"]={frontend="MPT",data={repo="plan9k",dependencies={},files={"/usr/bin/base64.lua","/usr/lib/data.lua","/usr/bin/deflate.lua","/usr/bin/inflate.lua","/usr/bin/md5sum.lua","/usr/bin/sha256sum.lua","/usr/bin/gpg.lua"},checksum="480a898a741b2bf424f9e0e86e5072ba",name="plan9k-data"},deps={}},["plan9k-edit"]={frontend="MPT",data={repo="plan9k",dependencies={},files={"/bin/edit.lua"},checksum="34b1046ac9b7a87a1cdd74f8c03f27ea",name="plan9k-edit"},deps={}}},oppm={repos={},packages={}}} \ No newline at end of file