Documentation ¶
Overview ¶
sys just generalized some needed syscalls from different platforms.
Index ¶
- Constants
- func Accept(listenerFd int, timeout ...time.Duration) (int, syscall.Sockaddr, error)
- func AddRead(pollFd, fd int) (err error)
- func AddReadWrite(pollFd, fd int) (err error)
- func AddWrite(pollFd, fd int) (err error)
- func AsyncHandleEvents(events uint32, handler EventHandler)
- func AsyncHandleEventsAndWait(events uint32, handler EventHandler, wg *sync.WaitGroup)
- func CloseFd(fd int) error
- func CreatePoll() (pollFd, pollEvFd int, err error)
- func HandleEvents(events uint32, handler EventHandler) (err error)
- func ModRead(pollFd, fd int) (err error)
- func ModReadWrite(pollFd, fd int) (err error)
- func ModWrite(pollFd, fd int) (err error)
- func Read(fd int, p []byte) (n int, err error)
- func Readv(fd int, iovs [][]byte) (n int, err error)
- func SetKeepAlive(fd int, timeout ...time.Duration) (err error)
- func SetRecvBufferSize(fd, size int) error
- func SetReuseAddr(fd int) error
- func SetReusePort(fd int) error
- func SetSendBufferSize(fd, size int) error
- func SocketClosed(fd int) bool
- func Trigger(pollEvFd int) (err error)
- func UnRegister(pollFd, fd int) (err error)
- func WaitPoll(pollFd, pollEvFd int, w WaitCallback, doCallbackErr DoError, ...) error
- func Write(fd int, p []byte) (n int, err error)
- func WriteUdp(fd int, p []byte, flags int, to syscall.Sockaddr) (err error)
- func Writev(fd int, iovs [][]byte) (n int, err error)
- type DoError
- type EventHandler
- type WaitCallback
Constants ¶
View Source
const ( MaxPollSize = 1024 MinPollSize = 32 InitPollSize = 128 EVFilterFd = -0xd DefaultTCPKeepAlive = 15 // Seconds )
View Source
const ( TCP_KEEPINTVL = syscall.TCP_KEEPINTVL TCP_KEEPIDLE = syscall.TCP_KEEPIDLE SOL_SOCKET = syscall.SOL_SOCKET IPPROTO_TCP = syscall.IPPROTO_TCP SO_KEEPALIVE = syscall.SO_KEEPALIVE SO_REUSEPORT = 0xf )
View Source
const ( ErrEvents = syscall.EPOLLERR | syscall.EPOLLHUP | syscall.EPOLLRDHUP OutEvents = ErrEvents | syscall.EPOLLOUT InEvents = ErrEvents | syscall.EPOLLIN | syscall.EPOLLPRI ClosedFdEvents = 0 )
View Source
const ( EAGAIN = syscall.EAGAIN ECONNRESET = syscall.ECONNRESET EINVAL = syscall.EINVAL ENOENT = syscall.ENOENT )
View Source
const ( ReadEvents = syscall.EPOLLPRI | syscall.EPOLLIN WriteEvents = syscall.EPOLLOUT ReadWriteEvents = ReadEvents | WriteEvents )
Variables ¶
This section is empty.
Functions ¶
func AddReadWrite ¶
func AsyncHandleEvents ¶ added in v1.0.1
func AsyncHandleEvents(events uint32, handler EventHandler)
func AsyncHandleEventsAndWait ¶ added in v1.1.0
func AsyncHandleEventsAndWait(events uint32, handler EventHandler, wg *sync.WaitGroup)
func CreatePoll ¶
func HandleEvents ¶
func HandleEvents(events uint32, handler EventHandler) (err error)
func ModReadWrite ¶
func SetRecvBufferSize ¶
func SetReuseAddr ¶
func SetReusePort ¶
func SetSendBufferSize ¶
func SocketClosed ¶
func UnRegister ¶
Types ¶
type EventHandler ¶
Click to show internal directories.
Click to hide internal directories.