poll
Package poll supports non-blocking I/O on file descriptors with polling. This supports I/O operations that block only a goroutine, not a thread. This is used by the net and os packages. It uses a poller built into the runtime, with support from the runtime scheduler.
常量
This section is empty.
变量
|
|
Accept4Func is used to hook the accept4 call.
|
|
AcceptFunc is used to hook the accept call.
|
|
CloseFunc is used to hook the close call.
|
|
ErrDeadlineExceeded is returned for an expired deadline. This is exported by the os package as os.ErrDeadlineExceeded.
|
|
ErrFileClosing is returned when a file descriptor is used after it has been closed.
|
|
ErrNetClosing is returned when a network descriptor is used after it has been closed.
|
|
ErrNoDeadline is returned when a request is made to set a deadline on a file type that does not use the poller.
|
|
ErrNotPollable is returned when the file or socket is not suitable for event notification.
|
|
TestHookDidWritev is a hook for testing writev.
函数
func CopyFileRange <- go1.15
|
|
CopyFileRange copies at most remain bytes of data from src to dst, using the copy_file_range system call. dst and src must refer to regular files.
func DupCloseOnExec <- go1.11
|
|
DupCloseOnExec dups fd and marks it close-on-exec.
func IsPollDescriptor <- go1.12
|
|
IsPollDescriptor reports whether fd is the descriptor being used by the poller. This is only used for testing.
func SendFile
|
|
SendFile wraps the sendfile system call.
func Splice <- go1.11
|
|
Splice transfers at most remain bytes of data from src to dst, using the splice system call to minimize copies of data from and to userspace.
Splice gets a pipe buffer from the pool or creates a new one if needed, to serve as a buffer for the data transfer. src and dst must both be stream-oriented sockets.
If err != nil, sc is the system call which caused the error.
类型
type DeadlineExceededError <- go1.15
|
|
DeadlineExceededError is returned for an expired deadline.
(*DeadlineExceededError) Error <- go1.15
|
|
Implement the net.Error interface. The string is “i/o timeout” because that is what was returned by earlier Go versions. Changing it may break programs that match on error strings.
(*DeadlineExceededError) Temporary <- go1.15
|
|
(*DeadlineExceededError) Timeout <- go1.15
|
|
type FD
|
|
FD is a file descriptor. The net and os packages use this type as a field of a larger type representing a network connection or OS file.
(*FD) Accept
|
|
Accept wraps the accept network call.
(*FD) Close
|
|
Close closes the FD. The underlying file descriptor is closed by the destroy method when there are no remaining references.
(*FD) Dup <- go1.11
|
|
Dup duplicates the file descriptor.
(*FD) Fchdir
|
|
Fchdir wraps syscall.Fchdir.
(*FD) Fchmod
|
|
Fchmod wraps syscall.Fchmod.
(*FD) Fchown
|
|
Fchown wraps syscall.Fchown.
(*FD) Fstat
|
|
Fstat wraps syscall.Fstat
(*FD) Fsync
|
|
Fsync wraps syscall.Fsync.
(*FD) Ftruncate
|
|
Ftruncate wraps syscall.Ftruncate.
(*FD) Init
|
|
Init initializes the FD. The Sysfd field should already be set. This can be called multiple times on a single FD. The net argument is a network name from the net package (e.g., “tcp”), or “file”. Set pollable to true if fd should be managed by runtime netpoll.
(*FD) Pread
|
|
Pread wraps the pread system call.
(*FD) Pwrite
|
|
Pwrite wraps the pwrite system call.
(*FD) RawControl
|
|
RawControl invokes the user-defined function f for a non-IO operation.
(*FD) RawRead
|
|
RawRead invokes the user-defined function f for a read operation.
(*FD) RawWrite
|
|
RawWrite invokes the user-defined function f for a write operation.
(*FD) Read
|
|
Read implements io.Reader.
(*FD) ReadDirent
|
|
ReadDirent wraps syscall.ReadDirent. We treat this like an ordinary system call rather than a call that tries to fill the buffer.
(*FD) ReadFrom
|
|
ReadFrom wraps the recvfrom network call.
(*FD) ReadFromInet4 <- go1.18
|
|
ReadFromInet4 wraps the recvfrom network call for IPv4.
(*FD) ReadFromInet6 <- go1.18
|
|
ReadFromInet6 wraps the recvfrom network call for IPv6.
(*FD) ReadMsg
|
|
ReadMsg wraps the recvmsg network call.
(*FD) ReadMsgInet4 <- go1.18
|
|
ReadMsgInet4 is ReadMsg, but specialized for syscall.SockaddrInet4.
(*FD) ReadMsgInet6 <- go1.18
|
|
ReadMsgInet6 is ReadMsg, but specialized for syscall.SockaddrInet6.
(*FD) Seek
|
|
Seek wraps syscall.Seek.
(*FD) SetBlocking <- go1.10
|
|
SetBlocking puts the file into blocking mode.
(*FD) SetDeadline
|
|
SetDeadline sets the read and write deadlines associated with fd.
(*FD) SetReadDeadline
|
|
SetReadDeadline sets the read deadline associated with fd.
(*FD) SetWriteDeadline
|
|
SetWriteDeadline sets the write deadline associated with fd.
(*FD) SetsockoptByte
|
|
SetsockoptByte wraps the setsockopt network call with a byte argument.
(*FD) SetsockoptIPMreq
|
|
SetsockoptIPMreq wraps the setsockopt network call with an IPMreq argument.
(*FD) SetsockoptIPMreqn
|
|
SetsockoptIPMreqn wraps the setsockopt network call with an IPMreqn argument.
(*FD) SetsockoptIPv6Mreq
|
|
SetsockoptIPv6Mreq wraps the setsockopt network call with an IPv6Mreq argument.
(*FD) SetsockoptInet4Addr
|
|
SetsockoptInet4Addr wraps the setsockopt network call with an IPv4 address.
(*FD) SetsockoptInt
|
|
SetsockoptInt wraps the setsockopt network call with an int argument.
(*FD) SetsockoptLinger
|
|
SetsockoptLinger wraps the setsockopt network call with a Linger argument.
(*FD) Shutdown
|
|
Shutdown wraps syscall.Shutdown.
(*FD) WaitWrite
|
|
WaitWrite waits until data can be read from fd.
(*FD) Write
|
|
Write implements io.Writer.
(*FD) WriteMsg
|
|
WriteMsg wraps the sendmsg network call.
(*FD) WriteMsgInet4 <- go1.18
|
|
WriteMsgInet4 is WriteMsg specialized for syscall.SockaddrInet4.
(*FD) WriteMsgInet6 <- go1.18
|
|
WriteMsgInet6 is WriteMsg specialized for syscall.SockaddrInet6.
(*FD) WriteOnce <- go1.10
|
|
WriteOnce is for testing only. It makes a single write call.
(*FD) WriteTo
|
|
WriteTo wraps the sendto network call.
(*FD) WriteToInet4 <- go1.18
|
|
WriteToInet4 wraps the sendto network call for IPv4 addresses.
(*FD) WriteToInet6 <- go1.18
|
|
WriteToInet6 wraps the sendto network call for IPv6 addresses.
(*FD) Writev
|
|
Writev wraps the writev system call.