*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->OpenBSD man pages -> KASSERT (9)              
Title
Content
Arch
Section
 

KERN(9)

Contents


NAME    [Toc]    [Back]

     kern - kernel library routines

SYNOPSIS    [Toc]    [Back]

     #include <lib/libkern.h>

DESCRIPTION    [Toc]    [Back]

     The kern library implements a set of  useful  functions  and
macros inside
     the kernel.

MATH    [Toc]    [Back]

     int
     imax(int a, int b);

     int
     imin(int a, int b);

     long
     lmax(long a, long b);

     long
     lmin(long a, long b);

     u_int
     max(u_int a, u_int b);

     u_int
     min(u_int a, u_int b);

     u_long
     ulmax(u_long a, u_long b);

     u_long
     ulmin(u_long a, u_long b);

     int
     abs(int j);

     The  min(),  imin(), lmin() and ulmin() functions return the
smallest integer
 between a and b, inclusive.  The max(),  imax(),  lmax()
and ulmax()
     functions return the largest integer between a and b, inclusive.

     The abs() function computes the absolute value of integer j.

ASSERTIONS    [Toc]    [Back]

     void
     assert(CONDITION);

     void
     KASSERT(CONDITION);

     void
     KDASSERT(CONDITION);

     These  macros  cause  kernel panic(9) if the given condition
evaluates to
     false.  assert() tests are always  compiled  in.   KASSERT()
tests are only
     included  if  the kernel has DIAGNOSTIC enabled.  KDASSERT()
tests are only
     included if the kernel has DEBUG enabled.

BYTE STRINGS    [Toc]    [Back]

     int
     locc(int mask, u_int size, char *cp);

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

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

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

     int
     ffs(int value);

     The  locc() function locates an integer of value mask inside
the string
     cp.  The skpc() function locates an  unsigned  character  of
value 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.

     locc(), 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), memchr(3), memcmp(3) and ffs(3).

CHARACTER STRINGS    [Toc]    [Back]

     size_t
     strlen(const char *s);

     char *
     strncpy(char *dst, const char *src, size_t len);

     size_t
     strlcpy(char *dst, const char *src, size_t size);

     size_t
     strlcat(char *dst, const char *src, size_t size);

     int
     strcmp(const char *s1, const char *s2);

     int
     strncmp(const char *s1, const char *s2, size_t len);

     int
     strncasecmp(const char *s1, const char *s2, size_tlen);

     Those  functions have the same semantics as their libc counterparts,
     strlen(3), strncpy(3),  strlcpy(3),  strlcat(3),  strcmp(3),
strncmp(3) and
     strncasecmp(3).

RANDOM NUMBER GENERATION    [Toc]    [Back]

     u_long
     random(void);

     void
     srandom(u_long seed);

     The   random()   function  returns  a  random  number.   The
srandom() function
     initializes the random seed.  random() will by default  produce a sequence
     of  numbers that can be duplicated by calling srandom() with
`1' as the
     seed.  The random() function  is  discouraged  in  favor  of
arc4random(9).

MISCELLANEOUS    [Toc]    [Back]

     int
     getsn(char *cp, int size);

     The  getsn()  function reads user input from the console and
returns on
     newline.  The result is written into cp, which is assumed to
be size
     bytes long.

SEE ALSO    [Toc]    [Back]

      
      
     assert(3), bcmp(3), ffs(3), memchr(3), memcmp(3), string(3),
     arc4random(9)

STANDARDS    [Toc]    [Back]

     The  abs(),   memchr(),   memcmp(),   strlen(),   strncpy(),
strcmp(), strncmp()
     and  strcasecmp()  functions  conform  to  ANSI  X3.159-1989
(``ANSI C'').

HISTORY    [Toc]    [Back]

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

OpenBSD      3.6                          August      9,     2002
[ Back ]
 Similar pages
Name OS Title
kiconv_add_xlat16_table FreeBSD Kernel side iconv library
kiconv_add_xlat16_cspairs FreeBSD Kernel side iconv library
kiconv_add_xlat16_cspair FreeBSD Kernel side iconv library
kiconv FreeBSD Kernel side iconv library
geom_stats_snapshot_get FreeBSD userland API library for kernel GEOM subsystem
geom_stats_resync FreeBSD userland API library for kernel GEOM subsystem
geom_stats_close FreeBSD userland API library for kernel GEOM subsystem
geom_stats_open FreeBSD userland API library for kernel GEOM subsystem
libgeom FreeBSD userland API library for kernel GEOM subsystem
geom_stats_snapshot_timestamp FreeBSD userland API library for kernel GEOM subsystem
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service