summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/kernel/semaphore
diff options
context:
space:
mode:
authorJing Chen <chjing@google.com>2020-12-03 19:55:20 -0800
committergVisor bot <gvisor-bot@google.com>2020-12-03 19:57:51 -0800
commita78cef0ed7ce15583424f5873f0aa6fdad1d5c2f (patch)
treec6a09e9fbbbbaea63f68bde1a9ef0a698a7b7ae3 /pkg/sentry/kernel/semaphore
parent9eb77281c4fe1c1f252a0df67ca2c1fee8867b80 (diff)
Implement command IPC_INFO for semctl.
PiperOrigin-RevId: 345589628
Diffstat (limited to 'pkg/sentry/kernel/semaphore')
-rw-r--r--pkg/sentry/kernel/semaphore/semaphore.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/pkg/sentry/kernel/semaphore/semaphore.go b/pkg/sentry/kernel/semaphore/semaphore.go
index 335be8edd..31198d772 100644
--- a/pkg/sentry/kernel/semaphore/semaphore.go
+++ b/pkg/sentry/kernel/semaphore/semaphore.go
@@ -176,6 +176,22 @@ func (r *Registry) FindOrCreate(ctx context.Context, key, nsems int32, mode linu
return r.newSet(ctx, key, owner, owner, perms, nsems)
}
+// IPCInfo returns information about system-wide semaphore limits and parameters.
+func (r *Registry) IPCInfo() *linux.SemInfo {
+ return &linux.SemInfo{
+ SemMap: linux.SEMMAP,
+ SemMni: linux.SEMMNI,
+ SemMns: linux.SEMMNS,
+ SemMnu: linux.SEMMNU,
+ SemMsl: linux.SEMMSL,
+ SemOpm: linux.SEMOPM,
+ SemUme: linux.SEMUME,
+ SemUsz: 0, // SemUsz not supported.
+ SemVmx: linux.SEMVMX,
+ SemAem: linux.SEMAEM,
+ }
+}
+
// RemoveID removes set with give 'id' from the registry and marks the set as
// dead. All waiters will be awakened and fail.
func (r *Registry) RemoveID(id int32, creds *auth.Credentials) error {