Skip to content

Instantly share code, notes, and snippets.

Avatar

Twocanoes Software, Inc twocanoes

View GitHub Profile
@landonf
landonf / watchdog.c
Last active Dec 25, 2015
Enables OS X's hardware watchdog.
View watchdog.c
#include <CoreFoundation/CoreFoundation.h>
#include <IOKit/IOKitLib.h>
#include <dispatch/dispatch.h>
// 5 minutes
#define TIMEOUT (5*60)
bool reset_watchdog (int timeout) {
io_service_t service = IOServiceGetMatchingService(kIOMasterPortDefault, IOServiceMatching("IOWatchDogTimer"));
if (service == IO_OBJECT_NULL) {
You can’t perform that action at this time.