libexplain  1.4.D001
Data Fields
explain_iocontrol_t Struct Reference

#include <iocontrol.h>

Data Fields

const char * name
int number
int(* disambiguate )(int fildes, int request, const void *data)
expain_iocontrol_print_func_t print_name
expain_iocontrol_print_func_t print_data
expain_iocontrol_print_func_t print_explanation
void(* print_data_returned )(const explain_iocontrol_t *p, struct explain_string_buffer_t *sb, int errnum, int fildes, int request, const void *data)
unsigned data_size
const char * data_type
unsigned flags
const char * file
int line

Detailed Description

The explain_iocontrol_t type is used to represent an ioctl(2) call, providing name and number.

Note:
This information is not kept in a single table for all values, like every other set of constants, because (a) some values are ambiguous, and (b) the includes files have bugs making it impossible to include all of them in the same combilation unit.

Definition at line 60 of file iocontrol.h.


Field Documentation

The data_size member is used to remember the sizeof the data pointed to by the ioctl data argument. This is used by ioctl scan to allocate data of the correct size.

If set to NOT_A_POINTER, it means that the data passed to the ioctl is not a pointer (an intptr_t instead).

Definition at line 145 of file iocontrol.h.

The data_type member is used to remember the type of the data pointed to by the ioctl data argument. This is used to improve the description, but also to provide this to static analysis tools.

Definition at line 152 of file iocontrol.h.

int(* explain_iocontrol_t::disambiguate)(int fildes, int request, const void *data)

The disambiguate method is used to ambiguous ioctl(2) request values, to attempt to discern which was intended from information about the state of the file descriptor, and the request itself. This is not always possible, given that the code is not psychic.

If the NULL pointer value is used, the value is assumed to be non-ambiguous. This is almost always the case.

Returns 0 on success (i.e. a match), -1 on failure (i.e. not a match).

Definition at line 88 of file iocontrol.h.

The file member is used to rememebr the name of the file this ioctl is defined in, by using __FILE__ in the initialiser. This is needed to obtain useful error message out of the explain_iocontrol_check_conflicts function.

Definition at line 167 of file iocontrol.h.

The flags member is used to store assorted information about the ioctl, mostly of interest when checking ioctl data for internal consistency.

Definition at line 159 of file iocontrol.h.

The line member is used to rememebr the line number of the source file this ioctl is defined in, by using __LINE__ in the initialiser. This is needed to obtain useful error message out of the explain_iocontrol_check_conflicts function.

Definition at line 175 of file iocontrol.h.

The name of the ioctl(2) request.

Set to NULL for systems on which this ioctl does not apply.

Definition at line 67 of file iocontrol.h.

The numeric value of the ioctl(2) request.

Set to zero (0) for systems on which this ioctl does not apply.

Definition at line 74 of file iocontrol.h.

The print_data member is a pointer to a function that is used to print a representation of the data argument passed to an ioctl(2) system call.

Definition at line 105 of file iocontrol.h.

void(* explain_iocontrol_t::print_data_returned)(const explain_iocontrol_t *p, struct explain_string_buffer_t *sb, int errnum, int fildes, int request, const void *data)

The print_data_returned method is used to print a representation of the data argument returned by an ioctl(2) system call.

Parameters:
pPointer to the explain_iocontrol_t instance, rather like "this" in C++ code.
sbThe string buffer to print into.
errnumThe error number that caused all this, obtained from the global errno variable, possibly indirectly.
fildesThe original fildes, exactly as passed to the ioctl(2) system call.
requestThe original request, exactly as passed to the ioctl(2) system call.
dataThe original data, exactly as passed to the ioctl(2) system call.

Definition at line 133 of file iocontrol.h.

The print_explanation member is a pointer to a function that is used to print an representation of the data returned by a successful ioctl(2) system call.

Definition at line 112 of file iocontrol.h.

The print_name member is a pointer to a function that is is used to print the name of a request argument passed to an ioctl(2) system call.

If the NULL pointer is used, the default action is to print the name member.

Definition at line 98 of file iocontrol.h.


The documentation for this struct was generated from the following file: