Documentation ¶
Overview ¶
Package unix provides an implementation of the socket.Socket interface for the AF_UNIX protocol family.
Index ¶
- func New(ctx context.Context, endpoint transport.Endpoint, stype linux.SockType) *fs.File
- func NewWithDirent(ctx context.Context, d *fs.Dirent, ep transport.Endpoint, stype linux.SockType, ...) *fs.File
- type EndpointReader
- type EndpointWriter
- type SocketOperations
- func (s *SocketOperations) Accept(t *kernel.Task, peerRequested bool, flags int, blocking bool) (int32, linux.SockAddr, uint32, *syserr.Error)
- func (s *SocketOperations) Bind(t *kernel.Task, sockaddr []byte) *syserr.Error
- func (s *SocketOperations) Connect(t *kernel.Task, sockaddr []byte, blocking bool) *syserr.Error
- func (s *SocketOperations) ConnectedPasscred() bool
- func (s *SocketOperations) DecRef()
- func (s *SocketOperations) Endpoint() transport.Endpoint
- func (s *SocketOperations) EventRegister(e *waiter.Entry, mask waiter.EventMask)
- func (s *SocketOperations) EventUnregister(e *waiter.Entry)
- func (s *SocketOperations) GetPeerName(t *kernel.Task) (linux.SockAddr, uint32, *syserr.Error)
- func (s *SocketOperations) GetSockName(t *kernel.Task) (linux.SockAddr, uint32, *syserr.Error)
- func (s *SocketOperations) GetSockOpt(t *kernel.Task, level, name int, outPtr usermem.Addr, outLen int) (interface{}, *syserr.Error)
- func (s *SocketOperations) Ioctl(ctx context.Context, _ *fs.File, io usermem.IO, args arch.SyscallArguments) (uintptr, error)
- func (s *SocketOperations) Listen(t *kernel.Task, backlog int) *syserr.Error
- func (s *SocketOperations) Passcred() bool
- func (s *SocketOperations) Read(ctx context.Context, _ *fs.File, dst usermem.IOSequence, _ int64) (int64, error)
- func (s *SocketOperations) Readiness(mask waiter.EventMask) waiter.EventMask
- func (s *SocketOperations) RecvMsg(t *kernel.Task, dst usermem.IOSequence, flags int, haveDeadline bool, ...) (n int, msgFlags int, senderAddr linux.SockAddr, senderAddrLen uint32, ...)
- func (s *SocketOperations) Release()
- func (s *SocketOperations) SendMsg(t *kernel.Task, src usermem.IOSequence, to []byte, flags int, ...) (int, *syserr.Error)
- func (s *SocketOperations) SetSockOpt(t *kernel.Task, level int, name int, optVal []byte) *syserr.Error
- func (s *SocketOperations) Shutdown(t *kernel.Task, how int) *syserr.Error
- func (s *SocketOperations) State() uint32
- func (s *SocketOperations) Type() (family int, skType linux.SockType, protocol int)
- func (s *SocketOperations) Write(ctx context.Context, _ *fs.File, src usermem.IOSequence, _ int64) (int64, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type EndpointReader ¶
type EndpointReader struct { Ctx context.Context // Endpoint is the transport.Endpoint to read from. Endpoint transport.Endpoint // Creds indicates if credential control messages are requested. Creds bool // NumRights is the number of SCM_RIGHTS FDs requested. NumRights int // Peek indicates that the data should not be consumed from the // endpoint. Peek bool // MsgSize is the size of the message that was read from. For stream // sockets, it is the amount read. MsgSize int64 // From, if not nil, will be set with the address read from. From *tcpip.FullAddress // Control contains the received control messages. Control transport.ControlMessages // ControlTrunc indicates that SCM_RIGHTS FDs were discarded based on // the value of NumRights. ControlTrunc bool }
EndpointReader implements safemem.Reader that reads from a transport.Endpoint.
EndpointReader is not thread-safe.
func (*EndpointReader) ReadToBlocks ¶
func (r *EndpointReader) ReadToBlocks(dsts safemem.BlockSeq) (uint64, error)
ReadToBlocks implements safemem.Reader.ReadToBlocks.
type EndpointWriter ¶
type EndpointWriter struct { Ctx context.Context // Endpoint is the transport.Endpoint to write to. Endpoint transport.Endpoint // Control is the control messages to send. Control transport.ControlMessages // To is the endpoint to send to. May be nil. To transport.BoundEndpoint }
EndpointWriter implements safemem.Writer that writes to a transport.Endpoint.
EndpointWriter is not thread-safe.
func (*EndpointWriter) WriteFromBlocks ¶
func (w *EndpointWriter) WriteFromBlocks(srcs safemem.BlockSeq) (uint64, error)
WriteFromBlocks implements safemem.Writer.WriteFromBlocks.
type SocketOperations ¶
type SocketOperations struct { fsutil.FilePipeSeek `state:"nosave"` fsutil.FileNotDirReaddir `state:"nosave"` fsutil.FileNoFsync `state:"nosave"` fsutil.FileNoMMap `state:"nosave"` fsutil.FileNoSplice `state:"nosave"` fsutil.FileNoopFlush `state:"nosave"` fsutil.FileUseInodeUnstableAttr `state:"nosave"` refs.AtomicRefCount socket.SendReceiveTimeout // contains filtered or unexported fields }
SocketOperations is a Unix socket. It is similar to a netstack socket, except it is backed by a transport.Endpoint instead of a tcpip.Endpoint.
+stateify savable
func (*SocketOperations) Accept ¶
func (s *SocketOperations) Accept(t *kernel.Task, peerRequested bool, flags int, blocking bool) (int32, linux.SockAddr, uint32, *syserr.Error)
Accept implements the linux syscall accept(2) for sockets backed by a transport.Endpoint.
func (*SocketOperations) Connect ¶
Connect implements the linux syscall connect(2) for unix sockets.
func (*SocketOperations) ConnectedPasscred ¶
func (s *SocketOperations) ConnectedPasscred() bool
ConnectedPasscred implements transport.Credentialer.ConnectedPasscred.
func (*SocketOperations) DecRef ¶
func (s *SocketOperations) DecRef()
DecRef implements RefCounter.DecRef.
func (*SocketOperations) Endpoint ¶
func (s *SocketOperations) Endpoint() transport.Endpoint
Endpoint extracts the transport.Endpoint.
func (*SocketOperations) EventRegister ¶
func (s *SocketOperations) EventRegister(e *waiter.Entry, mask waiter.EventMask)
EventRegister implements waiter.Waitable.EventRegister.
func (*SocketOperations) EventUnregister ¶
func (s *SocketOperations) EventUnregister(e *waiter.Entry)
EventUnregister implements waiter.Waitable.EventUnregister.
func (*SocketOperations) GetPeerName ¶
GetPeerName implements the linux syscall getpeername(2) for sockets backed by a transport.Endpoint.
func (*SocketOperations) GetSockName ¶
GetSockName implements the linux syscall getsockname(2) for sockets backed by a transport.Endpoint.
func (*SocketOperations) GetSockOpt ¶
func (s *SocketOperations) GetSockOpt(t *kernel.Task, level, name int, outPtr usermem.Addr, outLen int) (interface{}, *syserr.Error)
GetSockOpt implements the linux syscall getsockopt(2) for sockets backed by a transport.Endpoint.
func (*SocketOperations) Ioctl ¶
func (s *SocketOperations) Ioctl(ctx context.Context, _ *fs.File, io usermem.IO, args arch.SyscallArguments) (uintptr, error)
Ioctl implements fs.FileOperations.Ioctl.
func (*SocketOperations) Listen ¶
Listen implements the linux syscall listen(2) for sockets backed by a transport.Endpoint.
func (*SocketOperations) Passcred ¶
func (s *SocketOperations) Passcred() bool
Passcred implements transport.Credentialer.Passcred.
func (*SocketOperations) Read ¶
func (s *SocketOperations) Read(ctx context.Context, _ *fs.File, dst usermem.IOSequence, _ int64) (int64, error)
Read implements fs.FileOperations.Read.
func (*SocketOperations) Readiness ¶
func (s *SocketOperations) Readiness(mask waiter.EventMask) waiter.EventMask
Readiness implements waiter.Waitable.Readiness.
func (*SocketOperations) RecvMsg ¶
func (s *SocketOperations) RecvMsg(t *kernel.Task, dst usermem.IOSequence, flags int, haveDeadline bool, deadline ktime.Time, senderRequested bool, controlDataLen uint64) (n int, msgFlags int, senderAddr linux.SockAddr, senderAddrLen uint32, controlMessages socket.ControlMessages, err *syserr.Error)
RecvMsg implements the linux syscall recvmsg(2) for sockets backed by a transport.Endpoint.
func (*SocketOperations) Release ¶
func (s *SocketOperations) Release()
Release implemements fs.FileOperations.Release.
func (*SocketOperations) SendMsg ¶
func (s *SocketOperations) SendMsg(t *kernel.Task, src usermem.IOSequence, to []byte, flags int, haveDeadline bool, deadline ktime.Time, controlMessages socket.ControlMessages) (int, *syserr.Error)
SendMsg implements the linux syscall sendmsg(2) for unix sockets backed by a transport.Endpoint.
func (*SocketOperations) SetSockOpt ¶
func (s *SocketOperations) SetSockOpt(t *kernel.Task, level int, name int, optVal []byte) *syserr.Error
SetSockOpt implements the linux syscall setsockopt(2) for sockets backed by a transport.Endpoint.
func (*SocketOperations) Shutdown ¶
Shutdown implements the linux syscall shutdown(2) for sockets backed by a transport.Endpoint.
func (*SocketOperations) State ¶
func (s *SocketOperations) State() uint32
State implements socket.Socket.State.