// Nanosleep implements linux syscall Nanosleep(2).
Nanosleep implements linux syscall Nanosleep(2).
// Nanosleep implements linux syscall Nanosleep ( 2 ) .
func Nanosleep(t *kernel.Task, args arch.SyscallArguments) (uintptr, *kernel.SyscallControl, error) {
	addr := args[0].Pointer()
	rem := args[1].Pointer()
	ts, err := copyTimespecIn(t, addr)
	if err != nil {
		return 0, nil, err
	}
	if !ts.Valid() {
		return 0, nil, syserror.EINVAL
	}
	dur := time.Duration(ts.ToNsecCapped()) * time.Nanosecond
	c := t.Kernel().MonotonicClock()
	return 0, nil, clockNanosleepUntil(t, c, c.Now().Add(dur), rem, true)
}
func Nanosleep ( t * kernel . Task , args arch . SyscallArguments ) ( uintptr , * kernel . SyscallControl , error ) { addr := args [ 0 ] . Pointer ( ) rem := args [ 1 ] . Pointer ( ) ts , err := copyTimespecIn ( t , addr ) if err != nil { return 0 , nil , err } if ! ts . Valid ( ) { return 0 , nil , syserror . EINVAL } dur := time . Duration ( ts . ToNsecCapped ( ) ) * time . Nanosecond c := t . Kernel ( ) . MonotonicClock ( ) return 0 , nil , clockNanosleepUntil ( t , c , c . Now ( ) . Add ( dur ) , rem , true ) }
Nanosleep implements linux syscall Nanosleep(2).
Nanosleep implements linux syscall Nanosleep ( 2 ) .
// Just like linux, we cap the timeout with the max number that int64 can // represent which is roughly 292 years.