behaviors

package
v1.1.5 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2021 License: LGPL-3.0 Imports: 15 Imported by: 0

Documentation

Overview

Package pidfile provides structure and helper functions to create and remove PID file. A PID file is usually a file used to store the process ID of a running process.

@ref https://github.com/moby/moby/tree/master/pkg/pidfile

Index

Constants

View Source
const MaxTimeout = 43200

Variables

View Source
var (
	ErrProcessRunning = errors.New("process is running")
	ErrFileStale      = errors.New("pidfile exists but process is not running")
	ErrFileInvalid    = errors.New("pidfile has invalid contents")
)

Common error for pidfile package

Functions

func DropPrivilege

func DropPrivilege(userStr string, fds []*os.File)

func FcntlInt

func FcntlInt(fd uintptr, cmd, arg int) (int, error)

FcntlInt performs a fcntl syscall on fd with the provided command and argument.

func NetProbe

func NetProbe(address string, ifi *string, timeout int) error

func RegisterFswatcher

func RegisterFswatcher(filename string, callback func())

Types

type PIDFile

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

PIDFile is a file used to store the process ID of a running process.

func NewPidFile

func NewPidFile() (*PIDFile, error)

New creates a PIDfile using the specified path.

func (PIDFile) Content

func (file PIDFile) Content() (int, error)

Read the PIDFile content.

func (PIDFile) Remove

func (file PIDFile) Remove() error

Remove the PIDFile.

func (PIDFile) Running

func (file PIDFile) Running() bool

Detect whether is process is running.

func (PIDFile) Write

func (file PIDFile) Write() error

Write writes a pidfile, returning an error if the process is already running or pidfile is orphaned

func (PIDFile) WriteControl

func (file PIDFile) WriteControl(pid int, overwrite bool) error

Jump to

Keyboard shortcuts

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