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 available 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(2)
abs
atof(2)
atoi, strtol, strtoul, strtoll, and strtoull
cleanname(2)
cleanname
encode(2)
dec64 and encodefmt
fmtinstall(2)
Fmt, fmtinstall, fmtprint and fmtstrcpy
getbe(2)
getbe, putbe, getle, and putle
getcallerpc(2)
getcallerpc
getfields(2)
getfields and tokenize (see also parsecmd(9))
quote(2)
for quotefmtinstall
print(2)
print, seprint, snprint, sprint, vseprint and vsnprint,
memory(2)
memccpy, memchr, memcmp, memmove and memset
rune(2)
chartorune, runetochar, runelen, utflen and utfrune
open(2)
values OCEXEC, OEXCL, OEXEC, ORCLOSE, ORDWR, OREAD, OTRUNC and OWRITE,
stat(2)
data structures Dir and Qid, and values DMDIR etc. and QTDIR etc.
strcat(2)
strcat, strchr, strcmp, strcpy, strecpy, strlen, strncat, strncmp, strncpy, strrchr and strstr
wait(2)
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.

Copyright © 2024 Plan 9 Foundation. All rights reserved.