DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

udi_assert(3udi)


Perform driver internal consistency check

SYNOPSIS

#include <udi.h>

void udi_assert ( udi_boolean_t expr );
 

ARGUMENTS expr expression to evaluate for truthfulness

DESCRIPTION The udi_assert function is used by the driver to perform an internal consistency check. The supplied expression expr is evaluated and if the result is false, the consistency check is interpreted as having failed. A failed consistency check indicates an unrecoverable condition within the driver and the UDI environment should take steps to kill the driver or mark it as not-executable. A failed assertion is tantamount to a suicide request on the part of the driver but not for the system as a whole.

The actual handling of an assertion failure is left to the environment implementation. It may be that a particular environment even has multiple execution modes (e.g. free vs. checked) where the failed assertions have different results depending on the mode.

While it is not actually guaranteed that udi_assert will not return to the driver if expr is false, it is expected that drivers will be coded as if that were the case.

As an esoteric note, an environment may choose not to directly handle the udi_assert call simply by returning to the calling code regardless of the success or failure of the evaluated expression. Although the results are indeterminate (and it is likely that the system will subsequently crash as a result of an ignored assertion) the environment implementation has chosen this as a valid outcome of a failed assertion. This is a very subtle environment implementation issue that should not affect driver code; as noted above, driver writers should write their code under the assumption that a failed udi_assert call will not return.


UDI Core Specification Contents