summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/kernel/mq/mq.go
diff options
context:
space:
mode:
authorZyad A. Ali <zyad.ali.me@gmail.com>2021-07-30 22:24:54 +0200
committerZyad A. Ali <zyad.ali.me@gmail.com>2021-09-28 20:43:52 +0200
commit9bde727f4f2e5b7cf52211a3a4fe71c7a0e4f1ea (patch)
tree7a7ee7ba120ec032ead678b848c81211bc4dde9b /pkg/sentry/kernel/mq/mq.go
parent583e18501ee8ee263295edd6f5ccf30d0278d854 (diff)
Implement Registry.Remove.
Remove implements the behaviour of mq_unlink(2). Updates #136
Diffstat (limited to 'pkg/sentry/kernel/mq/mq.go')
-rw-r--r--pkg/sentry/kernel/mq/mq.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/pkg/sentry/kernel/mq/mq.go b/pkg/sentry/kernel/mq/mq.go
index c21cc9d47..a7c787081 100644
--- a/pkg/sentry/kernel/mq/mq.go
+++ b/pkg/sentry/kernel/mq/mq.go
@@ -224,8 +224,22 @@ func (r *Registry) newQueueLocked(creds *auth.Credentials, owner fs.FileOwner, p
}, nil
}
+// Remove removes the queue with the given name from the registry. See
+// mq_unlink(2).
+func (r *Registry) Remove(ctx context.Context, name string) error {
+ if len(name) > MaxName {
+ return linuxerr.ENAMETOOLONG
+ }
+
+ r.mu.Lock()
+ defer r.mu.Unlock()
+ return r.impl.Unlink(ctx, name)
+}
+
// Destroy destroys the registry and releases all held references.
func (r *Registry) Destroy(ctx context.Context) {
+ r.mu.Lock()
+ defer r.mu.Unlock()
r.impl.Destroy(ctx)
}