Go to main content

Writing Device Drivers for Oracle® Solaris 11.3

Exit Print View

Updated: March 2019
 
 

Utility Functions

The following list provides a subset of the utility functions that are available.

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

strcat()

Append two strings

strncat()

Append two strings, with length limit

strlcat()

Append two strings, with length and buffer limit

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()

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

strlcpy()

Copy a string from one location to another with length limit and buffer limit

strcasecmp()

Case insensitive version of strcmp()

strncasecmp()

Case insensitive version of strncmp()

strchr()

Find a character in a string

strstr()

Locate the first occurrence of one string in another string

strcasestr()

Case insensitive version of strstr()

strfree()

Frees memory associated with a string

sprintf(), vsprintf()

Format characters in memory

snprintf()

Format characters in memory with buffer size specified

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

See the man pages section 9: DDI and DKI Kernel Functions for detailed information about the utility functions.