BSD / POSIX

The BSD layer provides the POSIX system interface on Darwin: files and file descriptors, processes and signals, sockets, terminals, and the sysctl namespace. It sits on top of Mach and is the layer most portable UNIX code talks to. Most functions here also carry a man page, imported and cross-checked against the headers.

see also: man pages

Types & conventions

_types.h__uint32_t
inttypes.h<inttypes.h> -- Standard C header, defined in ISO/IEC 9899:1999
limits.h$NetBSD: limits.h,v 1.8 1996/10/21 05:10:50 jtc Exp $
stdint.hfrom ISO/IEC 988:1999 spec
sys/_select.hThis is called from sys/select.h and sys/time.h for the common prototype
sys/_types/_mach_port_t.hmach_port_t - a named port right
sys/_types/_s_ifmt.h[XSI] The symbolic names for file modes for use as values of mode_t
sys/_types/_sigaltstack.hStructure used in sigaltstack call.
sys/syslimits.h$NetBSD: syslimits.h,v 1.15 1997/06/25 00:48:09 lukem Exp $
sysexits.h SYSEXITS.H -- Exit status codes for system programs.

Threads & scheduling

pthread.hMkLinux
pthread/qos.hpthread_attr_t
sched.hScheduling paramters
sys/posix_sem.hposix_shm.c : Support for POSIX semaphore APIs
sys/qos.h@typedef qos_class_t
sys/semaphore.h@(#)semaphore.h 1.0 2/29/00

Memory & IPC

mach_debug/lockgroup_info.hFile: mach/lockgroup_info.h
mach_debug/mach_debug.hThis file represents the interfaces that used to come
mach_debug/vm_info.hFile: mach_debug/vm_info.h
sys/msg.h$NetBSD: msg.h,v 1.4 1994/06/29 06:44:43 cgd Exp $
sys/posix_shm.hposix_shm.c : Support for POSIX shared memory APIs
sys/sem.h$NetBSD: sem.h,v 1.5 1994/06/29 06:45:15 cgd Exp $
sys/shm.h$NetBSD: shm.h,v 1.15 1994/06/29 06:45:17 cgd Exp $

Strings & text

libgen.h$OpenBSD: libgen.h,v 1.4 1999/05/28 22:00:22 espie Exp $

Atomics, byte order & libkern

libkern/OSAtomicQueue.h@header Lockless atomic enqueue and dequeue
libkern/OSCacheControl.hFunctions performed by sys_cache_control():
libkern/OSReturn.hCore OSReturn values.
libkern/OSThermalNotification.h* OSThermalNotification.h

Data structures

sys/rbtree.h$NetBSD: rbtree.h,v 1.2 2012/02/17 08:20:55 yamt Exp $

Events & kqueue

sys/poll.hThis file is intended to be compatible with the traditional poll.h.

Files & directories

aio.hFile: aio.h
copyfile.hversion 0.1
ftw.h$OpenBSD: ftw.h,v 1.1 2003/07/21 21:13:18 millert Exp $
glob.h(!_POSIX_C_SOURCE || _DARWIN_C_SOURCE)
paths.h$OpenBSD: paths.h,v 1.10 1997/11/09 00:29:02 bri Exp $
sys/aio.hFile: sys/aio.h
sys/disk.hDefinitions
sys/loadable_fs.h@(#)loadable_fs.h 2.0 26/06/90 (c) 1990 NeXT
sys/paths.h@(#)paths.h 1.0 11/13/00
sys/statvfs.hsys/statvfs.h

Processes & signals

dlfcn.hBased on the dlcompat work done by:
getopt.h$NetBSD: getopt.h,v 1.4 2000/07/07 10:43:54 ad Exp $
grp.h[XBD]
libproc.hfor audit_token_t
sandbox.hThis header is deprecated and may be removed in a future release.
setjmp.h_JBLEN is number of ints required to save the following:
spawn.h[SPN] Support for _POSIX_SPAWN
sys/kauth.hNOTICE: This file was modified by SPARTA, Inc. in 2005 to introduce
sys/kern_control.h@header kern_control.h
sys/kern_event.h@header kern_event.h
sys/lctx.hTODO: remove this file
sys/pipe.hNOTICE: This file was modified by SPARTA, Inc. in 2006 to introduce
sys/spawn.h[SPN] Support for _POSIX_SPAWN

Networking

arpa/ftp.hDefinitions for FTP; see RFC-765.
arpa/inet.h@(#)inet.h 8.1 (Berkeley) 6/2/93
arpa/nameser.h$Id: nameser.h,v 1.16 2009/03/03 01:52:48 each Exp $
arpa/nameser_compat.h from nameser.h 8.1 (Berkeley) 6/2/93
arpa/tftp.h$NetBSD: tftp.h,v 1.8 2003/08/07 09:44:12 agc Exp $
ifaddrs.h$FreeBSD: src/include/ifaddrs.h,v 1.3.32.1.4.1 2010/06/14 02:09:06 kensmith Exp $
net/ethernet.hFundamental constants relating to ethernet.
net/if_media.h$NetBSD: if_media.h,v 1.3 1997/03/26 01:19:27 thorpej Exp $
net/kext_net.hSupport for socket filter kernel extensions
net/ndrv.h@(#)ndrv.h 1.1 (MacOSX) 6/10/43
net/pfkeyv2.h$KAME: pfkeyv2.h,v 1.10 2000/03/22 07:04:20 sakane Exp $
netinet/bootp.hBootstrap Protocol (BOOTP). RFC 951.
netinet/icmp6.h$KAME: icmp6.h,v 1.46 2001/04/27 15:09:48 itojun Exp $
netinet/ip6.h$KAME: ip6.h,v 1.18 2001/03/29 05:34:30 itojun Exp $

Time

Terminals

util.h$NetBSD: util.h,v 1.10 1997/12/01 02:25:46 lukem Exp $

Audit (BSM)

bsm/audit_session.hRequired for audit.h.
bsm/libbsm.hNB: definitions, etc., marked with "OpenSSH compatibility" were introduced

Tracing & debugging

sys/dtrace.hDTrace Dynamic Tracing Software: Kernel Interfaces
sys/kernel_types.hMacros(?) to clear/set/test flags.

Misc