From 6cbe58797781cb8514a62bb3ab0e3e8a5d58bce2 Mon Sep 17 00:00:00 2001 From: dzwdz Date: Thu, 31 Aug 2023 01:06:41 +0200 Subject: kernel: add _sys_getprocfs in place of HANDLE_PROCFS This makes the side-effects more explicit, and feels less hacky than `HANDLE_PROCFS`. I don't think accessing a handle alone should have side-effects, even if it's a "special" one. --- src/libc/camellia.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/libc/camellia.c') diff --git a/src/libc/camellia.c b/src/libc/camellia.c index 4e092e4..bc38e77 100644 --- a/src/libc/camellia.c +++ b/src/libc/camellia.c @@ -28,3 +28,14 @@ hid_t camellia_open(const char *path, int flags) { return ret; } + +int camellia_procfs(const char *path) { + hid_t hid = _sys_getprocfs(0); + if (hid < 0) { + errno = -hid; + return -1; + } + _sys_mount(hid, path, strlen(path)); + close(hid); + return 0; +} -- cgit v1.2.3