pidfd

package module
v0.0.0-...-2fccdda Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2023 License: MIT Imports: 9 Imported by: 0

README

pidfd Test Status Go Reference Go Report Card

Package pidfd provides access to Linux process file descriptors. MIT Licensed.

Documentation

Overview

Package pidfd provides access to Linux process file descriptors.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

type Error struct {
	FD, PID int
	Err     error
}

An Error is an error value produced by the pidfd_* family of syscalls.

func (*Error) Error

func (e *Error) Error() string

Error implements error.

func (*Error) Is

func (e *Error) Is(target error) bool

Is implements errors.Is comparison.

func (*Error) Unwrap

func (e *Error) Unwrap() error

Unwrap implements errors.Unwrap functionality.

type File

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

A File is a handle to a Linux pidfd. If the process referred to by the pidfd no longer exists, File's methods will return an *Error value which is compatible with errors.Is(err, os.ErrNotExist).

func Open

func Open(pid int) (*File, error)

Open opens a pidfd File referring to the process identified by pid. If the process does not exist, an *Error value is returned which is compatible with errors.Is(err, os.ErrNotExist).

func (*File) Close

func (f *File) Close() error

Close releases the File's resources.

func (*File) SendSignal

func (f *File) SendSignal(signal os.Signal) error

SendSignal sends a signal the process referred to by File. Note that unix.Signal values also implement os.Signal.

func (*File) Wait

func (f *File) Wait(ctx context.Context) error

Wait waits for the process referred to by File to exit. If the context is canceled, Wait will unblock and return an error.

Jump to

Keyboard shortcuts

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