2.7. The C Library The user-level standard C librarythe ubiquitous libcis known as libSystem on Mac OS X. /usr/lib/libc.dylib is a symbolic link to /usr/lib/libSystem.dylib. libSystem could be thought of as a metalibrary, as it consists of several BSD libraries, some of which are independent libraries on a typical Unix system. Normalcy is maintained by symbolically linking such libraries to libSystem, as is the case with libc. Some of libSystem's constituent libraries are specific to Mac OS X or otherwise internal to libSystem. The following are examples of externally visible libraries contained in libSystem: libc the standard C library libdbm a database library libdl a programming interface to the dynamic linking loader libinfo a library that provides various "info" APIs, such as DNS and multicast DNS, NIS, and NetInfo libkvm a library that provides a uniform interface for accessing kernel virtual memory images; used by programs such as ps libm the standard math library libpoll a wrapper library that emulates the System V poll() system call on top of BSD's select() system call libpthread the POSIX thread[29] library [29] POSIX threads (Pthreads) on Mac OS X are implemented using Mach kernel threads, with one Mach thread per pthread.
librpcsvc a miscellaneous "Sun" RPC services library On Mac OS X 10.3 and earlier, libdl is a wrapper library that emulates the POSIX dynamic linking loader APIthe dlopen(), dlclose(), dlsym(), and dlerror() functions[30]on top of Darwin's native dyld API. On Mac OS X 10.4 and later, the dlopen() function family is implemented natively within dyld. [30] Typical libdl implementations also provide the dladdr() function, which is not defined by POSIX. dladdr() queries the dynamic linker for information about the image containing a specified address. Internally available functionality in libSystem includes the following: libdyldapis provides a low-level API to the dynamic link editor libkeymgr used for maintaining process-wide global data known to all threads across all dynamic libraries liblaunch provides an interface to launchd, the manager of system-wide and per-user daemons and agents libmacho provides an API for accessing segments and sections in Mach-O files libnotify allows applications to exchange events through namespace-based[31] stateless notifications [31] The clients of this API share a global namespace. Clients may post notifications, which are associated with names. Similarly, clients may monitor names by registering for notifications.
libstreams implements an I/O streams mechanism libunc allows creation, dispatch, and manipulation of user notifications libSystem also includes an object file containing the commpage symbols. As we will see in Chapters 5 and 6, the commpage area is a region of memory that is mapped (shared and read-only) into every process's address space. It contains frequently used system-wide code and data. The commpage symbols in libSystem are placed in a special segment (the __DATA segment within the __commpage section), which allows a debugger to access them. |