INTRO(3) INTRO(3)
NAME
intro - introduction to functions and libraries
DESCRIPTION
This section describes functions found in various libraries,
other than those functions that directly invoke system
primitives, which are described in Section 2 of this volume.
Certain major collections are identified by a letter after
the section number:
(3C) These functions, together with those of Section 2 and
those marked (3S), constitute the Standard C Library
libc, which is automatically loaded by the C compiler,
cc(1). (For this reason the (3C) and (3S) sections
together comprise one section of this manual.) The
link editor ld(1) searches this library under the -lc
option. A "shared library" version of libc can be
searched using the -lcs option, resulting in smaller
a.outs. Declarations for some of these functions may
be obtained from #include files indicated on the
appropriate pages.
(3S) These functions constitute the ``standard I/O
package'' [see stdio(3S)]. These functions are in the
library libc, already mentioned. Declarations for
these functions may be obtained from the #include file
<stdio.h>.
(3M) These functions constitute the Math Library, libm.
They are not automatically loaded by the C compiler,
cc(1); however, the link editor searches this library
under the -lm option. Declarations for these
functions may be obtained from the #include file
<math.h>. Several generally useful mathematical
constants are also defined there [see math(5)].
(3N) This contains sets of functions constituting the
Network Services library. These sets provide protocol
independent interfaces to networking services based on
the service definitions of the OSI (Open Systems
Interconnection) reference model. Application
developers access the function sets that provide
services at a particular level.
Page 1 May 1989
INTRO(3) INTRO(3)
The function sets contained in the library are:
TRANSPORT INTERFACE (TI) - provide the services of
the OSI Transport Layer. These services provide
reliable end-to-end data transmission using the
services of an underlying network. Applications
written using the TI functions are independent of
the underlying protocols. Declarations for these
functions may be obtained from the #include file
<tiuser.h>. The link editor ld(1) searches this
library under the -lnsls option.
(3X) Various specialized libraries. The files in which
these libraries are found are given on the appropriate
pages.
(3P) These functions constitute the ANSI/IEEE POSIX
operating system interface specifications. These
functions are in the library libc, already mentioned.
DEFINITIONS
A character is any bit pattern able to fit into a byte on
the machine. The null character is a character with value
0, represented in the C language as '\0'. A character array
is a sequence of characters. A null-terminated character
array is a sequence of characters, the last of which is the
null character. A string is a designation for a null-
terminated character array. The null string is a character
array containing only the null character. A NULL pointer is
the value that is obtained by casting 0 into a pointer. The
C language guarantees that this value will not match that of
any legitimate pointer, so many functions that return
pointers return it to indicate an error. NULL is defined as
0 in <stdio.h>; the user can include an appropriate
definition if not using <stdio.h>.
Netbuf In the Network Services library, netbuf is a
structure used in various Transport Interface (TI) functions
to send and receive data and information. It contains the
following members:
unsigned int maxlen;
Page 2 May 1989
INTRO(3) INTRO(3)
unsigned int len;
char *buf;
Buf points to a user input and/or output buffer. Len
generally specifies the number of bytes contained in the
buffer. If the structure is used for both input and output,
the function will replace the user value of len on return.
Maxlen generally has significance only when buf is used to
receive output from the TI function. In this case, it
specifies the physical size of the buffer, the maximum value
of len that can be set by the function. If maxlen is not
large enough to hold the returned information, an TBUFOVFLW
error will generally result. However, certain functions may
return part of the data and not generate an error.
FILES
LIBDIR usually /lib
LIBDIR/libc.a
LIBDIR/libc_s.a
LIBDIR/libm.a
SEE ALSO
ar(1), cc(1), ld(1), lint(1), nm(1), intro(2), stdio(3S),
math(5).
DIAGNOSTICS
Functions in the C and Math Libraries (3C and 3M) may return
the conventional values 0 or +HUGE (the largest-magnitude
single-precision floating-point numbers; HUGE is defined in
the <math.h> header file) when the function is undefined for
the given arguments or when the value is not representable.
In these cases, the external variable errno [see intro(2)]
is set to the value EDOM or ERANGE.
WARNING
Many of the functions in the libraries call and/or refer to
other functions and external variables described in this
section and in Section 2 (System Calls). If a program
inadvertently defines a function or external variable with
Page 3 May 1989
INTRO(3) INTRO(3)
the same name, the presumed library version of the function
or external variable may not be loaded. The lint(1) program
checker reports name conflicts of this kind as ``multiple
declarations'' of the names in question. Definitions for
Sections 2, 3C, and 3S are checked automatically. Other
definitions can be included by using the -l option. (For
example, -lm includes definitions for Section 3M, the Math
Library.) Use of lint is highly recommended.
Page 4 May 1989