package sysfs
import (
"syscall"
"time"
"unsafe"
"github.com/tetratelabs/wazero/experimental/sys"
)
type pollFd struct {
fd int32
events int16
revents int16
}
func newPollFd(fd uintptr , events , revents int16 ) pollFd {
return pollFd {fd : int32 (fd ), events : events , revents : revents }
}
const _POLLIN = 0x0001
func _poll(fds []pollFd , timeoutMillis int32 ) (n int , errno sys .Errno ) {
var ts syscall .Timespec
if timeoutMillis >= 0 {
ts = syscall .NsecToTimespec (int64 (time .Duration (timeoutMillis ) * time .Millisecond ))
}
return ppoll (fds , &ts )
}
func ppoll(fds []pollFd , timespec *syscall .Timespec ) (n int , err sys .Errno ) {
var fdptr *pollFd
nfd := len (fds )
if nfd != 0 {
fdptr = &fds [0 ]
}
n1 , _ , errno := syscall .Syscall6 (
uintptr (syscall .SYS_PPOLL ),
uintptr (unsafe .Pointer (fdptr )),
uintptr (nfd ),
uintptr (unsafe .Pointer (timespec )),
uintptr (unsafe .Pointer (nil )),
uintptr (unsafe .Pointer (nil )),
uintptr (unsafe .Pointer (nil )))
return int (n1 ), sys .UnwrapOSError (errno )
}
The pages are generated with Golds v0.8.2 . (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu .
PR and bug reports are welcome and can be submitted to the issue list .
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds .