diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2022-03-10 09:02:06 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-10 09:02:06 -0500 |
commit | e10394da7e20daee66869d128339b1733a088999 (patch) | |
tree | 10a5d52ac81dec667b7de9d0e1d9f0138f6af8df /vendor/golang.org/x/sys/unix/syscall_linux.go | |
parent | acfcecf2ae41528d1d7ecd43d37d8fd554f587bc (diff) | |
parent | a5353207c7c08c5ea81c8c358241b6a61173e93c (diff) | |
download | podman-e10394da7e20daee66869d128339b1733a088999.tar.gz podman-e10394da7e20daee66869d128339b1733a088999.tar.bz2 podman-e10394da7e20daee66869d128339b1733a088999.zip |
Merge pull request #13476 from containers/dependabot/go_modules/github.com/vbauerster/mpb/v7-7.4.1
Bump github.com/vbauerster/mpb/v7 from 7.3.2 to 7.4.1
Diffstat (limited to 'vendor/golang.org/x/sys/unix/syscall_linux.go')
-rw-r--r-- | vendor/golang.org/x/sys/unix/syscall_linux.go | 49 |
1 files changed, 47 insertions, 2 deletions
diff --git a/vendor/golang.org/x/sys/unix/syscall_linux.go b/vendor/golang.org/x/sys/unix/syscall_linux.go index f432b0684..f5915e234 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux.go @@ -14,6 +14,7 @@ package unix import ( "encoding/binary" "syscall" + "time" "unsafe" ) @@ -2314,11 +2315,56 @@ type RemoteIovec struct { //sys shmdt(addr uintptr) (err error) //sys shmget(key int, size int, flag int) (id int, err error) +//sys getitimer(which int, currValue *Itimerval) (err error) +//sys setitimer(which int, newValue *Itimerval, oldValue *Itimerval) (err error) + +// MakeItimerval creates an Itimerval from interval and value durations. +func MakeItimerval(interval, value time.Duration) Itimerval { + return Itimerval{ + Interval: NsecToTimeval(interval.Nanoseconds()), + Value: NsecToTimeval(value.Nanoseconds()), + } +} + +// A value which may be passed to the which parameter for Getitimer and +// Setitimer. +type ItimerWhich int + +// Possible which values for Getitimer and Setitimer. +const ( + ItimerReal ItimerWhich = ITIMER_REAL + ItimerVirtual ItimerWhich = ITIMER_VIRTUAL + ItimerProf ItimerWhich = ITIMER_PROF +) + +// Getitimer wraps getitimer(2) to return the current value of the timer +// specified by which. +func Getitimer(which ItimerWhich) (Itimerval, error) { + var it Itimerval + if err := getitimer(int(which), &it); err != nil { + return Itimerval{}, err + } + + return it, nil +} + +// Setitimer wraps setitimer(2) to arm or disarm the timer specified by which. +// It returns the previous value of the timer. +// +// If the Itimerval argument is the zero value, the timer will be disarmed. +func Setitimer(which ItimerWhich, it Itimerval) (Itimerval, error) { + var prev Itimerval + if err := setitimer(int(which), &it, &prev); err != nil { + return Itimerval{}, err + } + + return prev, nil +} + /* * Unimplemented */ // AfsSyscall -// Alarm // ArchPrctl // Brk // ClockNanosleep @@ -2334,7 +2380,6 @@ type RemoteIovec struct { // GetMempolicy // GetRobustList // GetThreadArea -// Getitimer // Getpmsg // IoCancel // IoDestroy |