proc

package
v1.15.1 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2016 License: BSD-1-Clause Imports: 7 Imported by: 0

Documentation

Overview

Package proc provides process forking and initialization functionality for one or more IRC clients. This is intended to facilitate zero-downtime binary upgrades by allowing the bot to fork itself and passing existing network connections to the new child process.

A parent forks itself through the Fork() call. The child process then gets access to the client connections through a call to InheritedFiles(). Before calling this, ensure that `flag.Parse()` has been called at least once.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Fork

func Fork()

Fork sends SIGUSR1 to the current process. This kickstarts the forking process.

func InheritedFiles

func InheritedFiles() []*os.File

InheritedFiles returns a list of N file descriptors inherited from a previous session through the Fork call.

This function assumes that flag.Parse() has been called at least once already. The `-fork` flag has been registered during initialization of this package.

func Kill

func Kill()

Kill sends SIGINT to the current process. This can be used to cleanly break out of a signal polling loop from anywhere in the program.

func KillParent

func KillParent()

KillParent sends SIGINT to the parent process. This is intended to be called by a child after it has been forked and has re-initialized the inherited connections. The parent may now shut down.

func Wait

func Wait(argv []string, clients ...*os.File)

Wait polls for OS signals to either kill or fork this process.

The signals it waits for are: SIGKILL, SIGINT, SIGTERM and SIGUSR1. The latter one being responsible for forking this process. The others are there so we may cleanly exit this process.

Types

This section is empty.

Jump to

Keyboard shortcuts

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