rasProject_01 / weSweetHome
R. 240
process control / RasPi software by weinert-automation
|
Process control helpers for Raspberry Pi: lock and watchdog. More...
Functions | |
void | closeLock (void) |
Unlock the lock file | |
int | initWatchdog (void) |
Get and initialise or arm the watchdog. More... | |
int | justInitWatchdog (void) |
Get and initialise or arm the watchdog. More... | |
int | justLock (char const *lckPiGpioFil) |
Open and lock the lock file. More... | |
int | openLock (char const *lckPiGpioFil, uint8_t const perr) |
Open and lock the lock file. More... | |
void | stopWatchdog (void) |
Stop and disarm the watchdog. More... | |
void | triggerWatchdog (void) |
Trigger the watchdog. More... | |
Variables | |
int | lockFd |
Lock file handle. More... | |
int | useIOlock |
Do use IO lock. More... | |
int | useWatchdog |
flag to use watchdog; default ON More... | |
Process control helpers for Raspberry Pi: lock and watchdog.
Revision history
This is a supplementary basic library to handle locks and a watchdog.
int justLock | ( | char const * | lckPiGpioFil | ) |
Open and lock the lock file.
This function is the basic implementation of openLock. Applications not wanting its optional logging or doing their own should use this function directly.
lckPiGpioFil | lock file name |
int openLock | ( | char const * | lckPiGpioFil, |
uint8_t const | perr | ||
) |
Open and lock the lock file.
This function may use logging and streams not available on smaller applications. Those applications not wanting that optional logging or doing their own should use the function justLock().
lckPiGpioFil | lock file path name |
perr | make error message when lock file does not exist or can't be locked |
int initWatchdog | ( | void | ) |
Get and initialise or arm the watchdog.
If the watchdog is to be used, i.e. useWatchdog is ON. this function tries to get it. Otherwise it does nothing but return 0 (success).
On no success 1 is returned and useWatchdog is set OFF and the misfortune is logged. Use justInitWatchdog() :: for silence.
int justInitWatchdog | ( | void | ) |
Get and initialise or arm the watchdog.
This function justInitWatchdog() is the basic implementation of initWatchdog() without logging failure.
void stopWatchdog | ( | void | ) |
Stop and disarm the watchdog.
If the watchdog is to be used, i.e. useWatchdog is ON, this function stops and disarms it.
useWatchdog is then OFF .
void triggerWatchdog | ( | void | ) |
Trigger the watchdog.
If the watchdog is to be used, i.e. useWatchdog is ON, this function triggers it.
If the watchdog is armed (by initWatchdog()) not triggering it at least once about every 15 s will lead to system reset.
|
extern |
|
extern |
Lock file handle.
Do not use directly.