aboutsummaryrefslogtreecommitdiffhomepage
path: root/system/dispatcher.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2025-09-06 19:47:58 +0900
committerOphestra <cat@gensokyo.uk>2025-09-06 19:47:58 +0900
commit6cc2b406a45dee7c3fcb686036efdccc1776368d (patch)
treebc05b1f63856841802d1dc4544ef26e633919c93 /system/dispatcher.go
parentfcd0f2ede7e51b92ffbc91e57f6096e29b3b5b7d (diff)
system/link: use syscall dispatcher
This enables hardlink op methods to be instrumented. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'system/dispatcher.go')
-rw-r--r--system/dispatcher.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/system/dispatcher.go b/system/dispatcher.go
index c896de57..5d5c82bf 100644
--- a/system/dispatcher.go
+++ b/system/dispatcher.go
@@ -1,6 +1,8 @@
package system
import (
+ "os"
+
"hakurei.app/system/acl"
"hakurei.app/system/dbus"
)
@@ -13,6 +15,11 @@ type syscallDispatcher interface {
// just synchronising access is not enough, as this is for test instrumentation.
new(f func(k syscallDispatcher))
+ // link provides os.Link.
+ link(oldname, newname string) error
+ // remove provides os.Remove.
+ remove(name string) error
+
// aclUpdate provides [acl.Update].
aclUpdate(name string, uid int, perms ...acl.Perm) error
@@ -37,6 +44,9 @@ type direct struct{}
func (k direct) new(f func(k syscallDispatcher)) { go f(k) }
+func (k direct) link(oldname, newname string) error { return os.Link(oldname, newname) }
+func (k direct) remove(name string) error { return os.Remove(name) }
+
func (k direct) aclUpdate(name string, uid int, perms ...acl.Perm) error {
return acl.Update(name, uid, perms...)
}