Documentation
¶
Overview ¶
Package watchdog provides access to hardware watchdogs. These can be used to automatically reset/reboot a system if they are no longer pinged.
Index ¶
- type Device
- func (w *Device) Close() error
- func (w *Device) CloseActive() error
- func (w *Device) GetPreTimeout() (time.Duration, error)
- func (w *Device) GetTimeout() (time.Duration, error)
- func (w *Device) LastResetByWatchdog() (bool, error)
- func (w *Device) Ping() error
- func (w *Device) SetPreTimeout(t time.Duration) error
- func (w *Device) SetTimeout(t time.Duration) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Device ¶
type Device struct { // Type identifies the type of watchdog device. It corresponds to the Linux // driver's watchdog_info.identity value. Type string // HasConfiguratbleTimeout indicates if the device supports the SetTimeout // call. HasConfigurableTimeout bool // HasPretimeout indicates if the device supports notifying the system of // an impending reset and the functions to control this // (Get/SetPreTimeout). HasPretimeout bool // Indicates if the watchdog is capable of reporting that it is responsible // for the last system reset. ReportsWatchdogReset bool // contains filtered or unexported fields }
Device represents a handle to a hardware watchdog.
func (*Device) CloseActive ¶
CloseActive releases all resources and file handles, but keeps the watchdog active. Another system must reopen it and ping it before it expires to avoid a reset.
func (*Device) GetPreTimeout ¶
GetPreTimeout gets the current pre-timeout (see SetPreTimeout for more).
func (*Device) GetTimeout ¶
GetTimeout returns the configured timeout duration.
func (*Device) LastResetByWatchdog ¶
LastResetByWatchdog returns true if the last system reset was caused by this watchdog. Not all watchdogs report this accurately.
func (*Device) Ping ¶
Ping the watchdog. This needs to be called regularly before the watchdog timeout expires, otherwise the system resets.
func (*Device) SetPreTimeout ¶
SetPreTimeout sets the minimum duration left on the expiry timer where when it drops below that, the system is notified (via some high-priority interrupt, usually an NMI). This is only available if HasPretimeout is true. This can be used by the system (if it's still in a sem-working state) to recover or dump diagnostic information before it gets forcibly reset by the watchdog. To disable this functionality, set the duration to zero.
func (*Device) SetTimeout ¶
SetTimeout sets the duration since the last ping after which it performs a recovery actions (usually a reset or reboot). Due to hardware limitations this function may approximate the set duration or not be a available at all. GetTimeout returns the active timeout.