Writing Device Drivers
Previous Next

Utility Functions

The utility functions are:

nulldev()

Zero return function

nodev()

Error return function

nochpoll()

Error return function for non-pollable devices

ASSERT()

Expression verification

bcopy()

Copy data between address locations in the kernel

bzero()

Clear memory for a given number of bytes

bcmp()

Compare two byte arrays

ddi_ffs()

Find the first bit set in a long integer

ddi_fls()

Find the last bit set in a long integer

swab()

Swap bytes in 16-bit halfwords

strcmp()

Compare two null-terminated strings

strncmp()

Compare two null-terminated strings, with length limit

strlen()

Determine the number of non-null bytes in a string

strnlen()

(Available starting with SXCE build 88) Determine the number of non-null bytes in a string, with length limit

strcpy()

Copy a string from one location to another

strncpy()

Copy a string from one location to another, with length limit

strchr()

Find a character in a string

sprintf(), vsprintf()

Format characters in memory

numtos()

Convert an integer to a decimal string

stoi()

Convert a decimal string to an integer

max()

Return the larger of two integers

min()

Return the lesser of two integers

va_arg()

Finds the next value in a variable argument list

va_copy()

Copies the state of a variable argument list

va_end()

Deletes pointer to a variable argument list

va_start()

Finds the pointer to the start of a variable argument list

Previous Next