4 release, 3 sample code, Release – ADLINK CSA-5100 User Manual
Page 38: Sample code
 
38
CSA-5100
DESCRIPTION 
This function defines functions for the watchdog device according to the available 
features. 
int ioctl(int handle, int cmd,[int *argdx, int argcx]) may be used in client to call this 
feature. 
 
PARAMETERS 
handle
[IN] File handle to the watchdog;
cmd
[IN] Watchdog command, such as “WDIOC_xxx”;
argxx
[IN/OUT] Argument pointer, such as“WDIOS_xxx”, only used after
WDIOC_SETOPTIONS. 
 
RETURN 
0: success 
-1: error 
6.2.4 release
The Watchdog Driver provides several ioctl options: 
 
Closing the watchdog device either stops the watchdog timer or in the case that nowayout is 
set or the magic character wasn't written, a critical warning about a running watchdog timer 
will be given. 
 
PROTOTYPE 
static int release(struct inode *inode, struct file *file) 
 
DESCRIPTION 
This function is used to check whether the watchdog device closing is expected or not. This 
feature will be called automatically when closing the watchdog device file “/dev/watchdog”. 
 
 
6.3 Sample Code
The following sample code is provided to illustrate how the SuperIO Watchdog timer and 
LAN bypass control can be implemented. 
 
#include <stdio.h> 
#include <stdlib.h> 
#include <string.h> 
#include <unistd.h> 
#include <fcntl.h> 
#include <sys/ioctl.h> 
#include <linux/types.h> 
#include <linux/watchdog.h> 
 
#define WDIOC_ENABLEBYPS 
_IOR(WATCHDOG_IOCTL_BASE, 101, int)
#define WDIOC_DISABLEBYPS _IOR(WATCHDOG_IOCTL_BASE, 102, int) 
 
int fd; 
 
/* 
 * This function simply sends an IOCTL to the driver, which in turn ticks