graceful

package
v0.0.0-...-fd00b2c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 4, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package usock implements a wrapper around the unix(7) SCM_RIGHTS API, which allows processes to exchange file handles over a unix(7) control socket.

Index

Constants

This section is empty.

Variables

View Source
var Signal = make(chan struct{})

Functions

func FD2Unix

func FD2Unix(fd int) (*net.UnixConn, error)

func IsChild

func IsChild() bool

IsChild returns true if this executable was launched by StartChild

func ReadJSON

func ReadJSON(src *net.UnixConn, msg any) error

func ReadJSONConn

func ReadJSONConn(src *net.UnixConn, msg any) (net.Conn, error)

func ReadJSONFile

func ReadJSONFile(src *net.UnixConn, msg any) (*os.File, error)

func ReadWithFile

func ReadWithFile(src *net.UnixConn, dst []byte) (int, *os.File, error)

ReadWithFile reads data from src, and if it includes an out-of-band control message, it will try to turn it into a file handle.

func Setup

func Setup(ctx context.Context) context.Context

func SocketPair

func SocketPair() (*net.UnixConn, *net.UnixConn, error)

SocketPair returns a pair of connected unix sockets.

func StartChild

func StartChild() (*net.UnixConn, error)

func Sync

func Sync(ctx context.Context) chan struct{}

Sync returns the channel put in by WithSync, if no such channel exists it returns a closed channel.

func WithSync

func WithSync(ctx context.Context) (context.Context, func())

func WriteJSON

func WriteJSON(dst *net.UnixConn, msg any) error

func WriteJSONFile

func WriteJSONFile(dst *net.UnixConn, msg any, handle *os.File) error

func WriteWithFile

func WriteWithFile(dst *net.UnixConn, msg []byte, handle *os.File) (int, error)

WriteWithFile writes a message to dst, including the provided file handle in an out-of-band control message.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL