MEMCMP(9) | Kernel Developer's Manual | MEMCMP(9)

# NAME

`skpc`, `scanc`, `bcmp`, `timingsafe_bcmp`, `memchr`, `memcmp` — kernel library byte string routines

# SYNOPSIS

`#include <lib/libkern/libkern.h>`

int
`skpc`(int mask, size_t size, u_char *cp);

int
`scanc`(u_int size, const u_char *cp, const u_char *table, int mask);

int
`bcmp`(const void *b1, const void *b2, size_t len);

int
`timingsafe_bcmp`(const void *b1, const void *b2, size_t len);

void *
`memchr`(const void *b, int c, size_t len);

int
`memcmp`(const void *b1, const void *b2, size_t len);

# DESCRIPTION

The `skpc`() function locates the first unsigned character of value different than mask inside the string cp.

The `scanc`() function expects a string of indexes into the table table. Each table element is bitwise ANDed against mask.

`skpc`() and `scanc`() expect the string to be of size size, and return the index relative to the end of the string where the match occurred, or zero if mask is not present in the string.

The remaining functions have the same semantics as their libc counterparts, bcmp(3), timingsafe_bcmp(3), memchr(3), and memcmp(3).

# STANDARDS

The `memchr`() and `memcmp`() functions conform to ANSI X3.159-1989 (“ANSI C89”).

# HISTORY

The `skpc`() and `scanc`() functions are based on vax instructions of the same name.

April 23, 2018 | Debian