geopm  3.1.1.dev296+g5916b956
GEOPM - Global Extensible Open Power Manager
Classes | Public Member Functions | Static Public Member Functions | List of all members
geopm::POSIXSignal Class Referenceabstract

#include <POSIXSignal.hpp>

Inheritance diagram for geopm::POSIXSignal:
Inheritance graph
[legend]

Classes

struct  m_info_s
 Reduced information set from siginfo_t struct defined in signal.h. More...
 

Public Member Functions

 POSIXSignal ()=default
 
virtual ~POSIXSignal ()=default
 
virtual sigset_t make_sigset (const std::set< int > &signal_set) const =0
 Create a sigset_t from a set of signal numbers. More...
 
virtual m_info_s reduce_info (const siginfo_t &info) const =0
 Extract the signal number, signal value integer and sending PID from a siginfo_t struct to simplify mock data. More...
 
virtual int sig_wait_info (const sigset_t *sigset, siginfo_t *info) const =0
 Wrapper for sigwaitinfo(2) that converts errors into Exceptions. More...
 
virtual int sig_timed_wait (const sigset_t *sigset, siginfo_t *info, const struct timespec *timeout) const =0
 Wrapper for sigtimedwait(2) that converts errors into Exceptions. More...
 
virtual void sig_queue (pid_t pid, int sig, int value) const =0
 Wrapper for sigqueue(3) that converts errors into Exceptions. More...
 
virtual void sig_action (int signum, const struct sigaction *act, struct sigaction *oldact) const =0
 Wrapper for sigaction(2) that converts errors into Exceptions. More...
 
virtual void sig_proc_mask (int how, const sigset_t *sigset, sigset_t *oldset) const =0
 Wrapper for sigprocmask(2) that converts errors into Exceptions. More...
 
virtual void sig_suspend (const sigset_t *mask) const =0
 Wrapper for sigsuspend(2) that converts errors into Exceptions. More...
 

Static Public Member Functions

static std::unique_ptr< POSIXSignalmake_unique (void)
 Factory method for POSIXSignal interface. More...
 

Constructor & Destructor Documentation

◆ POSIXSignal()

geopm::POSIXSignal::POSIXSignal ( )
default

◆ ~POSIXSignal()

virtual geopm::POSIXSignal::~POSIXSignal ( )
virtualdefault

Member Function Documentation

◆ make_sigset()

virtual sigset_t geopm::POSIXSignal::make_sigset ( const std::set< int > &  signal_set) const
pure virtual

Create a sigset_t from a set of signal numbers.

Exceptions
geopm::Exceptionupon EINVAL
Parameters
signal_set[in]: Set of all signal numbers to add to the sigset.
Returns
A sigset_t that is zeroed except for specified signals

Implemented in geopm::POSIXSignalImp.

◆ make_unique()

std::unique_ptr< POSIXSignal > geopm::POSIXSignal::make_unique ( void  )
static

Factory method for POSIXSignal interface.

Returns
Unique pointer to an implementation of the POSIXSignal interface.

◆ reduce_info()

virtual m_info_s geopm::POSIXSignal::reduce_info ( const siginfo_t &  info) const
pure virtual

Extract the signal number, signal value integer and sending PID from a siginfo_t struct to simplify mock data.

Parameters
info[in]: see sigaction(2) man page
Returns
m_info_s reduced information set from siginfo_t struct

Implemented in geopm::POSIXSignalImp.

◆ sig_action()

virtual void geopm::POSIXSignal::sig_action ( int  signum,
const struct sigaction *  act,
struct sigaction *  oldact 
) const
pure virtual

Wrapper for sigaction(2) that converts errors into Exceptions.

Exceptions
geopm::Exceptionupon EFAULT, EINVAL
Warning
The Linux API sigaction(2) does not properly implement error checking, so this function checks for EFAULT if act or oldact are nullptr
Remarks
See documentation for sigaction(2) about parameters.

Implemented in geopm::POSIXSignalImp.

◆ sig_proc_mask()

virtual void geopm::POSIXSignal::sig_proc_mask ( int  how,
const sigset_t *  sigset,
sigset_t *  oldset 
) const
pure virtual

Wrapper for sigprocmask(2) that converts errors into Exceptions.

Exceptions
geopm::Exceptionupon EFAULT, EINVAL
Remarks
See documentation for sigprocmask(2) about parameters and return value.

Implemented in geopm::POSIXSignalImp.

◆ sig_queue()

virtual void geopm::POSIXSignal::sig_queue ( pid_t  pid,
int  sig,
int  value 
) const
pure virtual

Wrapper for sigqueue(3) that converts errors into Exceptions.

Exceptions
geopm::Exceptionupon EINVAL, ESRCH
Remarks
See documentation for sigqueue(3) about parameters.

Implemented in geopm::POSIXSignalImp.

◆ sig_suspend()

virtual void geopm::POSIXSignal::sig_suspend ( const sigset_t *  mask) const
pure virtual

Wrapper for sigsuspend(2) that converts errors into Exceptions.

Exceptions
geopm::Exceptionupon EFAULT
Remarks
See documentation for sigsuspend(2) about parameters and return value. Except that it doesn't return an error by default.

Implemented in geopm::POSIXSignalImp.

◆ sig_timed_wait()

virtual int geopm::POSIXSignal::sig_timed_wait ( const sigset_t *  sigset,
siginfo_t *  info,
const struct timespec *  timeout 
) const
pure virtual

Wrapper for sigtimedwait(2) that converts errors into Exceptions.

Exceptions
geopm::Exceptionupon EAGAIN, EINTR, EINVAL
Remarks
See documentation for sigtimedwait(2) about parameters and return value.

Implemented in geopm::POSIXSignalImp.

◆ sig_wait_info()

virtual int geopm::POSIXSignal::sig_wait_info ( const sigset_t *  sigset,
siginfo_t *  info 
) const
pure virtual

Wrapper for sigwaitinfo(2) that converts errors into Exceptions.

Exceptions
geopm::Exceptionupon EAGAIN, EINTR, EINVAL
Remarks
See documentation for sigwaitinfo(2) about parameters and return value.

Implemented in geopm::POSIXSignalImp.


The documentation for this class was generated from the following files: