LIB(9) LIB(9)
NAME
lib - C library functions used by the kernel
SYNOPSIS
#include "../port/lib.h"
DESCRIPTION
A small collection of functions from the normal Plan 9 C
library is used in the kernel. Only a subset is made avail-
able by declarations in lib.h, which must be included
instead of the usual <libc.h>. Here is a list of the manual
pages, and the functions from them declared by lib.h for
kernel use:
abs
atoi, strtol, strtoul, strtoll, and strtoull
cleanname
dec64 and encodefmt
Fmt, fmtinstall, fmtprint and fmtstrcpy
getbe, putbe, getle, and putle
getcallerpc
getfields and tokenize (see also parsecmd(9))
for quotefmtinstall
print, seprint, snprint, sprint, vseprint and vsnprint,
memccpy, memchr, memcmp, memmove and memset
chartorune, runetochar, runelen, utflen and utfrune
Page 1 Plan 9 (printed 10/30/25)
LIB(9) LIB(9)
values OCEXEC, OEXCL, OEXEC, ORCLOSE, ORDWR, OREAD,
OTRUNC and OWRITE,
data structures Dir and Qid, and values DMDIR etc. and
QTDIR etc.
strcat, strchr, strcmp, strcpy, strecpy, strlen,
strncat, strncmp, strncpy, strrchr and strstr
data structure Waitmsg
lib.h also defines ERRMAX (the limit in bytes for error
strings) and KNAMELEN (fixed-length limit in bytes for
device driver file names)
A few other libraries such as memdraw(2) and mp(2) are
called by specialised kernel components and drivers but they
use the normal include file for each library.
Page 2 Plan 9 (printed 10/30/25)