package poll

Import Path
	internal/poll (on go.dev)

Dependency Relation
	imports 9 packages, and imported by 2 packages

Involved Source Files copy_file_range_linux.go errno_unix.go 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. fd_fsync_posix.go fd_mutex.go fd_poll_runtime.go fd_posix.go fd_unix.go fd_unixjs.go fd_writev_unix.go hook_cloexec.go hook_unix.go iovec_unix.go sendfile_linux.go sock_cloexec.go sockopt.go sockopt_linux.go sockopt_unix.go sockoptip.go splice_linux.go writev.go
Package-Level Type Names (total 8, in which 3 are exported)
/* sort exporteds by: | */
DeadlineExceededError is returned for an expired deadline. 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() bool (*DeadlineExceededError) Timeout() bool *DeadlineExceededError : error *DeadlineExceededError : net.Error
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. Whether this is a streaming descriptor, as opposed to a packet-based descriptor like a UDP socket. Immutable. Platform dependent state of the file descriptor. System file descriptor. Immutable until Close. Whether a zero byte read indicates EOF. This is false for a message based socket connection. Accept wraps the accept network call. Close closes the FD. The underlying file descriptor is closed by the destroy method when there are no remaining references. Dup duplicates the file descriptor. Fchdir wraps syscall.Fchdir. Fchmod wraps syscall.Fchmod. Fchown wraps syscall.Fchown. Fstat wraps syscall.Fstat Fsync wraps syscall.Fsync. Ftruncate wraps syscall.Ftruncate. GetsockoptInt wraps the getsockopt network call with an int argument. 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. Pread wraps the pread system call. Pwrite wraps the pwrite system call. RawControl invokes the user-defined function f for a non-IO operation. RawRead invokes the user-defined function f for a read operation. RawWrite invokes the user-defined function f for a write operation. Read implements io.Reader. ReadDirent wraps syscall.ReadDirent. We treat this like an ordinary system call rather than a call that tries to fill the buffer. ReadFrom wraps the recvfrom network call. ReadFromInet4 wraps the recvfrom network call for IPv4. ReadFromInet6 wraps the recvfrom network call for IPv6. ReadMsg wraps the recvmsg network call. ReadMsgInet4 is ReadMsg, but specialized for syscall.SockaddrInet4. ReadMsgInet6 is ReadMsg, but specialized for syscall.SockaddrInet6. Seek wraps syscall.Seek. SetBlocking puts the file into blocking mode. SetDeadline sets the read and write deadlines associated with fd. SetReadDeadline sets the read deadline associated with fd. SetWriteDeadline sets the write deadline associated with fd. SetsockoptByte wraps the setsockopt network call with a byte argument. SetsockoptIPMreq wraps the setsockopt network call with an IPMreq argument. SetsockoptIPMreqn wraps the setsockopt network call with an IPMreqn argument. SetsockoptIPv6Mreq wraps the setsockopt network call with an IPv6Mreq argument. SetsockoptInet4Addr wraps the setsockopt network call with an IPv4 address. SetsockoptInt wraps the setsockopt network call with an int argument. SetsockoptLinger wraps the setsockopt network call with a Linger argument. Shutdown wraps syscall.Shutdown. WaitWrite waits until data can be read from fd. Write implements io.Writer. WriteMsg wraps the sendmsg network call. WriteMsgInet4 is WriteMsg specialized for syscall.SockaddrInet4. WriteMsgInet6 is WriteMsg specialized for syscall.SockaddrInet6. WriteOnce is for testing only. It makes a single write call. WriteTo wraps the sendto network call. WriteToInet4 wraps the sendto network call for IPv4 addresses. WriteToInet6 wraps the sendto network call for IPv6 addresses. Writev wraps the writev system call. *FD : internal/bisect.Writer *FD : io.Closer *FD : io.ReadCloser *FD : io.Reader *FD : io.ReadSeekCloser *FD : io.ReadSeeker *FD : io.ReadWriteCloser *FD : io.ReadWriter *FD : io.ReadWriteSeeker *FD : io.Seeker *FD : io.WriteCloser *FD : io.Writer *FD : io.WriteSeeker func CopyFileRange(dst, src *FD, remain int64) (written int64, handled bool, err error) func SendFile(dstFD *FD, src int, remain int64) (int64, error, bool) func Splice(dst, src *FD, remain int64) (written int64, handled bool, sc string, err error)
Package-Level Functions (total 37, in which 5 are exported)
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.
DupCloseOnExec dups fd and marks it close-on-exec.
IsPollDescriptor reports whether fd is the descriptor being used by the poller. This is only used for testing.
SendFile wraps the sendfile system call.
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.
Package-Level Variables (total 17, in which 9 are exported)
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.
Package-Level Constants (total 19, none are exported)