systemd

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: GPL-3.0, LGPL-3.0 Imports: 17 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package systemd handles authd's socket activation and descriptor store.

Index

Constants

View Source
const StorePrefix = "pa-"

StorePrefix distinguishes reservation descriptors from listening sockets.

Variables

View Source
var ErrDescriptorNameExists = errors.New("descriptor store name already exists")

ErrDescriptorNameExists means Put rejected a name before changing the store.

Functions

func Listeners

func Listeners() ([]net.Listener, error)

Listeners returns only listening sockets, not reservation descriptors.

Types

type DescriptorStore

type DescriptorStore interface {
	Load() map[string][]*os.File
	Put(name string, files ...*os.File) error
	Remove(names ...string) error
	Close() error
}

DescriptorStore preserves descriptors outside the authd process.

func NewDescriptorStore

func NewDescriptorStore() (DescriptorStore, error)

NewDescriptorStore returns nil when authd is not running under a configured systemd service. Such instances must not expose first-time SSH reservations.

func Z_ForTests_DescriptorStoreClient

func Z_ForTests_DescriptorStoreClient(socket string) DescriptorStore

Z_ForTests_DescriptorStoreClient connects integration-test daemons to the descriptors retained by their parent test process.

type TestDescriptorStore

type TestDescriptorStore struct {
	FailPut    bool
	FailRemove bool
	// contains filtered or unexported fields
}

TestDescriptorStore holds descriptors outside a simulated daemon instance.

func Z_ForTests_NewDescriptorStore

func Z_ForTests_NewDescriptorStore(tb testing.TB) *TestDescriptorStore

Z_ForTests_NewDescriptorStore supplies the same ownership semantics as systemd, without changing the host's service manager.

func (*TestDescriptorStore) Close

func (s *TestDescriptorStore) Close() error

Close represents daemon exit, not service-manager exit.

func (*TestDescriptorStore) Load

func (s *TestDescriptorStore) Load() map[string][]*os.File

Load duplicates systemd's references for a new daemon instance.

func (*TestDescriptorStore) Put

func (s *TestDescriptorStore) Put(name string, files ...*os.File) error

Put keeps copies after the sender closes its descriptors.

func (*TestDescriptorStore) Remove

func (s *TestDescriptorStore) Remove(names ...string) error

Remove releases the service manager's copies.

func (*TestDescriptorStore) Serve

func (s *TestDescriptorStore) Serve(tb testing.TB, socket string)

Serve retains subprocess descriptors until the test ends, including across daemon restarts. The socket must be in a private test directory.

func (*TestDescriptorStore) SetFailRemove

func (s *TestDescriptorStore) SetFailRemove(fail bool)

SetFailRemove changes removal failures while a daemon worker is running.

Jump to

Keyboard shortcuts

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