systemd

package module
v0.0.0-...-290a813 Latest Latest
Warning

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

Go to latest
Published: May 1, 2017 License: MIT Imports: 6 Imported by: 1

README

systemd Build Status Coverage Status GoDoc

This package provides native systemd integration for Go programs.

Socket Activation

systemd socket activation (or any other compatible socket passing system passing sockets via LISTEN_FDS enviornment variables) is enabled by systemd.Listen and systemd.ListenWithNames.

Documentation

Overview

Package systemd provides functions for native systemd integration.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Booted

func Booted() bool

Booted checks whether the system was booted up using the systemd init system. This functions internally checks whether the runtime unit file directory "/run/systemd/system" exists and is thus specific to systemd.

Types

type Socket

type Socket struct {
	// contains filtered or unexported fields
}

Socket is the abstraction of a socket passed as a file descriptor by systemd.

func Listen

func Listen() (sockets []Socket, err error)

Listen returns sockets passed by the service manager as part of the socket-based activation logic. If no sockets have been received, an empty slice is returned. If more than one socket is received, they will be passed in the same order as configured in the systemd socket unit file.

func ListenWithNames

func ListenWithNames() (files []Socket, err error)

ListenWithNames is like Listen but also assigns passed names to the sockets. The name can be used to identify a socket. Names can be assigned in the systemd unit files.

func (*Socket) Close

func (s *Socket) Close() error

Close closes the Socket, rendering it unusable for I/O. It returns an error, if any.

func (*Socket) Conn

func (s *Socket) Conn() (c net.Conn, err error)

Conn returns a copy of the network connection corresponding to the open socket s. It is the caller's responsibility to close s when finished. Closing c does not affect s, and closing s does not affect c.

func (*Socket) Fd

func (s *Socket) Fd() uintptr

Fd returns the integer Unix file descriptor referencing the open socket. The file descriptor is valid only until s.Close is called or s is garbage collected.

func (*Socket) File

func (s *Socket) File() (f *os.File)

File returns the underlying os.File of the socket. Closing f does also close s and closing s does also close f.

func (*Socket) Listener

func (s *Socket) Listener() (ln net.Listener, err error)

Listener returns a copy of the network listener corresponding to the open socket s. It is the caller's responsibility to close ln when finished. Closing ln does not affect s, and closing s does not affect ln.

func (*Socket) Name

func (s *Socket) Name() string

Name returns the name assigned to the socket.

func (*Socket) PacketConn

func (s *Socket) PacketConn() (c net.PacketConn, err error)

PacketConn returns a copy of the packet network connection corresponding to the open socket s. It is the caller's responsibility to close s when finished. Closing c does not affect s, and closing s does not affect c.

Jump to

Keyboard shortcuts

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