Programa De Ejemplo Del Mecanismo De Vigilancia - Sun Microsystems Netra 1290 Guía De Administración

Tabla de contenido

Publicidad

La estructura de datos del control del mecanismo de vigilancia y reinicio:
EJEMPLO DE CÓDIGO B-2
typedef struct {
} lom_dogctl_t;

Programa de ejemplo del mecanismo de vigilancia

El siguiente ejemplo es un programa para el temporizador del mecanismo de vigilancia.
EJEMPLO DE CÓDIGO B-3
#include
#include
#include
#include
#include <lom_io.h>
int main() {
}
120
Guía de administración del servidor Netra 1290 • Agosto de 2006
Estructura de datos de control del mecanismo de vigilancia y
reinicio
int reset_enable; /* reset enabled if non-zero */
int dog_enable; /* watchdog enabled if non-zero */
Programa de ejemplo del mecanismo de vigilancia
<sys/types.h>
<fcntl.h>
<unistd.h>
<sys/stat.h>
uint_t timeout = 30; /* 30 seconds */
lom_dogctl_t dogctl;
int fd;
dogctl.reset_enable = 1;
dogctl.dog_enable = 1;
fd = open("/dev/ntwdt", O_EXCL);
/* Set timeout */
ioctl(fd, LOMIOCDOGTIME, (void *)&timeout);
/* Enable watchdog */
ioctl(fd, LOMIOCDOGCTL, (void *)&dogctl);
/* Keep patting */
while (1) {
ioctl(fd, LOMIOCDOGPAT, NULL);
sleep (5);
}
return (0);

Publicidad

Tabla de contenido
loading

Tabla de contenido