diff options
author | Zach Koopmans <zkoopmans@google.com> | 2021-07-12 15:24:04 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2021-07-12 15:26:20 -0700 |
commit | e3fdd1593217894328d5a917bbc356d0a7d145f0 (patch) | |
tree | 1913cf79abb68fda218f249ffa32a7bf309330ac /pkg/sentry/kernel/semaphore | |
parent | ebe99977a47d93ee769121f9463650cfb924e243 (diff) |
[syserror] Update syserror to linuxerr for more errors.
Update the following from syserror to the linuxerr equivalent:
EEXIST
EFAULT
ENOTDIR
ENOTTY
EOPNOTSUPP
ERANGE
ESRCH
PiperOrigin-RevId: 384329869
Diffstat (limited to 'pkg/sentry/kernel/semaphore')
-rw-r--r-- | pkg/sentry/kernel/semaphore/semaphore.go | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/pkg/sentry/kernel/semaphore/semaphore.go b/pkg/sentry/kernel/semaphore/semaphore.go index 067cc75c1..485c3a788 100644 --- a/pkg/sentry/kernel/semaphore/semaphore.go +++ b/pkg/sentry/kernel/semaphore/semaphore.go @@ -151,7 +151,7 @@ func (r *Registry) FindOrCreate(ctx context.Context, key, nsems int32, mode linu return nil, linuxerr.EINVAL } if create && exclusive { - return nil, syserror.EEXIST + return nil, linuxerr.EEXIST } return set, nil } @@ -418,7 +418,7 @@ func (s *Set) semStat(creds *auth.Credentials, permMask fs.PermMask) (*linux.Sem // SetVal overrides a semaphore value, waking up waiters as needed. func (s *Set) SetVal(ctx context.Context, num int32, val int16, creds *auth.Credentials, pid int32) error { if val < 0 || val > valueMax { - return syserror.ERANGE + return linuxerr.ERANGE } s.mu.Lock() @@ -431,7 +431,7 @@ func (s *Set) SetVal(ctx context.Context, num int32, val int16, creds *auth.Cred sem := s.findSem(num) if sem == nil { - return syserror.ERANGE + return linuxerr.ERANGE } // TODO(gvisor.dev/issue/137): Clear undo entries in all processes. @@ -453,7 +453,7 @@ func (s *Set) SetValAll(ctx context.Context, vals []uint16, creds *auth.Credenti for _, val := range vals { if val > valueMax { - return syserror.ERANGE + return linuxerr.ERANGE } } @@ -489,7 +489,7 @@ func (s *Set) GetVal(num int32, creds *auth.Credentials) (int16, error) { sem := s.findSem(num) if sem == nil { - return 0, syserror.ERANGE + return 0, linuxerr.ERANGE } return sem.value, nil } @@ -523,7 +523,7 @@ func (s *Set) GetPID(num int32, creds *auth.Credentials) (int32, error) { sem := s.findSem(num) if sem == nil { - return 0, syserror.ERANGE + return 0, linuxerr.ERANGE } return sem.pid, nil } @@ -539,7 +539,7 @@ func (s *Set) countWaiters(num int32, creds *auth.Credentials, pred func(w *wait sem := s.findSem(num) if sem == nil { - return 0, syserror.ERANGE + return 0, linuxerr.ERANGE } var cnt uint16 for w := sem.waiters.Front(); w != nil; w = w.Next() { @@ -625,7 +625,7 @@ func (s *Set) executeOps(ctx context.Context, ops []linux.Sembuf, pid int32) (ch if op.SemOp < 0 { // Handle 'wait' operation. if -op.SemOp > valueMax { - return nil, 0, syserror.ERANGE + return nil, 0, linuxerr.ERANGE } if -op.SemOp > tmpVals[op.SemNum] { // Not enough resources, must wait. @@ -640,7 +640,7 @@ func (s *Set) executeOps(ctx context.Context, ops []linux.Sembuf, pid int32) (ch } else { // op.SemOp > 0: Handle 'signal' operation. if tmpVals[op.SemNum] > valueMax-op.SemOp { - return nil, 0, syserror.ERANGE + return nil, 0, linuxerr.ERANGE } } |