INTRO(3)                  OpenBSD Programmer's Manual                 INTRO(3)

NNAAMMEE
     iinnttrroo - introduction to the C libraries

SSYYNNOOPPSSIISS
     cccc [_f_l_a_g_s] _f_i_l_e _._._. [--lllliibbrraarryy]

DDEESSCCRRIIPPTTIIOONN
     The manual pages in section 3 provide an overview of the C library
     functions, their error returns, and other common definitions and
     concepts.  Most of these functions are available from the C library,
     _l_i_b_c.  Other libraries, such as the math library, _l_i_b_m, must be indicated
     at compile time with the --ll option of the compiler.

     The various libraries (followed by the loader flag):

     libc (--llcc)
             Standard C library functions.  When using the C compiler cc(1),
             it is not necessary to supply the loader flag --llcc for these
             functions.  There are several ``libraries'' or groups of
             functions included inside of libc: the standard I/O routines,
             database routines, bit operators, string operators, character
             tests and character operators, DES encryption routines, storage
             allocation, time functions, signal handling, and more.

     libcompat (--llccoommppaatt)
             Functions which are obsolete but are available for compatibility
             with 4.3BSD.  In particular, a number of system call interfaces
             provided in previous releases of BSD have been included for
             source code compatibility.  Use of these routines should, for the
             most part, be avoided.  The manual page entry for each
             compatibility routine indicates the proper interface to use.

     libcrypto (--llccrryyppttoo)
             The OpenSSL crypto library.  Implements a range of cryptographic
             algorithms, providing such functionality as symmetric encryption,
             public key cryptography, and certificate handling.  See
             crypto(3).

     libcurses (--llccuurrsseess)
     libncurses (--llnnccuurrsseess)
     libncursesw (--llnnccuurrsseessww)
     libtermcap (--lltteerrmmccaapp)
     libtermlib (--lltteerrmmlliibb)
             Terminal-independent screen management routines for two-
             dimensional non-bitmap display terminals.  This implementation is
             ``new curses'' and is a replacement for 4.2BSD classic curses.
             The libraries _l_i_b_n_c_u_r_s_e_s, _l_i_b_n_c_u_r_s_e_s_w, _l_i_b_t_e_r_m_c_a_p, and _l_i_b_t_e_r_m_l_i_b
             are all hard links to _l_i_b_c_u_r_s_e_s.  This is for compatibility
             purposes only; new programs should link with --llccuurrsseess.  See
             curses(3) and termcap(3).

     libedit (--lleeddiitt)
             Generic line editing and history functions, similar to those
             found in sh(1).  Functions using the _l_i_b_e_d_i_t library must be
             linked with the _l_i_b_c_u_r_s_e_s library, i.e. --lleeddiitt --llccuurrsseess.  See
             editline(3).

     libevent (--lleevveenntt)
             Provides a mechanism to execute a function when a specific event
             on a file descriptor occurs or after a given time has passed.
             See event(3).

     libexpat (--lleexxppaatt)
             Library routines for parsing XML documents.

     libform (--llffoorrmm)
     libformw (--llffoorrmmww)
             Terminal-independent facilities for composing form screens on
             character-cell terminals.  Functions using the _l_i_b_f_o_r_m library
             must be linked with the _l_i_b_c_u_r_s_e_s library, i.e. --llffoorrmm --llccuurrsseess.
             _l_i_b_f_o_r_m_w is a hard link to _l_i_b_f_o_r_m intended for use with
             _l_i_b_n_c_u_r_s_e_s_w wide-character functions.  See form(3).

     libgcc (--llggcccc)
             GCC runtime support, including long arithmetic, propolice, and
             language independent exception support.  Note: users do not
             normally have to explicitly link with this library.

     libgssapi (--llggssssaappii)
             The Generic Security Service Application Program Interface
             (GSS-API) provides security services to callers in a generic
             fashion.  See gssapi(3).

     libiberty (--lliibbeerrttyy)
             Collection of subroutines missing in other operating systems, as
             well as the C++ demangler and other functions used by the GNU
             toolchain.

     libkadm5clnt (--llkkaaddmm55ccllnntt)
             Kerberos administration client library, for talking to a Kerberos
             database.  Clients communicate via the network.

     libkadm5srv (--llkkaaddmm55ssrrvv)
             Kerberos administration server library, for talking to a Kerberos
             database.  Servers talk directly to the database.

     libkeynote (--llkkeeyynnoottee)
             System library for the keynote trust-management system.  Trust-
             management systems provide standard, general-purpose mechanisms
             for specifying application security policies and credentials.
             Functions using the libkeynote library must be linked with the
             _l_i_b_m and _l_i_b_c_r_y_p_t_o libraries, i.e. --llkkeeyynnoottee --llmm --llccrryyppttoo.  See
             keynote(3) and keynote(4).

     libkrb5 (--llkkrrbb55)
     libasn1 (--llaassnn11)
     libcom_err (--llccoomm__eerrrr)
     libhdb (--llhhddbb)
     libkafs (--llkkaaffss)
             Kerberos 5 libraries.  The libraries _l_i_b_a_s_n_1, _l_i_b_c_o_m___e_r_r, _l_i_b_h_d_b,
             and _l_i_b_k_a_f_s are all hard links to _l_i_b_k_r_b_5.  See krb5(3).

     libkvm (--llkkvvmm)
             Kernel memory interface library.  Provides a uniform interface
             for accessing kernel virtual memory images, including live
             systems and crash dumps.  See kvm(3).

     libl (--llll)
     libfl (--llffll)
             The library for lex(1), a lexical analyzer generator.  The _l_i_b_f_l
             library is a hard link to _l_i_b_l.

     libm (--llmm)
             Mathematical functions which comprise the C math library, _l_i_b_m.
             See math(3).

     libmenu (--llmmeennuu)
     libmenuw (--llmmeennuuww)
             Terminal-independent facilities for composing menu systems on
             character-cell terminals.  Functions using the _l_i_b_m_e_n_u library
             must be linked with the _l_i_b_c_u_r_s_e_s library, i.e. --llmmeennuu --llccuurrsseess.
             _l_i_b_m_e_n_u_w is a hard link to _l_i_b_m_e_n_u intended for use with
             _l_i_b_n_c_u_r_s_e_s_w wide-character functions.  See menu(3).

     libmilter (--llmmiilltteerr)
             The sendmail(8) mail filter API.  See the documentation in
             _/_u_s_r_/_s_h_a_r_e_/_d_o_c_/_h_t_m_l_/_m_i_l_t_e_r_/.

     libobjc (--lloobbjjcc)
             Library for Objective C, an object-oriented superset of ANSI C.
             Use this to compile Objective C programs.

     libocurses (--llooccuurrsseess)
     libotermcap (--llootteerrmmccaapp)
             Routines to provide the user with a method of updating screens
             with reasonable optimisation.  The ocurses(3) library is
             compatible with the _c_u_r_s_e_s library provided in 4.3.  _l_i_b_o_t_e_r_m_c_a_p
             is the 4.3-compatible _t_e_r_m_c_a_p library, and is a hard link to
             _l_i_b_o_c_u_r_s_e_s.  See otermcap(3).

     libossaudio (--lloossssaauuddiioo)
             Provides an emulation of the OSS (Linux) audio interface.  This
             is used only for porting programs.  See ossaudio(3).

     libpanel (--llppaanneell)
     libpanelw (--llppaanneellww)
             Terminal-independent facilities for stacked windows on character-
             cell terminals.  Functions using the _l_i_b_p_a_n_e_l library must be
             linked with the _l_i_b_c_u_r_s_e_s library, i.e. --llppaanneell --llccuurrsseess.
             _l_i_b_p_a_n_e_l_w is a hard link to _l_i_b_p_a_n_e_l intended for use with
             _l_i_b_n_c_u_r_s_e_s_w wide-charcter functions.  See panel(3).

     libpcap (--llppccaapp)
             Packet capture library.  All packets on the network, even those
             destined for other hosts, are accessible through this library.
             See pcap(3).

     libperl (--llppeerrll)
             Support routines for perl(1).

     libpthread (--pptthhrreeaadd)
             IEEE Std 1003.1-2001 (``POSIX'') threads API and thread
             scheduler.  Threaded applications should use --pptthhrreeaadd not
             --llpptthhrreeaadd.  See pthreads(3).  Note: users do not normally have to
             explicitly link with this library.

     libreadline (--llrreeaaddlliinnee)
             Command line editing interface.  See readline(3).

     librpcsvc (--llrrppccssvvcc)
             Generated by rpcgen(1), containing stub functions for many common
             rpc(3) protocols.

     libskey (--llsskkeeyy)
             Support library for the S/Key one time password (OTP)
             authentication toolkit.  See skey(3).

     libsndio (--llssnnddiioo)
             Library for audio(4) hardware and the aucat(1) audio server.  See
             sio_open(3).

     libssl (--llssssll)
             The OpenSSL ssl library implements the Secure Sockets Layer (SSL
             v2/v3) and Transport Layer Security (TLS v1) protocols.  See
             ssl(3).

     libstdc++ (--llssttddcc++++)
             GCC subroutine library for C++.  See c++(1).  Note: users do not
             normally have to explicitly link with this library.

     libsupc++ (--llssuuppcc++++)
             (GCC 3.3.x systems only) C++ core language support (exceptions,
             new, typeinfo).  Note: users do not normally have to explicitly
             link with this library.

     libusbhid (--lluussbbhhiidd)
             Routines to extract data from USB Human Interface Devices (HIDs).
             See usbhid(3).

     libutil (--lluuttiill)
             System utility functions.  These are currently check_expire(3),
             fmt_scaled(3), fparseln(3), getmaxpartitions(3),
             getrawpartition(3), imsg_init(3), login(3), login_fbtab(3),
             opendev(3), opendisk(3), openpty(3), pidfile(3), pw_init(3),
             pw_lock(3), readlabelfs(3) and uucplock(3).

     libwrap (--llwwrraapp)
             TCP wrapper access control library.  See hosts_access(3) and
             rfc1413(3).

     liby (--llyy)
             The library for yacc(1), an LALR parser generator.

     libz (--llzz)
             General purpose data compression library.  The functions in this
             library are documented in compress(3).  The data format is
             described in RFCs 1950 - 1952.

     Platform-specific libraries:

     libalpha (--llaallpphhaa)
             Alpha I/O and memory access functions.  See inb(2).

     libamd64 (--llaammdd6644)
             AMD64 I/O and memory access functions.  See amd64_get_ioperm(2)
             and amd64_iopl(2).

     libarm (--llaarrmm)
             ARM I/O and memory access functions.  See arm_drain_writebuf(2)
             and arm_sync_icache(2).

     libi386 (--llii338866)
             i386 I/O and memory access functions.  See i386_get_ioperm(2),
             i386_get_ldt(2), i386_iopl(2), and i386_vm86(2).

LLIIBBRRAARRYY TTYYPPEESS
     The system libraries are located in _/_u_s_r_/_l_i_b.  Typically, a library will
     have a number of variants:

           libc.a
           libc.so.30.1
           libc_p.a
           libc_pic.a

     Libraries with an `.a' suffix are static.  When a program is linked
     against a library, all the library code will be linked into the binary.
     This means the binary can be run even when the libraries are unavailable.
     However, it can be inefficient with memory usage.  The C compiler, cc(1),
     can be instructed to link statically by specifying the --ssttaattiicc flag.

     Libraries with a `.so.X.Y' suffix are dynamic libraries.  When code is
     compiled dynamically, the library code that the application needs is not
     linked into the binary.  Instead, data structures are added containing
     information about which dynamic libraries to link with.  When the binary
     is executed, the run-time linker ld.so(1) reads these data structures,
     and loads them at a virtual address using the mmap(2) system call.

     `X' represents the major number of the library, and `Y' represents the
     minor number.  In general, a binary will be able to use a dynamic library
     with a differing minor number, but the major numbers must match.  In the
     example above, a binary linked with minor number `3' would be linkable
     against libc.so.30.1, while a binary linked with major number `31' would
     not.

     The advantages of dynamic libraries are that multiple instances of the
     same program can share address space, and the physical size of the binary
     is smaller.  The disadvantage is the added complexity that comes with
     loading the libraries dynamically, and the extra time taken to load the
     libraries.  Of course, if the libraries are not available, the binary
     will be unable to execute.  The C compiler, cc(1), can be instructed to
     link dynamically by specifying the --sshhaarreedd flag, although on systems that
     support it, this will be the default and need not be specified.

     Libraries with a `_p.a' suffix are profiling libraries.  They contain
     extra information suitable for analysing programs, such as execution
     speed and call counts.  This in turn can be interpreted by utilities such
     as gprof(1).  The C compiler, cc(1), can be instructed to generate
     profiling code, or to link with profiling libraries, by specifying the
     --ppgg flag.

     Libraries with a `_pic.a' suffix contain position-independent code (PIC).
     Normally, compilers produce relocatable code.  Relocatable code needs to
     be modified at run-time, depending on where in memory it is to be run.
     PIC code does not need to be modified at run-time, but is less efficient
     than relocatable code.  PIC code is used by shared libraries, which can
     make them slower.  The C compiler, cc(1), can be instructed to generate
     PIC code, or to link with PIC libraries, by specifying the --ffppiicc or --ffPPIICC
     flags.

     With the exception of dynamic libraries, libraries are generated using
     the ar(1) utility.  The libraries contain an index to the contents of the
     library, stored within the library itself.  The index lists each symbol
     defined by a member of a library that is a relocatable object file.  This
     speeds up linking to the library, and allows routines in the library to
     call each other regardless of their placement within the library.  The
     index is created by ranlib(1) and can be viewed using nm(1).

     The building of PIC versions of libraries and dynamic libraries can be
     prevented by setting the variable NOPIC in _/_e_t_c_/_m_k_._c_o_n_f.  The building of
     profiling versions of libraries and/or dynamic libraries can be prevented
     by setting the variable NOPROFILE in _/_e_t_c_/_m_k_._c_o_n_f.  See mk.conf(5) for
     more details.

FFIILLEESS
     _/_u_s_r_/_l_i_b_/_l_i_b_a_s_n_1_._a
     _/_u_s_r_/_l_i_b_/_l_i_b_c_._a
     _/_u_s_r_/_l_i_b_/_l_i_b_c_o_m___e_r_r_._a
     _/_u_s_r_/_l_i_b_/_l_i_b_c_o_m_p_a_t_._a
     _/_u_s_r_/_l_i_b_/_l_i_b_c_r_y_p_t_o_._a
     _/_u_s_r_/_l_i_b_/_l_i_b_c_u_r_s_e_s_._a
     _/_u_s_r_/_l_i_b_/_l_i_b_e_d_i_t_._a
     _/_u_s_r_/_l_i_b_/_l_i_b_e_v_e_n_t_._a
     _/_u_s_r_/_l_i_b_/_l_i_b_e_x_p_a_t_._a
     _/_u_s_r_/_l_i_b_/_l_i_b_f_l_._a
     _/_u_s_r_/_l_i_b_/_l_i_b_f_o_r_m_._a
     _/_u_s_r_/_l_i_b_/_l_i_b_f_o_r_m_w_._a
     _/_u_s_r_/_l_i_b_/_g_c_c_-_l_i_b_/_$_{_A_R_C_H_}_-_u_n_k_n_o_w_n_-_o_p_e_n_b_s_d_$_{_O_S_R_E_V_}_/_$_{_G_C_C_R_E_V_}_/_f_p_i_c_/_l_i_b_g_c_c_._a
     _/_u_s_r_/_l_i_b_/_l_i_b_g_s_s_a_p_i_._a
     _/_u_s_r_/_l_i_b_/_l_i_b_h_d_b_._a
     _/_u_s_r_/_l_i_b_/_l_i_b_i_b_e_r_t_y_._a
     _/_u_s_r_/_l_i_b_/_l_i_b_k_a_d_m_5_c_l_n_t_._a
     _/_u_s_r_/_l_i_b_/_l_i_b_k_a_d_m_5_s_r_v_._a
     _/_u_s_r_/_l_i_b_/_l_i_b_k_a_f_s_._a
     _/_u_s_r_/_l_i_b_/_l_i_b_k_e_y_n_o_t_e_._a
     _/_u_s_r_/_l_i_b_/_l_i_b_k_r_b_5_._a
     _/_u_s_r_/_l_i_b_/_l_i_b_k_v_m_._a
     _/_u_s_r_/_l_i_b_/_l_i_b_l_._a
     _/_u_s_r_/_l_i_b_/_l_i_b_m_._a
     _/_u_s_r_/_l_i_b_/_l_i_b_m_e_n_u_._a
     _/_u_s_r_/_l_i_b_/_l_i_b_m_e_n_u_w_._a
     _/_u_s_r_/_l_i_b_/_l_i_b_m_i_l_t_e_r_._a
     _/_u_s_r_/_l_i_b_/_l_i_b_n_c_u_r_s_e_s_._a
     _/_u_s_r_/_l_i_b_/_l_i_b_n_c_u_r_s_e_s_w_._a
     _/_u_s_r_/_l_i_b_/_l_i_b_o_b_j_c_._a
     _/_u_s_r_/_l_i_b_/_l_i_b_o_c_u_r_s_e_s_._a
     _/_u_s_r_/_l_i_b_/_l_i_b_o_s_s_a_u_d_i_o_._a
     _/_u_s_r_/_l_i_b_/_l_i_b_o_t_e_r_m_c_a_p_._a
     _/_u_s_r_/_l_i_b_/_l_i_b_p_a_n_e_l_._a
     _/_u_s_r_/_l_i_b_/_l_i_b_p_a_n_e_l_w_._a
     _/_u_s_r_/_l_i_b_/_l_i_b_p_c_a_p_._a
     _/_u_s_r_/_l_i_b_/_l_i_b_p_e_r_l_._a
     _/_u_s_r_/_l_i_b_/_l_i_b_p_t_h_r_e_a_d_._a
     _/_u_s_r_/_l_i_b_/_l_i_b_r_e_a_d_l_i_n_e_._a
     _/_u_s_r_/_l_i_b_/_l_i_b_r_p_c_s_v_c_._a
     _/_u_s_r_/_l_i_b_/_l_i_b_s_k_e_y_._a
     _/_u_s_r_/_l_i_b_/_l_i_b_s_n_d_i_o_._a
     _/_u_s_r_/_l_i_b_/_l_i_b_s_s_l_._a
     _/_u_s_r_/_l_i_b_/_l_i_b_s_t_d_c_+_+_._a
     _/_u_s_r_/_l_i_b_/_l_i_b_s_u_p_c_+_+_._a
     _/_u_s_r_/_l_i_b_/_l_i_b_t_e_r_m_c_a_p_._a
     _/_u_s_r_/_l_i_b_/_l_i_b_t_e_r_m_l_i_b_._a
     _/_u_s_r_/_l_i_b_/_l_i_b_u_s_b_h_i_d_._a
     _/_u_s_r_/_l_i_b_/_l_i_b_u_t_i_l_._a
     _/_u_s_r_/_l_i_b_/_l_i_b_w_r_a_p_._a
     _/_u_s_r_/_l_i_b_/_l_i_b_y_._a
     _/_u_s_r_/_l_i_b_/_l_i_b_z_._a         

     _/_u_s_r_/_l_i_b_/_l_i_b_a_l_p_h_a_._a
     _/_u_s_r_/_l_i_b_/_l_i_b_a_m_d_6_4_._a
     _/_u_s_r_/_l_i_b_/_l_i_b_a_r_m_._a
     _/_u_s_r_/_l_i_b_/_l_i_b_i_3_8_6_._a

SSEEEE AALLSSOO
     ar(1), cc(1), gcc-local(1), gprof(1), ld.so(1), nm(1), ranlib(1),
     mk.conf(5)

HHIISSTTOORRYY
     An iinnttrroo manual appeared in Version 7 AT&T UNIX.

OpenBSD 4.9                    October 28, 2010                    OpenBSD 4.9
