summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/kernel
diff options
context:
space:
mode:
authorZyad A. Ali <zyad.ali.me@gmail.com>2021-05-31 21:15:28 +0200
committerZyad A. Ali <zyad.ali.me@gmail.com>2021-05-31 21:15:28 +0200
commit16d25c972c7d66e8f788c853519788f6bffc1bd2 (patch)
tree7bfb8d6e9197334c308fe5de5c25c1022deb4316 /pkg/sentry/kernel
parent30bca3270b9aba3394363a7fbb81291c9b0bb898 (diff)
Use syserror.ENOSPC for system-wide semaphore limits.
semget(2) man page specifies that ENOSPC should be used if "the system limit for the maximum number of semaphore sets (SEMMNI), or the system wide maximum number of semaphores (SEMMNS), would be exceeded."
Diffstat (limited to 'pkg/sentry/kernel')
-rw-r--r--pkg/sentry/kernel/semaphore/semaphore.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/pkg/sentry/kernel/semaphore/semaphore.go b/pkg/sentry/kernel/semaphore/semaphore.go
index 1d9edf118..47bb66b42 100644
--- a/pkg/sentry/kernel/semaphore/semaphore.go
+++ b/pkg/sentry/kernel/semaphore/semaphore.go
@@ -171,10 +171,10 @@ func (r *Registry) FindOrCreate(ctx context.Context, key, nsems int32, mode linu
// Map semaphores and map indexes in a registry are of the same size,
// check map semaphores only here for the system limit.
if len(r.semaphores) >= setsMax {
- return nil, syserror.EINVAL
+ return nil, syserror.ENOSPC
}
if r.totalSems() > int(semsTotalMax-nsems) {
- return nil, syserror.EINVAL
+ return nil, syserror.ENOSPC
}
// Finally create a new set.