The posix module naturally relies on relevant system libraries to provide the POSIX APIs it uses. These may be provided by diverse libraries (e.g. libpthread.so) or all by a single /lib/libc.so.*; platforms using this code need to work out those details for themselves and ensure their build systems provide suitable include paths to compilation and libraries to the linker.
Some projects' clients may wish to reduce their foot-print by using a
stripped-down library. It should be noted
that µClibc, a.k.a. uCLibc, provides
a standard C library for embedded Linux systems, with a strong emphasis on small
foot-print: it may be more constructive to simply switch to this instead of
trying to strip down (at risk of breaking applications that use) some other
system libc. However, for the benefit of those helping clients to
decide what can be stripped, this page lists the library functions known to be
in use in this module. Note that your configuration of the system system may
also imply dependencies on system library functions; such of these as are used
by this module are also listed below, by the name of the macro via which they
are accessed – e.g. with their op_ prefix.
Note that which APIs you actually use shall depend on which of the APIs exported by the module are currently being imported. The sections below group system APIs loosely by type; each lists relevant module APIs, although no attempt is made to exhaustively identify the mapping between module and system APIs.
Contents:
Primary module API: API_POSIX_LOG.
Requirements:
stdio.h, FILE, feof(), ferror(), clearerr(), fileno()
Primary module APIs: API_POSIX_DIR, API_POSIX_FILE
and API_POSIX_PATH. Requirements:
dirent.h, DIR, struct dirent, opendir(), readdir_r(), closedir()
utime.h, struct utimbuf, utime
Primary module API: API_POSIX_CLOCK, API_POSIX_TIME_ZONE
Requirements:
time.h,
sys/time.h
Primary module
APIs: API_POSIX_LOCALE, API_POSIX_SYS_LOCALE
and API_POSIX_NATIVE. Requirements:
locale.h
langinfo.h, nl_langinfo(), T_FMT, CODESET
Primary module API: API_POSIX_THREAD.
Requirements:
pthread.h,
semaphore.h
Primary module APIs: API_POSIX_NETIF
and API_POSIX_DNS. Very variable, depending on tweaks; see
documentation of tweaks for more detail. Requirements:
net/if.h, ioctl(), IFF_UP
sys/sockio.h; struct lifconf, struct lifreq; SIOCGLIFCONF, SIOCGLIFFLAGS, SIOCGLIFINDEX; IFF_LOOPBACK, IFF_BROADCAST, IFF_POINTOPOINT
sys/ioctl.h, struct ifreq; SIOCGIFNAME, SIOCGIFFLAGS, SIOCGIFADDR; IFF_LOOPBACK, IFF_BROADCAST, IFF_POINTOPOINT
ifaddrs.h, getifaddrs(), struct ifaddrs
sys/socket.h,
netdb.h
Network queries imply socket addresses, hence the APIs they use (see
next section). API_POSIX_NETWORK is implemented on top
of API_POSIX_NETIF using features of addresses.
Primary module API: API_POSIX_SOCKADDR. Various structs and
macros with a 6
in their names are only used
if TWEAK_POSIX_SUPPORT_IPV6 is enabled.
Requirements:
sys/socket.h, AF_INET, AF_INET6
netinet/in.h, struct in_addr, struct in6_addr, struct sockaddr_in, struct sockaddr_in6, INADDR_ANY; IN6_IS_ADDR_UNSPECIFIED or in6addr_any (TWEAK_POSIX_IN6ADDR_ANY)
arpa/inet.h, inet_ntop(), inet_pton(), INET6_ADDRSTRLEN
API_POSIX_NETADDR extends this to serve other APIs; the
system functions it needs to do so are listed against those APIs.
Primary module
APIs: API_POSIX_SOCKET, API_POSIX_UDP_SOCKET. Each
needs socket addresses, listed above. Requirements:
fcntl.h,
unistd.h; fcntl(), F_GETFD, F_SETFD, FD_CLOEXEC, F_GETFL, F_SETFL, O_NONBLOCK
sys/socket.h; socket(), setsockopt(), connect(), send(), sendto(), recv(), recvfrom(), close(); struct sockaddr, struct sockaddr_storage; MSG_PEEK, SOCK_DGRAM, SOCK_STREAM, SOL_SOCKET, SO_RCVBUF, SO_REUSEADDR, IPPROTO_IP, IP_ADD_MEMBERSHIP, IP_MULTICAST_IF, IPPROTO_IPV6, IPV6_JOIN_GROUP
Primary module APIs: API_POSIX_SYS
(API_POSIX_HOST, API_POSIX_PROCESS), API_POSIX_IRREGULAR, API_POSIX_SETENV, API_POSIX_SO, API_POSIX_SIGNAL
and API_POSIX_SIMPLE_SELECTOR. Requirements:
stdlib.h,
sys/wait.h
fnmatch.h, fnmatch()
stdarg.h, va_list, va_start(), va_end()
unistd.h, system(), fork(), waitpid(), getpid(), _exit()
dlfcn.h, dlopen(), dlsym(), dlerror(), dlclose()
sys/utsname.h, uname()
float.h,
math.h, exp()
signal.h; signal() or sigaction(), SA_SIGINFO; sigset_t, sigaddset(), sigismember(), sigemptyset(); SIG_DFL, SIG_IGN, SIG_ERR
sys/select.h, select(), FD_ZERO(), FD_SET(), FD_ISSET()
Note
that API_POSIX_SELECT_CALLBACK
and API_POSIX_ASYNC use no system APIs directly, although they may
do so via other APIs.
Requirements:
See also: