[ Previous | Next | Contents | Home | Search ]
AIX Version 4.3 Kernel and Subsystems Technical Reference, Volume 1

w_init Kernel Service

Purpose

Registers a watchdog timer with the kernel.

Syntax

#include <sys/types.h>
#include <sys/errno.h>
#include <sys/watchdog.h>
int w_init (w)
struct watchdog *w;

Parameter

w Specifies the watchdog timer structure.

Description

Attention: The watchdog structure must be pinned when the w_init service is called. It must remain pinned until after the call to the w_clear service. During this time, the watchdog structure must not be altered except by the watchdog services.

The watchdog timer services, including the w_init kernel service, are typically used to verify that an I/O operation completes in a reasonable time. The watchdog timer is initialized to the stopped state and must be started using the w_start service.

In a uniprocessor environment, the call always succeeds. This is untrue in a multiprocessor environment, where the call will fail if the watchdog timer is being handled by another processor. Therefore, the function now has a return value, which is set to 0 if successful, or -1 otherwise. Funnelled device drivers do not need to check the return value since they run in a logical uniprocessor environment. Multiprocessor-safe and multiprocessor-efficient device drivers need to check the return value in a loop. In addition, if a driver uses locking, it must release and reacquire its lock within this loop, as shown below:

while (w_init(&watchdog))
  release_then_reacquire_dd_lock; 
                  /* null statement if locks not used */

The calling parameters for the watchdog timer function are:

void func (w)
struct watchdog *w;

Execution Environment

The w_init kernel service can be called from the process environment only.

Return Values

0 Indictates that the watchdog structure was successfully initialized.
-1 Indicates that the watchdog structure could not be initialized.

Implementation Specifics

The w_init kernel service is part of Base Operating System (BOS) Runtime.

Related Information

The w_clear kernel service, w_start kernel service, w_stop kernel service.

Timer and Time-of-Day Kernel Services in AIX Kernel Extensions and Device Support Programming Concepts.


[ Previous | Next | Contents | Home | Search ]