tweet:2024:0521_01
                FreeBSDでlua54でsysctl
あんまりにもあまりだったのでmemoを。
いつか luaで色々書きたい。
LUA用のFreeBSD-sysctl moduleはすでに開発されていて、GitHUBにえて公開されている。
これをinstallするなら、pkgから
pkg install lua54-sysctl
で終わり。
以下にsample codeを
local sysctl = require("sysctl")
local ip_address, err = sysctl.get("net.inet.ip.forwarding")
if err then
    print("Error reading sysctl value:", err)
else
    print("IP forwarding enabled:", ip_address)
end
Bing CoPilotが優秀すぎた…
tweet/2024/0521_01.txt · 最終更新:  by seirios
                
                