This is libc.info, produced by makeinfo version 7.2 from libc.texinfo. This is ‘The GNU C Library Reference Manual’, for version 2.42. Copyright © 1993-2025 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with the Invariant Sections being "Free Software Needs Free Documentation" and "GNU Lesser General Public License", the Front-Cover texts being "A GNU Manual", and with the Back-Cover Texts as in (a) below. A copy of the license is included in the section entitled "GNU Free Documentation License". (a) The FSF's Back-Cover Text is: "You have the freedom to copy and modify this GNU manual. Buying copies from the FSF supports it in developing GNU and promoting software freedom." INFO-DIR-SECTION Software libraries START-INFO-DIR-ENTRY * Libc: (libc). C library. END-INFO-DIR-ENTRY INFO-DIR-SECTION GNU C library functions and macros START-INFO-DIR-ENTRY * ALTWERASE: (libc)Local Modes. * ARGP_ERR_UNKNOWN: (libc)Argp Parser Functions. * ARG_MAX: (libc)General Limits. * BAUD_MAX: (libc)Line Speed. * BC_BASE_MAX: (libc)Utility Limits. * BC_DIM_MAX: (libc)Utility Limits. * BC_SCALE_MAX: (libc)Utility Limits. * BC_STRING_MAX: (libc)Utility Limits. * BRKINT: (libc)Input Modes. * BUFSIZ: (libc)Controlling Buffering. * CCTS_OFLOW: (libc)Control Modes. * CHAR_BIT: (libc)Width of Type. * CHILD_MAX: (libc)General Limits. * CIGNORE: (libc)Control Modes. * CLK_TCK: (libc)Processor Time. * CLOCAL: (libc)Control Modes. * CLOCKS_PER_SEC: (libc)CPU Time. * CLOCK_BOOTTIME: (libc)Getting the Time. * CLOCK_BOOTTIME_ALARM: (libc)Getting the Time. * CLOCK_MONOTONIC: (libc)Getting the Time. * CLOCK_MONOTONIC_COARSE: (libc)Getting the Time. * CLOCK_MONOTONIC_RAW: (libc)Getting the Time. * CLOCK_PROCESS_CPUTIME_ID: (libc)Getting the Time. * CLOCK_REALTIME: (libc)Getting the Time. * CLOCK_REALTIME_ALARM: (libc)Getting the Time. * CLOCK_REALTIME_COARSE: (libc)Getting the Time. * CLOCK_TAI: (libc)Getting the Time. * CLOCK_THREAD_CPUTIME_ID: (libc)Getting the Time. * COLL_WEIGHTS_MAX: (libc)Utility Limits. * CPU_ALLOC: (libc)CPU Affinity. * CPU_ALLOC_SIZE: (libc)CPU Affinity. * CPU_AND: (libc)CPU Affinity. * CPU_AND_S: (libc)CPU Affinity. * CPU_CLR: (libc)CPU Affinity. * CPU_CLR_S: (libc)CPU Affinity. * CPU_COUNT: (libc)CPU Affinity. * CPU_COUNT_S: (libc)CPU Affinity. * CPU_EQUAL: (libc)CPU Affinity. * CPU_EQUAL_S: (libc)CPU Affinity. * CPU_FEATURE_ACTIVE: (libc)X86. * CPU_FEATURE_PRESENT: (libc)X86. * CPU_FREE: (libc)CPU Affinity. * CPU_ISSET: (libc)CPU Affinity. * CPU_ISSET_S: (libc)CPU Affinity. * CPU_OR: (libc)CPU Affinity. * CPU_OR_S: (libc)CPU Affinity. * CPU_SET: (libc)CPU Affinity. * CPU_SETSIZE: (libc)CPU Affinity. * CPU_SET_S: (libc)CPU Affinity. * CPU_XOR: (libc)CPU Affinity. * CPU_XOR_S: (libc)CPU Affinity. * CPU_ZERO: (libc)CPU Affinity. * CPU_ZERO_S: (libc)CPU Affinity. * CREAD: (libc)Control Modes. * CRTS_IFLOW: (libc)Control Modes. * CS5: (libc)Control Modes. * CS6: (libc)Control Modes. * CS7: (libc)Control Modes. * CS8: (libc)Control Modes. * CSIZE: (libc)Control Modes. * CSTOPB: (libc)Control Modes. * DLFO_EH_SEGMENT_TYPE: (libc)Dynamic Linker Introspection. * DLFO_STRUCT_HAS_EH_COUNT: (libc)Dynamic Linker Introspection. * DLFO_STRUCT_HAS_EH_DBASE: (libc)Dynamic Linker Introspection. * DTTOIF: (libc)Directory Entries. * E2BIG: (libc)Error Codes. * EACCES: (libc)Error Codes. * EADDRINUSE: (libc)Error Codes. * EADDRNOTAVAIL: (libc)Error Codes. * EADV: (libc)Error Codes. * EAFNOSUPPORT: (libc)Error Codes. * EAGAIN: (libc)Error Codes. * EALREADY: (libc)Error Codes. * EAUTH: (libc)Error Codes. * EBACKGROUND: (libc)Error Codes. * EBADE: (libc)Error Codes. * EBADF: (libc)Error Codes. * EBADFD: (libc)Error Codes. * EBADMSG: (libc)Error Codes. * EBADR: (libc)Error Codes. * EBADRPC: (libc)Error Codes. * EBADRQC: (libc)Error Codes. * EBADSLT: (libc)Error Codes. * EBFONT: (libc)Error Codes. * EBUSY: (libc)Error Codes. * ECANCELED: (libc)Error Codes. * ECHILD: (libc)Error Codes. * ECHO: (libc)Local Modes. * ECHOCTL: (libc)Local Modes. * ECHOE: (libc)Local Modes. * ECHOK: (libc)Local Modes. * ECHOKE: (libc)Local Modes. * ECHONL: (libc)Local Modes. * ECHOPRT: (libc)Local Modes. * ECHRNG: (libc)Error Codes. * ECOMM: (libc)Error Codes. * ECONNABORTED: (libc)Error Codes. * ECONNREFUSED: (libc)Error Codes. * ECONNRESET: (libc)Error Codes. * ED: (libc)Error Codes. * EDEADLK: (libc)Error Codes. * EDEADLOCK: (libc)Error Codes. * EDESTADDRREQ: (libc)Error Codes. * EDIED: (libc)Error Codes. * EDOM: (libc)Error Codes. * EDOTDOT: (libc)Error Codes. * EDQUOT: (libc)Error Codes. * EEXIST: (libc)Error Codes. * EFAULT: (libc)Error Codes. * EFBIG: (libc)Error Codes. * EFTYPE: (libc)Error Codes. * EGRATUITOUS: (libc)Error Codes. * EGREGIOUS: (libc)Error Codes. * EHOSTDOWN: (libc)Error Codes. * EHOSTUNREACH: (libc)Error Codes. * EHWPOISON: (libc)Error Codes. * EIDRM: (libc)Error Codes. * EIEIO: (libc)Error Codes. * EILSEQ: (libc)Error Codes. * EINPROGRESS: (libc)Error Codes. * EINTR: (libc)Error Codes. * EINVAL: (libc)Error Codes. * EIO: (libc)Error Codes. * EISCONN: (libc)Error Codes. * EISDIR: (libc)Error Codes. * EISNAM: (libc)Error Codes. * EKEYEXPIRED: (libc)Error Codes. * EKEYREJECTED: (libc)Error Codes. * EKEYREVOKED: (libc)Error Codes. * EL2HLT: (libc)Error Codes. * EL2NSYNC: (libc)Error Codes. * EL3HLT: (libc)Error Codes. * EL3RST: (libc)Error Codes. * ELIBACC: (libc)Error Codes. * ELIBBAD: (libc)Error Codes. * ELIBEXEC: (libc)Error Codes. * ELIBMAX: (libc)Error Codes. * ELIBSCN: (libc)Error Codes. * ELNRNG: (libc)Error Codes. * ELOOP: (libc)Error Codes. * EMEDIUMTYPE: (libc)Error Codes. * EMFILE: (libc)Error Codes. * EMLINK: (libc)Error Codes. * EMSGSIZE: (libc)Error Codes. * EMULTIHOP: (libc)Error Codes. * ENAMETOOLONG: (libc)Error Codes. * ENAVAIL: (libc)Error Codes. * ENEEDAUTH: (libc)Error Codes. * ENETDOWN: (libc)Error Codes. * ENETRESET: (libc)Error Codes. * ENETUNREACH: (libc)Error Codes. * ENFILE: (libc)Error Codes. * ENOANO: (libc)Error Codes. * ENOBUFS: (libc)Error Codes. * ENOCSI: (libc)Error Codes. * ENODATA: (libc)Error Codes. * ENODEV: (libc)Error Codes. * ENOENT: (libc)Error Codes. * ENOEXEC: (libc)Error Codes. * ENOKEY: (libc)Error Codes. * ENOLCK: (libc)Error Codes. * ENOLINK: (libc)Error Codes. * ENOMEDIUM: (libc)Error Codes. * ENOMEM: (libc)Error Codes. * ENOMSG: (libc)Error Codes. * ENONET: (libc)Error Codes. * ENOPKG: (libc)Error Codes. * ENOPROTOOPT: (libc)Error Codes. * ENOSPC: (libc)Error Codes. * ENOSR: (libc)Error Codes. * ENOSTR: (libc)Error Codes. * ENOSYS: (libc)Error Codes. * ENOTBLK: (libc)Error Codes. * ENOTCONN: (libc)Error Codes. * ENOTDIR: (libc)Error Codes. * ENOTEMPTY: (libc)Error Codes. * ENOTNAM: (libc)Error Codes. * ENOTRECOVERABLE: (libc)Error Codes. * ENOTSOCK: (libc)Error Codes. * ENOTSUP: (libc)Error Codes. * ENOTTY: (libc)Error Codes. * ENOTUNIQ: (libc)Error Codes. * ENXIO: (libc)Error Codes. * EOF: (libc)EOF and Errors. * EOPNOTSUPP: (libc)Error Codes. * EOVERFLOW: (libc)Error Codes. * EOWNERDEAD: (libc)Error Codes. * EPERM: (libc)Error Codes. * EPFNOSUPPORT: (libc)Error Codes. * EPIPE: (libc)Error Codes. * EPROCLIM: (libc)Error Codes. * EPROCUNAVAIL: (libc)Error Codes. * EPROGMISMATCH: (libc)Error Codes. * EPROGUNAVAIL: (libc)Error Codes. * EPROTO: (libc)Error Codes. * EPROTONOSUPPORT: (libc)Error Codes. * EPROTOTYPE: (libc)Error Codes. * EQUIV_CLASS_MAX: (libc)Utility Limits. * ERANGE: (libc)Error Codes. * EREMCHG: (libc)Error Codes. * EREMOTE: (libc)Error Codes. * EREMOTEIO: (libc)Error Codes. * ERESTART: (libc)Error Codes. * ERFKILL: (libc)Error Codes. * EROFS: (libc)Error Codes. * ERPCMISMATCH: (libc)Error Codes. * ESHUTDOWN: (libc)Error Codes. * ESOCKTNOSUPPORT: (libc)Error Codes. * ESPIPE: (libc)Error Codes. * ESRCH: (libc)Error Codes. * ESRMNT: (libc)Error Codes. * ESTALE: (libc)Error Codes. * ESTRPIPE: (libc)Error Codes. * ETIME: (libc)Error Codes. * ETIMEDOUT: (libc)Error Codes. * ETOOMANYREFS: (libc)Error Codes. * ETXTBSY: (libc)Error Codes. * EUCLEAN: (libc)Error Codes. * EUNATCH: (libc)Error Codes. * EUSERS: (libc)Error Codes. * EWOULDBLOCK: (libc)Error Codes. * EXDEV: (libc)Error Codes. * EXFULL: (libc)Error Codes. * EXIT_FAILURE: (libc)Exit Status. * EXIT_SUCCESS: (libc)Exit Status. * EXPR_NEST_MAX: (libc)Utility Limits. * FD_CLOEXEC: (libc)Descriptor Flags. * FD_CLR: (libc)Waiting for I/O. * FD_ISSET: (libc)Waiting for I/O. * FD_SET: (libc)Waiting for I/O. * FD_SETSIZE: (libc)Waiting for I/O. * FD_ZERO: (libc)Waiting for I/O. * FE_SNANS_ALWAYS_SIGNAL: (libc)Infinity and NaN. * FILENAME_MAX: (libc)Limits for Files. * FLUSHO: (libc)Local Modes. * FOPEN_MAX: (libc)Opening Streams. * FP_ILOGB0: (libc)Exponents and Logarithms. * FP_ILOGBNAN: (libc)Exponents and Logarithms. * FP_LLOGB0: (libc)Exponents and Logarithms. * FP_LLOGBNAN: (libc)Exponents and Logarithms. * F_DUPFD: (libc)Duplicating Descriptors. * F_GETFD: (libc)Descriptor Flags. * F_GETFL: (libc)Getting File Status Flags. * F_GETLK: (libc)File Locks. * F_GETOWN: (libc)Interrupt Input. * F_OFD_GETLK: (libc)Open File Description Locks. * F_OFD_SETLK: (libc)Open File Description Locks. * F_OFD_SETLKW: (libc)Open File Description Locks. * F_OK: (libc)Testing File Access. * F_SETFD: (libc)Descriptor Flags. * F_SETFL: (libc)Getting File Status Flags. * F_SETLK: (libc)File Locks. * F_SETLKW: (libc)File Locks. * F_SETOWN: (libc)Interrupt Input. * HUGE_VAL: (libc)Math Error Reporting. * HUGE_VALF: (libc)Math Error Reporting. * HUGE_VALL: (libc)Math Error Reporting. * HUGE_VAL_FN: (libc)Math Error Reporting. * HUGE_VAL_FNx: (libc)Math Error Reporting. * HUPCL: (libc)Control Modes. * I: (libc)Complex Numbers. * ICANON: (libc)Local Modes. * ICRNL: (libc)Input Modes. * IEXTEN: (libc)Local Modes. * IFNAMSIZ: (libc)Interface Naming. * IFTODT: (libc)Directory Entries. * IGNBRK: (libc)Input Modes. * IGNCR: (libc)Input Modes. * IGNPAR: (libc)Input Modes. * IMAXBEL: (libc)Input Modes. * INADDR_ANY: (libc)Host Address Data Type. * INADDR_BROADCAST: (libc)Host Address Data Type. * INADDR_LOOPBACK: (libc)Host Address Data Type. * INADDR_NONE: (libc)Host Address Data Type. * INFINITY: (libc)Infinity and NaN. * INLCR: (libc)Input Modes. * INPCK: (libc)Input Modes. * IPPORT_RESERVED: (libc)Ports. * IPPORT_USERRESERVED: (libc)Ports. * ISIG: (libc)Local Modes. * ISTRIP: (libc)Input Modes. * IXANY: (libc)Input Modes. * IXOFF: (libc)Input Modes. * IXON: (libc)Input Modes. * LINE_MAX: (libc)Utility Limits. * LINK_MAX: (libc)Limits for Files. * L_ctermid: (libc)Identifying the Terminal. * L_cuserid: (libc)Who Logged In. * L_tmpnam: (libc)Temporary Files. * MAXNAMLEN: (libc)Limits for Files. * MAXSYMLINKS: (libc)Symbolic Links. * MAX_CANON: (libc)Limits for Files. * MAX_INPUT: (libc)Limits for Files. * MB_CUR_MAX: (libc)Selecting the Conversion. * MB_LEN_MAX: (libc)Selecting the Conversion. * MDMBUF: (libc)Control Modes. * MSG_DONTROUTE: (libc)Socket Data Options. * MSG_OOB: (libc)Socket Data Options. * MSG_PEEK: (libc)Socket Data Options. * NAME_MAX: (libc)Limits for Files. * NAN: (libc)Infinity and NaN. * NCCS: (libc)Mode Data Types. * NGROUPS_MAX: (libc)General Limits. * NOFLSH: (libc)Local Modes. * NOKERNINFO: (libc)Local Modes. * NSIG: (libc)Standard Signals. * NULL: (libc)Null Pointer Constant. * ONLCR: (libc)Output Modes. * ONOEOT: (libc)Output Modes. * OPEN_MAX: (libc)General Limits. * OPOST: (libc)Output Modes. * OXTABS: (libc)Output Modes. * O_ACCMODE: (libc)Access Modes. * O_APPEND: (libc)Operating Modes. * O_ASYNC: (libc)Operating Modes. * O_CREAT: (libc)Open-time Flags. * O_DIRECTORY: (libc)Open-time Flags. * O_EXCL: (libc)Open-time Flags. * O_EXEC: (libc)Access Modes. * O_EXLOCK: (libc)Open-time Flags. * O_FSYNC: (libc)Operating Modes. * O_IGNORE_CTTY: (libc)Open-time Flags. * O_NDELAY: (libc)Operating Modes. * O_NOATIME: (libc)Operating Modes. * O_NOCTTY: (libc)Open-time Flags. * O_NOFOLLOW: (libc)Open-time Flags. * O_NOLINK: (libc)Open-time Flags. * O_NONBLOCK: (libc)Open-time Flags. * O_NONBLOCK: (libc)Operating Modes. * O_NOTRANS: (libc)Open-time Flags. * O_PATH: (libc)Access Modes. * O_RDONLY: (libc)Access Modes. * O_RDWR: (libc)Access Modes. * O_READ: (libc)Access Modes. * O_SHLOCK: (libc)Open-time Flags. * O_SYNC: (libc)Operating Modes. * O_TMPFILE: (libc)Open-time Flags. * O_TRUNC: (libc)Open-time Flags. * O_WRITE: (libc)Access Modes. * O_WRONLY: (libc)Access Modes. * PARENB: (libc)Control Modes. * PARMRK: (libc)Input Modes. * PARODD: (libc)Control Modes. * PATH_MAX: (libc)Limits for Files. * PA_FLAG_MASK: (libc)Parsing a Template String. * PENDIN: (libc)Local Modes. * PF_FILE: (libc)Local Namespace Details. * PF_INET6: (libc)Internet Namespace. * PF_INET: (libc)Internet Namespace. * PF_LOCAL: (libc)Local Namespace Details. * PF_UNIX: (libc)Local Namespace Details. * PIPE_BUF: (libc)Limits for Files. * PTHREAD_ATTR_NO_SIGMASK_NP: (libc)Initial Thread Signal Mask. * P_tmpdir: (libc)Temporary Files. * RAND_MAX: (libc)ISO Random. * RE_DUP_MAX: (libc)General Limits. * RLIM_INFINITY: (libc)Limits on Resources. * RSEQ_SIG: (libc)Restartable Sequences. * R_OK: (libc)Testing File Access. * SA_NOCLDSTOP: (libc)Flags for Sigaction. * SA_NOCLDWAIT: (libc)Flags for Sigaction. * SA_NODEFER: (libc)Flags for Sigaction. * SA_ONSTACK: (libc)Flags for Sigaction. * SA_RESETHAND: (libc)Flags for Sigaction. * SA_RESTART: (libc)Flags for Sigaction. * SA_SIGINFO: (libc)Flags for Sigaction. * SEEK_CUR: (libc)File Positioning. * SEEK_END: (libc)File Positioning. * SEEK_SET: (libc)File Positioning. * SIGABRT: (libc)Program Error Signals. * SIGALRM: (libc)Alarm Signals. * SIGBUS: (libc)Program Error Signals. * SIGCHLD: (libc)Job Control Signals. * SIGCLD: (libc)Job Control Signals. * SIGCONT: (libc)Job Control Signals. * SIGEMT: (libc)Program Error Signals. * SIGFPE: (libc)Program Error Signals. * SIGHUP: (libc)Termination Signals. * SIGILL: (libc)Program Error Signals. * SIGINFO: (libc)Miscellaneous Signals. * SIGINT: (libc)Termination Signals. * SIGIO: (libc)Asynchronous I/O Signals. * SIGIOT: (libc)Program Error Signals. * SIGKILL: (libc)Termination Signals. * SIGLOST: (libc)Operation Error Signals. * SIGPIPE: (libc)Operation Error Signals. * SIGPOLL: (libc)Asynchronous I/O Signals. * SIGPROF: (libc)Alarm Signals. * SIGPWR: (libc)Miscellaneous Signals. * SIGQUIT: (libc)Termination Signals. * SIGSEGV: (libc)Program Error Signals. * SIGSTKFLT: (libc)Program Error Signals. * SIGSTOP: (libc)Job Control Signals. * SIGSYS: (libc)Program Error Signals. * SIGTERM: (libc)Termination Signals. * SIGTRAP: (libc)Program Error Signals. * SIGTSTP: (libc)Job Control Signals. * SIGTTIN: (libc)Job Control Signals. * SIGTTOU: (libc)Job Control Signals. * SIGURG: (libc)Asynchronous I/O Signals. * SIGUSR1: (libc)Miscellaneous Signals. * SIGUSR2: (libc)Miscellaneous Signals. * SIGVTALRM: (libc)Alarm Signals. * SIGWINCH: (libc)Miscellaneous Signals. * SIGXCPU: (libc)Operation Error Signals. * SIGXFSZ: (libc)Operation Error Signals. * SIG_ERR: (libc)Basic Signal Handling. * SNAN: (libc)Infinity and NaN. * SNANF: (libc)Infinity and NaN. * SNANFN: (libc)Infinity and NaN. * SNANFNx: (libc)Infinity and NaN. * SNANL: (libc)Infinity and NaN. * SOCK_DGRAM: (libc)Communication Styles. * SOCK_RAW: (libc)Communication Styles. * SOCK_RDM: (libc)Communication Styles. * SOCK_SEQPACKET: (libc)Communication Styles. * SOCK_STREAM: (libc)Communication Styles. * SOL_SOCKET: (libc)Socket-Level Options. * SPEED_MAX: (libc)Line Speed. * SSIZE_MAX: (libc)General Limits. * STREAM_MAX: (libc)General Limits. * SUN_LEN: (libc)Local Namespace Details. * S_IFMT: (libc)Testing File Type. * S_ISBLK: (libc)Testing File Type. * S_ISCHR: (libc)Testing File Type. * S_ISDIR: (libc)Testing File Type. * S_ISFIFO: (libc)Testing File Type. * S_ISLNK: (libc)Testing File Type. * S_ISREG: (libc)Testing File Type. * S_ISSOCK: (libc)Testing File Type. * S_TYPEISMQ: (libc)Testing File Type. * S_TYPEISSEM: (libc)Testing File Type. * S_TYPEISSHM: (libc)Testing File Type. * TIME_UTC: (libc)Getting the Time. * TMP_MAX: (libc)Temporary Files. * TOSTOP: (libc)Local Modes. * TZNAME_MAX: (libc)General Limits. * VDISCARD: (libc)Other Special. * VDSUSP: (libc)Signal Characters. * VEOF: (libc)Editing Characters. * VEOL2: (libc)Editing Characters. * VEOL: (libc)Editing Characters. * VERASE: (libc)Editing Characters. * VINTR: (libc)Signal Characters. * VKILL: (libc)Editing Characters. * VLNEXT: (libc)Other Special. * VMIN: (libc)Noncanonical Input. * VQUIT: (libc)Signal Characters. * VREPRINT: (libc)Editing Characters. * VSTART: (libc)Start/Stop Characters. * VSTATUS: (libc)Other Special. * VSTOP: (libc)Start/Stop Characters. * VSUSP: (libc)Signal Characters. * VTIME: (libc)Noncanonical Input. * VWERASE: (libc)Editing Characters. * WCHAR_MAX: (libc)Extended Char Intro. * WCHAR_MIN: (libc)Extended Char Intro. * WCOREDUMP: (libc)Process Completion Status. * WEOF: (libc)EOF and Errors. * WEOF: (libc)Extended Char Intro. * WEXITSTATUS: (libc)Process Completion Status. * WIFEXITED: (libc)Process Completion Status. * WIFSIGNALED: (libc)Process Completion Status. * WIFSTOPPED: (libc)Process Completion Status. * WSTOPSIG: (libc)Process Completion Status. * WTERMSIG: (libc)Process Completion Status. * W_OK: (libc)Testing File Access. * X_OK: (libc)Testing File Access. * _Complex_I: (libc)Complex Numbers. * _Exit: (libc)Termination Internals. * _Fork: (libc)Creating a Process. * _IOFBF: (libc)Controlling Buffering. * _IOLBF: (libc)Controlling Buffering. * _IONBF: (libc)Controlling Buffering. * _Imaginary_I: (libc)Complex Numbers. * _PATH_UTMP: (libc)Manipulating the Database. * _PATH_WTMP: (libc)Manipulating the Database. * _POSIX2_C_DEV: (libc)System Options. * _POSIX2_C_VERSION: (libc)Version Supported. * _POSIX2_FORT_DEV: (libc)System Options. * _POSIX2_FORT_RUN: (libc)System Options. * _POSIX2_LOCALEDEF: (libc)System Options. * _POSIX2_SW_DEV: (libc)System Options. * _POSIX_CHOWN_RESTRICTED: (libc)Options for Files. * _POSIX_JOB_CONTROL: (libc)System Options. * _POSIX_NO_TRUNC: (libc)Options for Files. * _POSIX_SAVED_IDS: (libc)System Options. * _POSIX_VDISABLE: (libc)Options for Files. * _POSIX_VERSION: (libc)Version Supported. * __fbufsize: (libc)Controlling Buffering. * __flbf: (libc)Controlling Buffering. * __fpending: (libc)Controlling Buffering. * __fpurge: (libc)Flushing Buffers. * __freadable: (libc)Opening Streams. * __freading: (libc)Opening Streams. * __fsetlocking: (libc)Streams and Threads. * __fwritable: (libc)Opening Streams. * __fwriting: (libc)Opening Streams. * __gconv_end_fct: (libc)glibc iconv Implementation. * __gconv_fct: (libc)glibc iconv Implementation. * __gconv_init_fct: (libc)glibc iconv Implementation. * __ppc_get_timebase: (libc)PowerPC. * __ppc_get_timebase_freq: (libc)PowerPC. * __ppc_mdoio: (libc)PowerPC. * __ppc_mdoom: (libc)PowerPC. * __ppc_set_ppr_low: (libc)PowerPC. * __ppc_set_ppr_med: (libc)PowerPC. * __ppc_set_ppr_med_high: (libc)PowerPC. * __ppc_set_ppr_med_low: (libc)PowerPC. * __ppc_set_ppr_very_low: (libc)PowerPC. * __ppc_yield: (libc)PowerPC. * __riscv_flush_icache: (libc)RISC-V. * __va_copy: (libc)Argument Macros. * __x86_get_cpuid_feature_leaf: (libc)X86. * _dl_find_object: (libc)Dynamic Linker Introspection. * _exit: (libc)Termination Internals. * _flushlbf: (libc)Flushing Buffers. * _tolower: (libc)Case Conversion. * _toupper: (libc)Case Conversion. * a64l: (libc)Encode Binary Data. * abort: (libc)Aborting a Program. * abs: (libc)Absolute Value. * accept: (libc)Accepting Connections. * access: (libc)Testing File Access. * acos: (libc)Inverse Trig Functions. * acosf: (libc)Inverse Trig Functions. * acosfN: (libc)Inverse Trig Functions. * acosfNx: (libc)Inverse Trig Functions. * acosh: (libc)Hyperbolic Functions. * acoshf: (libc)Hyperbolic Functions. * acoshfN: (libc)Hyperbolic Functions. * acoshfNx: (libc)Hyperbolic Functions. * acoshl: (libc)Hyperbolic Functions. * acosl: (libc)Inverse Trig Functions. * acospi: (libc)Inverse Trig Functions. * acospif: (libc)Inverse Trig Functions. * acospifN: (libc)Inverse Trig Functions. * acospifNx: (libc)Inverse Trig Functions. * acospil: (libc)Inverse Trig Functions. * addmntent: (libc)mtab. * addseverity: (libc)Adding Severity Classes. * adjtime: (libc)Setting and Adjusting the Time. * adjtimex: (libc)Setting and Adjusting the Time. * aio_cancel64: (libc)Cancel AIO Operations. * aio_cancel: (libc)Cancel AIO Operations. * aio_error64: (libc)Status of AIO Operations. * aio_error: (libc)Status of AIO Operations. * aio_fsync64: (libc)Synchronizing AIO Operations. * aio_fsync: (libc)Synchronizing AIO Operations. * aio_init: (libc)Configuration of AIO. * aio_read64: (libc)Asynchronous Reads/Writes. * aio_read: (libc)Asynchronous Reads/Writes. * aio_return64: (libc)Status of AIO Operations. * aio_return: (libc)Status of AIO Operations. * aio_suspend64: (libc)Synchronizing AIO Operations. * aio_suspend: (libc)Synchronizing AIO Operations. * aio_write64: (libc)Asynchronous Reads/Writes. * aio_write: (libc)Asynchronous Reads/Writes. * alarm: (libc)Setting an Alarm. * aligned_alloc: (libc)Aligned Memory Blocks. * alloca: (libc)Variable Size Automatic. * alphasort64: (libc)Scanning Directory Content. * alphasort: (libc)Scanning Directory Content. * arc4random: (libc)High Quality Random. * arc4random_buf: (libc)High Quality Random. * arc4random_uniform: (libc)High Quality Random. * argp_error: (libc)Argp Helper Functions. * argp_failure: (libc)Argp Helper Functions. * argp_help: (libc)Argp Help. * argp_parse: (libc)Argp. * argp_state_help: (libc)Argp Helper Functions. * argp_usage: (libc)Argp Helper Functions. * argz_add: (libc)Argz Functions. * argz_add_sep: (libc)Argz Functions. * argz_append: (libc)Argz Functions. * argz_count: (libc)Argz Functions. * argz_create: (libc)Argz Functions. * argz_create_sep: (libc)Argz Functions. * argz_delete: (libc)Argz Functions. * argz_extract: (libc)Argz Functions. * argz_insert: (libc)Argz Functions. * argz_next: (libc)Argz Functions. * argz_replace: (libc)Argz Functions. * argz_stringify: (libc)Argz Functions. * asctime: (libc)Formatting Calendar Time. * asctime_r: (libc)Formatting Calendar Time. * asin: (libc)Inverse Trig Functions. * asinf: (libc)Inverse Trig Functions. * asinfN: (libc)Inverse Trig Functions. * asinfNx: (libc)Inverse Trig Functions. * asinh: (libc)Hyperbolic Functions. * asinhf: (libc)Hyperbolic Functions. * asinhfN: (libc)Hyperbolic Functions. * asinhfNx: (libc)Hyperbolic Functions. * asinhl: (libc)Hyperbolic Functions. * asinl: (libc)Inverse Trig Functions. * asinpi: (libc)Inverse Trig Functions. * asinpif: (libc)Inverse Trig Functions. * asinpifN: (libc)Inverse Trig Functions. * asinpifNx: (libc)Inverse Trig Functions. * asinpil: (libc)Inverse Trig Functions. * asprintf: (libc)Dynamic Output. * assert: (libc)Consistency Checking. * assert_perror: (libc)Consistency Checking. * atan2: (libc)Inverse Trig Functions. * atan2f: (libc)Inverse Trig Functions. * atan2fN: (libc)Inverse Trig Functions. * atan2fNx: (libc)Inverse Trig Functions. * atan2l: (libc)Inverse Trig Functions. * atan2pi: (libc)Inverse Trig Functions. * atan2pif: (libc)Inverse Trig Functions. * atan2pifN: (libc)Inverse Trig Functions. * atan2pifNx: (libc)Inverse Trig Functions. * atan2pil: (libc)Inverse Trig Functions. * atan: (libc)Inverse Trig Functions. * atanf: (libc)Inverse Trig Functions. * atanfN: (libc)Inverse Trig Functions. * atanfNx: (libc)Inverse Trig Functions. * atanh: (libc)Hyperbolic Functions. * atanhf: (libc)Hyperbolic Functions. * atanhfN: (libc)Hyperbolic Functions. * atanhfNx: (libc)Hyperbolic Functions. * atanhl: (libc)Hyperbolic Functions. * atanl: (libc)Inverse Trig Functions. * atanpi: (libc)Inverse Trig Functions. * atanpif: (libc)Inverse Trig Functions. * atanpifN: (libc)Inverse Trig Functions. * atanpifNx: (libc)Inverse Trig Functions. * atanpil: (libc)Inverse Trig Functions. * atexit: (libc)Cleanups on Exit. * atof: (libc)Parsing of Floats. * atoi: (libc)Parsing of Integers. * atol: (libc)Parsing of Integers. * atoll: (libc)Parsing of Integers. * backtrace: (libc)Backtraces. * backtrace_symbols: (libc)Backtraces. * backtrace_symbols_fd: (libc)Backtraces. * basename: (libc)Finding Tokens in a String. * basename: (libc)Finding Tokens in a String. * bcmp: (libc)String/Array Comparison. * bcopy: (libc)Copying Strings and Arrays. * bind: (libc)Setting Address. * bind_textdomain_codeset: (libc)Charset conversion in gettext. * bindtextdomain: (libc)Locating gettext catalog. * brk: (libc)Resizing the Data Segment. * bsearch: (libc)Array Search Function. * btowc: (libc)Converting a Character. * bzero: (libc)Copying Strings and Arrays. * cabs: (libc)Absolute Value. * cabsf: (libc)Absolute Value. * cabsfN: (libc)Absolute Value. * cabsfNx: (libc)Absolute Value. * cabsl: (libc)Absolute Value. * cacos: (libc)Inverse Trig Functions. * cacosf: (libc)Inverse Trig Functions. * cacosfN: (libc)Inverse Trig Functions. * cacosfNx: (libc)Inverse Trig Functions. * cacosh: (libc)Hyperbolic Functions. * cacoshf: (libc)Hyperbolic Functions. * cacoshfN: (libc)Hyperbolic Functions. * cacoshfNx: (libc)Hyperbolic Functions. * cacoshl: (libc)Hyperbolic Functions. * cacosl: (libc)Inverse Trig Functions. * call_once: (libc)Call Once. * calloc: (libc)Allocating Cleared Space. * canonicalize: (libc)FP Bit Twiddling. * canonicalize_file_name: (libc)Symbolic Links. * canonicalizef: (libc)FP Bit Twiddling. * canonicalizefN: (libc)FP Bit Twiddling. * canonicalizefNx: (libc)FP Bit Twiddling. * canonicalizel: (libc)FP Bit Twiddling. * carg: (libc)Operations on Complex. * cargf: (libc)Operations on Complex. * cargfN: (libc)Operations on Complex. * cargfNx: (libc)Operations on Complex. * cargl: (libc)Operations on Complex. * casin: (libc)Inverse Trig Functions. * casinf: (libc)Inverse Trig Functions. * casinfN: (libc)Inverse Trig Functions. * casinfNx: (libc)Inverse Trig Functions. * casinh: (libc)Hyperbolic Functions. * casinhf: (libc)Hyperbolic Functions. * casinhfN: (libc)Hyperbolic Functions. * casinhfNx: (libc)Hyperbolic Functions. * casinhl: (libc)Hyperbolic Functions. * casinl: (libc)Inverse Trig Functions. * catan: (libc)Inverse Trig Functions. * catanf: (libc)Inverse Trig Functions. * catanfN: (libc)Inverse Trig Functions. * catanfNx: (libc)Inverse Trig Functions. * catanh: (libc)Hyperbolic Functions. * catanhf: (libc)Hyperbolic Functions. * catanhfN: (libc)Hyperbolic Functions. * catanhfNx: (libc)Hyperbolic Functions. * catanhl: (libc)Hyperbolic Functions. * catanl: (libc)Inverse Trig Functions. * catclose: (libc)The catgets Functions. * catgets: (libc)The catgets Functions. * catopen: (libc)The catgets Functions. * cbrt: (libc)Exponents and Logarithms. * cbrtf: (libc)Exponents and Logarithms. * cbrtfN: (libc)Exponents and Logarithms. * cbrtfNx: (libc)Exponents and Logarithms. * cbrtl: (libc)Exponents and Logarithms. * ccos: (libc)Trig Functions. * ccosf: (libc)Trig Functions. * ccosfN: (libc)Trig Functions. * ccosfNx: (libc)Trig Functions. * ccosh: (libc)Hyperbolic Functions. * ccoshf: (libc)Hyperbolic Functions. * ccoshfN: (libc)Hyperbolic Functions. * ccoshfNx: (libc)Hyperbolic Functions. * ccoshl: (libc)Hyperbolic Functions. * ccosl: (libc)Trig Functions. * ceil: (libc)Rounding Functions. * ceilf: (libc)Rounding Functions. * ceilfN: (libc)Rounding Functions. * ceilfNx: (libc)Rounding Functions. * ceill: (libc)Rounding Functions. * cexp: (libc)Exponents and Logarithms. * cexpf: (libc)Exponents and Logarithms. * cexpfN: (libc)Exponents and Logarithms. * cexpfNx: (libc)Exponents and Logarithms. * cexpl: (libc)Exponents and Logarithms. * cfgetibaud: (libc)Line Speed. * cfgetispeed: (libc)Line Speed. * cfgetobaud: (libc)Line Speed. * cfgetospeed: (libc)Line Speed. * cfmakeraw: (libc)Noncanonical Input. * cfsetbaud: (libc)Line Speed. * cfsetibaud: (libc)Line Speed. * cfsetispeed: (libc)Line Speed. * cfsetobaud: (libc)Line Speed. * cfsetospeed: (libc)Line Speed. * cfsetspeed: (libc)Line Speed. * chdir: (libc)Working Directory. * chmod: (libc)Setting Permissions. * chown: (libc)File Owner. * cimag: (libc)Operations on Complex. * cimagf: (libc)Operations on Complex. * cimagfN: (libc)Operations on Complex. * cimagfNx: (libc)Operations on Complex. * cimagl: (libc)Operations on Complex. * clearenv: (libc)Environment Access. * clearerr: (libc)Error Recovery. * clearerr_unlocked: (libc)Error Recovery. * clock: (libc)CPU Time. * clock_getres: (libc)Getting the Time. * clock_gettime: (libc)Getting the Time. * clock_nanosleep: (libc)Sleeping. * clock_settime: (libc)Setting and Adjusting the Time. * clog10: (libc)Exponents and Logarithms. * clog10f: (libc)Exponents and Logarithms. * clog10fN: (libc)Exponents and Logarithms. * clog10fNx: (libc)Exponents and Logarithms. * clog10l: (libc)Exponents and Logarithms. * clog: (libc)Exponents and Logarithms. * clogf: (libc)Exponents and Logarithms. * clogfN: (libc)Exponents and Logarithms. * clogfNx: (libc)Exponents and Logarithms. * clogl: (libc)Exponents and Logarithms. * close: (libc)Opening and Closing Files. * close_range: (libc)Opening and Closing Files. * closedir: (libc)Reading/Closing Directory. * closefrom: (libc)Opening and Closing Files. * closelog: (libc)closelog. * cnd_broadcast: (libc)ISO C Condition Variables. * cnd_destroy: (libc)ISO C Condition Variables. * cnd_init: (libc)ISO C Condition Variables. * cnd_signal: (libc)ISO C Condition Variables. * cnd_timedwait: (libc)ISO C Condition Variables. * cnd_wait: (libc)ISO C Condition Variables. * compoundn: (libc)Exponents and Logarithms. * compoundnf: (libc)Exponents and Logarithms. * compoundnfN: (libc)Exponents and Logarithms. * compoundnfNx: (libc)Exponents and Logarithms. * compoundnl: (libc)Exponents and Logarithms. * confstr: (libc)String Parameters. * conj: (libc)Operations on Complex. * conjf: (libc)Operations on Complex. * conjfN: (libc)Operations on Complex. * conjfNx: (libc)Operations on Complex. * conjl: (libc)Operations on Complex. * connect: (libc)Connecting. * copy_file_range: (libc)Copying File Data. * copysign: (libc)FP Bit Twiddling. * copysignf: (libc)FP Bit Twiddling. * copysignfN: (libc)FP Bit Twiddling. * copysignfNx: (libc)FP Bit Twiddling. * copysignl: (libc)FP Bit Twiddling. * cos: (libc)Trig Functions. * cosf: (libc)Trig Functions. * cosfN: (libc)Trig Functions. * cosfNx: (libc)Trig Functions. * cosh: (libc)Hyperbolic Functions. * coshf: (libc)Hyperbolic Functions. * coshfN: (libc)Hyperbolic Functions. * coshfNx: (libc)Hyperbolic Functions. * coshl: (libc)Hyperbolic Functions. * cosl: (libc)Trig Functions. * cospi: (libc)Trig Functions. * cospif: (libc)Trig Functions. * cospifN: (libc)Trig Functions. * cospifNx: (libc)Trig Functions. * cospil: (libc)Trig Functions. * cpow: (libc)Exponents and Logarithms. * cpowf: (libc)Exponents and Logarithms. * cpowfN: (libc)Exponents and Logarithms. * cpowfNx: (libc)Exponents and Logarithms. * cpowl: (libc)Exponents and Logarithms. * cproj: (libc)Operations on Complex. * cprojf: (libc)Operations on Complex. * cprojfN: (libc)Operations on Complex. * cprojfNx: (libc)Operations on Complex. * cprojl: (libc)Operations on Complex. * creal: (libc)Operations on Complex. * crealf: (libc)Operations on Complex. * crealfN: (libc)Operations on Complex. * crealfNx: (libc)Operations on Complex. * creall: (libc)Operations on Complex. * creat64: (libc)Opening and Closing Files. * creat: (libc)Opening and Closing Files. * csin: (libc)Trig Functions. * csinf: (libc)Trig Functions. * csinfN: (libc)Trig Functions. * csinfNx: (libc)Trig Functions. * csinh: (libc)Hyperbolic Functions. * csinhf: (libc)Hyperbolic Functions. * csinhfN: (libc)Hyperbolic Functions. * csinhfNx: (libc)Hyperbolic Functions. * csinhl: (libc)Hyperbolic Functions. * csinl: (libc)Trig Functions. * csqrt: (libc)Exponents and Logarithms. * csqrtf: (libc)Exponents and Logarithms. * csqrtfN: (libc)Exponents and Logarithms. * csqrtfNx: (libc)Exponents and Logarithms. * csqrtl: (libc)Exponents and Logarithms. * ctan: (libc)Trig Functions. * ctanf: (libc)Trig Functions. * ctanfN: (libc)Trig Functions. * ctanfNx: (libc)Trig Functions. * ctanh: (libc)Hyperbolic Functions. * ctanhf: (libc)Hyperbolic Functions. * ctanhfN: (libc)Hyperbolic Functions. * ctanhfNx: (libc)Hyperbolic Functions. * ctanhl: (libc)Hyperbolic Functions. * ctanl: (libc)Trig Functions. * ctermid: (libc)Identifying the Terminal. * ctime: (libc)Formatting Calendar Time. * ctime_r: (libc)Formatting Calendar Time. * cuserid: (libc)Who Logged In. * daddl: (libc)Misc FP Arithmetic. * dcgettext: (libc)Translation with gettext. * dcngettext: (libc)Advanced gettext functions. * ddivl: (libc)Misc FP Arithmetic. * dfmal: (libc)Misc FP Arithmetic. * dgettext: (libc)Translation with gettext. * difftime: (libc)Calculating Elapsed Time. * dirfd: (libc)Opening a Directory. * dirname: (libc)Finding Tokens in a String. * div: (libc)Integer Division. * dlinfo: (libc)Dynamic Linker Introspection. * dmull: (libc)Misc FP Arithmetic. * dngettext: (libc)Advanced gettext functions. * dprintf: (libc)Formatted Output Functions. * drand48: (libc)SVID Random. * drand48_r: (libc)SVID Random. * drem: (libc)Remainder Functions. * dremf: (libc)Remainder Functions. * dreml: (libc)Remainder Functions. * dsqrtl: (libc)Misc FP Arithmetic. * dsubl: (libc)Misc FP Arithmetic. * dup2: (libc)Duplicating Descriptors. * dup3: (libc)Duplicating Descriptors. * dup: (libc)Duplicating Descriptors. * ecvt: (libc)System V Number Conversion. * ecvt_r: (libc)System V Number Conversion. * endfsent: (libc)fstab. * endgrent: (libc)Scanning All Groups. * endhostent: (libc)Host Names. * endmntent: (libc)mtab. * endnetent: (libc)Networks Database. * endnetgrent: (libc)Lookup Netgroup. * endprotoent: (libc)Protocols Database. * endpwent: (libc)Scanning All Users. * endservent: (libc)Services Database. * endutent: (libc)Manipulating the Database. * endutxent: (libc)XPG Functions. * envz_add: (libc)Envz Functions. * envz_entry: (libc)Envz Functions. * envz_get: (libc)Envz Functions. * envz_merge: (libc)Envz Functions. * envz_remove: (libc)Envz Functions. * envz_strip: (libc)Envz Functions. * epoll_create: (libc)Other Low-Level I/O APIs. * epoll_wait: (libc)Other Low-Level I/O APIs. * erand48: (libc)SVID Random. * erand48_r: (libc)SVID Random. * erf: (libc)Special Functions. * erfc: (libc)Special Functions. * erfcf: (libc)Special Functions. * erfcfN: (libc)Special Functions. * erfcfNx: (libc)Special Functions. * erfcl: (libc)Special Functions. * erff: (libc)Special Functions. * erffN: (libc)Special Functions. * erffNx: (libc)Special Functions. * erfl: (libc)Special Functions. * err: (libc)Error Messages. * errno: (libc)Checking for Errors. * error: (libc)Error Messages. * error_at_line: (libc)Error Messages. * errx: (libc)Error Messages. * execl: (libc)Executing a File. * execle: (libc)Executing a File. * execlp: (libc)Executing a File. * execv: (libc)Executing a File. * execve: (libc)Executing a File. * execvp: (libc)Executing a File. * exit: (libc)Normal Termination. * exp10: (libc)Exponents and Logarithms. * exp10f: (libc)Exponents and Logarithms. * exp10fN: (libc)Exponents and Logarithms. * exp10fNx: (libc)Exponents and Logarithms. * exp10l: (libc)Exponents and Logarithms. * exp10m1: (libc)Exponents and Logarithms. * exp10m1f: (libc)Exponents and Logarithms. * exp10m1fN: (libc)Exponents and Logarithms. * exp10m1fNx: (libc)Exponents and Logarithms. * exp10m1l: (libc)Exponents and Logarithms. * exp2: (libc)Exponents and Logarithms. * exp2f: (libc)Exponents and Logarithms. * exp2fN: (libc)Exponents and Logarithms. * exp2fNx: (libc)Exponents and Logarithms. * exp2l: (libc)Exponents and Logarithms. * exp2m1: (libc)Exponents and Logarithms. * exp2m1f: (libc)Exponents and Logarithms. * exp2m1fN: (libc)Exponents and Logarithms. * exp2m1fNx: (libc)Exponents and Logarithms. * exp2m1l: (libc)Exponents and Logarithms. * exp: (libc)Exponents and Logarithms. * expf: (libc)Exponents and Logarithms. * expfN: (libc)Exponents and Logarithms. * expfNx: (libc)Exponents and Logarithms. * expl: (libc)Exponents and Logarithms. * explicit_bzero: (libc)Erasing Sensitive Data. * expm1: (libc)Exponents and Logarithms. * expm1f: (libc)Exponents and Logarithms. * expm1fN: (libc)Exponents and Logarithms. * expm1fNx: (libc)Exponents and Logarithms. * expm1l: (libc)Exponents and Logarithms. * fMaddfN: (libc)Misc FP Arithmetic. * fMaddfNx: (libc)Misc FP Arithmetic. * fMdivfN: (libc)Misc FP Arithmetic. * fMdivfNx: (libc)Misc FP Arithmetic. * fMfmafN: (libc)Misc FP Arithmetic. * fMfmafNx: (libc)Misc FP Arithmetic. * fMmulfN: (libc)Misc FP Arithmetic. * fMmulfNx: (libc)Misc FP Arithmetic. * fMsqrtfN: (libc)Misc FP Arithmetic. * fMsqrtfNx: (libc)Misc FP Arithmetic. * fMsubfN: (libc)Misc FP Arithmetic. * fMsubfNx: (libc)Misc FP Arithmetic. * fMxaddfN: (libc)Misc FP Arithmetic. * fMxaddfNx: (libc)Misc FP Arithmetic. * fMxdivfN: (libc)Misc FP Arithmetic. * fMxdivfNx: (libc)Misc FP Arithmetic. * fMxfmafN: (libc)Misc FP Arithmetic. * fMxfmafNx: (libc)Misc FP Arithmetic. * fMxmulfN: (libc)Misc FP Arithmetic. * fMxmulfNx: (libc)Misc FP Arithmetic. * fMxsqrtfN: (libc)Misc FP Arithmetic. * fMxsqrtfNx: (libc)Misc FP Arithmetic. * fMxsubfN: (libc)Misc FP Arithmetic. * fMxsubfNx: (libc)Misc FP Arithmetic. * fabs: (libc)Absolute Value. * fabsf: (libc)Absolute Value. * fabsfN: (libc)Absolute Value. * fabsfNx: (libc)Absolute Value. * fabsl: (libc)Absolute Value. * faccessat: (libc)Testing File Access. * fadd: (libc)Misc FP Arithmetic. * faddl: (libc)Misc FP Arithmetic. * fchdir: (libc)Working Directory. * fchmod: (libc)Setting Permissions. * fchown: (libc)File Owner. * fclose: (libc)Closing Streams. * fcloseall: (libc)Closing Streams. * fcntl: (libc)Control Operations. * fcvt: (libc)System V Number Conversion. * fcvt_r: (libc)System V Number Conversion. * fdatasync: (libc)Synchronizing I/O. * fdim: (libc)Misc FP Arithmetic. * fdimf: (libc)Misc FP Arithmetic. * fdimfN: (libc)Misc FP Arithmetic. * fdimfNx: (libc)Misc FP Arithmetic. * fdiml: (libc)Misc FP Arithmetic. * fdiv: (libc)Misc FP Arithmetic. * fdivl: (libc)Misc FP Arithmetic. * fdopen: (libc)Descriptors and Streams. * fdopendir: (libc)Opening a Directory. * feclearexcept: (libc)Status bit operations. * fedisableexcept: (libc)Control Functions. * feenableexcept: (libc)Control Functions. * fegetenv: (libc)Control Functions. * fegetexcept: (libc)Control Functions. * fegetexceptflag: (libc)Status bit operations. * fegetmode: (libc)Control Functions. * fegetround: (libc)Rounding. * feholdexcept: (libc)Control Functions. * feof: (libc)EOF and Errors. * feof_unlocked: (libc)EOF and Errors. * feraiseexcept: (libc)Status bit operations. * ferror: (libc)EOF and Errors. * ferror_unlocked: (libc)EOF and Errors. * fesetenv: (libc)Control Functions. * fesetexcept: (libc)Status bit operations. * fesetexceptflag: (libc)Status bit operations. * fesetmode: (libc)Control Functions. * fesetround: (libc)Rounding. * fetestexcept: (libc)Status bit operations. * fetestexceptflag: (libc)Status bit operations. * feupdateenv: (libc)Control Functions. * fexecve: (libc)Executing a File. * fflush: (libc)Flushing Buffers. * fflush_unlocked: (libc)Flushing Buffers. * ffma: (libc)Misc FP Arithmetic. * ffmal: (libc)Misc FP Arithmetic. * fgetc: (libc)Character Input. * fgetc_unlocked: (libc)Character Input. * fgetgrent: (libc)Scanning All Groups. * fgetgrent_r: (libc)Scanning All Groups. * fgetpos64: (libc)Portable Positioning. * fgetpos: (libc)Portable Positioning. * fgetpwent: (libc)Scanning All Users. * fgetpwent_r: (libc)Scanning All Users. * fgets: (libc)Line Input. * fgets_unlocked: (libc)Line Input. * fgetwc: (libc)Character Input. * fgetwc_unlocked: (libc)Character Input. * fgetws: (libc)Line Input. * fgetws_unlocked: (libc)Line Input. * fileno: (libc)Descriptors and Streams. * fileno_unlocked: (libc)Descriptors and Streams. * finite: (libc)Floating Point Classes. * finitef: (libc)Floating Point Classes. * finitel: (libc)Floating Point Classes. * flockfile: (libc)Streams and Threads. * floor: (libc)Rounding Functions. * floorf: (libc)Rounding Functions. * floorfN: (libc)Rounding Functions. * floorfNx: (libc)Rounding Functions. * floorl: (libc)Rounding Functions. * fma: (libc)Misc FP Arithmetic. * fmaf: (libc)Misc FP Arithmetic. * fmafN: (libc)Misc FP Arithmetic. * fmafNx: (libc)Misc FP Arithmetic. * fmal: (libc)Misc FP Arithmetic. * fmax: (libc)Misc FP Arithmetic. * fmaxf: (libc)Misc FP Arithmetic. * fmaxfN: (libc)Misc FP Arithmetic. * fmaxfNx: (libc)Misc FP Arithmetic. * fmaximum: (libc)Misc FP Arithmetic. * fmaximum_mag: (libc)Misc FP Arithmetic. * fmaximum_mag_num: (libc)Misc FP Arithmetic. * fmaximum_mag_numf: (libc)Misc FP Arithmetic. * fmaximum_mag_numfN: (libc)Misc FP Arithmetic. * fmaximum_mag_numfNx: (libc)Misc FP Arithmetic. * fmaximum_mag_numl: (libc)Misc FP Arithmetic. * fmaximum_magf: (libc)Misc FP Arithmetic. * fmaximum_magfN: (libc)Misc FP Arithmetic. * fmaximum_magfNx: (libc)Misc FP Arithmetic. * fmaximum_magl: (libc)Misc FP Arithmetic. * fmaximum_num: (libc)Misc FP Arithmetic. * fmaximum_numf: (libc)Misc FP Arithmetic. * fmaximum_numfN: (libc)Misc FP Arithmetic. * fmaximum_numfNx: (libc)Misc FP Arithmetic. * fmaximum_numl: (libc)Misc FP Arithmetic. * fmaximumf: (libc)Misc FP Arithmetic. * fmaximumfN: (libc)Misc FP Arithmetic. * fmaximumfNx: (libc)Misc FP Arithmetic. * fmaximuml: (libc)Misc FP Arithmetic. * fmaxl: (libc)Misc FP Arithmetic. * fmaxmag: (libc)Misc FP Arithmetic. * fmaxmagf: (libc)Misc FP Arithmetic. * fmaxmagfN: (libc)Misc FP Arithmetic. * fmaxmagfNx: (libc)Misc FP Arithmetic. * fmaxmagl: (libc)Misc FP Arithmetic. * fmemopen: (libc)String Streams. * fmin: (libc)Misc FP Arithmetic. * fminf: (libc)Misc FP Arithmetic. * fminfN: (libc)Misc FP Arithmetic. * fminfNx: (libc)Misc FP Arithmetic. * fminimum: (libc)Misc FP Arithmetic. * fminimum_mag: (libc)Misc FP Arithmetic. * fminimum_mag_num: (libc)Misc FP Arithmetic. * fminimum_mag_numf: (libc)Misc FP Arithmetic. * fminimum_mag_numfN: (libc)Misc FP Arithmetic. * fminimum_mag_numfNx: (libc)Misc FP Arithmetic. * fminimum_mag_numl: (libc)Misc FP Arithmetic. * fminimum_magf: (libc)Misc FP Arithmetic. * fminimum_magfN: (libc)Misc FP Arithmetic. * fminimum_magfNx: (libc)Misc FP Arithmetic. * fminimum_magl: (libc)Misc FP Arithmetic. * fminimum_num: (libc)Misc FP Arithmetic. * fminimum_numf: (libc)Misc FP Arithmetic. * fminimum_numfN: (libc)Misc FP Arithmetic. * fminimum_numfNx: (libc)Misc FP Arithmetic. * fminimum_numl: (libc)Misc FP Arithmetic. * fminimumf: (libc)Misc FP Arithmetic. * fminimumfN: (libc)Misc FP Arithmetic. * fminimumfNx: (libc)Misc FP Arithmetic. * fminimuml: (libc)Misc FP Arithmetic. * fminl: (libc)Misc FP Arithmetic. * fminmag: (libc)Misc FP Arithmetic. * fminmagf: (libc)Misc FP Arithmetic. * fminmagfN: (libc)Misc FP Arithmetic. * fminmagfNx: (libc)Misc FP Arithmetic. * fminmagl: (libc)Misc FP Arithmetic. * fmod: (libc)Remainder Functions. * fmodf: (libc)Remainder Functions. * fmodfN: (libc)Remainder Functions. * fmodfNx: (libc)Remainder Functions. * fmodl: (libc)Remainder Functions. * fmtmsg: (libc)Printing Formatted Messages. * fmul: (libc)Misc FP Arithmetic. * fmull: (libc)Misc FP Arithmetic. * fnmatch: (libc)Wildcard Matching. * fopen64: (libc)Opening Streams. * fopen: (libc)Opening Streams. * fopencookie: (libc)Streams and Cookies. * fork: (libc)Creating a Process. * forkpty: (libc)Pseudo-Terminal Pairs. * fpathconf: (libc)Pathconf. * fpclassify: (libc)Floating Point Classes. * fprintf: (libc)Formatted Output Functions. * fputc: (libc)Simple Output. * fputc_unlocked: (libc)Simple Output. * fputs: (libc)Simple Output. * fputs_unlocked: (libc)Simple Output. * fputwc: (libc)Simple Output. * fputwc_unlocked: (libc)Simple Output. * fputws: (libc)Simple Output. * fputws_unlocked: (libc)Simple Output. * fread: (libc)Block Input/Output. * fread_unlocked: (libc)Block Input/Output. * free: (libc)Freeing after Malloc. * freopen64: (libc)Opening Streams. * freopen: (libc)Opening Streams. * frexp: (libc)Normalization Functions. * frexpf: (libc)Normalization Functions. * frexpfN: (libc)Normalization Functions. * frexpfNx: (libc)Normalization Functions. * frexpl: (libc)Normalization Functions. * fromfp: (libc)Rounding Functions. * fromfpf: (libc)Rounding Functions. * fromfpfN: (libc)Rounding Functions. * fromfpfNx: (libc)Rounding Functions. * fromfpl: (libc)Rounding Functions. * fromfpx: (libc)Rounding Functions. * fromfpxf: (libc)Rounding Functions. * fromfpxfN: (libc)Rounding Functions. * fromfpxfNx: (libc)Rounding Functions. * fromfpxl: (libc)Rounding Functions. * fscanf: (libc)Formatted Input Functions. * fseek: (libc)File Positioning. * fseeko64: (libc)File Positioning. * fseeko: (libc)File Positioning. * fsetpos64: (libc)Portable Positioning. * fsetpos: (libc)Portable Positioning. * fsqrt: (libc)Misc FP Arithmetic. * fsqrtl: (libc)Misc FP Arithmetic. * fstat64: (libc)Reading Attributes. * fstat: (libc)Reading Attributes. * fstatat64: (libc)Reading Attributes. * fstatat: (libc)Reading Attributes. * fsub: (libc)Misc FP Arithmetic. * fsubl: (libc)Misc FP Arithmetic. * fsync: (libc)Synchronizing I/O. * ftell: (libc)File Positioning. * ftello64: (libc)File Positioning. * ftello: (libc)File Positioning. * ftruncate64: (libc)File Size. * ftruncate: (libc)File Size. * ftrylockfile: (libc)Streams and Threads. * ftw64: (libc)Working with Directory Trees. * ftw: (libc)Working with Directory Trees. * funlockfile: (libc)Streams and Threads. * futimens: (libc)File Times. * futimes: (libc)File Times. * fwide: (libc)Streams and I18N. * fwprintf: (libc)Formatted Output Functions. * fwrite: (libc)Block Input/Output. * fwrite_unlocked: (libc)Block Input/Output. * fwscanf: (libc)Formatted Input Functions. * gamma: (libc)Special Functions. * gammaf: (libc)Special Functions. * gammal: (libc)Special Functions. * gcvt: (libc)System V Number Conversion. * get_avphys_pages: (libc)Query Memory Parameters. * get_current_dir_name: (libc)Working Directory. * get_nprocs: (libc)Processor Resources. * get_nprocs_conf: (libc)Processor Resources. * get_phys_pages: (libc)Query Memory Parameters. * getauxval: (libc)Auxiliary Vector. * getc: (libc)Character Input. * getc_unlocked: (libc)Character Input. * getchar: (libc)Character Input. * getchar_unlocked: (libc)Character Input. * getcontext: (libc)System V contexts. * getcpu: (libc)CPU Affinity. * getcwd: (libc)Working Directory. * getdate: (libc)General Time String Parsing. * getdate_r: (libc)General Time String Parsing. * getdelim: (libc)Line Input. * getdents64: (libc)Low-level Directory Access. * getdomainnname: (libc)Host Identification. * getegid: (libc)Reading Persona. * getentropy: (libc)Unpredictable Bytes. * getenv: (libc)Environment Access. * geteuid: (libc)Reading Persona. * getfsent: (libc)fstab. * getfsfile: (libc)fstab. * getfsspec: (libc)fstab. * getgid: (libc)Reading Persona. * getgrent: (libc)Scanning All Groups. * getgrent_r: (libc)Scanning All Groups. * getgrgid: (libc)Lookup Group. * getgrgid_r: (libc)Lookup Group. * getgrnam: (libc)Lookup Group. * getgrnam_r: (libc)Lookup Group. * getgrouplist: (libc)Setting Groups. * getgroups: (libc)Reading Persona. * gethostbyaddr: (libc)Host Names. * gethostbyaddr_r: (libc)Host Names. * gethostbyname2: (libc)Host Names. * gethostbyname2_r: (libc)Host Names. * gethostbyname: (libc)Host Names. * gethostbyname_r: (libc)Host Names. * gethostent: (libc)Host Names. * gethostid: (libc)Host Identification. * gethostname: (libc)Host Identification. * getitimer: (libc)Setting an Alarm. * getline: (libc)Line Input. * getloadavg: (libc)Processor Resources. * getlogin: (libc)Who Logged In. * getmntent: (libc)mtab. * getmntent_r: (libc)mtab. * getnetbyaddr: (libc)Networks Database. * getnetbyname: (libc)Networks Database. * getnetent: (libc)Networks Database. * getnetgrent: (libc)Lookup Netgroup. * getnetgrent_r: (libc)Lookup Netgroup. * getopt: (libc)Using Getopt. * getopt_long: (libc)Getopt Long Options. * getopt_long_only: (libc)Getopt Long Options. * getpagesize: (libc)Query Memory Parameters. * getpass: (libc)getpass. * getpayload: (libc)FP Bit Twiddling. * getpayloadf: (libc)FP Bit Twiddling. * getpayloadfN: (libc)FP Bit Twiddling. * getpayloadfNx: (libc)FP Bit Twiddling. * getpayloadl: (libc)FP Bit Twiddling. * getpeername: (libc)Who is Connected. * getpgid: (libc)Process Group Functions. * getpgrp: (libc)Process Group Functions. * getpid: (libc)Process Identification. * getppid: (libc)Process Identification. * getpriority: (libc)Traditional Scheduling Functions. * getprotobyname: (libc)Protocols Database. * getprotobynumber: (libc)Protocols Database. * getprotoent: (libc)Protocols Database. * getpt: (libc)Allocation. * getpwent: (libc)Scanning All Users. * getpwent_r: (libc)Scanning All Users. * getpwnam: (libc)Lookup User. * getpwnam_r: (libc)Lookup User. * getpwuid: (libc)Lookup User. * getpwuid_r: (libc)Lookup User. * getrandom: (libc)Unpredictable Bytes. * getrlimit64: (libc)Limits on Resources. * getrlimit: (libc)Limits on Resources. * getrusage: (libc)Resource Usage. * gets: (libc)Line Input. * getservbyname: (libc)Services Database. * getservbyport: (libc)Services Database. * getservent: (libc)Services Database. * getsid: (libc)Process Group Functions. * getsockname: (libc)Reading Address. * getsockopt: (libc)Socket Option Functions. * getsubopt: (libc)Suboptions. * gettext: (libc)Translation with gettext. * gettid: (libc)Process Identification. * gettimeofday: (libc)Getting the Time. * getuid: (libc)Reading Persona. * getumask: (libc)Setting Permissions. * getutent: (libc)Manipulating the Database. * getutent_r: (libc)Manipulating the Database. * getutid: (libc)Manipulating the Database. * getutid_r: (libc)Manipulating the Database. * getutline: (libc)Manipulating the Database. * getutline_r: (libc)Manipulating the Database. * getutmp: (libc)XPG Functions. * getutmpx: (libc)XPG Functions. * getutxent: (libc)XPG Functions. * getutxid: (libc)XPG Functions. * getutxline: (libc)XPG Functions. * getw: (libc)Character Input. * getwc: (libc)Character Input. * getwc_unlocked: (libc)Character Input. * getwchar: (libc)Character Input. * getwchar_unlocked: (libc)Character Input. * getwd: (libc)Working Directory. * glob64: (libc)Calling Glob. * glob: (libc)Calling Glob. * globfree64: (libc)More Flags for Globbing. * globfree: (libc)More Flags for Globbing. * gmtime: (libc)Broken-down Time. * gmtime_r: (libc)Broken-down Time. * grantpt: (libc)Allocation. * gsignal: (libc)Signaling Yourself. * gtty: (libc)BSD Terminal Modes. * hasmntopt: (libc)mtab. * hcreate: (libc)Hash Search Function. * hcreate_r: (libc)Hash Search Function. * hdestroy: (libc)Hash Search Function. * hdestroy_r: (libc)Hash Search Function. * hsearch: (libc)Hash Search Function. * hsearch_r: (libc)Hash Search Function. * htonl: (libc)Byte Order. * htons: (libc)Byte Order. * hypot: (libc)Exponents and Logarithms. * hypotf: (libc)Exponents and Logarithms. * hypotfN: (libc)Exponents and Logarithms. * hypotfNx: (libc)Exponents and Logarithms. * hypotl: (libc)Exponents and Logarithms. * iconv: (libc)Generic Conversion Interface. * iconv_close: (libc)Generic Conversion Interface. * iconv_open: (libc)Generic Conversion Interface. * if_freenameindex: (libc)Interface Naming. * if_indextoname: (libc)Interface Naming. * if_nameindex: (libc)Interface Naming. * if_nametoindex: (libc)Interface Naming. * ilogb: (libc)Exponents and Logarithms. * ilogbf: (libc)Exponents and Logarithms. * ilogbfN: (libc)Exponents and Logarithms. * ilogbfNx: (libc)Exponents and Logarithms. * ilogbl: (libc)Exponents and Logarithms. * imaxabs: (libc)Absolute Value. * imaxdiv: (libc)Integer Division. * in6addr_any: (libc)Host Address Data Type. * in6addr_loopback: (libc)Host Address Data Type. * index: (libc)Search Functions. * inet_addr: (libc)Host Address Functions. * inet_aton: (libc)Host Address Functions. * inet_lnaof: (libc)Host Address Functions. * inet_makeaddr: (libc)Host Address Functions. * inet_netof: (libc)Host Address Functions. * inet_network: (libc)Host Address Functions. * inet_ntoa: (libc)Host Address Functions. * inet_ntop: (libc)Host Address Functions. * inet_pton: (libc)Host Address Functions. * initgroups: (libc)Setting Groups. * initstate: (libc)BSD Random. * initstate_r: (libc)BSD Random. * innetgr: (libc)Netgroup Membership. * ioctl: (libc)IOCTLs. * isalnum: (libc)Classification of Characters. * isalpha: (libc)Classification of Characters. * isascii: (libc)Classification of Characters. * isatty: (libc)Is It a Terminal. * isblank: (libc)Classification of Characters. * iscanonical: (libc)Floating Point Classes. * iscntrl: (libc)Classification of Characters. * isdigit: (libc)Classification of Characters. * iseqsig: (libc)FP Comparison Functions. * isfinite: (libc)Floating Point Classes. * isgraph: (libc)Classification of Characters. * isgreater: (libc)FP Comparison Functions. * isgreaterequal: (libc)FP Comparison Functions. * isinf: (libc)Floating Point Classes. * isinff: (libc)Floating Point Classes. * isinfl: (libc)Floating Point Classes. * isless: (libc)FP Comparison Functions. * islessequal: (libc)FP Comparison Functions. * islessgreater: (libc)FP Comparison Functions. * islower: (libc)Classification of Characters. * isnan: (libc)Floating Point Classes. * isnan: (libc)Floating Point Classes. * isnanf: (libc)Floating Point Classes. * isnanl: (libc)Floating Point Classes. * isnormal: (libc)Floating Point Classes. * isprint: (libc)Classification of Characters. * ispunct: (libc)Classification of Characters. * issignaling: (libc)Floating Point Classes. * isspace: (libc)Classification of Characters. * issubnormal: (libc)Floating Point Classes. * isunordered: (libc)FP Comparison Functions. * isupper: (libc)Classification of Characters. * iswalnum: (libc)Classification of Wide Characters. * iswalpha: (libc)Classification of Wide Characters. * iswblank: (libc)Classification of Wide Characters. * iswcntrl: (libc)Classification of Wide Characters. * iswctype: (libc)Classification of Wide Characters. * iswdigit: (libc)Classification of Wide Characters. * iswgraph: (libc)Classification of Wide Characters. * iswlower: (libc)Classification of Wide Characters. * iswprint: (libc)Classification of Wide Characters. * iswpunct: (libc)Classification of Wide Characters. * iswspace: (libc)Classification of Wide Characters. * iswupper: (libc)Classification of Wide Characters. * iswxdigit: (libc)Classification of Wide Characters. * isxdigit: (libc)Classification of Characters. * iszero: (libc)Floating Point Classes. * j0: (libc)Special Functions. * j0f: (libc)Special Functions. * j0fN: (libc)Special Functions. * j0fNx: (libc)Special Functions. * j0l: (libc)Special Functions. * j1: (libc)Special Functions. * j1f: (libc)Special Functions. * j1fN: (libc)Special Functions. * j1fNx: (libc)Special Functions. * j1l: (libc)Special Functions. * jn: (libc)Special Functions. * jnf: (libc)Special Functions. * jnfN: (libc)Special Functions. * jnfNx: (libc)Special Functions. * jnl: (libc)Special Functions. * jrand48: (libc)SVID Random. * jrand48_r: (libc)SVID Random. * kill: (libc)Signaling Another Process. * killpg: (libc)Signaling Another Process. * l64a: (libc)Encode Binary Data. * labs: (libc)Absolute Value. * lcong48: (libc)SVID Random. * lcong48_r: (libc)SVID Random. * ldexp: (libc)Normalization Functions. * ldexpf: (libc)Normalization Functions. * ldexpfN: (libc)Normalization Functions. * ldexpfNx: (libc)Normalization Functions. * ldexpl: (libc)Normalization Functions. * ldiv: (libc)Integer Division. * lfind: (libc)Array Search Function. * lgamma: (libc)Special Functions. * lgamma_r: (libc)Special Functions. * lgammaf: (libc)Special Functions. * lgammafN: (libc)Special Functions. * lgammafN_r: (libc)Special Functions. * lgammafNx: (libc)Special Functions. * lgammafNx_r: (libc)Special Functions. * lgammaf_r: (libc)Special Functions. * lgammal: (libc)Special Functions. * lgammal_r: (libc)Special Functions. * link: (libc)Hard Links. * linkat: (libc)Hard Links. * lio_listio64: (libc)Asynchronous Reads/Writes. * lio_listio: (libc)Asynchronous Reads/Writes. * listen: (libc)Listening. * llabs: (libc)Absolute Value. * lldiv: (libc)Integer Division. * llogb: (libc)Exponents and Logarithms. * llogbf: (libc)Exponents and Logarithms. * llogbfN: (libc)Exponents and Logarithms. * llogbfNx: (libc)Exponents and Logarithms. * llogbl: (libc)Exponents and Logarithms. * llrint: (libc)Rounding Functions. * llrintf: (libc)Rounding Functions. * llrintfN: (libc)Rounding Functions. * llrintfNx: (libc)Rounding Functions. * llrintl: (libc)Rounding Functions. * llround: (libc)Rounding Functions. * llroundf: (libc)Rounding Functions. * llroundfN: (libc)Rounding Functions. * llroundfNx: (libc)Rounding Functions. * llroundl: (libc)Rounding Functions. * localeconv: (libc)The Lame Way to Locale Data. * localtime: (libc)Broken-down Time. * localtime_r: (libc)Broken-down Time. * log10: (libc)Exponents and Logarithms. * log10f: (libc)Exponents and Logarithms. * log10fN: (libc)Exponents and Logarithms. * log10fNx: (libc)Exponents and Logarithms. * log10l: (libc)Exponents and Logarithms. * log10p1: (libc)Exponents and Logarithms. * log10p1f: (libc)Exponents and Logarithms. * log10p1fN: (libc)Exponents and Logarithms. * log10p1fNx: (libc)Exponents and Logarithms. * log10p1l: (libc)Exponents and Logarithms. * log1p: (libc)Exponents and Logarithms. * log1pf: (libc)Exponents and Logarithms. * log1pfN: (libc)Exponents and Logarithms. * log1pfNx: (libc)Exponents and Logarithms. * log1pl: (libc)Exponents and Logarithms. * log2: (libc)Exponents and Logarithms. * log2f: (libc)Exponents and Logarithms. * log2fN: (libc)Exponents and Logarithms. * log2fNx: (libc)Exponents and Logarithms. * log2l: (libc)Exponents and Logarithms. * log2p1: (libc)Exponents and Logarithms. * log2p1f: (libc)Exponents and Logarithms. * log2p1fN: (libc)Exponents and Logarithms. * log2p1fNx: (libc)Exponents and Logarithms. * log2p1l: (libc)Exponents and Logarithms. * log: (libc)Exponents and Logarithms. * logb: (libc)Exponents and Logarithms. * logbf: (libc)Exponents and Logarithms. * logbfN: (libc)Exponents and Logarithms. * logbfNx: (libc)Exponents and Logarithms. * logbl: (libc)Exponents and Logarithms. * logf: (libc)Exponents and Logarithms. * logfN: (libc)Exponents and Logarithms. * logfNx: (libc)Exponents and Logarithms. * login: (libc)Logging In and Out. * login_tty: (libc)Logging In and Out. * logl: (libc)Exponents and Logarithms. * logout: (libc)Logging In and Out. * logp1: (libc)Exponents and Logarithms. * logp1f: (libc)Exponents and Logarithms. * logp1fN: (libc)Exponents and Logarithms. * logp1fNx: (libc)Exponents and Logarithms. * logp1l: (libc)Exponents and Logarithms. * logwtmp: (libc)Logging In and Out. * longjmp: (libc)Non-Local Details. * lrand48: (libc)SVID Random. * lrand48_r: (libc)SVID Random. * lrint: (libc)Rounding Functions. * lrintf: (libc)Rounding Functions. * lrintfN: (libc)Rounding Functions. * lrintfNx: (libc)Rounding Functions. * lrintl: (libc)Rounding Functions. * lround: (libc)Rounding Functions. * lroundf: (libc)Rounding Functions. * lroundfN: (libc)Rounding Functions. * lroundfNx: (libc)Rounding Functions. * lroundl: (libc)Rounding Functions. * lsearch: (libc)Array Search Function. * lseek64: (libc)File Position Primitive. * lseek: (libc)File Position Primitive. * lstat64: (libc)Reading Attributes. * lstat: (libc)Reading Attributes. * lutimes: (libc)File Times. * madvise: (libc)Memory-mapped I/O. * makecontext: (libc)System V contexts. * mallinfo2: (libc)Statistics of Malloc. * malloc: (libc)Basic Allocation. * mallopt: (libc)Malloc Tunable Parameters. * mblen: (libc)Non-reentrant Character Conversion. * mbrlen: (libc)Converting a Character. * mbrtowc: (libc)Converting a Character. * mbsinit: (libc)Keeping the state. * mbsnrtowcs: (libc)Converting Strings. * mbsrtowcs: (libc)Converting Strings. * mbstowcs: (libc)Non-reentrant String Conversion. * mbtowc: (libc)Non-reentrant Character Conversion. * mcheck: (libc)Heap Consistency Checking. * memalign: (libc)Aligned Memory Blocks. * memccpy: (libc)Copying Strings and Arrays. * memchr: (libc)Search Functions. * memcmp: (libc)String/Array Comparison. * memcpy: (libc)Copying Strings and Arrays. * memfd_create: (libc)Memory-mapped I/O. * memfrob: (libc)Obfuscating Data. * memmem: (libc)Search Functions. * memmove: (libc)Copying Strings and Arrays. * mempcpy: (libc)Copying Strings and Arrays. * memrchr: (libc)Search Functions. * memset: (libc)Copying Strings and Arrays. * mkdir: (libc)Creating Directories. * mkdirat: (libc)Creating Directories. * mkdtemp: (libc)Temporary Files. * mkfifo: (libc)FIFO Special Files. * mknod: (libc)Making Special Files. * mkstemp: (libc)Temporary Files. * mktemp: (libc)Temporary Files. * mktime: (libc)Broken-down Time. * mlock2: (libc)Page Lock Functions. * mlock: (libc)Page Lock Functions. * mlockall: (libc)Page Lock Functions. * mmap64: (libc)Memory-mapped I/O. * mmap: (libc)Memory-mapped I/O. * modf: (libc)Rounding Functions. * modff: (libc)Rounding Functions. * modffN: (libc)Rounding Functions. * modffNx: (libc)Rounding Functions. * modfl: (libc)Rounding Functions. * mount: (libc)Mount-Unmount-Remount. * mprobe: (libc)Heap Consistency Checking. * mprotect: (libc)Memory Protection. * mrand48: (libc)SVID Random. * mrand48_r: (libc)SVID Random. * mremap: (libc)Memory-mapped I/O. * msync: (libc)Memory-mapped I/O. * mtrace: (libc)Tracing malloc. * mtx_destroy: (libc)ISO C Mutexes. * mtx_init: (libc)ISO C Mutexes. * mtx_lock: (libc)ISO C Mutexes. * mtx_timedlock: (libc)ISO C Mutexes. * mtx_trylock: (libc)ISO C Mutexes. * mtx_unlock: (libc)ISO C Mutexes. * munlock: (libc)Page Lock Functions. * munlockall: (libc)Page Lock Functions. * munmap: (libc)Memory-mapped I/O. * muntrace: (libc)Tracing malloc. * nan: (libc)FP Bit Twiddling. * nanf: (libc)FP Bit Twiddling. * nanfN: (libc)FP Bit Twiddling. * nanfNx: (libc)FP Bit Twiddling. * nanl: (libc)FP Bit Twiddling. * nanosleep: (libc)Sleeping. * nearbyint: (libc)Rounding Functions. * nearbyintf: (libc)Rounding Functions. * nearbyintfN: (libc)Rounding Functions. * nearbyintfNx: (libc)Rounding Functions. * nearbyintl: (libc)Rounding Functions. * nextafter: (libc)FP Bit Twiddling. * nextafterf: (libc)FP Bit Twiddling. * nextafterfN: (libc)FP Bit Twiddling. * nextafterfNx: (libc)FP Bit Twiddling. * nextafterl: (libc)FP Bit Twiddling. * nextdown: (libc)FP Bit Twiddling. * nextdownf: (libc)FP Bit Twiddling. * nextdownfN: (libc)FP Bit Twiddling. * nextdownfNx: (libc)FP Bit Twiddling. * nextdownl: (libc)FP Bit Twiddling. * nexttoward: (libc)FP Bit Twiddling. * nexttowardf: (libc)FP Bit Twiddling. * nexttowardl: (libc)FP Bit Twiddling. * nextup: (libc)FP Bit Twiddling. * nextupf: (libc)FP Bit Twiddling. * nextupfN: (libc)FP Bit Twiddling. * nextupfNx: (libc)FP Bit Twiddling. * nextupl: (libc)FP Bit Twiddling. * nftw64: (libc)Working with Directory Trees. * nftw: (libc)Working with Directory Trees. * ngettext: (libc)Advanced gettext functions. * nice: (libc)Traditional Scheduling Functions. * nl_langinfo: (libc)The Elegant and Fast Way. * nrand48: (libc)SVID Random. * nrand48_r: (libc)SVID Random. * ntohl: (libc)Byte Order. * ntohs: (libc)Byte Order. * ntp_adjtime: (libc)Setting and Adjusting the Time. * ntp_gettime: (libc)Setting and Adjusting the Time. * obstack_1grow: (libc)Growing Objects. * obstack_1grow_fast: (libc)Extra Fast Growing. * obstack_alignment_mask: (libc)Obstacks Data Alignment. * obstack_alloc: (libc)Allocation in an Obstack. * obstack_base: (libc)Status of an Obstack. * obstack_blank: (libc)Growing Objects. * obstack_blank_fast: (libc)Extra Fast Growing. * obstack_chunk_size: (libc)Obstack Chunks. * obstack_copy0: (libc)Allocation in an Obstack. * obstack_copy: (libc)Allocation in an Obstack. * obstack_finish: (libc)Growing Objects. * obstack_free: (libc)Freeing Obstack Objects. * obstack_grow0: (libc)Growing Objects. * obstack_grow: (libc)Growing Objects. * obstack_init: (libc)Preparing for Obstacks. * obstack_int_grow: (libc)Growing Objects. * obstack_int_grow_fast: (libc)Extra Fast Growing. * obstack_next_free: (libc)Status of an Obstack. * obstack_object_size: (libc)Growing Objects. * obstack_object_size: (libc)Status of an Obstack. * obstack_printf: (libc)Dynamic Output. * obstack_ptr_grow: (libc)Growing Objects. * obstack_ptr_grow_fast: (libc)Extra Fast Growing. * obstack_room: (libc)Extra Fast Growing. * obstack_vprintf: (libc)Variable Arguments Output. * offsetof: (libc)Structure Measurement. * on_exit: (libc)Cleanups on Exit. * open64: (libc)Opening and Closing Files. * open: (libc)Opening and Closing Files. * open_memstream: (libc)String Streams. * openat64: (libc)Opening and Closing Files. * openat: (libc)Opening and Closing Files. * opendir: (libc)Opening a Directory. * openlog: (libc)openlog. * openpty: (libc)Pseudo-Terminal Pairs. * parse_printf_format: (libc)Parsing a Template String. * pathconf: (libc)Pathconf. * pause: (libc)Using Pause. * pclose: (libc)Pipe to a Subprocess. * perror: (libc)Error Messages. * pidfd_getpid: (libc)Querying a Process. * pipe: (libc)Creating a Pipe. * pkey_alloc: (libc)Memory Protection. * pkey_free: (libc)Memory Protection. * pkey_get: (libc)Memory Protection. * pkey_mprotect: (libc)Memory Protection. * pkey_set: (libc)Memory Protection. * poll: (libc)Other Low-Level I/O APIs. * popen: (libc)Pipe to a Subprocess. * posix_fallocate64: (libc)Storage Allocation. * posix_fallocate: (libc)Storage Allocation. * posix_memalign: (libc)Aligned Memory Blocks. * posix_openpt: (libc)Allocation. * pow: (libc)Exponents and Logarithms. * powf: (libc)Exponents and Logarithms. * powfN: (libc)Exponents and Logarithms. * powfNx: (libc)Exponents and Logarithms. * powl: (libc)Exponents and Logarithms. * pown: (libc)Exponents and Logarithms. * pownf: (libc)Exponents and Logarithms. * pownfN: (libc)Exponents and Logarithms. * pownfNx: (libc)Exponents and Logarithms. * pownl: (libc)Exponents and Logarithms. * powr: (libc)Exponents and Logarithms. * powrf: (libc)Exponents and Logarithms. * powrfN: (libc)Exponents and Logarithms. * powrfNx: (libc)Exponents and Logarithms. * powrl: (libc)Exponents and Logarithms. * pread64: (libc)I/O Primitives. * pread: (libc)I/O Primitives. * preadv2: (libc)Scatter-Gather. * preadv64: (libc)Scatter-Gather. * preadv64v2: (libc)Scatter-Gather. * preadv: (libc)Scatter-Gather. * printf: (libc)Formatted Output Functions. * printf_size: (libc)Predefined Printf Handlers. * printf_size_info: (libc)Predefined Printf Handlers. * psignal: (libc)Signal Messages. * pthread_attr_destroy: (libc)Creating and Destroying Threads. * pthread_attr_getaffinity_np: (libc)Thread CPU Affinity. * pthread_attr_getdetachstate: (libc)Creating and Destroying Threads. * pthread_attr_getsigmask_np: (libc)Initial Thread Signal Mask. * pthread_attr_init: (libc)Creating and Destroying Threads. * pthread_attr_setaffinity_np: (libc)Thread CPU Affinity. * pthread_attr_setdetachstate: (libc)Creating and Destroying Threads. * pthread_attr_setsigmask_np: (libc)Initial Thread Signal Mask. * pthread_barrier_destroy: (libc)POSIX Barriers. * pthread_barrier_init: (libc)POSIX Barriers. * pthread_barrier_wait: (libc)POSIX Barriers. * pthread_clockjoin_np: (libc)Joining Threads. * pthread_cond_clockwait: (libc)Waiting with Explicit Clocks. * pthread_create: (libc)Creating and Destroying Threads. * pthread_detach: (libc)Creating and Destroying Threads. * pthread_equal: (libc)POSIX Threads Other APIs. * pthread_getaffinity_np: (libc)Thread CPU Affinity. * pthread_getattr_default_np: (libc)Default Thread Attributes. * pthread_getcpuclockid: (libc)POSIX Threads Other APIs. * pthread_getname_np: (libc)Thread Names. * pthread_getspecific: (libc)Thread-specific Data. * pthread_gettid_np: (libc)Process Identification. * pthread_join: (libc)Creating and Destroying Threads. * pthread_key_create: (libc)Thread-specific Data. * pthread_key_delete: (libc)Thread-specific Data. * pthread_kill: (libc)Creating and Destroying Threads. * pthread_mutex_clocklock: (libc)POSIX Mutexes. * pthread_mutex_destroy: (libc)POSIX Mutexes. * pthread_mutex_init: (libc)POSIX Mutexes. * pthread_mutex_lock: (libc)POSIX Mutexes. * pthread_mutex_timedlock: (libc)POSIX Mutexes. * pthread_mutex_trylock: (libc)POSIX Mutexes. * pthread_mutex_unlock: (libc)POSIX Mutexes. * pthread_mutexattr_destroy: (libc)POSIX Mutexes. * pthread_mutexattr_gettype: (libc)POSIX Mutexes. * pthread_mutexattr_init: (libc)POSIX Mutexes. * pthread_mutexattr_settype: (libc)POSIX Mutexes. * pthread_once: (libc)POSIX Threads Other APIs. * pthread_rwlock_clockrdlock: (libc)Waiting with Explicit Clocks. * pthread_rwlock_clockwrlock: (libc)Waiting with Explicit Clocks. * pthread_self: (libc)Creating and Destroying Threads. * pthread_setaffinity_np: (libc)Thread CPU Affinity. * pthread_setattr_default_np: (libc)Default Thread Attributes. * pthread_setname_np: (libc)Thread Names. * pthread_setspecific: (libc)Thread-specific Data. * pthread_sigmask: (libc)POSIX Threads Other APIs. * pthread_spin_destroy: (libc)POSIX Spin Locks. * pthread_spin_init: (libc)POSIX Spin Locks. * pthread_spin_lock: (libc)POSIX Spin Locks. * pthread_spin_trylock: (libc)POSIX Spin Locks. * pthread_spin_unlock: (libc)POSIX Spin Locks. * pthread_timedjoin_np: (libc)Joining Threads. * pthread_tryjoin_np: (libc)Joining Threads. * ptsname: (libc)Allocation. * ptsname_r: (libc)Allocation. * putc: (libc)Simple Output. * putc_unlocked: (libc)Simple Output. * putchar: (libc)Simple Output. * putchar_unlocked: (libc)Simple Output. * putenv: (libc)Environment Access. * putpwent: (libc)Writing a User Entry. * puts: (libc)Simple Output. * pututline: (libc)Manipulating the Database. * pututxline: (libc)XPG Functions. * putw: (libc)Simple Output. * putwc: (libc)Simple Output. * putwc_unlocked: (libc)Simple Output. * putwchar: (libc)Simple Output. * putwchar_unlocked: (libc)Simple Output. * pwrite64: (libc)I/O Primitives. * pwrite: (libc)I/O Primitives. * pwritev2: (libc)Scatter-Gather. * pwritev64: (libc)Scatter-Gather. * pwritev64v2: (libc)Scatter-Gather. * pwritev: (libc)Scatter-Gather. * qecvt: (libc)System V Number Conversion. * qecvt_r: (libc)System V Number Conversion. * qfcvt: (libc)System V Number Conversion. * qfcvt_r: (libc)System V Number Conversion. * qgcvt: (libc)System V Number Conversion. * qsort: (libc)Array Sort Function. * raise: (libc)Signaling Yourself. * rand: (libc)ISO Random. * rand_r: (libc)ISO Random. * random: (libc)BSD Random. * random_r: (libc)BSD Random. * rawmemchr: (libc)Search Functions. * read: (libc)I/O Primitives. * readdir64: (libc)Reading/Closing Directory. * readdir64_r: (libc)Reading/Closing Directory. * readdir: (libc)Reading/Closing Directory. * readdir_r: (libc)Reading/Closing Directory. * readlink: (libc)Symbolic Links. * readv: (libc)Scatter-Gather. * realloc: (libc)Changing Block Size. * reallocarray: (libc)Changing Block Size. * realpath: (libc)Symbolic Links. * recv: (libc)Receiving Data. * recvfrom: (libc)Receiving Datagrams. * recvmsg: (libc)Other Socket APIs. * regcomp: (libc)POSIX Regexp Compilation. * regerror: (libc)Regexp Cleanup. * regexec: (libc)Matching POSIX Regexps. * regfree: (libc)Regexp Cleanup. * register_printf_function: (libc)Registering New Conversions. * remainder: (libc)Remainder Functions. * remainderf: (libc)Remainder Functions. * remainderfN: (libc)Remainder Functions. * remainderfNx: (libc)Remainder Functions. * remainderl: (libc)Remainder Functions. * remove: (libc)Deleting Files. * rename: (libc)Renaming Files. * renameat: (libc)Renaming Files. * rewind: (libc)File Positioning. * rewinddir: (libc)Random Access Directory. * rindex: (libc)Search Functions. * rint: (libc)Rounding Functions. * rintf: (libc)Rounding Functions. * rintfN: (libc)Rounding Functions. * rintfNx: (libc)Rounding Functions. * rintl: (libc)Rounding Functions. * rmdir: (libc)Deleting Files. * rootn: (libc)Exponents and Logarithms. * rootnf: (libc)Exponents and Logarithms. * rootnfN: (libc)Exponents and Logarithms. * rootnfNx: (libc)Exponents and Logarithms. * rootnl: (libc)Exponents and Logarithms. * round: (libc)Rounding Functions. * roundeven: (libc)Rounding Functions. * roundevenf: (libc)Rounding Functions. * roundevenfN: (libc)Rounding Functions. * roundevenfNx: (libc)Rounding Functions. * roundevenl: (libc)Rounding Functions. * roundf: (libc)Rounding Functions. * roundfN: (libc)Rounding Functions. * roundfNx: (libc)Rounding Functions. * roundl: (libc)Rounding Functions. * rpmatch: (libc)Yes-or-No Questions. * rsqrt: (libc)Exponents and Logarithms. * rsqrtf: (libc)Exponents and Logarithms. * rsqrtfN: (libc)Exponents and Logarithms. * rsqrtfNx: (libc)Exponents and Logarithms. * rsqrtl: (libc)Exponents and Logarithms. * sbrk: (libc)Resizing the Data Segment. * scalb: (libc)Normalization Functions. * scalbf: (libc)Normalization Functions. * scalbl: (libc)Normalization Functions. * scalbln: (libc)Normalization Functions. * scalblnf: (libc)Normalization Functions. * scalblnfN: (libc)Normalization Functions. * scalblnfNx: (libc)Normalization Functions. * scalblnl: (libc)Normalization Functions. * scalbn: (libc)Normalization Functions. * scalbnf: (libc)Normalization Functions. * scalbnfN: (libc)Normalization Functions. * scalbnfNx: (libc)Normalization Functions. * scalbnl: (libc)Normalization Functions. * scandir64: (libc)Scanning Directory Content. * scandir: (libc)Scanning Directory Content. * scanf: (libc)Formatted Input Functions. * sched_get_priority_max: (libc)Basic Scheduling Functions. * sched_get_priority_min: (libc)Basic Scheduling Functions. * sched_getaffinity: (libc)CPU Affinity. * sched_getattr: (libc)Extensible Scheduling. * sched_getcpu: (libc)CPU Affinity. * sched_getparam: (libc)Basic Scheduling Functions. * sched_getscheduler: (libc)Basic Scheduling Functions. * sched_rr_get_interval: (libc)Basic Scheduling Functions. * sched_setaffinity: (libc)CPU Affinity. * sched_setattr: (libc)Extensible Scheduling. * sched_setparam: (libc)Basic Scheduling Functions. * sched_setscheduler: (libc)Basic Scheduling Functions. * sched_yield: (libc)Basic Scheduling Functions. * secure_getenv: (libc)Environment Access. * seed48: (libc)SVID Random. * seed48_r: (libc)SVID Random. * seekdir: (libc)Random Access Directory. * select: (libc)Waiting for I/O. * sem_clockwait: (libc)POSIX Semaphores. * sem_close: (libc)POSIX Semaphores. * sem_destroy: (libc)POSIX Semaphores. * sem_getvalue: (libc)POSIX Semaphores. * sem_init: (libc)POSIX Semaphores. * sem_open: (libc)POSIX Semaphores. * sem_post: (libc)POSIX Semaphores. * sem_timedwait: (libc)POSIX Semaphores. * sem_trywait: (libc)POSIX Semaphores. * sem_unlink: (libc)POSIX Semaphores. * sem_wait: (libc)POSIX Semaphores. * semctl: (libc)Semaphores. * semget: (libc)Semaphores. * semop: (libc)Semaphores. * semtimedop: (libc)Semaphores. * send: (libc)Sending Data. * sendmsg: (libc)Other Socket APIs. * sendto: (libc)Sending Datagrams. * setbuf: (libc)Controlling Buffering. * setbuffer: (libc)Controlling Buffering. * setcontext: (libc)System V contexts. * setdomainname: (libc)Host Identification. * setegid: (libc)Setting Groups. * setenv: (libc)Environment Access. * seteuid: (libc)Setting User ID. * setfsent: (libc)fstab. * setgid: (libc)Setting Groups. * setgrent: (libc)Scanning All Groups. * setgroups: (libc)Setting Groups. * sethostent: (libc)Host Names. * sethostid: (libc)Host Identification. * sethostname: (libc)Host Identification. * setitimer: (libc)Setting an Alarm. * setjmp: (libc)Non-Local Details. * setlinebuf: (libc)Controlling Buffering. * setlocale: (libc)Setting the Locale. * setlogmask: (libc)setlogmask. * setmntent: (libc)mtab. * setnetent: (libc)Networks Database. * setnetgrent: (libc)Lookup Netgroup. * setpayload: (libc)FP Bit Twiddling. * setpayloadf: (libc)FP Bit Twiddling. * setpayloadfN: (libc)FP Bit Twiddling. * setpayloadfNx: (libc)FP Bit Twiddling. * setpayloadl: (libc)FP Bit Twiddling. * setpayloadsig: (libc)FP Bit Twiddling. * setpayloadsigf: (libc)FP Bit Twiddling. * setpayloadsigfN: (libc)FP Bit Twiddling. * setpayloadsigfNx: (libc)FP Bit Twiddling. * setpayloadsigl: (libc)FP Bit Twiddling. * setpgid: (libc)Process Group Functions. * setpgrp: (libc)Process Group Functions. * setpriority: (libc)Traditional Scheduling Functions. * setprotoent: (libc)Protocols Database. * setpwent: (libc)Scanning All Users. * setregid: (libc)Setting Groups. * setreuid: (libc)Setting User ID. * setrlimit64: (libc)Limits on Resources. * setrlimit: (libc)Limits on Resources. * setservent: (libc)Services Database. * setsid: (libc)Process Group Functions. * setsockopt: (libc)Socket Option Functions. * setstate: (libc)BSD Random. * setstate_r: (libc)BSD Random. * settimeofday: (libc)Setting and Adjusting the Time. * setuid: (libc)Setting User ID. * setutent: (libc)Manipulating the Database. * setutxent: (libc)XPG Functions. * setvbuf: (libc)Controlling Buffering. * shm_open: (libc)Memory-mapped I/O. * shm_unlink: (libc)Memory-mapped I/O. * shutdown: (libc)Closing a Socket. * sigabbrev_np: (libc)Signal Messages. * sigaction: (libc)Advanced Signal Handling. * sigaddset: (libc)Signal Sets. * sigaltstack: (libc)Signal Stack. * sigblock: (libc)BSD Signal Handling. * sigdelset: (libc)Signal Sets. * sigdescr_np: (libc)Signal Messages. * sigemptyset: (libc)Signal Sets. * sigfillset: (libc)Signal Sets. * siginterrupt: (libc)BSD Signal Handling. * sigismember: (libc)Signal Sets. * siglongjmp: (libc)Non-Local Exits and Signals. * sigmask: (libc)BSD Signal Handling. * signal: (libc)Basic Signal Handling. * signbit: (libc)FP Bit Twiddling. * significand: (libc)Normalization Functions. * significandf: (libc)Normalization Functions. * significandl: (libc)Normalization Functions. * sigpause: (libc)BSD Signal Handling. * sigpending: (libc)Checking for Pending Signals. * sigprocmask: (libc)Process Signal Mask. * sigsetjmp: (libc)Non-Local Exits and Signals. * sigsetmask: (libc)BSD Signal Handling. * sigstack: (libc)Signal Stack. * sigsuspend: (libc)Sigsuspend. * sin: (libc)Trig Functions. * sincos: (libc)Trig Functions. * sincosf: (libc)Trig Functions. * sincosfN: (libc)Trig Functions. * sincosfNx: (libc)Trig Functions. * sincosl: (libc)Trig Functions. * sinf: (libc)Trig Functions. * sinfN: (libc)Trig Functions. * sinfNx: (libc)Trig Functions. * sinh: (libc)Hyperbolic Functions. * sinhf: (libc)Hyperbolic Functions. * sinhfN: (libc)Hyperbolic Functions. * sinhfNx: (libc)Hyperbolic Functions. * sinhl: (libc)Hyperbolic Functions. * sinl: (libc)Trig Functions. * sinpi: (libc)Trig Functions. * sinpif: (libc)Trig Functions. * sinpifN: (libc)Trig Functions. * sinpifNx: (libc)Trig Functions. * sinpil: (libc)Trig Functions. * sleep: (libc)Sleeping. * snprintf: (libc)Formatted Output Functions. * socket: (libc)Creating a Socket. * socketpair: (libc)Socket Pairs. * sprintf: (libc)Formatted Output Functions. * sqrt: (libc)Exponents and Logarithms. * sqrtf: (libc)Exponents and Logarithms. * sqrtfN: (libc)Exponents and Logarithms. * sqrtfNx: (libc)Exponents and Logarithms. * sqrtl: (libc)Exponents and Logarithms. * srand48: (libc)SVID Random. * srand48_r: (libc)SVID Random. * srand: (libc)ISO Random. * srandom: (libc)BSD Random. * srandom_r: (libc)BSD Random. * sscanf: (libc)Formatted Input Functions. * ssignal: (libc)Basic Signal Handling. * stat64: (libc)Reading Attributes. * stat: (libc)Reading Attributes. * stdc_bit_ceil_uc: (libc)Bit Manipulation. * stdc_bit_ceil_ui: (libc)Bit Manipulation. * stdc_bit_ceil_ul: (libc)Bit Manipulation. * stdc_bit_ceil_ull: (libc)Bit Manipulation. * stdc_bit_ceil_us: (libc)Bit Manipulation. * stdc_bit_floor_uc: (libc)Bit Manipulation. * stdc_bit_floor_ui: (libc)Bit Manipulation. * stdc_bit_floor_ul: (libc)Bit Manipulation. * stdc_bit_floor_ull: (libc)Bit Manipulation. * stdc_bit_floor_us: (libc)Bit Manipulation. * stdc_bit_width_uc: (libc)Bit Manipulation. * stdc_bit_width_ui: (libc)Bit Manipulation. * stdc_bit_width_ul: (libc)Bit Manipulation. * stdc_bit_width_ull: (libc)Bit Manipulation. * stdc_bit_width_us: (libc)Bit Manipulation. * stdc_count_ones_uc: (libc)Bit Manipulation. * stdc_count_ones_ui: (libc)Bit Manipulation. * stdc_count_ones_ul: (libc)Bit Manipulation. * stdc_count_ones_ull: (libc)Bit Manipulation. * stdc_count_ones_us: (libc)Bit Manipulation. * stdc_count_zeros_uc: (libc)Bit Manipulation. * stdc_count_zeros_ui: (libc)Bit Manipulation. * stdc_count_zeros_ul: (libc)Bit Manipulation. * stdc_count_zeros_ull: (libc)Bit Manipulation. * stdc_count_zeros_us: (libc)Bit Manipulation. * stdc_first_leading_one_uc: (libc)Bit Manipulation. * stdc_first_leading_one_ui: (libc)Bit Manipulation. * stdc_first_leading_one_ul: (libc)Bit Manipulation. * stdc_first_leading_one_ull: (libc)Bit Manipulation. * stdc_first_leading_one_us: (libc)Bit Manipulation. * stdc_first_leading_zero_uc: (libc)Bit Manipulation. * stdc_first_leading_zero_ui: (libc)Bit Manipulation. * stdc_first_leading_zero_ul: (libc)Bit Manipulation. * stdc_first_leading_zero_ull: (libc)Bit Manipulation. * stdc_first_leading_zero_us: (libc)Bit Manipulation. * stdc_first_trailing_one_uc: (libc)Bit Manipulation. * stdc_first_trailing_one_ui: (libc)Bit Manipulation. * stdc_first_trailing_one_ul: (libc)Bit Manipulation. * stdc_first_trailing_one_ull: (libc)Bit Manipulation. * stdc_first_trailing_one_us: (libc)Bit Manipulation. * stdc_first_trailing_zero_uc: (libc)Bit Manipulation. * stdc_first_trailing_zero_ui: (libc)Bit Manipulation. * stdc_first_trailing_zero_ul: (libc)Bit Manipulation. * stdc_first_trailing_zero_ull: (libc)Bit Manipulation. * stdc_first_trailing_zero_us: (libc)Bit Manipulation. * stdc_has_single_bit_uc: (libc)Bit Manipulation. * stdc_has_single_bit_ui: (libc)Bit Manipulation. * stdc_has_single_bit_ul: (libc)Bit Manipulation. * stdc_has_single_bit_ull: (libc)Bit Manipulation. * stdc_has_single_bit_us: (libc)Bit Manipulation. * stdc_leading_ones_uc: (libc)Bit Manipulation. * stdc_leading_ones_ui: (libc)Bit Manipulation. * stdc_leading_ones_ul: (libc)Bit Manipulation. * stdc_leading_ones_ull: (libc)Bit Manipulation. * stdc_leading_ones_us: (libc)Bit Manipulation. * stdc_leading_zeros_uc: (libc)Bit Manipulation. * stdc_leading_zeros_ui: (libc)Bit Manipulation. * stdc_leading_zeros_ul: (libc)Bit Manipulation. * stdc_leading_zeros_ull: (libc)Bit Manipulation. * stdc_leading_zeros_us: (libc)Bit Manipulation. * stdc_trailing_ones_uc: (libc)Bit Manipulation. * stdc_trailing_ones_ui: (libc)Bit Manipulation. * stdc_trailing_ones_ul: (libc)Bit Manipulation. * stdc_trailing_ones_ull: (libc)Bit Manipulation. * stdc_trailing_ones_us: (libc)Bit Manipulation. * stdc_trailing_zeros_uc: (libc)Bit Manipulation. * stdc_trailing_zeros_ui: (libc)Bit Manipulation. * stdc_trailing_zeros_ul: (libc)Bit Manipulation. * stdc_trailing_zeros_ull: (libc)Bit Manipulation. * stdc_trailing_zeros_us: (libc)Bit Manipulation. * stime: (libc)Setting and Adjusting the Time. * stpcpy: (libc)Copying Strings and Arrays. * stpncpy: (libc)Truncating Strings. * strcasecmp: (libc)String/Array Comparison. * strcasestr: (libc)Search Functions. * strcat: (libc)Concatenating Strings. * strchr: (libc)Search Functions. * strchrnul: (libc)Search Functions. * strcmp: (libc)String/Array Comparison. * strcoll: (libc)Collation Functions. * strcpy: (libc)Copying Strings and Arrays. * strcspn: (libc)Search Functions. * strdup: (libc)Copying Strings and Arrays. * strdupa: (libc)Copying Strings and Arrays. * strerror: (libc)Error Messages. * strerror_l: (libc)Error Messages. * strerror_r: (libc)Error Messages. * strerror_r: (libc)Error Messages. * strerrordesc_np: (libc)Error Messages. * strerrorname_np: (libc)Error Messages. * strfmon: (libc)Formatting Numbers. * strfromd: (libc)Printing of Floats. * strfromf: (libc)Printing of Floats. * strfromfN: (libc)Printing of Floats. * strfromfNx: (libc)Printing of Floats. * strfroml: (libc)Printing of Floats. * strfry: (libc)Shuffling Bytes. * strftime: (libc)Formatting Calendar Time. * strftime_l: (libc)Formatting Calendar Time. * strlcat: (libc)Truncating Strings. * strlcpy: (libc)Truncating Strings. * strlen: (libc)String Length. * strncasecmp: (libc)String/Array Comparison. * strncat: (libc)Truncating Strings. * strncmp: (libc)String/Array Comparison. * strncpy: (libc)Truncating Strings. * strndup: (libc)Truncating Strings. * strndupa: (libc)Truncating Strings. * strnlen: (libc)String Length. * strpbrk: (libc)Search Functions. * strptime: (libc)Low-Level Time String Parsing. * strrchr: (libc)Search Functions. * strsep: (libc)Finding Tokens in a String. * strsignal: (libc)Signal Messages. * strspn: (libc)Search Functions. * strstr: (libc)Search Functions. * strtod: (libc)Parsing of Floats. * strtof: (libc)Parsing of Floats. * strtofN: (libc)Parsing of Floats. * strtofNx: (libc)Parsing of Floats. * strtoimax: (libc)Parsing of Integers. * strtok: (libc)Finding Tokens in a String. * strtok_r: (libc)Finding Tokens in a String. * strtol: (libc)Parsing of Integers. * strtold: (libc)Parsing of Floats. * strtoll: (libc)Parsing of Integers. * strtoq: (libc)Parsing of Integers. * strtoul: (libc)Parsing of Integers. * strtoull: (libc)Parsing of Integers. * strtoumax: (libc)Parsing of Integers. * strtouq: (libc)Parsing of Integers. * strverscmp: (libc)String/Array Comparison. * strxfrm: (libc)Collation Functions. * stty: (libc)BSD Terminal Modes. * swapcontext: (libc)System V contexts. * swprintf: (libc)Formatted Output Functions. * swscanf: (libc)Formatted Input Functions. * symlink: (libc)Symbolic Links. * sync: (libc)Synchronizing I/O. * syscall: (libc)System Calls. * sysconf: (libc)Sysconf Definition. * syslog: (libc)syslog; vsyslog. * system: (libc)Running a Command. * sysv_signal: (libc)Basic Signal Handling. * tan: (libc)Trig Functions. * tanf: (libc)Trig Functions. * tanfN: (libc)Trig Functions. * tanfNx: (libc)Trig Functions. * tanh: (libc)Hyperbolic Functions. * tanhf: (libc)Hyperbolic Functions. * tanhfN: (libc)Hyperbolic Functions. * tanhfNx: (libc)Hyperbolic Functions. * tanhl: (libc)Hyperbolic Functions. * tanl: (libc)Trig Functions. * tanpi: (libc)Trig Functions. * tanpif: (libc)Trig Functions. * tanpifN: (libc)Trig Functions. * tanpifNx: (libc)Trig Functions. * tanpil: (libc)Trig Functions. * tcdrain: (libc)Line Control. * tcflow: (libc)Line Control. * tcflush: (libc)Line Control. * tcgetattr: (libc)Mode Functions. * tcgetpgrp: (libc)Terminal Access Functions. * tcgetsid: (libc)Terminal Access Functions. * tcsendbreak: (libc)Line Control. * tcsetattr: (libc)Mode Functions. * tcsetpgrp: (libc)Terminal Access Functions. * tdelete: (libc)Tree Search Function. * tdestroy: (libc)Tree Search Function. * telldir: (libc)Random Access Directory. * tempnam: (libc)Temporary Files. * textdomain: (libc)Locating gettext catalog. * tfind: (libc)Tree Search Function. * tgamma: (libc)Special Functions. * tgammaf: (libc)Special Functions. * tgammafN: (libc)Special Functions. * tgammafNx: (libc)Special Functions. * tgammal: (libc)Special Functions. * tgkill: (libc)Signaling Another Process. * thrd_create: (libc)ISO C Thread Management. * thrd_current: (libc)ISO C Thread Management. * thrd_detach: (libc)ISO C Thread Management. * thrd_equal: (libc)ISO C Thread Management. * thrd_exit: (libc)ISO C Thread Management. * thrd_join: (libc)ISO C Thread Management. * thrd_sleep: (libc)ISO C Thread Management. * thrd_yield: (libc)ISO C Thread Management. * time: (libc)Getting the Time. * timegm: (libc)Broken-down Time. * timelocal: (libc)Broken-down Time. * times: (libc)Processor Time. * timespec_get: (libc)Getting the Time. * timespec_getres: (libc)Getting the Time. * tmpfile64: (libc)Temporary Files. * tmpfile: (libc)Temporary Files. * tmpnam: (libc)Temporary Files. * tmpnam_r: (libc)Temporary Files. * toascii: (libc)Case Conversion. * tolower: (libc)Case Conversion. * totalorder: (libc)FP Comparison Functions. * totalorderf: (libc)FP Comparison Functions. * totalorderfN: (libc)FP Comparison Functions. * totalorderfNx: (libc)FP Comparison Functions. * totalorderl: (libc)FP Comparison Functions. * totalordermag: (libc)FP Comparison Functions. * totalordermagf: (libc)FP Comparison Functions. * totalordermagfN: (libc)FP Comparison Functions. * totalordermagfNx: (libc)FP Comparison Functions. * totalordermagl: (libc)FP Comparison Functions. * toupper: (libc)Case Conversion. * towctrans: (libc)Wide Character Case Conversion. * towlower: (libc)Wide Character Case Conversion. * towupper: (libc)Wide Character Case Conversion. * trunc: (libc)Rounding Functions. * truncate64: (libc)File Size. * truncate: (libc)File Size. * truncf: (libc)Rounding Functions. * truncfN: (libc)Rounding Functions. * truncfNx: (libc)Rounding Functions. * truncl: (libc)Rounding Functions. * tsearch: (libc)Tree Search Function. * tss_create: (libc)ISO C Thread-local Storage. * tss_delete: (libc)ISO C Thread-local Storage. * tss_get: (libc)ISO C Thread-local Storage. * tss_set: (libc)ISO C Thread-local Storage. * ttyname: (libc)Is It a Terminal. * ttyname_r: (libc)Is It a Terminal. * twalk: (libc)Tree Search Function. * twalk_r: (libc)Tree Search Function. * tzset: (libc)Time Zone State. * uabs: (libc)Absolute Value. * ufromfp: (libc)Rounding Functions. * ufromfpf: (libc)Rounding Functions. * ufromfpfN: (libc)Rounding Functions. * ufromfpfNx: (libc)Rounding Functions. * ufromfpl: (libc)Rounding Functions. * ufromfpx: (libc)Rounding Functions. * ufromfpxf: (libc)Rounding Functions. * ufromfpxfN: (libc)Rounding Functions. * ufromfpxfNx: (libc)Rounding Functions. * ufromfpxl: (libc)Rounding Functions. * uimaxabs: (libc)Absolute Value. * ulabs: (libc)Absolute Value. * ulimit: (libc)Limits on Resources. * ullabs: (libc)Absolute Value. * umask: (libc)Setting Permissions. * umount2: (libc)Mount-Unmount-Remount. * umount: (libc)Mount-Unmount-Remount. * uname: (libc)Platform Type. * ungetc: (libc)How Unread. * ungetwc: (libc)How Unread. * unlink: (libc)Deleting Files. * unlinkat: (libc)Deleting Files. * unlockpt: (libc)Allocation. * unsetenv: (libc)Environment Access. * updwtmp: (libc)Manipulating the Database. * utime: (libc)File Times. * utimensat: (libc)File Times. * utimes: (libc)File Times. * utmpname: (libc)Manipulating the Database. * utmpxname: (libc)XPG Functions. * va_arg: (libc)Argument Macros. * va_copy: (libc)Argument Macros. * va_end: (libc)Argument Macros. * va_start: (libc)Argument Macros. * valloc: (libc)Aligned Memory Blocks. * vasprintf: (libc)Variable Arguments Output. * vdprintf: (libc)Variable Arguments Output. * verr: (libc)Error Messages. * verrx: (libc)Error Messages. * versionsort64: (libc)Scanning Directory Content. * versionsort: (libc)Scanning Directory Content. * vfork: (libc)Creating a Process. * vfprintf: (libc)Variable Arguments Output. * vfscanf: (libc)Variable Arguments Input. * vfwprintf: (libc)Variable Arguments Output. * vfwscanf: (libc)Variable Arguments Input. * vlimit: (libc)Limits on Resources. * vprintf: (libc)Variable Arguments Output. * vscanf: (libc)Variable Arguments Input. * vsnprintf: (libc)Variable Arguments Output. * vsprintf: (libc)Variable Arguments Output. * vsscanf: (libc)Variable Arguments Input. * vswprintf: (libc)Variable Arguments Output. * vswscanf: (libc)Variable Arguments Input. * vsyslog: (libc)syslog; vsyslog. * vwarn: (libc)Error Messages. * vwarnx: (libc)Error Messages. * vwprintf: (libc)Variable Arguments Output. * vwscanf: (libc)Variable Arguments Input. * wait3: (libc)BSD Wait Functions. * wait4: (libc)Process Completion. * wait: (libc)Process Completion. * waitpid: (libc)Process Completion. * warn: (libc)Error Messages. * warnx: (libc)Error Messages. * wcpcpy: (libc)Copying Strings and Arrays. * wcpncpy: (libc)Truncating Strings. * wcrtomb: (libc)Converting a Character. * wcscasecmp: (libc)String/Array Comparison. * wcscat: (libc)Concatenating Strings. * wcschr: (libc)Search Functions. * wcschrnul: (libc)Search Functions. * wcscmp: (libc)String/Array Comparison. * wcscoll: (libc)Collation Functions. * wcscpy: (libc)Copying Strings and Arrays. * wcscspn: (libc)Search Functions. * wcsdup: (libc)Copying Strings and Arrays. * wcsftime: (libc)Formatting Calendar Time. * wcslcat: (libc)Truncating Strings. * wcslcpy: (libc)Truncating Strings. * wcslen: (libc)String Length. * wcsncasecmp: (libc)String/Array Comparison. * wcsncat: (libc)Truncating Strings. * wcsncmp: (libc)String/Array Comparison. * wcsncpy: (libc)Truncating Strings. * wcsnlen: (libc)String Length. * wcsnrtombs: (libc)Converting Strings. * wcspbrk: (libc)Search Functions. * wcsrchr: (libc)Search Functions. * wcsrtombs: (libc)Converting Strings. * wcsspn: (libc)Search Functions. * wcsstr: (libc)Search Functions. * wcstod: (libc)Parsing of Floats. * wcstof: (libc)Parsing of Floats. * wcstofN: (libc)Parsing of Floats. * wcstofNx: (libc)Parsing of Floats. * wcstoimax: (libc)Parsing of Integers. * wcstok: (libc)Finding Tokens in a String. * wcstol: (libc)Parsing of Integers. * wcstold: (libc)Parsing of Floats. * wcstoll: (libc)Parsing of Integers. * wcstombs: (libc)Non-reentrant String Conversion. * wcstoq: (libc)Parsing of Integers. * wcstoul: (libc)Parsing of Integers. * wcstoull: (libc)Parsing of Integers. * wcstoumax: (libc)Parsing of Integers. * wcstouq: (libc)Parsing of Integers. * wcswcs: (libc)Search Functions. * wcsxfrm: (libc)Collation Functions. * wctob: (libc)Converting a Character. * wctomb: (libc)Non-reentrant Character Conversion. * wctrans: (libc)Wide Character Case Conversion. * wctype: (libc)Classification of Wide Characters. * wmemchr: (libc)Search Functions. * wmemcmp: (libc)String/Array Comparison. * wmemcpy: (libc)Copying Strings and Arrays. * wmemmove: (libc)Copying Strings and Arrays. * wmempcpy: (libc)Copying Strings and Arrays. * wmemset: (libc)Copying Strings and Arrays. * wordexp: (libc)Calling Wordexp. * wordfree: (libc)Calling Wordexp. * wprintf: (libc)Formatted Output Functions. * write: (libc)I/O Primitives. * writev: (libc)Scatter-Gather. * wscanf: (libc)Formatted Input Functions. * y0: (libc)Special Functions. * y0f: (libc)Special Functions. * y0fN: (libc)Special Functions. * y0fNx: (libc)Special Functions. * y0l: (libc)Special Functions. * y1: (libc)Special Functions. * y1f: (libc)Special Functions. * y1fN: (libc)Special Functions. * y1fNx: (libc)Special Functions. * y1l: (libc)Special Functions. * yn: (libc)Special Functions. * ynf: (libc)Special Functions. * ynfN: (libc)Special Functions. * ynfNx: (libc)Special Functions. * ynl: (libc)Special Functions. END-INFO-DIR-ENTRY  File: libc.info, Node: Examples of Sysconf, Prev: Constants for Sysconf, Up: Sysconf 33.4.3 Examples of ‘sysconf’ ---------------------------- We recommend that you first test for a macro definition for the parameter you are interested in, and call ‘sysconf’ only if the macro is not defined. For example, here is how to test whether job control is supported: int have_job_control (void) { #ifdef _POSIX_JOB_CONTROL return 1; #else int value = sysconf (_SC_JOB_CONTROL); if (value < 0) /* If the system is that badly wedged, there's no use trying to go on. */ fatal (strerror (errno)); return value; #endif } Here is how to get the value of a numeric limit: int get_child_max () { #ifdef CHILD_MAX return CHILD_MAX; #else int value = sysconf (_SC_CHILD_MAX); if (value < 0) fatal (strerror (errno)); return value; #endif }  File: libc.info, Node: Minimums, Next: Limits for Files, Prev: Sysconf, Up: System Configuration 33.5 Minimum Values for General Capacity Limits =============================================== Here are the names for the POSIX minimum upper bounds for the system limit parameters. The significance of these values is that you can safely push to these limits without checking whether the particular system you are using can go that far. ‘_POSIX_AIO_LISTIO_MAX’ The most restrictive limit permitted by POSIX for the maximum number of I/O operations that can be specified in a list I/O call. The value of this constant is ‘2’; thus you can add up to two new entries of the list of outstanding operations. ‘_POSIX_AIO_MAX’ The most restrictive limit permitted by POSIX for the maximum number of outstanding asynchronous I/O operations. The value of this constant is ‘1’. So you cannot expect that you can issue more than one operation and immediately continue with the normal work, receiving the notifications asynchronously. ‘_POSIX_ARG_MAX’ The value of this macro is the most restrictive limit permitted by POSIX for the maximum combined length of the ARGV and ENVIRON arguments that can be passed to the ‘exec’ functions. Its value is ‘4096’. ‘_POSIX_CHILD_MAX’ The value of this macro is the most restrictive limit permitted by POSIX for the maximum number of simultaneous processes per real user ID. Its value is ‘6’. ‘_POSIX_NGROUPS_MAX’ The value of this macro is the most restrictive limit permitted by POSIX for the maximum number of supplementary group IDs per process. Its value is ‘0’. ‘_POSIX_OPEN_MAX’ The value of this macro is the most restrictive limit permitted by POSIX for the maximum number of files that a single process can have open simultaneously. Its value is ‘16’. ‘_POSIX_SSIZE_MAX’ The value of this macro is the most restrictive limit permitted by POSIX for the maximum value that can be stored in an object of type ‘ssize_t’. Its value is ‘32767’. ‘_POSIX_STREAM_MAX’ The value of this macro is the most restrictive limit permitted by POSIX for the maximum number of streams that a single process can have open simultaneously. Its value is ‘8’. ‘_POSIX_TZNAME_MAX’ The value of this macro is the most restrictive limit permitted by POSIX for the maximum length of a time zone abbreviation. Its value is ‘3’. ‘_POSIX2_RE_DUP_MAX’ The value of this macro is the most restrictive limit permitted by POSIX for the numbers used in the ‘\{MIN,MAX\}’ construct in a regular expression. Its value is ‘255’.  File: libc.info, Node: Limits for Files, Next: Options for Files, Prev: Minimums, Up: System Configuration 33.6 Limits on File System Capacity =================================== The POSIX.1 standard specifies a number of parameters that describe the limitations of the file system. It's possible for the system to have a fixed, uniform limit for a parameter, but this isn't the usual case. On most systems, it's possible for different file systems (and, for some parameters, even different files) to have different maximum limits. For example, this is very likely if you use NFS to mount some of the file systems from other machines. Each of the following macros is defined in ‘limits.h’ only if the system has a fixed, uniform limit for the parameter in question. If the system allows different file systems or files to have different limits, then the macro is undefined; use ‘pathconf’ or ‘fpathconf’ to find out the limit that applies to a particular file. *Note Pathconf::. Each parameter also has another macro, with a name starting with ‘_POSIX’, which gives the lowest value that the limit is allowed to have on _any_ POSIX system. *Note File Minimums::. -- Macro: int LINK_MAX The uniform system limit (if any) for the number of names for a given file. *Note Hard Links::. -- Macro: int MAX_CANON The uniform system limit (if any) for the amount of text in a line of input when input editing is enabled. *Note Canonical or Not::. -- Macro: int MAX_INPUT The uniform system limit (if any) for the total number of characters typed ahead as input. *Note I/O Queues::. -- Macro: int NAME_MAX The uniform system limit (if any) for the length of a file name component, not including the terminating null character. *Portability Note:* On some systems, the GNU C Library defines ‘NAME_MAX’, but does not actually enforce this limit. -- Macro: int PATH_MAX The uniform system limit (if any) for the length of an entire file name (that is, the argument given to system calls such as ‘open’), including the terminating null character. *Portability Note:* The GNU C Library does not enforce this limit even if ‘PATH_MAX’ is defined. -- Macro: int PIPE_BUF The uniform system limit (if any) for the number of bytes that can be written atomically to a pipe. If multiple processes are writing to the same pipe simultaneously, output from different processes might be interleaved in chunks of this size. *Note Pipes and FIFOs::. These are alternative macro names for some of the same information. -- Macro: int MAXNAMLEN This is the BSD name for ‘NAME_MAX’. It is defined in ‘dirent.h’. -- Macro: int FILENAME_MAX The value of this macro is an integer constant expression that represents the maximum length of a file name string. It is defined in ‘stdio.h’. Unlike ‘PATH_MAX’, this macro is defined even if there is no actual limit imposed. In such a case, its value is typically a very large number. *This is always the case on GNU/Hurd systems.* *Usage Note:* Don't use ‘FILENAME_MAX’ as the size of an array in which to store a file name! You can't possibly make an array that big! Use dynamic allocation (*note Memory Allocation::) instead.  File: libc.info, Node: Options for Files, Next: File Minimums, Prev: Limits for Files, Up: System Configuration 33.7 Optional Features in File Support ====================================== POSIX defines certain system-specific options in the system calls for operating on files. Some systems support these options and others do not. Since these options are provided in the kernel, not in the library, simply using the GNU C Library does not guarantee that any of these features is supported; it depends on the system you are using. They can also vary between file systems on a single machine. This section describes the macros you can test to determine whether a particular option is supported on your machine. If a given macro is defined in ‘unistd.h’, then its value says whether the corresponding feature is supported. (A value of ‘-1’ indicates no; any other value indicates yes.) If the macro is undefined, it means particular files may or may not support the feature. Since all the machines that support the GNU C Library also support NFS, one can never make a general statement about whether all file systems support the ‘_POSIX_CHOWN_RESTRICTED’ and ‘_POSIX_NO_TRUNC’ features. So these names are never defined as macros in the GNU C Library. -- Macro: int _POSIX_CHOWN_RESTRICTED If this option is in effect, the ‘chown’ function is restricted so that the only changes permitted to nonprivileged processes is to change the group owner of a file to either be the effective group ID of the process, or one of its supplementary group IDs. *Note File Owner::. -- Macro: int _POSIX_NO_TRUNC If this option is in effect, file name components longer than ‘NAME_MAX’ generate an ‘ENAMETOOLONG’ error. Otherwise, file name components that are too long are silently truncated. -- Macro: unsigned char _POSIX_VDISABLE This option is only meaningful for files that are terminal devices. If it is enabled, then handling for special control characters can be disabled individually. *Note Special Characters::. If one of these macros is undefined, that means that the option might be in effect for some files and not for others. To inquire about a particular file, call ‘pathconf’ or ‘fpathconf’. *Note Pathconf::.  File: libc.info, Node: File Minimums, Next: Pathconf, Prev: Options for Files, Up: System Configuration 33.8 Minimum Values for File System Limits ========================================== Here are the names for the POSIX minimum upper bounds for some of the above parameters. The significance of these values is that you can safely push to these limits without checking whether the particular system you are using can go that far. In most cases GNU systems do not have these strict limitations. The actual limit should be requested if necessary. ‘_POSIX_LINK_MAX’ The most restrictive limit permitted by POSIX for the maximum value of a file's link count. The value of this constant is ‘8’; thus, you can always make up to eight names for a file without running into a system limit. ‘_POSIX_MAX_CANON’ The most restrictive limit permitted by POSIX for the maximum number of bytes in a canonical input line from a terminal device. The value of this constant is ‘255’. ‘_POSIX_MAX_INPUT’ The most restrictive limit permitted by POSIX for the maximum number of bytes in a terminal device input queue (or typeahead buffer). *Note Input Modes::. The value of this constant is ‘255’. ‘_POSIX_NAME_MAX’ The most restrictive limit permitted by POSIX for the maximum number of bytes in a file name component. The value of this constant is ‘14’. ‘_POSIX_PATH_MAX’ The most restrictive limit permitted by POSIX for the maximum number of bytes in a file name. The value of this constant is ‘256’. ‘_POSIX_PIPE_BUF’ The most restrictive limit permitted by POSIX for the maximum number of bytes that can be written atomically to a pipe. The value of this constant is ‘512’. ‘SYMLINK_MAX’ Maximum number of bytes in a symbolic link. ‘POSIX_REC_INCR_XFER_SIZE’ Recommended increment for file transfer sizes between the ‘POSIX_REC_MIN_XFER_SIZE’ and ‘POSIX_REC_MAX_XFER_SIZE’ values. ‘POSIX_REC_MAX_XFER_SIZE’ Maximum recommended file transfer size. ‘POSIX_REC_MIN_XFER_SIZE’ Minimum recommended file transfer size. ‘POSIX_REC_XFER_ALIGN’ Recommended file transfer buffer alignment.  File: libc.info, Node: Pathconf, Next: Utility Limits, Prev: File Minimums, Up: System Configuration 33.9 Using ‘pathconf’ ===================== When your machine allows different files to have different values for a file system parameter, you can use the functions in this section to find out the value that applies to any particular file. These functions and the associated constants for the PARAMETER argument are declared in the header file ‘unistd.h’. -- Function: long int pathconf (const char *FILENAME, int PARAMETER) Preliminary: | MT-Safe | AS-Unsafe lock heap | AC-Unsafe lock fd mem | *Note POSIX Safety Concepts::. This function is used to inquire about the limits that apply to the file named FILENAME. The PARAMETER argument should be one of the ‘_PC_’ constants listed below. The normal return value from ‘pathconf’ is the value you requested. A value of ‘-1’ is returned both if the implementation does not impose a limit, and in case of an error. In the former case, ‘errno’ is not set, while in the latter case, ‘errno’ is set to indicate the cause of the problem. So the only way to use this function robustly is to store ‘0’ into ‘errno’ just before calling it. Besides the usual file name errors (*note File Name Errors::), the following error condition is defined for this function: ‘EINVAL’ The value of PARAMETER is invalid, or the implementation doesn't support the PARAMETER for the specific file. -- Function: long int fpathconf (int FILEDES, int PARAMETER) Preliminary: | MT-Safe | AS-Unsafe lock heap | AC-Unsafe lock fd mem | *Note POSIX Safety Concepts::. This is just like ‘pathconf’ except that an open file descriptor is used to specify the file for which information is requested, instead of a file name. The following ‘errno’ error conditions are defined for this function: ‘EBADF’ The FILEDES argument is not a valid file descriptor. ‘EINVAL’ The value of PARAMETER is invalid, or the implementation doesn't support the PARAMETER for the specific file. Here are the symbolic constants that you can use as the PARAMETER argument to ‘pathconf’ and ‘fpathconf’. The values are all integer constants. ‘_PC_LINK_MAX’ Inquire about the value of ‘LINK_MAX’. ‘_PC_MAX_CANON’ Inquire about the value of ‘MAX_CANON’. ‘_PC_MAX_INPUT’ Inquire about the value of ‘MAX_INPUT’. ‘_PC_NAME_MAX’ Inquire about the value of ‘NAME_MAX’. ‘_PC_PATH_MAX’ Inquire about the value of ‘PATH_MAX’. ‘_PC_PIPE_BUF’ Inquire about the value of ‘PIPE_BUF’. ‘_PC_CHOWN_RESTRICTED’ Inquire about the value of ‘_POSIX_CHOWN_RESTRICTED’. ‘_PC_NO_TRUNC’ Inquire about the value of ‘_POSIX_NO_TRUNC’. ‘_PC_VDISABLE’ Inquire about the value of ‘_POSIX_VDISABLE’. ‘_PC_SYNC_IO’ Inquire about the value of ‘_POSIX_SYNC_IO’. ‘_PC_ASYNC_IO’ Inquire about the value of ‘_POSIX_ASYNC_IO’. ‘_PC_PRIO_IO’ Inquire about the value of ‘_POSIX_PRIO_IO’. ‘_PC_FILESIZEBITS’ Inquire about the availability of large files on the filesystem. ‘_PC_REC_INCR_XFER_SIZE’ Inquire about the value of ‘POSIX_REC_INCR_XFER_SIZE’. ‘_PC_REC_MAX_XFER_SIZE’ Inquire about the value of ‘POSIX_REC_MAX_XFER_SIZE’. ‘_PC_REC_MIN_XFER_SIZE’ Inquire about the value of ‘POSIX_REC_MIN_XFER_SIZE’. ‘_PC_REC_XFER_ALIGN’ Inquire about the value of ‘POSIX_REC_XFER_ALIGN’. *Portability Note:* On some systems, the GNU C Library does not enforce ‘_PC_NAME_MAX’ or ‘_PC_PATH_MAX’ limits.  File: libc.info, Node: Utility Limits, Next: Utility Minimums, Prev: Pathconf, Up: System Configuration 33.10 Utility Program Capacity Limits ===================================== The POSIX.2 standard specifies certain system limits that you can access through ‘sysconf’ that apply to utility behavior rather than the behavior of the library or the operating system. The GNU C Library defines macros for these limits, and ‘sysconf’ returns values for them if you ask; but these values convey no meaningful information. They are simply the smallest values that POSIX.2 permits. -- Macro: int BC_BASE_MAX The largest value of ‘obase’ that the ‘bc’ utility is guaranteed to support. -- Macro: int BC_DIM_MAX The largest number of elements in one array that the ‘bc’ utility is guaranteed to support. -- Macro: int BC_SCALE_MAX The largest value of ‘scale’ that the ‘bc’ utility is guaranteed to support. -- Macro: int BC_STRING_MAX The largest number of characters in one string constant that the ‘bc’ utility is guaranteed to support. -- Macro: int COLL_WEIGHTS_MAX The largest number of weights that can necessarily be used in defining the collating sequence for a locale. -- Macro: int EXPR_NEST_MAX The maximum number of expressions that can be nested within parentheses by the ‘expr’ utility. -- Macro: int LINE_MAX The largest text line that the text-oriented POSIX.2 utilities can support. (If you are using the GNU versions of these utilities, then there is no actual limit except that imposed by the available virtual memory, but there is no way that the library can tell you this.) -- Macro: int EQUIV_CLASS_MAX The maximum number of weights that can be assigned to an entry of the ‘LC_COLLATE’ category ‘order’ keyword in a locale definition. The GNU C Library does not presently support locale definitions.  File: libc.info, Node: Utility Minimums, Next: String Parameters, Prev: Utility Limits, Up: System Configuration 33.11 Minimum Values for Utility Limits ======================================= ‘_POSIX2_BC_BASE_MAX’ The most restrictive limit permitted by POSIX.2 for the maximum value of ‘obase’ in the ‘bc’ utility. Its value is ‘99’. ‘_POSIX2_BC_DIM_MAX’ The most restrictive limit permitted by POSIX.2 for the maximum size of an array in the ‘bc’ utility. Its value is ‘2048’. ‘_POSIX2_BC_SCALE_MAX’ The most restrictive limit permitted by POSIX.2 for the maximum value of ‘scale’ in the ‘bc’ utility. Its value is ‘99’. ‘_POSIX2_BC_STRING_MAX’ The most restrictive limit permitted by POSIX.2 for the maximum size of a string constant in the ‘bc’ utility. Its value is ‘1000’. ‘_POSIX2_COLL_WEIGHTS_MAX’ The most restrictive limit permitted by POSIX.2 for the maximum number of weights that can necessarily be used in defining the collating sequence for a locale. Its value is ‘2’. ‘_POSIX2_EXPR_NEST_MAX’ The most restrictive limit permitted by POSIX.2 for the maximum number of expressions nested within parenthesis when using the ‘expr’ utility. Its value is ‘32’. ‘_POSIX2_LINE_MAX’ The most restrictive limit permitted by POSIX.2 for the maximum size of a text line that the text utilities can handle. Its value is ‘2048’. ‘_POSIX2_EQUIV_CLASS_MAX’ The most restrictive limit permitted by POSIX.2 for the maximum number of weights that can be assigned to an entry of the ‘LC_COLLATE’ category ‘order’ keyword in a locale definition. Its value is ‘2’. The GNU C Library does not presently support locale definitions.  File: libc.info, Node: String Parameters, Prev: Utility Minimums, Up: System Configuration 33.12 String-Valued Parameters ============================== POSIX.2 defines a way to get string-valued parameters from the operating system with the function ‘confstr’: -- Function: size_t confstr (int PARAMETER, char *BUF, size_t LEN) Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety Concepts::. This function reads the value of a string-valued system parameter, storing the string into LEN bytes of memory space starting at BUF. The PARAMETER argument should be one of the ‘_CS_’ symbols listed below. The normal return value from ‘confstr’ is the length of the string value that you asked for. If you supply a null pointer for BUF, then ‘confstr’ does not try to store the string; it just returns its length. A value of ‘0’ indicates an error. If the string you asked for is too long for the buffer (that is, longer than ‘LEN - 1’), then ‘confstr’ stores just that much (leaving room for the terminating null character). You can tell that this has happened because ‘confstr’ returns a value greater than or equal to LEN. The following ‘errno’ error conditions are defined for this function: ‘EINVAL’ The value of the PARAMETER is invalid. Currently there is just one parameter you can read with ‘confstr’: ‘_CS_PATH’ This parameter's value is the recommended default path for searching for executable files. This is the path that a user has by default just after logging in. ‘_CS_LFS_CFLAGS’ The returned string specifies which additional flags must be given to the C compiler if a source is compiled using the ‘_LARGEFILE_SOURCE’ feature select macro; *note Feature Test Macros::. ‘_CS_LFS_LDFLAGS’ The returned string specifies which additional flags must be given to the linker if a source is compiled using the ‘_LARGEFILE_SOURCE’ feature select macro; *note Feature Test Macros::. ‘_CS_LFS_LIBS’ The returned string specifies which additional libraries must be linked to the application if a source is compiled using the ‘_LARGEFILE_SOURCE’ feature select macro; *note Feature Test Macros::. ‘_CS_LFS_LINTFLAGS’ The returned string specifies which additional flags must be given to the lint tool if a source is compiled using the ‘_LARGEFILE_SOURCE’ feature select macro; *note Feature Test Macros::. ‘_CS_LFS64_CFLAGS’ The returned string specifies which additional flags must be given to the C compiler if a source is compiled using the ‘_LARGEFILE64_SOURCE’ feature select macro; *note Feature Test Macros::. ‘_CS_LFS64_LDFLAGS’ The returned string specifies which additional flags must be given to the linker if a source is compiled using the ‘_LARGEFILE64_SOURCE’ feature select macro; *note Feature Test Macros::. ‘_CS_LFS64_LIBS’ The returned string specifies which additional libraries must be linked to the application if a source is compiled using the ‘_LARGEFILE64_SOURCE’ feature select macro; *note Feature Test Macros::. ‘_CS_LFS64_LINTFLAGS’ The returned string specifies which additional flags must be given to the lint tool if a source is compiled using the ‘_LARGEFILE64_SOURCE’ feature select macro; *note Feature Test Macros::. The way to use ‘confstr’ without any arbitrary limit on string size is to call it twice: first call it to get the length, allocate the buffer accordingly, and then call ‘confstr’ again to fill the buffer, like this: char * get_default_path (void) { size_t len = confstr (_CS_PATH, NULL, 0); char *buffer = (char *) xmalloc (len); if (confstr (_CS_PATH, buf, len + 1) == 0) { free (buffer); return NULL; } return buffer; }  File: libc.info, Node: Cryptographic Functions, Next: Debugging Support, Prev: System Configuration, Up: Top 34 Cryptographic Functions ************************** The GNU C Library includes only one type of special-purpose cryptographic functions; these allow use of a source of cryptographically strong pseudorandom numbers, if such a source is provided by the operating system. Programs that need general-purpose cryptography should use a dedicated cryptography library, such as libgcrypt. * Menu: * Unpredictable Bytes:: Randomness for cryptographic purposes.  File: libc.info, Node: Unpredictable Bytes, Up: Cryptographic Functions 34.1 Generating Unpredictable Bytes =================================== Cryptographic applications often need random data that will be as difficult as possible for a hostile eavesdropper to guess. The pseudo-random number generators provided by the GNU C Library (*note Pseudo-Random Numbers::) are not suitable for this purpose. They produce output that is _statistically_ random, but fails to be _unpredictable_. Cryptographic applications require a “cryptographic random number generator” (CRNG), also known as a “cryptographically strong pseudo-random number generator” (CSPRNG) or a “deterministic random bit generator” (DRBG). Currently, the GNU C Library does not provide a cryptographic random number generator, but it does provide functions that read cryptographically strong random data from a “randomness source” supplied by the operating system. This randomness source is a CRNG at heart, but it also continually "re-seeds" itself from physical sources of randomness, such as electronic noise and clock jitter. This means applications do not need to do anything to ensure that the random numbers it produces are different on each run. The catch, however, is that these functions will only produce relatively short random strings in any one call. Often this is not a problem, but applications that need more than a few kilobytes of cryptographically strong random data should call these functions once and use their output to seed a CRNG. Most applications should use ‘getentropy’. The ‘getrandom’ function is intended for low-level applications which need additional control over blocking behavior. -- Function: int getentropy (void *BUFFER, size_t LENGTH) | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety Concepts::. This function writes exactly LENGTH bytes of random data to the array starting at BUFFER. LENGTH can be no more than 256. On success, it returns zero. On failure, it returns -1, and ‘errno’ is set to indicate the problem. Some of the possible errors are listed below. ‘ENOSYS’ The operating system does not implement a randomness source, or does not support this way of accessing it. (For instance, the system call used by this function was added to the Linux kernel in version 3.17.) ‘EFAULT’ The combination of BUFFER and LENGTH arguments specifies an invalid memory range. ‘EIO’ LENGTH is larger than 256, or the kernel entropy pool has suffered a catastrophic failure. A call to ‘getentropy’ can only block when the system has just booted and the randomness source has not yet been initialized. However, if it does block, it cannot be interrupted by signals or thread cancellation. Programs intended to run in very early stages of the boot process may need to use ‘getrandom’ in non-blocking mode instead, and be prepared to cope with random data not being available at all. The ‘getentropy’ function is declared in the header file ‘sys/random.h’. It is derived from OpenBSD. -- Function: ssize_t getrandom (void *BUFFER, size_t LENGTH, unsigned int FLAGS) | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety Concepts::. This function writes up to LENGTH bytes of random data to the array starting at BUFFER. The FLAGS argument should be either zero, or the bitwise OR of some of the following flags: ‘GRND_RANDOM’ Use the ‘/dev/random’ (blocking) source instead of the ‘/dev/urandom’ (non-blocking) source to obtain randomness. If this flag is specified, the call may block, potentially for quite some time, even after the randomness source has been initialized. If it is not specified, the call can only block when the system has just booted and the randomness source has not yet been initialized. ‘GRND_NONBLOCK’ Instead of blocking, return to the caller immediately if no data is available. ‘GRND_INSECURE’ Write random data that may not be cryptographically secure. Unlike ‘getentropy’, the ‘getrandom’ function is a cancellation point, and if it blocks, it can be interrupted by signals. On success, ‘getrandom’ returns the number of bytes which have been written to the buffer, which may be less than LENGTH. On error, it returns -1, and ‘errno’ is set to indicate the problem. Some of the possible errors are: ‘ENOSYS’ The operating system does not implement a randomness source, or does not support this way of accessing it. (For instance, the system call used by this function was added to the Linux kernel in version 3.17.) ‘EAGAIN’ No random data was available and ‘GRND_NONBLOCK’ was specified in FLAGS. ‘EFAULT’ The combination of BUFFER and LENGTH arguments specifies an invalid memory range. ‘EINTR’ The system call was interrupted. During the system boot process, before the kernel randomness pool is initialized, this can happen even if FLAGS is zero. ‘EINVAL’ The FLAGS argument contains an invalid combination of flags. The ‘getrandom’ function is declared in the header file ‘sys/random.h’. It is a GNU extension.  File: libc.info, Node: Debugging Support, Next: Threads, Prev: Cryptographic Functions, Up: Top 35 Debugging support ******************** Applications are usually debugged using dedicated debugger programs. But sometimes this is not possible and, in any case, it is useful to provide the developer with as much information as possible at the time the problems are experienced. For this reason a few functions are provided which a program can use to help the developer more easily locate the problem. * Menu: * Backtraces:: Obtaining and printing a back trace of the current stack.  File: libc.info, Node: Backtraces, Up: Debugging Support 35.1 Backtraces =============== A “backtrace” is a list of the function calls that are currently active in a thread. The usual way to inspect a backtrace of a program is to use an external debugger such as gdb. However, sometimes it is useful to obtain a backtrace programmatically from within a program, e.g., for the purposes of logging or diagnostics. The header file ‘execinfo.h’ declares three functions that obtain and manipulate backtraces of the current thread. -- Function: int backtrace (void **BUFFER, int SIZE) Preliminary: | MT-Safe | AS-Unsafe init heap dlopen plugin lock | AC-Unsafe init mem lock fd | *Note POSIX Safety Concepts::. The ‘backtrace’ function obtains a backtrace for the current thread, as a list of pointers, and places the information into BUFFER. The argument SIZE should be the number of ‘void *’ elements that will fit into BUFFER. The return value is the actual number of entries of BUFFER that are obtained, and is at most SIZE. The pointers placed in BUFFER are actually return addresses obtained by inspecting the stack, one return address per stack frame. Note that certain compiler optimizations may interfere with obtaining a valid backtrace. Function inlining causes the inlined function to not have a stack frame; tail call optimization replaces one stack frame with another; frame pointer elimination will stop ‘backtrace’ from interpreting the stack contents correctly. -- Function: char ** backtrace_symbols (void *const *BUFFER, int SIZE) Preliminary: | MT-Safe | AS-Unsafe heap | AC-Unsafe mem lock | *Note POSIX Safety Concepts::. The ‘backtrace_symbols’ function translates the information obtained from the ‘backtrace’ function into an array of strings. The argument BUFFER should be a pointer to an array of addresses obtained via the ‘backtrace’ function, and SIZE is the number of entries in that array (the return value of ‘backtrace’). The return value is a pointer to an array of strings, which has SIZE entries just like the array BUFFER. Each string contains a printable representation of the corresponding element of BUFFER. It includes the function name (if this can be determined), an offset into the function, and the actual return address (in hexadecimal). Currently, the function name and offset can only be obtained on systems that use the ELF binary format for programs and libraries. On other systems, only the hexadecimal return address will be present. Also, you may need to pass additional flags to the linker to make the function names available to the program. (For example, on systems using GNU ld, you must pass ‘-rdynamic’.) The return value of ‘backtrace_symbols’ is a pointer obtained via the ‘malloc’ function, and it is the responsibility of the caller to ‘free’ that pointer. Note that only the return value need be freed, not the individual strings. The return value is ‘NULL’ if sufficient memory for the strings cannot be obtained. -- Function: void backtrace_symbols_fd (void *const *BUFFER, int SIZE, int FD) Preliminary: | MT-Safe | AS-Safe | AC-Unsafe lock | *Note POSIX Safety Concepts::. The ‘backtrace_symbols_fd’ function performs the same translation as the function ‘backtrace_symbols’ function. Instead of returning the strings to the caller, it writes the strings to the file descriptor FD, one per line. It does not use the ‘malloc’ function, and can therefore be used in situations where that function might fail. The following program illustrates the use of these functions. Note that the array to contain the return addresses returned by ‘backtrace’ is allocated on the stack. Therefore code like this can be used in situations where the memory handling via ‘malloc’ does not work anymore (in which case the ‘backtrace_symbols’ has to be replaced by a ‘backtrace_symbols_fd’ call as well). The number of return addresses is normally not very large. Even complicated programs rather seldom have a nesting level of more than, say, 50 and with 200 possible entries probably all programs should be covered. #include #include #include /* Obtain a backtrace and print it to ‘stdout’. */ void print_trace (void) { void *array[10]; char **strings; int size, i; size = backtrace (array, 10); strings = backtrace_symbols (array, size); if (strings != NULL) { printf ("Obtained %d stack frames.\n", size); for (i = 0; i < size; i++) printf ("%s\n", strings[i]); } free (strings); } /* A dummy function to make the backtrace more interesting. */ void dummy_function (void) { print_trace (); } int main (void) { dummy_function (); return 0; }  File: libc.info, Node: Threads, Next: Dynamic Linker, Prev: Debugging Support, Up: Top 36 Threads ********** This chapter describes functions used for managing threads. The GNU C Library provides two threading implementations: ISO C threads and POSIX threads. * Menu: * ISO C Threads:: Threads based on the ISO C specification. * POSIX Threads:: Threads based on the POSIX specification.  File: libc.info, Node: ISO C Threads, Next: POSIX Threads, Up: Threads 36.1 ISO C Threads ================== This section describes the GNU C Library ISO C threads implementation. To have a deeper understanding of this API, it is strongly recommended to read ISO/IEC 9899:2011, section 7.26, in which ISO C threads were originally specified. All types and function prototypes are declared in the header file ‘threads.h’. * Menu: * ISO C Threads Return Values:: Symbolic constants that represent a function's return value. * ISO C Thread Management:: Support for basic threading. * Call Once:: Single-call functions and macros. * ISO C Mutexes:: A low-level mechanism for mutual exclusion. * ISO C Condition Variables:: High-level objects for thread synchronization. * ISO C Thread-local Storage:: Functions to support thread-local storage.  File: libc.info, Node: ISO C Threads Return Values, Next: ISO C Thread Management, Up: ISO C Threads 36.1.1 Return Values -------------------- The ISO C thread specification provides the following enumeration constants for return values from functions in the API: ‘thrd_timedout’ A specified time was reached without acquiring the requested resource, usually a mutex or condition variable. ‘thrd_success’ The requested operation succeeded. ‘thrd_busy’ The requested operation failed because a requested resource is already in use. ‘thrd_error’ The requested operation failed. ‘thrd_nomem’ The requested operation failed because it was unable to allocate enough memory.  File: libc.info, Node: ISO C Thread Management, Next: Call Once, Prev: ISO C Threads Return Values, Up: ISO C Threads 36.1.2 Creation and Control --------------------------- The GNU C Library implements a set of functions that allow the user to easily create and use threads. Additional functionality is provided to control the behavior of threads. The following data types are defined for managing threads: -- Data Type: thrd_t A unique object that identifies a thread. -- Data Type: thrd_start_t This data type is an ‘int (*) (void *)’ typedef that is passed to ‘thrd_create’ when creating a new thread. It should point to the first function that thread will run. The following functions are used for working with threads: -- Function: int thrd_create (thrd_t *THR, thrd_start_t FUNC, void *ARG) Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety Concepts::. ‘thrd_create’ creates a new thread that will execute the function FUNC. The object pointed to by ARG will be used as the argument to FUNC. If successful, THR is set to the new thread identifier. This function may return ‘thrd_success’, ‘thrd_nomem’, or ‘thrd_error’. -- Function: thrd_t thrd_current (void) Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety Concepts::. This function returns the identifier of the calling thread. -- Function: int thrd_equal (thrd_t LHS, thrd_t RHS) Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety Concepts::. ‘thrd_equal’ checks whether LHS and RHS refer to the same thread. If LHS and RHS are different threads, this function returns 0; otherwise, the return value is non-zero. -- Function: int thrd_sleep (const struct timespec *TIME_POINT, struct timespec *REMAINING) Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety Concepts::. ‘thrd_sleep’ blocks the execution of the current thread for at least until the elapsed time pointed to by TIME_POINT has been reached. This function does not take an absolute time, but a duration that the thread is required to be blocked. *Note Time Basics::, and *note Time Types::. The thread may wake early if a signal that is not ignored is received. In such a case, if ‘remaining’ is not NULL, the remaining time duration is stored in the object pointed to by REMAINING. ‘thrd_sleep’ returns 0 if it blocked for at least the amount of time in ‘time_point’, -1 if it was interrupted by a signal, or a negative number on failure. -- Function: void thrd_yield (void) Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety Concepts::. ‘thrd_yield’ provides a hint to the implementation to reschedule the execution of the current thread, allowing other threads to run. -- Function: _Noreturn void thrd_exit (int RES) Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety Concepts::. ‘thrd_exit’ terminates execution of the calling thread and sets its result code to RES. If this function is called from a single-threaded process, the call is equivalent to calling ‘exit’ with ‘EXIT_SUCCESS’ (*note Normal Termination::). Also note that returning from a function that started a thread is equivalent to calling ‘thrd_exit’. -- Function: int thrd_detach (thrd_t THR) Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety Concepts::. ‘thrd_detach’ detaches the thread identified by ‘thr’ from the current control thread. The resources held by the detached thread will be freed automatically once the thread exits. The parent thread will never be notified by any THR signal. Calling ‘thrd_detach’ on a thread that was previously detached or joined by another thread results in undefined behavior. This function returns either ‘thrd_success’ or ‘thrd_error’. -- Function: int thrd_join (thrd_t THR, int *RES) Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety Concepts::. ‘thrd_join’ blocks the current thread until the thread identified by ‘thr’ finishes execution. If ‘res’ is not NULL, the result code of the thread is put into the location pointed to by RES. The termination of the thread “synchronizes-with” the completion of this function, meaning both threads have arrived at a common point in their execution. Calling ‘thrd_join’ on a thread that was previously detached or joined by another thread results in undefined behavior. This function returns either ‘thrd_success’ or ‘thrd_error’.  File: libc.info, Node: Call Once, Next: ISO C Mutexes, Prev: ISO C Thread Management, Up: ISO C Threads 36.1.3 Call Once ---------------- In order to guarantee single access to a function, the GNU C Library implements a “call once function” to ensure a function is only called once in the presence of multiple, potentially calling threads. -- Data Type: once_flag A complete object type capable of holding a flag used by ‘call_once’. -- Macro: ONCE_FLAG_INIT This value is used to initialize an object of type ‘once_flag’. -- Function: void call_once (once_flag *FLAG, void (*FUNC) (void)) Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety Concepts::. ‘call_once’ calls function FUNC exactly once, even if invoked from several threads. The completion of the function FUNC synchronizes-with all previous or subsequent calls to ‘call_once’ with the same ‘flag’ variable.  File: libc.info, Node: ISO C Mutexes, Next: ISO C Condition Variables, Prev: Call Once, Up: ISO C Threads 36.1.4 Mutexes -------------- To have better control of resources and how threads access them, the GNU C Library implements a “mutex” object, which can help avoid race conditions and other concurrency issues. The term "mutex" refers to mutual exclusion. The fundamental data type for a mutex is the ‘mtx_t’: -- Data Type: mtx_t The ‘mtx_t’ data type uniquely identifies a mutex object. The ISO C standard defines several types of mutexes. They are represented by the following symbolic constants: ‘mtx_plain’ A mutex that does not support timeout, or test and return. ‘mtx_recursive’ A mutex that supports recursive locking, which means that the owning thread can lock it more than once without causing deadlock. ‘mtx_timed’ A mutex that supports timeout. The following functions are used for working with mutexes: -- Function: int mtx_init (mtx_t *MUTEX, int TYPE) Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety Concepts::. ‘mtx_init’ creates a new mutex object with type TYPE. The object pointed to by MUTEX is set to the identifier of the newly created mutex. Not all combinations of mutex types are valid for the ‘type’ argument. Valid uses of mutex types for the ‘type’ argument are: ‘mtx_plain’ A non-recursive mutex that does not support timeout. ‘mtx_timed’ A non-recursive mutex that does support timeout. ‘mtx_plain | mtx_recursive’ A recursive mutex that does not support timeout. ‘mtx_timed | mtx_recursive’ A recursive mutex that does support timeout. This function returns either ‘thrd_success’ or ‘thrd_error’. -- Function: int mtx_lock (mtx_t *MUTEX) Preliminary: | MT-Safe | AS-Unsafe lock | AC-Unsafe lock | *Note POSIX Safety Concepts::. ‘mtx_lock’ blocks the current thread until the mutex pointed to by MUTEX is locked. The behavior is undefined if the current thread has already locked the mutex and the mutex is not recursive. Prior calls to ‘mtx_unlock’ on the same mutex synchronize-with this operation (if this operation succeeds), and all lock/unlock operations on any given mutex form a single total order (similar to the modification order of an atomic). This function returns either ‘thrd_success’ or ‘thrd_error’. -- Function: int mtx_timedlock (mtx_t *restrict MUTEX, const struct timespec *restrict TIME_POINT) Preliminary: | MT-Safe | AS-Unsafe lock | AC-Unsafe lock | *Note POSIX Safety Concepts::. ‘mtx_timedlock’ blocks the current thread until the mutex pointed to by MUTEX is locked or until the calendar time pointed to by TIME_POINT has been reached. Since this function takes an absolute time, if a duration is required, the calendar time must be calculated manually. *Note Time Basics::, and *note Calendar Time::. If the current thread has already locked the mutex and the mutex is not recursive, or if the mutex does not support timeout, the behavior of this function is undefined. Prior calls to ‘mtx_unlock’ on the same mutex synchronize-with this operation (if this operation succeeds), and all lock/unlock operations on any given mutex form a single total order (similar to the modification order of an atomic). This function returns either ‘thrd_success’ or ‘thrd_error’. -- Function: int mtx_trylock (mtx_t *MUTEX) Preliminary: | MT-Safe | AS-Unsafe lock | AC-Unsafe lock | *Note POSIX Safety Concepts::. ‘mtx_trylock’ tries to lock the mutex pointed to by MUTEX without blocking. It returns immediately if the mutex is already locked. Prior calls to ‘mtx_unlock’ on the same mutex synchronize-with this operation (if this operation succeeds), and all lock/unlock operations on any given mutex form a single total order (similar to the modification order of an atomic). This function returns ‘thrd_success’ if the lock was obtained, ‘thrd_busy’ if the mutex is already locked, and ‘thrd_error’ on failure. -- Function: int mtx_unlock (mtx_t *MUTEX) Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety Concepts::. ‘mtx_unlock’ unlocks the mutex pointed to by MUTEX. The behavior is undefined if the mutex is not locked by the calling thread. This function synchronizes-with subsequent ‘mtx_lock’, ‘mtx_trylock’, and ‘mtx_timedlock’ calls on the same mutex. All lock/unlock operations on any given mutex form a single total order (similar to the modification order of an atomic). This function returns either ‘thrd_success’ or ‘thrd_error’. -- Function: void mtx_destroy (mtx_t *MUTEX) Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety Concepts::. ‘mtx_destroy’ destroys the mutex pointed to by MUTEX. If there are any threads waiting on the mutex, the behavior is undefined.  File: libc.info, Node: ISO C Condition Variables, Next: ISO C Thread-local Storage, Prev: ISO C Mutexes, Up: ISO C Threads 36.1.5 Condition Variables -------------------------- Mutexes are not the only synchronization mechanisms available. For some more complex tasks, the GNU C Library also implements “condition variables”, which allow the programmer to think at a higher level when solving complex synchronization problems. They are used to synchronize threads waiting on a certain condition to happen. The fundamental data type for condition variables is the ‘cnd_t’: -- Data Type: cnd_t The ‘cnd_t’ uniquely identifies a condition variable object. The following functions are used for working with condition variables: -- Function: int cnd_init (cnd_t *COND) Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety Concepts::. ‘cnd_init’ initializes a new condition variable, identified by COND. This function may return ‘thrd_success’, ‘thrd_nomem’, or ‘thrd_error’. -- Function: int cnd_signal (cnd_t *COND) Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety Concepts::. ‘cnd_signal’ unblocks one thread that is currently waiting on the condition variable pointed to by COND. If a thread is successfully unblocked, this function returns ‘thrd_success’. If no threads are blocked, this function does nothing and returns ‘thrd_success’. Otherwise, this function returns ‘thrd_error’. -- Function: int cnd_broadcast (cnd_t *COND) Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety Concepts::. ‘cnd_broadcast’ unblocks all the threads that are currently waiting on the condition variable pointed to by COND. This function returns ‘thrd_success’ on success. If no threads are blocked, this function does nothing and returns ‘thrd_success’. Otherwise, this function returns ‘thrd_error’. -- Function: int cnd_wait (cnd_t *COND, mtx_t *MUTEX) Preliminary: | MT-Safe | AS-Unsafe lock | AC-Unsafe lock | *Note POSIX Safety Concepts::. ‘cnd_wait’ atomically unlocks the mutex pointed to by MUTEX and blocks on the condition variable pointed to by COND until the thread is signaled by ‘cnd_signal’ or ‘cnd_broadcast’. The mutex is locked again before the function returns. This function returns either ‘thrd_success’ or ‘thrd_error’. -- Function: int cnd_timedwait (cnd_t *restrict COND, mtx_t *restrict MUTEX, const struct timespec *restrict TIME_POINT) Preliminary: | MT-Safe | AS-Unsafe lock | AC-Unsafe lock | *Note POSIX Safety Concepts::. ‘cnd_timedwait’ atomically unlocks the mutex pointed to by MUTEX and blocks on the condition variable pointed to by COND until the thread is signaled by ‘cnd_signal’ or ‘cnd_broadcast’, or until the calendar time pointed to by TIME_POINT has been reached. The mutex is locked again before the function returns. As for ‘mtx_timedlock’, since this function takes an absolute time, if a duration is required, the calendar time must be calculated manually. *Note Time Basics::, and *note Calendar Time::. This function may return ‘thrd_success’, ‘thrd_nomem’, or ‘thrd_error’. -- Function: void cnd_destroy (cnd_t *COND) Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety Concepts::. ‘cnd_destroy’ destroys the condition variable pointed to by COND. If there are threads waiting on COND, the behavior is undefined.  File: libc.info, Node: ISO C Thread-local Storage, Prev: ISO C Condition Variables, Up: ISO C Threads 36.1.6 Thread-local Storage --------------------------- The GNU C Library implements functions to provide “thread-local storage”, a mechanism by which variables can be defined to have unique per-thread storage, lifetimes that match the thread lifetime, and destructors that cleanup the unique per-thread storage. Several data types and macros exist for working with thread-local storage: -- Data Type: tss_t The ‘tss_t’ data type identifies a thread-specific storage object. Even if shared, every thread will have its own instance of the variable, with different values. -- Data Type: tss_dtor_t The ‘tss_dtor_t’ is a function pointer of type ‘void (*) (void *)’, to be used as a thread-specific storage destructor. The function will be called when the current thread calls ‘thrd_exit’ (but never when calling ‘tss_delete’ or ‘exit’). -- Macro: thread_local ‘thread_local’ is used to mark a variable with thread storage duration, which means it is created when the thread starts and cleaned up when the thread ends. _Note:_ For C++, C++11 or later is required to use the ‘thread_local’ keyword. -- Macro: TSS_DTOR_ITERATIONS ‘TSS_DTOR_ITERATIONS’ is an integer constant expression representing the maximum number of iterations over all thread-local destructors at the time of thread termination. This value provides a bounded limit to the destruction of thread-local storage; e.g., consider a destructor that creates more thread-local storage. The following functions are used to manage thread-local storage: -- Function: int tss_create (tss_t *TSS_KEY, tss_dtor_t DESTRUCTOR) Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety Concepts::. ‘tss_create’ creates a new thread-specific storage key and stores it in the object pointed to by TSS_KEY. Although the same key value may be used by different threads, the values bound to the key by ‘tss_set’ are maintained on a per-thread basis and persist for the life of the calling thread. If ‘destructor’ is not NULL, a destructor function will be set, and called when the thread finishes its execution by calling ‘thrd_exit’. This function returns ‘thrd_success’ if ‘tss_key’ is successfully set to a unique value for the thread; otherwise, ‘thrd_error’ is returned and the value of ‘tss_key’ is undefined. -- Function: int tss_set (tss_t TSS_KEY, void *VAL) Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety Concepts::. ‘tss_set’ sets the value of the thread-specific storage identified by TSS_KEY for the current thread to VAL. Different threads may set different values to the same key. This function returns either ‘thrd_success’ or ‘thrd_error’. -- Function: void * tss_get (tss_t TSS_KEY) Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety Concepts::. ‘tss_get’ returns the value identified by TSS_KEY held in thread-specific storage for the current thread. Different threads may get different values identified by the same key. On failure, ‘tss_get’ returns zero. -- Function: void tss_delete (tss_t TSS_KEY) Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety Concepts::. ‘tss_delete’ destroys the thread-specific storage identified by TSS_KEY.  File: libc.info, Node: POSIX Threads, Prev: ISO C Threads, Up: Threads 36.2 POSIX Threads ================== This section describes the GNU C Library POSIX Threads implementation. * Menu: * Creating and Destroying Threads:: * Thread-specific Data:: Support for creating and managing thread-specific data * Waiting with Explicit Clocks:: Functions for waiting with an explicit clock specification. * POSIX Semaphores:: Support for process and thread synchronization using semaphores * POSIX Barriers:: Support for process and thread synchronization using barriers * POSIX Spin Locks:: Support for process and thread synchronization using spinlocks * POSIX Mutexes:: Support for mutual exclusion * POSIX Threads Other APIs:: Other Standard functions * Non-POSIX Extensions:: Additional functions to extend POSIX Thread functionality  File: libc.info, Node: Creating and Destroying Threads, Next: Thread-specific Data, Up: POSIX Threads 36.2.1 Creating and Destroying Threads -------------------------------------- -- Function: int pthread_create (pthread_t *NEWTHREAD, const pthread_attr_t *ATTR, void *(*START_ROUTINE) (void *), void *ARG) This function creates a new thread with attributes ATTR. This thread will call START_ROUTINE and pass it ARG. If START_ROUTINE returns, the thread will exit and the return value will become the thread's exit value. The new thread's ID is stored in NEWTHREAD. Returns 0 on success. This documentation is a stub. For additional information on this function, consult the manual page pthread_create(3) (Latest, online: ) *Note Linux Kernel::. -- Function: int pthread_detach (pthread_t TH) Indicates that thread TH must clean up after itself automatically when it exits, as the parent thread will not call ‘pthread_join’ on it. This documentation is a stub. For additional information on this function, consult the manual page pthread_detach(3) (Latest, online: ) *Note Linux Kernel::. -- Function: int pthread_join (pthread_t TH, void **THREAD_RETURN) Waits for thread TH to exit, and stores its return value in THREAD_RETURN. This documentation is a stub. For additional information on this function, consult the manual page pthread_join(3) (Latest, online: ) *Note Linux Kernel::. -- Function: int pthread_kill (pthread_t TH, int SIGNAL) Sends signal SIGNAL to thread TH. This documentation is a stub. For additional information on this function, consult the manual page pthread_kill(3) (Latest, online: ) *Note Linux Kernel::. -- Function: pthread_t pthread_self (void) Returns the ID of the thread which performed the call. This documentation is a stub. For additional information on this function, consult the manual page pthread_self(3) (Latest, online: ) *Note Linux Kernel::. Each thread has a set of attributes which are passed to ‘pthread_create’ via the ‘pthread_attr_t’ type, which should be considered an opaque type. -- Function: int pthread_attr_init (pthread_attr_t *ATTR) Initializes ATTR to its default values and allocates any resources required. Once initialized, ATTR can be modified by other ‘pthread_attr_*’ functions, or used by ‘pthread_create’. This documentation is a stub. For additional information on this function, consult the manual page pthread_attr_init(3) (Latest, online: ) *Note Linux Kernel::. -- Function: int pthread_attr_destroy (pthread_attr_t *ATTR) When no longer needed, ATTR should be destroyed with this function, which releases any resources allocated. Note that ATTR is only needed for the ‘pthread_create’ call, not for the running thread itself. This documentation is a stub. For additional information on this function, consult the manual page pthread_attr_destroy(3) (Latest, online: ) *Note Linux Kernel::. -- Function: int pthread_attr_setdetachstate (pthread_attr_t *ATTR, int DETACHSTATE) Sets the detach state attribute for ATTR. This attribute may be one of the following: ‘PTHREAD_CREATE_DETACHED’ Causes the created thread to be detached, that is, as if ‘pthread_detach’ had been called on it. ‘PTHREAD_CREATE_JOINABLE’ Causes the created thread to be joinable, that is, ‘pthread_join’ must be called on it. This documentation is a stub. For additional information on this function, consult the manual page pthread_attr_setdetachstate(3) (Latest, online: ) *Note Linux Kernel::. -- Function: int pthread_attr_getdetachstate (const pthread_attr_t *ATTR, int *DETACHSTATE) Gets the detach state attribute from ATTR. This documentation is a stub. For additional information on this function, consult the manual page pthread_attr_getdetachstate(3) (Latest, online: ) *Note Linux Kernel::.  File: libc.info, Node: Thread-specific Data, Next: Waiting with Explicit Clocks, Prev: Creating and Destroying Threads, Up: POSIX Threads 36.2.2 Thread-specific Data --------------------------- The GNU C Library implements functions to allow users to create and manage data specific to a thread. Such data may be destroyed at thread exit, if a destructor is provided. The following functions are defined: -- Function: int pthread_key_create (pthread_key_t *KEY, void (*DESTRUCTOR)(void*)) Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety Concepts::. Create a thread-specific data key for the calling thread, referenced by KEY. Objects declared with the C++11 ‘thread_local’ keyword are destroyed before thread-specific data, so they should not be used in thread-specific data destructors or even as members of the thread-specific data, since the latter is passed as an argument to the destructor function. -- Function: int pthread_key_delete (pthread_key_t KEY) Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety Concepts::. Destroy the thread-specific data KEY in the calling thread. The destructor for the thread-specific data is not called during destruction, nor is it called during thread exit. -- Function: void * pthread_getspecific (pthread_key_t KEY) Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety Concepts::. Return the thread-specific data associated with KEY in the calling thread. -- Function: int pthread_setspecific (pthread_key_t KEY, const void *VALUE) Preliminary: | MT-Safe | AS-Unsafe corrupt heap | AC-Unsafe corrupt mem | *Note POSIX Safety Concepts::. Associate the thread-specific VALUE with KEY in the calling thread.  File: libc.info, Node: Waiting with Explicit Clocks, Next: POSIX Semaphores, Prev: Thread-specific Data, Up: POSIX Threads 36.2.3 Functions for Waiting According to a Specific Clock ---------------------------------------------------------- The GNU C Library provides several waiting functions that expect an explicit ‘clockid_t’ argument. These functions were all adopted by POSIX.1-2024. -- Function: int pthread_cond_clockwait (pthread_cond_t *COND, pthread_mutex_t *MUTEX, clockid_t CLOCKID, const struct timespec *ABSTIME) Preliminary: | MT-Safe | AS-Unsafe lock | AC-Unsafe lock | *Note POSIX Safety Concepts::. Behaves like ‘pthread_cond_timedwait’ except the time ABSTIME is measured against the clock specified by CLOCKID rather than the clock specified or defaulted when ‘pthread_cond_init’ was called. Currently, CLOCKID must be either ‘CLOCK_MONOTONIC’ or ‘CLOCK_REALTIME’. -- Function: int pthread_rwlock_clockrdlock (pthread_rwlock_t *RWLOCK, clockid_t CLOCKID, const struct timespec *ABSTIME) Preliminary: | MT-Safe | AS-Unsafe lock | AC-Unsafe lock | *Note POSIX Safety Concepts::. Behaves like ‘pthread_rwlock_timedrdlock’ except the time ABSTIME is measured against the clock specified by CLOCKID rather than ‘CLOCK_REALTIME’. Currently, CLOCKID must be either ‘CLOCK_MONOTONIC’ or ‘CLOCK_REALTIME’, otherwise ‘EINVAL’ is returned. -- Function: int pthread_rwlock_clockwrlock (pthread_rwlock_t *RWLOCK, clockid_t CLOCKID, const struct timespec *ABSTIME) Preliminary: | MT-Safe | AS-Unsafe lock | AC-Unsafe lock | *Note POSIX Safety Concepts::. Behaves like ‘pthread_rwlock_timedwrlock’ except the time ABSTIME is measured against the clock specified by CLOCKID rather than ‘CLOCK_REALTIME’. Currently, CLOCKID must be either ‘CLOCK_MONOTONIC’ or ‘CLOCK_REALTIME’, otherwise ‘EINVAL’ is returned.  File: libc.info, Node: POSIX Semaphores, Next: POSIX Barriers, Prev: Waiting with Explicit Clocks, Up: POSIX Threads 36.2.4 POSIX Semaphores ----------------------- -- Function: int sem_init (sem_t *SEM, int PSHARED, unsigned int VALUE) Preliminary: | MT-Safe | AS-Safe | AC-Unsafe corrupt | *Note POSIX Safety Concepts::. This documentation is a stub. For additional information on this function, consult the manual page sem_init(3) (Latest, online: ) *Note Linux Kernel::. -- Function: int sem_destroy (sem_t *SEM) Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety Concepts::. This documentation is a stub. For additional information on this function, consult the manual page sem_destroy(3) (Latest, online: ) *Note Linux Kernel::. -- Function: sem_t * sem_open (const char *NAME, int OFLAG, ...) Preliminary: | MT-Safe | AS-Unsafe init | AC-Unsafe init | *Note POSIX Safety Concepts::. This documentation is a stub. For additional information on this function, consult the manual page sem_open(3) (Latest, online: ) *Note Linux Kernel::. -- Function: int sem_close (sem_t *SEM) Preliminary: | MT-Safe | AS-Unsafe lock | AC-Unsafe lock | *Note POSIX Safety Concepts::. This documentation is a stub. For additional information on this function, consult the manual page sem_close(3) (Latest, online: ) *Note Linux Kernel::. -- Function: int sem_unlink (const char *NAME) Preliminary: | MT-Safe | AS-Unsafe init | AC-Unsafe corrupt | *Note POSIX Safety Concepts::. This documentation is a stub. For additional information on this function, consult the manual page sem_unlink(3) (Latest, online: ) *Note Linux Kernel::. -- Function: int sem_wait (sem_t *SEM) Preliminary: | MT-Safe | AS-Safe | AC-Unsafe corrupt | *Note POSIX Safety Concepts::. This documentation is a stub. For additional information on this function, consult the manual page sem_wait(3) (Latest, online: ) *Note Linux Kernel::. -- Function: int sem_timedwait (sem_t *SEM, const struct timespec *ABSTIME) Preliminary: | MT-Safe | AS-Safe | AC-Unsafe corrupt | *Note POSIX Safety Concepts::. This documentation is a stub. For additional information on this function, consult the manual page sem_timedwait(3) (Latest, online: ) *Note Linux Kernel::. -- Function: int sem_clockwait (sem_t *SEM, clockid_t CLOCKID, const struct timespec *ABSTIME) Preliminary: | MT-Safe | AS-Unsafe lock | AC-Unsafe lock | *Note POSIX Safety Concepts::. Behaves like ‘sem_timedwait’ except the time ABSTIME is measured against the clock specified by CLOCKID rather than ‘CLOCK_REALTIME’. Currently, CLOCKID must be either ‘CLOCK_MONOTONIC’ or ‘CLOCK_REALTIME’. -- Function: int sem_trywait (sem_t *SEM) Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety Concepts::. This documentation is a stub. For additional information on this function, consult the manual page sem_trywait(3) (Latest, online: ) *Note Linux Kernel::. -- Function: int sem_post (sem_t *SEM) Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety Concepts::. This documentation is a stub. For additional information on this function, consult the manual page sem_post(3) (Latest, online: ) *Note Linux Kernel::. -- Function: int sem_getvalue (sem_t *SEM, int *SVAL) Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety Concepts::. This documentation is a stub. For additional information on this function, consult the manual page sem_getvalue(3) (Latest, online: ) *Note Linux Kernel::.  File: libc.info, Node: POSIX Barriers, Next: POSIX Spin Locks, Prev: POSIX Semaphores, Up: POSIX Threads 36.2.5 POSIX Barriers --------------------- A POSIX barrier works as follows: a file-local or global ‘pthread_barrier_t’ object is initialized via ‘pthread_barrier_init’ to require COUNT threads to wait on it. After that, up to COUNT-1 threads will wait on the barrier via ‘pthread_barrier_wait’. None of these calls will return until COUNT threads are waiting via the next call to ‘pthread_barrier_wait’, at which point, all of these calls will return. The net result is that COUNT threads will be synchronized at that point. At some point after this, the barrier is destroyed via ‘pthread_barrier_destroy’. Note that a barrier must be destroyed before being re-initialized, to ensure that all threads are properly synchronized, but need not be destroyed and re-initialized before being reused. -- Function: int pthread_barrier_init (pthread_barrier_t *BARRIER, const pthread_barrierattr_t *ATTR, unsigned int COUNT) Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety Concepts::. This function initializes a barrier to synchronize COUNT threads. The barrier must be uninitialized or destroyed before it is initialized; attempting to initialize an in-use barrier results in undefined behavior. The ATTR argument to ‘pthread_barrier_init’ is typically NULL for a process-private barrier, but may be used to share a barrier across processes (documentation TBD). On success, 0 is returned. On error, one of the following is returned: ‘EINVAL’ Either COUNT is zero, or is large enough to cause an internal overflow. -- Function: int pthread_barrier_wait (pthread_barrier_t *BARRIER) Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety Concepts::. This function synchronizes threads. The first COUNT-1 threads that wait on BARRIER will just wait. The next thread that waits on BARRIER will cause all COUNT threads' calls to return. The BARRIER must be initialized with ‘pthread_barrier_init’ and not yet destroyed with ‘pthread_barrier_destroy’. The return value of this function is ‘PTHREAD_BARRIER_SERIAL_THREAD’ for one thread (it is unspecified which thread) and 0 for the remainder, for each batch of COUNT threads synchronized. After such a batch is synchronized, the BARRIER will begin synchronizing the next COUNT threads. -- Function: int pthread_barrier_destroy (pthread_barrier_t *BARRIER) Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety Concepts::. Destroys BARRIER and releases any resources it may have allocated. A barrier must not be destroyed if any thread is waiting on it, or if it was not initialized. This call always succeeds and returns 0.  File: libc.info, Node: POSIX Spin Locks, Next: POSIX Mutexes, Prev: POSIX Barriers, Up: POSIX Threads 36.2.6 POSIX Spin Locks ----------------------- A spinlock is a low overhead lock suitable for use in a realtime thread where it's known that the thread won't be paused by the scheduler. Non-realtime threads should use mutexes instead. -- Function: int pthread_spin_init (pthread_spinlock_t *LOCK, int PSHARED) Initializes a spinlock. PSHARED is one of: ‘PTHREAD_PROCESS_PRIVATE’ This spinlock is private to the process which created it. ‘PTHREAD_PROCESS_SHARED’ This spinlock is shared across any process that can access it, for example through shared memory. This documentation is a stub. For additional information on this function, consult the manual page pthread_spin_init(3) (Latest, online: ) *Note Linux Kernel::. -- Function: int pthread_spin_destroy (pthread_spinlock_t *LOCK) Destroys a spinlock and releases any resources it held. This documentation is a stub. For additional information on this function, consult the manual page pthread_spin_destroy(3) (Latest, online: ) *Note Linux Kernel::. -- Function: int pthread_spin_lock (pthread_spinlock_t *LOCK) Locks a spinlock. Only one thread at a time can lock a spinlock. If another thread has locked this spinlock, the calling thread waits until it is unlocked, then attempts to lock it. This documentation is a stub. For additional information on this function, consult the manual page pthread_spin_lock(3) (Latest, online: ) *Note Linux Kernel::. -- Function: int pthread_spin_unlock (pthread_spinlock_t *LOCK) Unlocks a spinlock. If one or more threads are waiting for the lock to be unlocked, one of them (unspecified which) will succeed in locking it, and will return from ‘pthread_spin_lock’). This documentation is a stub. For additional information on this function, consult the manual page pthread_spin_unlock(3) (Latest, online: ) *Note Linux Kernel::. -- Function: int pthread_spin_trylock (pthread_spinlock_t *LOCK) Like ‘pthread_spin_unlock’ but returns 0 if the lock was unlocked, or EBUSY if it was locked. This documentation is a stub. For additional information on this function, consult the manual page pthread_spin_trylock(3) (Latest, online: ) *Note Linux Kernel::.  File: libc.info, Node: POSIX Mutexes, Next: POSIX Threads Other APIs, Prev: POSIX Spin Locks, Up: POSIX Threads 36.2.7 POSIX Mutexes -------------------- A _mutex_, or "mutual exclusion", is a way of guaranteeing that only one thread at a time is able to execute a protected bit of code (or access any other resource). Two or more threads trying to execute the same code at the same time, will instead take turns, according to the mutex. A mutex is much like a spinlock, but implemented in a way that is more appropriate for use in non-realtime threads, and is more resource-conserving. -- Function: int pthread_mutex_init (pthread_mutex_t *MUTEX, const pthread_mutexattr_t *MUTEXATTR) Initiailizes a mutex. This documentation is a stub. For additional information on this function, consult the manual page pthread_mutex_init(3) (Latest, online: ) *Note Linux Kernel::. -- Function: int pthread_mutex_destroy (pthread_mutex_t *MUTEX) Destroys a no-longer-needed mutex. This documentation is a stub. For additional information on this function, consult the manual page pthread_mutex_destroy(3) (Latest, online: ) *Note Linux Kernel::. -- Function: int pthread_mutex_lock (pthread_mutex_t *MUTEX) Only one thread at a time may lock MUTEX, and must unlock it when appropriate. If a thread calls ‘pthread_mutex_lock’ while MUTEX is locked by another thread, the calling thread will wait until MUTEX is unlocked, then attempt to lock it. Since there may be many threads waiting at the same time, the calling thread may need to repeat this wait-and-try many times before it successfully locks MUTEX, at which point the call to ‘pthread_mutex_locks’ returns succesfully. This function may fail with the following: ‘EAGAIN’ Too many locks were attempted. ‘EDEADLK’ The calling thread already holds a lock on MUTEX. ‘EINVAL’ MUTEX has an invalid kind, or an invalid priority was requested. ‘ENOTRECOVERABLE’ The thread holding the lock died in a way that the system cannot recover from. ‘EOWNERDEAD’ The thread holding the lock died in a way that the system can recover from. This documentation is a stub. For additional information on this function, consult the manual page pthread_mutex_lock(3) (Latest, online: ) *Note Linux Kernel::. -- Function: int pthread_mutex_trylock (pthread_mutex_t *MUTEX) Like ‘pthread_mutex_lock’ but if the lock cannot be immediately obtained, returns EBUSY. This documentation is a stub. For additional information on this function, consult the manual page pthread_mutex_trylock(3) (Latest, online: ) *Note Linux Kernel::. -- Function: int pthread_mutex_unlock (pthread_mutex_t *MUTEX) Unlocks MUTEX. Returns EPERM if the calling thread doesn't hold the lock on MUTEX. This documentation is a stub. For additional information on this function, consult the manual page pthread_mutex_unlock(3) (Latest, online: ) *Note Linux Kernel::. -- Function: int pthread_mutex_clocklock (pthread_mutex_t *MUTEX, clockid_t CLOCKID, const struct timespec *ABSTIME) -- Function: int pthread_mutex_timedlock (pthread_mutex_t *MUTEX, const struct timespec *ABSTIME) These two functions act like ‘pthread_mutex_lock’ with the exception that the call will not wait past time ABSTIME, as reported by CLOCKID or (for ‘pthread_mutex_timedlock’) ‘CLOCK_REALTIME’. If ABSTIME is reached and the mutex still cannot be locked, an ‘ETIMEDOUT’ error is returned. If the time had already passed when these functions are called, and the mutex cannot be immediately locked, the function times out immediately. -- Function: int pthread_mutexattr_init (const pthread_mutexattr_t *ATTR) Initializes ATTR with default values. This documentation is a stub. For additional information on this function, consult the manual page pthread_mutexattr_init(3) (Latest, online: ) *Note Linux Kernel::. -- Function: int pthread_mutexattr_destroy (pthread_mutexattr_t *ATTR) Destroys ATTR and releases any resources it may have allocated. This documentation is a stub. For additional information on this function, consult the manual page pthread_mutexattr_destroy(3) (Latest, online: ) *Note Linux Kernel::. -- Function: int pthread_mutexattr_settype (pthread_mutexattr_t *ATTR, int KIND) This functions allow you to change what kind of mutex a mutex is, by changing the attributes used to initialize it. The values for KIND are: ‘PTHREAD_MUTEX_NORMAL’ No attempt to detect deadlock is performed; a thread will deadlock if it tries to lock this mutex yet already holds a lock to it. Attempting to unlock a mutex not locked by the calling thread results in undefined behavior. ‘PTHREAD_MUTEX_ERRORCHECK’ Attemps to relock a mutex, or unlock a mutex not held, will result in an error. ‘PTHREAD_MUTEX_RECURSIVE’ Attempts to relock a mutex already held succeed, but require a matching number of unlocks to release it. Attempts to unlock a mutex not held will result in an error. ‘PTHREAD_MUTEX_DEFAULT’ Attemps to relock a mutex, or unlock a mutex not held, will result in undefined behavior. This is the default. -- Function: int pthread_mutexattr_gettype (const pthread_mutexattr_t *ATTR, int *KIND) This function gets the kind of mutex MUTEX is.  File: libc.info, Node: POSIX Threads Other APIs, Next: Non-POSIX Extensions, Prev: POSIX Mutexes, Up: POSIX Threads 36.2.8 POSIX Threads Other APIs ------------------------------- -- Function: int pthread_equal (pthread_t THREAD1, pthread_t THREAD2) Compares two thread IDs. If they are the same, returns nonzero, else returns zero. This documentation is a stub. For additional information on this function, consult the manual page pthread_equal(3) (Latest, online: ) *Note Linux Kernel::. -- Function: int pthread_getcpuclockid (pthread_t TH, __clockid_t *CLOCK_ID) Get the clock associated with TH. This documentation is a stub. For additional information on this function, consult the manual page pthread_getcpuclockid(3) (Latest, online: ) *Note Linux Kernel::. -- Function: int pthread_once (pthread_once_t *ONCE_CONTROL, void (*INIT_ROUTINE) (void)) Calls INIT_ROUTINE once for each ONCE_CONTROL, which must be statically initalized to ‘PTHREAD_ONCE_INIT’. Subsequent calls to ‘pthread_once’ with the same ONCE_CONTROL do not call INIT_ROUTINE, even in multi-threaded environments. This documentation is a stub. For additional information on this function, consult the manual page pthread_once(3) (Latest, online: ) *Note Linux Kernel::. -- Function: int pthread_sigmask (int HOW, const __sigset_t *NEWMASK, __sigset_t *OLDMASK) This documentation is a stub. For additional information on this function, consult the manual page pthread_sigmask(3) (Latest, online: ) *Note Linux Kernel::.  File: libc.info, Node: Non-POSIX Extensions, Prev: POSIX Threads Other APIs, Up: POSIX Threads 36.2.9 Non-POSIX Extensions --------------------------- In addition to implementing the POSIX API for threads, the GNU C Library provides additional functions and interfaces to provide functionality not specified in the standard. * Menu: * Default Thread Attributes:: Setting default attributes for threads in a process. * Initial Thread Signal Mask:: Setting the initial mask of threads. * Thread CPU Affinity:: Limiting which CPUs can run a thread. * Joining Threads:: Wait for a thread to terminate. * Thread Names:: Changing the name of a thread. * Single-Threaded:: Detecting single-threaded execution. * Restartable Sequences:: Linux-specific restartable sequences integration.  File: libc.info, Node: Default Thread Attributes, Next: Initial Thread Signal Mask, Up: Non-POSIX Extensions 36.2.9.1 Setting Process-wide defaults for thread attributes ............................................................ The GNU C Library provides non-standard API functions to set and get the default attributes used in the creation of threads in a process. -- Function: int pthread_getattr_default_np (pthread_attr_t *ATTR) Preliminary: | MT-Safe | AS-Unsafe lock | AC-Unsafe lock | *Note POSIX Safety Concepts::. Get the default attribute values and set ATTR to match. This function returns 0 on success and a non-zero error code on failure. -- Function: int pthread_setattr_default_np (pthread_attr_t *ATTR) Preliminary: | MT-Safe | AS-Unsafe heap lock | AC-Unsafe lock mem | *Note POSIX Safety Concepts::. Set the default attribute values to match the values in ATTR. The function returns 0 on success and a non-zero error code on failure. The following error codes are defined for this function: ‘EINVAL’ At least one of the values in ATTR does not qualify as valid for the attributes or the stack address is set in the attribute. ‘ENOMEM’ The system does not have sufficient memory.  File: libc.info, Node: Initial Thread Signal Mask, Next: Thread CPU Affinity, Prev: Default Thread Attributes, Up: Non-POSIX Extensions 36.2.9.2 Controlling the Initial Signal Mask of a New Thread ............................................................ The GNU C Library provides a way to specify the initial signal mask of a thread created using ‘pthread_create’, passing a thread attribute object configured for this purpose. -- Function: int pthread_attr_setsigmask_np (pthread_attr_t *ATTR, const sigset_t *SIGMASK) Preliminary: | MT-Safe | AS-Unsafe heap | AC-Unsafe mem | *Note POSIX Safety Concepts::. Change the initial signal mask specified by ATTR. If SIGMASK is not ‘NULL’, the initial signal mask for new threads created with ATTR is set to ‘*SIGMASK’. If SIGMASK is ‘NULL’, ATTR will no longer specify an explicit signal mask, so that the initial signal mask of the new thread is inherited from the thread that calls ‘pthread_create’. This function returns zero on success, and ‘ENOMEM’ on memory allocation failure. -- Function: int pthread_attr_getsigmask_np (const pthread_attr_t *ATTR, sigset_t *SIGMASK) Preliminary: | MT-Safe | AS-Unsafe heap | AC-Unsafe mem | *Note POSIX Safety Concepts::. Retrieve the signal mask stored in ATTR and copy it to ‘*SIGMASK’. If the signal mask has not been set, return the special constant ‘PTHREAD_ATTR_NO_SIGMASK_NP’, otherwise return zero. Obtaining the signal mask only works if it has been previously stored by ‘pthread_attr_setsigmask_np’. For example, the ‘pthread_getattr_np’ function does not obtain the current signal mask of the specified thread, and ‘pthread_attr_getsigmask_np’ will subsequently report the signal mask as unset. -- Macro: int PTHREAD_ATTR_NO_SIGMASK_NP The special value returned by ‘pthread_attr_setsigmask_np’ to indicate that no signal mask has been set for the attribute. It is possible to create a new thread with a specific signal mask without using these functions. On the thread that calls ‘pthread_create’, the required steps for the general case are: 1. Mask all signals, and save the old signal mask, using ‘pthread_sigmask’. This ensures that the new thread will be created with all signals masked, so that no signals can be delivered to the thread until the desired signal mask is set. 2. Call ‘pthread_create’ to create the new thread, passing the desired signal mask to the thread start routine (which could be a wrapper function for the actual thread start routine). It may be necessary to make a copy of the desired signal mask on the heap, so that the life-time of the copy extends to the point when the start routine needs to access the signal mask. 3. Restore the thread's signal mask, to the set that was saved in the first step. The start routine for the created thread needs to locate the desired signal mask and use ‘pthread_sigmask’ to apply it to the thread. If the signal mask was copied to a heap allocation, the copy should be freed.  File: libc.info, Node: Thread CPU Affinity, Next: Joining Threads, Prev: Initial Thread Signal Mask, Up: Non-POSIX Extensions 36.2.9.3 Thread CPU Affinity ............................ Processes and threads normally run on any available CPU. However, they can be given an _affinity_ to one or more CPUs, which limits them to the CPU set specified. -- Function: int pthread_attr_setaffinity_np (pthread_attr_t *ATTR, size_t CPUSETSIZE, const cpu_set_t *CPUSET) Sets the CPU affinity in ATTR. The CPU affinity controls which CPUs a thread may execute on. *Note CPU Affinity::. This documentation is a stub. For additional information on this function, consult the manual page pthread_attr_setaffinity_np(3) (Latest, online: ) *Note Linux Kernel::. -- Function: int pthread_attr_getaffinity_np (const pthread_attr_t *ATTR, size_t CPUSETSIZE, cpu_set_t *CPUSET) Gets the CPU affinity settings from ATTR. This documentation is a stub. For additional information on this function, consult the manual page pthread_attr_getaffinity_np(3) (Latest, online: ) *Note Linux Kernel::. -- Function: int pthread_setaffinity_np (pthread_t *TH, size_t CPUSETSIZE, const cpu_set_t *CPUSET) Sets the CPU affinity for thread TH. The CPU affinity controls which CPUs a thread may execute on. *Note CPU Affinity::. This documentation is a stub. For additional information on this function, consult the manual page pthread_setaffinity_np(3) (Latest, online: ) *Note Linux Kernel::. -- Function: int pthread_getaffinity_np (const pthread_t *TH, size_t CPUSETSIZE, cpu_set_t *CPUSET) Gets the CPU affinity for thread TH. The CPU affinity controls which CPUs a thread may execute on. *Note CPU Affinity::. This documentation is a stub. For additional information on this function, consult the manual page pthread_getaffinity_np(3) (Latest, online: ) *Note Linux Kernel::.  File: libc.info, Node: Joining Threads, Next: Thread Names, Prev: Thread CPU Affinity, Up: Non-POSIX Extensions 36.2.9.4 Wait for a thread to terminate ....................................... The GNU C Library provides several extensions to the ‘pthread_join’ function. -- Function: int pthread_tryjoin_np (pthread_t *THREAD, void **THREAD_RETURN) Preliminary: | MT-Safe | AS-Unsafe lock | AC-Unsafe lock | *Note POSIX Safety Concepts::. Behaves like ‘pthread_join’ except that it will return ‘EBUSY’ immediately if the thread specified by THREAD has not yet terminated. -- Function: int pthread_timedjoin_np (pthread_t *THREAD, void **THREAD_RETURN, const struct timespec *ABSTIME) Preliminary: | MT-Safe | AS-Unsafe lock | AC-Unsafe lock | *Note POSIX Safety Concepts::. Behaves like ‘pthread_tryjoin_np’ except that it will block until the absolute time ABSTIME measured against ‘CLOCK_REALTIME’ is reached if the thread has not terminated by that time and return ‘EBUSY’. If ABSTIME is equal to ‘NULL’ then the function will wait forever in the same way as ‘pthread_join’. -- Function: int pthread_clockjoin_np (pthread_t *THREAD, void **THREAD_RETURN, clockid_t CLOCKID, const struct timespec *ABSTIME) Preliminary: | MT-Safe | AS-Unsafe lock | AC-Unsafe lock | *Note POSIX Safety Concepts::. Behaves like ‘pthread_timedjoin_np’ except that the absolute time in ABSTIME is measured against the clock specified by CLOCKID. Currently, CLOCKID must be either ‘CLOCK_MONOTONIC’ or ‘CLOCK_REALTIME’. The ‘sem_clockwait’ function also works using a ‘clockid_t’ argument. *Note POSIX Semaphores::.  File: libc.info, Node: Thread Names, Next: Single-Threaded, Prev: Joining Threads, Up: Non-POSIX Extensions 36.2.9.5 Thread Names ..................... -- Function: int pthread_setname_np (pthread_t TH, const char *NAME) Gives thread TH the name NAME. This name shows up in ‘ps’ when it's listing individual threads. NAME is a NUL-terminated string of no more than 15 non-NUL characters. This documentation is a stub. For additional information on this function, consult the manual page pthread_setname_np(3) (Latest, online: ) *Note Linux Kernel::. -- Function: int pthread_getname_np (pthread_t TH, char *BUF, size_t BUFLEN) Retrieves the name of thread TH. This documentation is a stub. For additional information on this function, consult the manual page pthread_getname_np(3) (Latest, online: ) *Note Linux Kernel::.  File: libc.info, Node: Single-Threaded, Next: Restartable Sequences, Prev: Thread Names, Up: Non-POSIX Extensions 36.2.9.6 Detecting Single-Threaded Execution ............................................ Multi-threaded programs require synchronization among threads. This synchronization can be costly even if there is just a single thread and no data is shared between multiple processors. The GNU C Library offers an interface to detect whether the process is in single-threaded mode. Applications can use this information to avoid synchronization, for example by using regular instructions to load and store memory instead of atomic instructions, or using relaxed memory ordering instead of stronger memory ordering. -- Variable: char __libc_single_threaded This variable is non-zero if the current process is definitely single-threaded. If it is zero, the process may be multi-threaded, or the GNU C Library cannot determine at this point of the program execution whether the process is single-threaded or not. Applications must never write to this variable. Most applications should perform the same actions whether or not ‘__libc_single_threaded’ is true, except with less synchronization. If this rule is followed, a process that subsequently becomes multi-threaded is already in a consistent state. For example, in order to increment a reference count, the following code can be used: if (__libc_single_threaded) atomic_fetch_add (&reference_count, 1, memory_order_relaxed); else atomic_fetch_add (&reference_count, 1, memory_order_acq_rel); This still requires some form of synchronization on the single-threaded branch, so it can be beneficial not to declare the reference count as ‘_Atomic’, and use the GCC ‘__atomic’ built-ins. *Note Built-in Functions for Memory Model Aware Atomic Operations: (gcc)__atomic Builtins. Then the code to increment a reference count looks like this: if (__libc_single_threaded) ++reference_count; else __atomic_fetch_add (&reference_count, 1, __ATOMIC_ACQ_REL); (Depending on the data associated with the reference count, it may be possible to use the weaker ‘__ATOMIC_RELAXED’ memory ordering on the multi-threaded branch.) Several functions in the GNU C Library can change the value of the ‘__libc_single_threaded’ variable. For example, creating new threads using the ‘pthread_create’ or ‘thrd_create’ function sets the variable to false. This can also happen indirectly, say via a call to ‘dlopen’. Therefore, applications need to make a copy of the value of ‘__libc_single_threaded’ if after such a function call, behavior must match the value as it was before the call, like this: bool single_threaded = __libc_single_threaded; if (single_threaded) prepare_single_threaded (); else prepare_multi_thread (); void *handle = dlopen (shared_library_name, RTLD_NOW); lookup_symbols (handle); if (single_threaded) cleanup_single_threaded (); else cleanup_multi_thread (); Since the value of ‘__libc_single_threaded’ can change from true to false during the execution of the program, it is not useful for selecting optimized function implementations in IFUNC resolvers. Atomic operations can also be used on mappings shared among single-threaded processes. This means that a compiler must not use ‘__libc_single_threaded’ to optimize atomic operations, unless it is able to prove that the memory is not shared. *Implementation Note:* The ‘__libc_single_threaded’ variable is not declared as ‘volatile’ because it is expected that compilers optimize a sequence of single-threaded checks into one check, for example if several reference counts are updated. The current implementation in the GNU C Library does not set the ‘__libc_single_threaded’ variable to a true value if a process turns single-threaded again. Future versions of the GNU C Library may do this, but only as the result of function calls which imply an acquire (compiler) barrier. (Some compilers assume that well-known functions such as ‘malloc’ do not write to global variables, and setting ‘__libc_single_threaded’ would introduce a data race and undefined behavior.) In any case, an application must not write to ‘__libc_single_threaded’ even if it has joined the last application-created thread because future versions of the GNU C Library may create background threads after the first thread has been created, and the application has no way of knowing that these threads are present.  File: libc.info, Node: Restartable Sequences, Prev: Single-Threaded, Up: Non-POSIX Extensions 36.2.9.7 Restartable Sequences .............................. This section describes restartable sequences integration for the GNU C Library. This functionality is only available on Linux. -- Data Type: struct rseq The type of the restartable sequences area. Future versions of Linux may add additional fields to the end of this structure. Users need to obtain the address of the restartable sequences area using the thread pointer and the ‘__rseq_offset’ variable, described below. One use of the restartable sequences area is to read the current CPU number from its ‘cpu_id’ field, as an inline version of ‘sched_getcpu’. The GNU C Library sets the ‘cpu_id’ field to ‘RSEQ_CPU_ID_REGISTRATION_FAILED’ if registration failed or was explicitly disabled. Furthermore, users can store the address of a ‘struct rseq_cs’ object into the ‘rseq_cs’ field of ‘struct rseq’, thus informing the kernel that the thread enters a restartable sequence critical section. This pointer and the code areas it itself points to must not be left pointing to memory areas which are freed or re-used. Several approaches can guarantee this. If the application or library can guarantee that the memory used to hold the ‘struct rseq_cs’ and the code areas it refers to are never freed or re-used, no special action must be taken. Else, before that memory is re-used of freed, the application is responsible for setting the ‘rseq_cs’ field to ‘NULL’ in each thread's restartable sequence area to guarantee that it does not leak dangling references. Because the application does not typically have knowledge of libraries' use of restartable sequences, it is recommended that libraries using restartable sequences which may end up freeing or re-using their memory set the ‘rseq_cs’ field to ‘NULL’ before returning from library functions which use restartable sequences. The manual for the ‘rseq’ system call can be found at . -- Variable: ptrdiff_t __rseq_offset This variable contains the offset between the thread pointer (as defined by ‘__builtin_thread_pointer’ or the thread pointer register for the architecture) and the restartable sequences area. This value is the same for all threads in the process. If the restartable sequences area is located at a lower address than the location to which the thread pointer points, the value is negative. -- Variable: unsigned int __rseq_size This variable is either zero (if restartable sequence registration failed or has been disabled) or the size of the restartable sequence registration. This can be different from the size of ‘struct rseq’ if the kernel has extended the size of the registration. If registration is successful, ‘__rseq_size’ is at least 20 (the initially active size of ‘struct rseq’). Previous versions of the GNU C Library set this to 32 even if the kernel only supported the initial area of 20 bytes because the value included unused padding at the end of the restartable sequence area. -- Variable: unsigned int __rseq_flags The flags used during restartable sequence registration with the kernel. Currently zero. -- Macro: int RSEQ_SIG Each supported architecture provides a ‘RSEQ_SIG’ macro in ‘sys/rseq.h’ which contains a signature. That signature is expected to be present in the code before each restartable sequences abort handler. Failure to provide the expected signature may terminate the process with a segmentation fault.  File: libc.info, Node: Dynamic Linker, Next: Internal Probes, Prev: Threads, Up: Top 37 Dynamic Linker ***************** The “dynamic linker” is responsible for loading dynamically linked programs and their dependencies (in the form of shared objects). The dynamic linker in the GNU C Library also supports loading shared objects (such as plugins) later at run time. Dynamic linkers are sometimes called “dynamic loaders”. * Menu: * Dynamic Linker Invocation:: Explicit invocation of the dynamic linker. * Dynamic Linker Introspection:: Interfaces for querying mapping information. * Dynamic Linker Hardening:: Avoiding unexpected issues with dynamic linking.  File: libc.info, Node: Dynamic Linker Invocation, Next: Dynamic Linker Introspection, Up: Dynamic Linker 37.1 Dynamic Linker Invocation ============================== When a dynamically linked program starts, the operating system automatically loads the dynamic linker along with the program. The GNU C Library also supports invoking the dynamic linker explicitly to launch a program. This command uses the implied dynamic linker (also sometimes called the “program interpreter”): sh -c 'echo "Hello, world!"' This command specifies the dynamic linker explicitly: ld.so /bin/sh -c 'echo "Hello, world!"' Note that ‘ld.so’ does not search the ‘PATH’ environment variable, so the full file name of the executable needs to be specified. The ‘ld.so’ program supports various options. Options start ‘--’ and need to come before the program that is being launched. Some of the supported options are listed below. ‘--list-diagnostics’ Print system diagnostic information in a machine-readable format. *Note Dynamic Linker Diagnostics::. * Menu: * Dynamic Linker Diagnostics:: Obtaining system diagnostic information.  File: libc.info, Node: Dynamic Linker Diagnostics, Up: Dynamic Linker Invocation 37.1.1 Dynamic Linker Diagnostics --------------------------------- The ‘ld.so --list-diagnostics’ produces machine-readable diagnostics output. This output contains system data that affects the behavior of the GNU C Library, and potentially application behavior as well. The exact set of diagnostic items can change between releases of the GNU C Library. The output format itself is not expected to change radically. The following table shows some example lines that can be written by the diagnostics command. ‘dl_pagesize=0x1000’ The system page size is 4096 bytes. ‘env[0x14]="LANG=en_US.UTF-8"’ This item indicates that the 21st environment variable at process startup contains a setting for ‘LANG’. ‘env_filtered[0x22]="DISPLAY"’ The 35th environment variable is ‘DISPLAY’. Its value is not included in the output for privacy reasons because it is not recognized as harmless by the diagnostics code. ‘path.prefix="/usr"’ This means that the GNU C Library was configured with ‘--prefix=/usr’. ‘path.system_dirs[0x0]="/lib64/"’ ‘path.system_dirs[0x1]="/usr/lib64/"’ The built-in dynamic linker search path contains two directories, ‘/lib64’ and ‘/usr/lib64’. * Menu: * Dynamic Linker Diagnostics Format:: Format of ld.so output. * Dynamic Linker Diagnostics Values:: Data contain in ld.so output.  File: libc.info, Node: Dynamic Linker Diagnostics Format, Next: Dynamic Linker Diagnostics Values, Up: Dynamic Linker Diagnostics 37.1.1.1 Dynamic Linker Diagnostics Format .......................................... As seen above, diagnostic lines assign values (integers or strings) to a sequence of labeled subscripts, separated by ‘.’. Some subscripts have integer indices associated with them. The subscript indices are not necessarily contiguous or small, so an associative array should be used to store them. Currently, all integers fit into the 64-bit unsigned integer range. Every access path to a value has a fixed type (string or integer) independent of subscript index values. Likewise, whether a subscript is indexed does not depend on previous indices (but may depend on previous subscript labels). A syntax description in ABNF (RFC 5234) follows. Note that ‘%x30-39’ denotes the range of decimal digits. Diagnostic output lines are expected to match the ‘line’ production. HEXDIG = %x30-39 / %x61-6f ; lowercase a-f only ALPHA = %x41-5a / %x61-7a / %x7f ; letters and underscore ALPHA-NUMERIC = ALPHA / %x30-39 / "_" DQUOTE = %x22 ; " ; Numbers are always hexadecimal and use a 0x prefix. hex-value-prefix = %x30 %x78 hex-value = hex-value-prefix 1*HEXDIG ; Strings use octal escape sequences and \\, \". string-char = %x20-21 / %x23-5c / %x5d-7e ; printable but not "\ string-quoted-octal = %x30-33 2*2%x30-37 string-quoted = "\" ("\" / DQUOTE / string-quoted-octal) string-value = DQUOTE *(string-char / string-quoted) DQUOTE value = hex-value / string-value label = ALPHA *ALPHA-NUMERIC index = "[" hex-value "]" subscript = label [index] line = subscript *("." subscript) "=" value  File: libc.info, Node: Dynamic Linker Diagnostics Values, Prev: Dynamic Linker Diagnostics Format, Up: Dynamic Linker Diagnostics 37.1.1.2 Dynamic Linker Diagnostics Values .......................................... As mentioned above, the set of diagnostics may change between the GNU C Library releases. Nevertheless, the following table documents a few common diagnostic items. All numbers are in hexadecimal, with a ‘0x’ prefix. ‘dl_dst_lib=STRING’ The ‘$LIB’ dynamic string token expands to STRING. ‘dl_hwcap=INTEGER’ ‘dl_hwcap2=INTEGER’ The HWCAP and HWCAP2 values, as returned for ‘getauxval’, and as used in other places depending on the architecture. ‘dl_pagesize=INTEGER’ The system page size is INTEGER bytes. ‘dl_platform=STRING’ The ‘$PLATFORM’ dynamic string token expands to STRING. ‘dso.libc=STRING’ This is the soname of the shared ‘libc’ object that is part of the GNU C Library. On most architectures, this is ‘libc.so.6’. ‘env[INDEX]=STRING’ ‘env_filtered[INDEX]=STRING’ An environment variable from the process environment. The integer INDEX is the array index in the environment array. Variables under ‘env’ include the variable value after the ‘=’ (assuming that it was present), variables under ‘env_filtered’ do not. ‘path.prefix=STRING’ This indicates that the GNU C Library was configured using ‘--prefix=STRING’. ‘path.sysconfdir=STRING’ The GNU C Library was configured (perhaps implicitly) with ‘--sysconfdir=STRING’ (typically ‘/etc’). ‘path.system_dirs[INDEX]=STRING’ These items list the elements of the built-in array that describes the default library search path. The value STRING is a directory file name with a trailing ‘/’. ‘path.rtld=STRING’ This string indicates the application binary interface (ABI) file name of the run-time dynamic linker. ‘version.release="stable"’ ‘version.release="development"’ The value ‘"stable"’ indicates that this build of the GNU C Library is from a release branch. Releases labeled as ‘"development"’ are unreleased development versions. ‘version.version="MAJOR.MINOR"’ ‘version.version="MAJOR.MINOR.9000"’ The GNU C Library version. Development releases end in ‘.9000’. ‘auxv[INDEX].a_type=TYPE’ ‘auxv[INDEX].a_val=INTEGER’ ‘auxv[INDEX].a_val_string=STRING’ An entry in the auxiliary vector (specific to Linux). The values TYPE (an integer) and INTEGER correspond to the members of ‘struct auxv’. If the value is a string, ‘a_val_string’ is used instead of ‘a_val’, so that values have consistent types. The ‘AT_HWCAP’ and ‘AT_HWCAP2’ values in this output do not reflect adjustment by the GNU C Library. ‘uname.sysname=STRING’ ‘uname.nodename=STRING’ ‘uname.release=STRING’ ‘uname.version=STRING’ ‘uname.machine=STRING’ ‘uname.domain=STRING’ These Linux-specific items show the values of ‘struct utsname’, as reported by the ‘uname’ function. *Note Platform Type::. ‘aarch64.cpu_features....’ These items are specific to the AArch64 architectures. They report data the GNU C Library uses to activate conditionally supported features such as BTI and MTE, and to select alternative function implementations. ‘aarch64.processor[INDEX]....’ These are additional items for the AArch64 architecture and are described below. ‘aarch64.processor[INDEX].requested=KERNEL-CPU’ The kernel is told to run the subsequent probing on the CPU numbered KERNEL-CPU. The values KERNEL-CPU and INDEX can be distinct if there are gaps in the process CPU affinity mask. This line is not included if CPU affinity mask information is not available. ‘aarch64.processor[INDEX].observed=KERNEL-CPU’ This line reports the kernel CPU number KERNEL-CPU on which the probing code initially ran. If the CPU number cannot be obtained, this line is not printed. ‘aarch64.processor[INDEX].observed_node=NODE’ This reports the observed NUMA node number, as reported by the ‘getcpu’ system call. If this information cannot be obtained, this line is not printed. ‘aarch64.processor[INDEX].midr_el1=VALUE’ The value of the ‘midr_el1’ system register on the processor INDEX. This line is only printed if the kernel indicates that this system register is supported. ‘aarch64.processor[INDEX].dczid_el0=VALUE’ The value of the ‘dczid_el0’ system register on the processor INDEX. ‘x86.cpu_features....’ These items are specific to the i386 and x86-64 architectures. They reflect supported CPU features and information on cache geometry, mostly collected using the CPUID instruction. ‘x86.processor[INDEX]....’ These are additional items for the i386 and x86-64 architectures, as described below. They mostly contain raw data from the CPUID instruction. The probes are performed for each active CPU for the ‘ld.so’ process, and data for different probed CPUs receives a uniqe INDEX value. Some CPUID data is expected to differ from CPU core to CPU core. In some cases, CPUs are not correctly initialized and indicate the presence of different feature sets. ‘x86.processor[INDEX].requested=KERNEL-CPU’ The kernel is told to run the subsequent probing on the CPU numbered KERNEL-CPU. The values KERNEL-CPU and INDEX can be distinct if there are gaps in the process CPU affinity mask. This line is not included if CPU affinity mask information is not available. ‘x86.processor[INDEX].observed=KERNEL-CPU’ This line reports the kernel CPU number KERNEL-CPU on which the probing code initially ran. If the CPU number cannot be obtained, this line is not printed. ‘x86.processor[INDEX].observed_node=NODE’ This reports the observed NUMA node number, as reported by the ‘getcpu’ system call. If this information cannot be obtained, this line is not printed. ‘x86.processor[INDEX].cpuid_leaves=COUNT’ This line indicates that COUNT distinct CPUID leaves were encountered. (This reflects internal ‘ld.so’ storage space, it does not directly correspond to ‘CPUID’ enumeration ranges.) ‘x86.processor[INDEX].ecx_limit=VALUE’ The CPUID data extraction code uses a brute-force approach to enumerate subleaves (see the ‘.subleaf_eax’ lines below). The last ‘%rcx’ value used in a CPUID query on this probed CPU was VALUE. ‘x86.processor[INDEX].cpuid.eax[QUERY_EAX].eax=EAX’ ‘x86.processor[INDEX].cpuid.eax[QUERY_EAX].ebx=EBX’ ‘x86.processor[INDEX].cpuid.eax[QUERY_EAX].ecx=ECX’ ‘x86.processor[INDEX].cpuid.eax[QUERY_EAX].edx=EDX’ These lines report the register contents after executing the CPUID instruction with ‘%rax == QUERY_EAX’ and ‘%rcx == 0’ (a “leaf”). For the first probed CPU (with a zero INDEX), only leaves with non-zero register contents are reported. For subsequent CPUs, only leaves whose register contents differs from the previously probed CPUs (with INDEX one less) are reported. Basic and extended leaves are reported using the same syntax. This means there is a large jump in QUERY_EAX for the first reported extended leaf. ‘x86.processor[INDEX].cpuid.subleaf_eax[QUERY_EAX].ecx[QUERY_ECX].eax=EAX’ ‘x86.processor[INDEX].cpuid.subleaf_eax[QUERY_EAX].ecx[QUERY_ECX].ebx=EBX’ ‘x86.processor[INDEX].cpuid.subleaf_eax[QUERY_EAX].ecx[QUERY_ECX].ecx=ECX’ ‘x86.processor[INDEX].cpuid.subleaf_eax[QUERY_EAX].ecx[QUERY_ECX].edx=EDX’ This is similar to the leaves above, but for a “subleaf”. For subleaves, the CPUID instruction is executed with ‘%rax == QUERY_EAX’ and ‘%rcx == QUERY_ECX’, so the result depends on both register values. The same rules about filtering zero and identical results apply. ‘x86.processor[INDEX].cpuid.subleaf_eax[QUERY_EAX].ecx[QUERY_ECX].until_ecx=ECX_LIMIT’ Some CPUID results are the same regardless the QUERY_ECX value. If this situation is detected, a line with the ‘.until_ecx’ selector ins included, and this indicates that the CPUID register contents is the same for ‘%rcx’ values between QUERY_ECX and ECX_LIMIT (inclusive). ‘x86.processor[INDEX].cpuid.subleaf_eax[QUERY_EAX].ecx[QUERY_ECX].ecx_query_mask=0xff’ This line indicates that in an ‘.until_ecx’ range, the CPUID instruction preserved the lowested 8 bits of the input ‘%rcx’ in the output ‘%rcx’ registers. Otherwise, the subleaves in the range have identical values. This special treatment is necessary to report compact range information in case such copying occurs (because the subleaves would otherwise be all different). ‘x86.processor[INDEX].xgetbv.ecx[QUERY_ECX]=RESULT’ This line shows the 64-bit RESULT value in the ‘%rdx:%rax’ register pair after executing the XGETBV instruction with ‘%rcx’ set to QUERY_ECX. Zero values and values matching the previously probed CPU are omitted. Nothing is printed if the system does not support the XGETBV instruction.  File: libc.info, Node: Dynamic Linker Introspection, Next: Dynamic Linker Hardening, Prev: Dynamic Linker Invocation, Up: Dynamic Linker 37.2 Dynamic Linker Introspection ================================= The GNU C Library provides various facilities for querying information from the dynamic linker. -- Data Type: struct link_map A “link map” is associated with the main executable and each shared object. Some fields of the link map are accessible to applications and exposed through the ‘struct link_map’. Applications must not modify the link map directly. Pointers to link maps can be obtained from the ‘_r_debug’ variable, from the ‘RTLD_DI_LINKMAP’ request for ‘dlinfo’, and from the ‘_dl_find_object’ function. See below for details. ‘l_addr’ This field contains the “load address” of the object. This is the offset that needs to be applied to unrelocated addresses in the object image (as stored on disk) to form an address that can be used at run time for accessing data or running code. For position-dependent executables, the load address is typically zero, and no adjustment is required. For position-independent objects, the ‘l_addr’ field usually contains the address of the object's ELF header in the process image. However, this correspondence is not guaranteed because the ELF header might not be mapped at all, and the ELF file as stored on disk might use zero as the lowest virtual address. Due to the second variable, values of the ‘l_addr’ field do not necessarily uniquely identify a shared object. On Linux, to obtain the lowest loaded address of the main program, use ‘getauxval’ to obtain the ‘AT_PHDR’ and ‘AT_PHNUM’ values for the current process. Alternatively, call ‘dlinfo (_r_debug.r_map, &PHDR)’ to obtain the number of program headers, and the address of the program header array will be stored in PHDR (of type ‘const ElfW(Phdr) *’, as explained below). These values allow processing the array of program headers and the address information in the ‘PT_LOAD’ entries among them. This works even when the program was started with an explicit loader invocation. ‘l_name’ For a shared object, this field contains the file name that the the GNU C Library dynamic loader used when opening the object. This can be a relative path (relative to the current directory at process start, or if the object was loaded later, via ‘dlopen’ or ‘dlmopen’). Symbolic links are not necessarily resolved. For the main executable, ‘l_name’ is ‘""’ (the empty string). (The main executable is not loaded by the GNU C Library, so its file name is not available.) On Linux, the main executable is available as ‘/proc/self/exe’ (unless an explicit loader invocation was used to start the program). The file name ‘/proc/self/exe’ continues to resolve to the same file even if it is moved within or deleted from the file system. Its current location can be read using ‘readlink’. *Note Symbolic Links::. (Although ‘/proc/self/exe’ is not actually a symbol link, it is only presented as one.) Note that ‘/proc’ may not be mounted, in which case ‘/proc/self/exe’ is not available. If an explicit loader invocation is used (such as ‘ld.so /usr/bin/emacs’), the ‘/proc/self/exe’ approach does not work because the file name refers to the dynamic linker ‘ld.so’, and not the ‘/usr/bin/emacs’ program. An approximation to the executable path is still available in the ‘INFO.dli_fname’ member after calling ‘dladdr (_r_debug.r_map->l_ld, &INFO)’. Note that this could be a relative path, and it is supplied by the process that created the current process, not the kernel, so it could be inaccurate. ‘l_ld’ This is a pointer to the ELF dynamic segment, an array of tag/value pairs that provide various pieces of information that the dynamic linking process uses. On most architectures, addresses in the dynamic segment are relocated at run time, but on some architectures and in some run-time configurations, it is necessary to add the ‘l_addr’ field value to obtain a proper address. ‘l_prev’ ‘l_next’ These fields are used to maintain a double-linked linked list of all link maps within one ‘dlmopen’ namespace. Note that there is currently no thread-safe way to iterate over this list. The callback-based ‘dl_iterate_phdr’ interface can be used instead. *Portability note:* It is not possible to create a ‘struct link_map’ object and pass a pointer to a function that expects a ‘struct link_map *’ argument. Only link map pointers initially supplied by the GNU C Library are permitted as arguments. In current versions of the GNU C Library, handles returned by ‘dlopen’ and ‘dlmopen’ are pointers to link maps. However, this is not a portable assumption, and may even change in future versions of the GNU C Library. To obtain the link map associated with a handle, see ‘dlinfo’ and ‘RTLD_DI_LINKMAP’ below. If a function accepts both ‘dlopen’/‘dlmopen’ handles and ‘struct link_map’ pointers in its ‘void *’ argument, that is documented explicitly. 37.2.1 Querying information for loaded objects ---------------------------------------------- The ‘dlinfo’ function provides access to internal information associated with ‘dlopen’/‘dlmopen’ handles and link maps. -- Function: int dlinfo (void *HANDLE, int REQUEST, void *ARG) | MT-Safe | AS-Unsafe corrupt | AC-Unsafe corrupt | *Note POSIX Safety Concepts::. This function returns information about HANDLE in the memory location ARG, based on REQUEST. The HANDLE argument must be a pointer returned by ‘dlopen’ or ‘dlmopen’; it must not have been closed by ‘dlclose’. Alternatively, HANDLE can be a ‘struct link_map *’ value for a link map of an object that has not been closed. On success, ‘dlinfo’ returns 0 for most request types; exceptions are noted below. If there is an error, the function returns -1, and ‘dlerror’ can be used to obtain a corresponding error message. The following operations are defined for use with REQUEST: ‘RTLD_DI_LINKMAP’ The corresponding ‘struct link_map’ pointer for HANDLE is written to ‘*ARG’. The ARG argument must be the address of an object of type ‘struct link_map *’. ‘RTLD_DI_LMID’ The namespace identifier of HANDLE is written to ‘*ARG’. The ARG argument must be the address of an object of type ‘Lmid_t’. ‘RTLD_DI_ORIGIN’ The value of the ‘$ORIGIN’ dynamic string token for HANDLE is written to the character array starting at ARG as a null-terminated string. This request type should not be used because it is prone to buffer overflows. ‘RTLD_DI_SERINFO’ ‘RTLD_DI_SERINFOSIZE’ These requests can be used to obtain search path information for HANDLE. For both requests, ARG must point to a ‘Dl_serinfo’ object. The ‘RTLD_DI_SERINFOSIZE’ request must be made first; it updates the ‘dls_size’ and ‘dls_cnt’ members of the ‘Dl_serinfo’ object. The caller should then allocate memory to store at least ‘dls_size’ bytes and pass that buffer to a ‘RTLD_DI_SERINFO’ request. This second request fills the ‘dls_serpath’ array. The number of array elements was returned in the ‘dls_cnt’ member in the initial ‘RTLD_DI_SERINFOSIZE’ request. The caller is responsible for freeing the allocated buffer. This interface is prone to buffer overflows in multi-threaded processes because the required size can change between the ‘RTLD_DI_SERINFOSIZE’ and ‘RTLD_DI_SERINFO’ requests. ‘RTLD_DI_TLS_DATA’ This request writes the address of the TLS block (in the current thread) for the shared object identified by HANDLE to ‘*ARG’. The argument ARG must be the address of an object of type ‘void *’. A null pointer is written if the object does not have any associated TLS block. ‘RTLD_DI_TLS_MODID’ This request writes the TLS module ID for the shared object HANDLE to ‘*ARG’. The argument ARG must be the address of an object of type ‘size_t’. The module ID is zero if the object does not have an associated TLS block. ‘RTLD_DI_PHDR’ This request writes the address of the program header array to ‘*ARG’. The argument ARG must be the address of an object of type ‘const ElfW(Phdr) *’ (that is, ‘const Elf32_Phdr *’ or ‘const Elf64_Phdr *’, as appropriate for the current architecture). For this request, the value returned by ‘dlinfo’ is the number of program headers in the program header array. The ‘dlinfo’ function is a GNU extension. The remainder of this section documents the ‘_dl_find_object’ function and supporting types and constants. -- Data Type: struct dl_find_object This structure contains information about a main program or loaded object. The ‘_dl_find_object’ function uses it to return result data to the caller. ‘unsigned long long int dlfo_flags’ Bit zero signals if SFrame stack data is valid. See ‘DLFO_FLAG_SFRAME’ below. ‘void *dlfo_map_start’ The start address of the inspected mapping. This information comes from the program header, so it follows its convention, and the address is not necessarily page-aligned. ‘void *dlfo_map_end’ The end address of the mapping. ‘struct link_map *dlfo_link_map’ This member contains a pointer to the link map of the object. ‘void *dlfo_eh_frame’ This member contains a pointer to the exception handling data of the object. See ‘DLFO_EH_SEGMENT_TYPE’ below. ‘void *dlfo_sframe’ This member points to the SFrame stack trace data associated with the object. It is valid only when ‘DLFO_FLAG_SFRAME’ is set in ‘dlfo_flags’; otherwise, it may be null or undefined. This structure is a GNU extension. -- Macro: int DLFO_STRUCT_HAS_EH_DBASE On most targets, this macro is defined as ‘0’. If it is defined to ‘1’, ‘struct dl_find_object’ contains an additional member ‘dlfo_eh_dbase’ of type ‘void *’. It is the base address for ‘DW_EH_PE_datarel’ DWARF encodings to this location. This macro is a GNU extension. -- Macro: int DLFO_STRUCT_HAS_EH_COUNT On most targets, this macro is defined as ‘0’. If it is defined to ‘1’, ‘struct dl_find_object’ contains an additional member ‘dlfo_eh_count’ of type ‘int’. It is the number of exception handling entries in the EH frame segment identified by the ‘dlfo_eh_frame’ member. This macro is a GNU extension. -- Macro: int DLFO_EH_SEGMENT_TYPE On targets using DWARF-based exception unwinding, this macro expands to ‘PT_GNU_EH_FRAME’. This indicates that ‘dlfo_eh_frame’ in ‘struct dl_find_object’ points to the ‘PT_GNU_EH_FRAME’ segment of the object. On targets that use other unwinding formats, the macro expands to the program header type for the unwinding data. This macro is a GNU extension. -- Function: int _dl_find_object (void *ADDRESS, struct dl_find_object *RESULT) | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety Concepts::. On success, this function returns 0 and writes about the object surrounding the address to ‘*RESULT’. On failure, -1 is returned. The ADDRESS can be a code address or data address. On architectures using function descriptors, no attempt is made to decode the function descriptor. Depending on how these descriptors are implemented, ‘_dl_find_object’ may return the object that defines the function descriptor (and not the object that contains the code implementing the function), or fail to find any object at all. On success ADDRESS is greater than or equal to ‘RESULT->dlfo_map_start’ and less than ‘RESULT->dlfo_map_end’, that is, the supplied code address is located within the reported mapping. This function returns a pointer to the unwinding information for the object that contains the program code ADDRESS in ‘RESULT->dlfo_eh_frame’. If the platform uses DWARF unwinding information, this is the in-memory address of the ‘PT_GNU_EH_FRAME’ segment. See ‘DLFO_EH_SEGMENT_TYPE’ above. In case ADDRESS resides in an object that lacks unwinding information, the function still returns 0, but sets ‘RESULT->dlfo_eh_frame’ to a null pointer. ‘_dl_find_object’ itself is thread-safe. However, if the application invokes ‘dlclose’ for the object that contains ADDRESS concurrently with ‘_dl_find_object’ or after the call returns, accessing the unwinding data for that object or the link map (through ‘RESULT->dlfo_link_map’) is not safe. Therefore, the application needs to ensure by other means (e.g., by convention) that ADDRESS remains a valid code address while the unwinding information is processed. This function is a GNU extension. The following flag masks are defined for use with ‘dlfo_flags’: ‘DLFO_FLAG_SFRAME’ A bit mask used to signal that the object contains SFrame data. See ‘dlfo_sframe’ above.  File: libc.info, Node: Dynamic Linker Hardening, Prev: Dynamic Linker Introspection, Up: Dynamic Linker 37.3 Avoiding Unexpected Issues With Dynamic Linking ==================================================== This section details recommendations for increasing application robustness, by avoiding potential issues related to dynamic linking. The recommendations have two main aims: reduce the involvement of the dynamic linker in application execution after process startup, and restrict the application to a dynamic linker feature set whose behavior is more easily understood. Key aspects of limiting dynamic linker usage after startup are: no use of the ‘dlopen’ function, disabling lazy binding, and using the static TLS model. More easily understood dynamic linker behavior requires avoiding name conflicts (symbols and sonames) and highly customizable features like the audit subsystem. Note that while these steps can be considered a form of application hardening, they do not guard against potential harm from accidental or deliberate loading of untrusted or malicious code. There is only limited overlap with traditional security hardening for applications running on GNU systems. 37.3.1 Restricted Dynamic Linker Features ----------------------------------------- Avoiding certain dynamic linker features can increase predictability of applications and reduce the risk of running into dynamic linker defects. • Do not use the functions ‘dlopen’, ‘dlmopen’, or ‘dlclose’. Dynamic loading and unloading of shared objects introduces substantial complications related to symbol and thread-local storage (TLS) management. • Without the ‘dlopen’ function, ‘dlsym’ and ‘dlvsym’ cannot be used with shared object handles. Minimizing the use of both functions is recommended. If they have to be used, only the ‘RTLD_DEFAULT’ pseudo-handle should be used. • Use the local-exec or initial-exec TLS models. If ‘dlopen’ is not used, there are no compatibility concerns for initial-exec TLS. This TLS model avoids most of the complexity around TLS access. In particular, there are no TLS-related run-time memory allocations after process or thread start. If shared objects are expected to be used more generally, outside the hardened, feature-restricted context, lack of compatibility between ‘dlopen’ and initial-exec TLS could be a concern. In that case, the second-best alternative is to use global-dynamic TLS with GNU2 TLS descriptors, for targets that fully implement them, including the fast path for access to TLS variables defined in the initially loaded set of objects. Like initial-exec TLS, this avoids memory allocations after thread creation, but only if the ‘dlopen’ function is not used. • Do not use lazy binding. Lazy binding may require run-time memory allocation, is not async-signal-safe, and introduces considerable complexity. • Make dependencies on shared objects explicit. Do not assume that certain libraries (such as ‘libc.so.6’) are always loaded. Specifically, if a main program or shared object references a symbol, create an ELF ‘DT_NEEDED’ dependency on that shared object, or on another shared object that is documented (or otherwise guaranteed) to have the required explicit dependency. Referencing a symbol without a matching link dependency results in underlinking, and underlinked objects cannot always be loaded correctly: Initialization of objects may not happen in the required order. • Do not create dependency loops between shared objects (‘libA.so.1’ depending on ‘libB.so.1’ depending on ‘libC.so.1’ depending on ‘libA.so.1’). The GNU C Library has to initialize one of the objects in the cycle first, and the choice of that object is arbitrary and can change over time. The object which is initialized first (and other objects involved in the cycle) may not run correctly because not all of its dependencies have been initialized. Underlinking (see above) can hide the presence of cycles. • Limit the creation of indirect function (IFUNC) resolvers. These resolvers run during relocation processing, when the GNU C Library is not in a fully consistent state. If you write your own IFUNC resolvers, do not depend on external data or function references in those resolvers. • Do not use the audit functionality (‘LD_AUDIT’, ‘DT_AUDIT’, ‘DT_DEPAUDIT’). Its callback and hooking capabilities introduce a lot of complexity and subtly alter dynamic linker behavior in corner cases even if the audit module is inactive. • Do not use symbol interposition. Without symbol interposition, the exact order in which shared objects are searched are less relevant. Exceptions to this rule are copy relocations (see the next item), and vague linkage, as used by the C++ implementation (see below). • One potential source of symbol interposition is a combination of static and dynamic linking, namely linking a static archive into multiple dynamic shared objects. For such scenarios, the static library should be converted into its own dynamic shared object. A different approach to this situation uses hidden visibility for symbols in the static library, but this can cause problems if the library does not expect that multiple copies of its code coexist within the same process, with no or partial sharing of state. • If you use shared objects that are linked with ‘-Wl,-Bsymbolic’ (or equivalent) or use protected visibility, the code for the main program must be built as ‘-fpic’ or ‘-fPIC’ to avoid creating copy relocations (and the main program must not use copy relocations for other reasons). Using ‘-fpie’ or ‘-fPIE’ is not an alternative to PIC code in this context. • Be careful about explicit section annotations. Make sure that the target section matches the properties of the declared entity (e.g., no writable objects in ‘.text’). • Ensure that all assembler or object input files have the recommended security markup, particularly for non-executable stack. • Avoid using non-default linker flags and features. In particular, do not use the ‘DT_PREINIT_ARRAY’ dynamic tag, and do not flag objects as ‘DF_1_INITFIRST’. Do not change the default linker script of BFD ld. Do not override ABI defaults, such as the dynamic linker path (with ‘--dynamic-linker’). • Some features of the GNU C Library indirectly depend on run-time code loading and ‘dlopen’. Use ‘iconv_open’ with built-in converters only (such as ‘UTF-8’). Do not use NSS functionality such as ‘getaddrinfo’ or ‘getpwuid_r’ unless the system is configured for built-in NSS service modules only (see below). Several considerations apply to ELF constructors and destructors. • The dynamic linker does not take constructor and destructor priorities into account when determining their execution order. Priorities are only used by the link editor for ordering execution within a completely linked object. If a dynamic shared object needs to be initialized before another object, this can be expressed with a ‘DT_NEEDED’ dependency on the object that needs to be initialized earlier. • The recommendations to avoid cyclic dependencies and symbol interposition make it less likely that ELF objects are accessed before their ELF constructors have run. However, using ‘dlsym’ and ‘dlvsym’, it is still possible to access uninitialized facilities even with these restrictions in place. (Of course, access to uninitialized functionality is also possible within a single shared object or the main executable, without resorting to explicit symbol lookup.) Consider using dynamic, on-demand initialization instead. To deal with access after de-initialization, it may be necessary to implement special cases for that scenario, potentially with degraded functionality. • Be aware that when ELF destructors are executed, it is possible to reference already-deconstructed shared objects. This can happen even in the absence of ‘dlsym’ and ‘dlvsym’ function calls, for example if client code using a shared object has registered callbacks or objects with another shared object. The ELF destructor for the client code is executed before the ELF destructor for the shared objects that it uses, based on the expected dependency order. • If ‘dlopen’ and ‘dlmopen’ are not used, ‘DT_NEEDED’ dependency information is complete, and lazy binding is disabled, the execution order of ELF destructors is expected to be the reverse of the ELF constructor order. However, two separate dependency sort operations still occur. Even though the listed preconditions should ensure that both sorts produce the same ordering, it is recommended not to depend on the destructor order being the reverse of the constructor order. The following items provide C++-specific guidance for preparing applications. If another programming language is used and it uses these toolchain features targeted at C++ to implement some language constructs, these restrictions and recommendations still apply in analogous ways. • C++ inline functions, templates, and other constructs may need to be duplicated into multiple shared objects using vague linkage, resulting in symbol interposition. This type of symbol interposition is unproblematic, as long as the C++ one definition rule (ODR) is followed, and all definitions in different translation units are equivalent according to the language C++ rules. • Be aware that under C++ language rules, it is unspecified whether evaluating a string literal results in the same address for each evaluation. This also applies to anonymous objects of static storage duration that GCC creates, for example to implement the compound literals C++ extension. As a result, comparing pointers to such objects, or using them directly as hash table keys, may give unexpected results. By default, variables of block scope of static storage have consistent addresses across different translation units, even if defined in functions that use vague linkage. • Special care is needed if a C++ project uses symbol visibility or symbol version management (for example, the GCC ‘visibility’ attribute, the GCC ‘-fvisibility’ option, or a linker version script with the linker option ‘--version-script’). It is necessary to ensure that the symbol management remains consistent with how the symbols are used. Some C++ constructs are implemented with the help of ancillary symbols, which can make complicated to achieve consistency. For example, an inline function that is always inlined into its callers has no symbol footprint for the function itself, but if the function contains a variable of static storage duration, this variable may result in the creation of one or more global symbols. For correctness, such symbols must be visible and bound to the same object in all other places where the inline function may be called. This requirement is not met if the symbol visibility is set to hidden, or if symbols are assigned a textually different symbol version (effectively creating two distinct symbols). Due to the complex interaction between ELF symbol management and C++ symbol generation, it is recommended to use C++ language features for symbol management, in particular inline namespaces. • The toolchain and dynamic linker have multiple mechanisms that bypass the usual symbol binding procedures. This means that the C++ one definition rule (ODR) still holds even if certain symbol-based isolation mechanisms are used, and object addresses are not shared across translation units with incompatible type definitions. This does not matter if the original (language-independent) advice regarding symbol interposition is followed. However, as the advice may be difficult to implement for C++ applications, it is recommended to avoid ODR violations across the entire process image. Inline namespaces can be helpful in this context because they can be used to create distinct ELF symbols while maintaining source code compatibility at the C++ level. • Be aware that as a special case of interposed symbols, symbols with the ‘STB_GNU_UNIQUE’ binding type do not follow the usual ELF symbol namespace isolation rules: such symbols bind across ‘RTLD_LOCAL’ boundaries. Furthermore, symbol versioning is ignored for such symbols; they are bound by symbol name only. All their definitions and uses must therefore be compatible. Hidden visibility still prevents the creation of ‘STB_GNU_UNIQUE’ symbols and can achieve isolation of incompatible definitions. • C++ constructor priorities only affect constructor ordering within one shared object. Global constructor order across shared objects is consistent with ELF dependency ordering if there are no ELF dependency cycles. • C++ exception handling and run-time type information (RTTI), as implemented in the GNU toolchain, is not address-significant, and therefore is not affected by the symbol binding behaviour of the dynamic linker. This means that types of the same fully-qualified name (in non-anonymous namespaces) are always considered the same from an exception-handling or RTTI perspective. This is true even if the type information object or vtable has hidden symbol visibility, or the corresponding symbols are versioned under different symbol versions, or the symbols are not bound to the same objects due to the use of ‘RTLD_LOCAL’ or ‘dlmopen’. This can cause issues in applications that contain multiple incompatible definitions of the same type. Inline namespaces can be used to create distinct symbols at the ELF layer, avoiding this type of issue. • C++ exception handling across multiple ‘dlmopen’ namespaces may not work, particular with the unwinder in GCC versions before 12. Current toolchain versions are able to process unwinding tables across ‘dlmopen’ boundaries. However, note that type comparison is name-based, not address-based (see the previous item), so exception types may still be matched in unexpected ways. An important special case of exception handling, invoking destructors for variables of block scope, is not impacted by this RTTI type-sharing. Likewise, regular virtual member function dispatch for objects is unaffected (but still requires that the type definitions match in all directly involved translation units). Once more, inline namespaces can be used to create distinct ELF symbols for different types. • Although the C++ standard requires that destructors for global objects run in the opposite order of their constructors, the Itanium C++ ABI requires a different destruction order in some cases. As a result, do not depend on the precise destructor invocation order in applications that use ‘dlclose’. • Registering destructors for later invocation allocates memory and may silently fail if insufficient memory is available. As a result, the destructor is never invoked. This applies to all forms of destructor registration, with the exception of thread-local variables (see the next item). To avoid this issue, ensure that such objects merely have trivial destructors, avoiding the need for registration, and deallocate resources using a different mechanism (for example, from an ELF destructor). • A similar issue exists for ‘thread_local’ variables with thread storage duration of types that have non-trivial destructors. However, in this case, memory allocation failure during registration leads to process termination. If process termination is not acceptable, use ‘thread_local’ variables with trivial destructors only. Functions for per-thread cleanup can be registered using ‘pthread_key_create’ (globally for all threads) and activated using ‘pthread_setspecific’ (on each thread). Note that a ‘pthread_key_create’ call may still fail (and ‘pthread_create’ keys are a limited resource in the GNU C Library), but this failure can be handled without terminating the process. 37.3.2 Producing Matching Binaries ---------------------------------- This subsection recommends tools and build flags for producing applications that meet the recommendations of the previous subsection. • Use BFD ld (‘bfd.ld’) from GNU binutils to produce binaries, invoked through a compiler driver such as ‘gcc’. The version should be not too far ahead of what was current when the version of the GNU C Library was first released. • Do not use a binutils release that is older than the one used to build the GNU C Library itself. • Compile with ‘-ftls-model=initial-exec’ to force the initial-exec TLS model. • Link with ‘-Wl,-z,now’ to disable lazy binding. • Link with ‘-Wl,-z,relro’ to enable RELRO (which is the default on most targets). • Specify all direct shared objects dependencies using ‘-l’ options to avoid underlinking. Rely on ‘.so’ files (which can be linker scripts) and searching with the ‘-l’ option. Do not specify the file names of shared objects on the linker command line. • Consider using ‘-Wl,-z,defs’ to treat underlinking as an error condition. • When creating a shared object (linked with ‘-shared’), use ‘-Wl,-soname,lib...’ to set a soname that matches the final installed name of the file. • Do not use the ‘-rpath’ linker option. (As explained below, all required shared objects should be installed into the default search path.) • Use ‘-Wl,--error-rwx-segments’ and ‘-Wl,--error-execstack’ to instruct the link editor to fail the link if the resulting final object would have read-write-execute segments or an executable stack. Such issues usually indicate that the input files are not marked up correctly. • Ensure that for each ‘LOAD’ segment in the ELF program header, file offsets, memory sizes, and load addresses are multiples of the largest page size supported at run time. Similarly, the start address and size of the ‘GNU_RELRO’ range should be multiples of the page size. Avoid creating gaps between ‘LOAD’ segments. The difference between the load addresses of two subsequent ‘LOAD’ segments should be the size of the first ‘LOAD’ segment. (This may require linking with ‘-Wl,-z,noseparate-code’.) This may not be possible to achieve with the currently available link editors. • If the multiple-of-page-size criterion for the ‘GNU_RELRO’ region cannot be achieved, ensure that the process memory image right before the start of the region does not contain executable or writable memory. 37.3.3 Checking Binaries ------------------------ In some cases, if the previous recommendations are not followed, this can be determined from the produced binaries. This section contains suggestions for verifying aspects of these binaries. • To detect underlinking, examine the dynamic symbol table, for example using ‘readelf -sDW’. If the symbol is defined in a shared object that uses symbol versioning, it must carry a symbol version, as in ‘pthread_kill@GLIBC_2.34’. • Examine the dynamic segment with ‘readelf -dW’ to check that all the required ‘NEEDED’ entries are present. (It is not necessary to list indirect dependencies if these dependencies are guaranteed to remain during the evolution of the explicitly listed direct dependencies.) • The ‘NEEDED’ entries should not contain full path names including slashes, only ‘sonames’. • For a further consistency check, collect all shared objects referenced via ‘NEEDED’ entries in dynamic segments, transitively, starting at the main program. Then determine their dynamic symbol tables (using ‘readelf -sDW’, for example). Ideally, every symbol should be defined at most once, so that symbol interposition does not happen. If there are interposed data symbols, check if the single interposing definition is in the main program. In this case, there must be a copy relocation for it. (This only applies to targets with copy relocations.) Function symbols should only be interposed in C++ applications, to implement vague linkage. (See the discussion in the C++ recommendations above.) • Using the previously collected ‘NEEDED’ entries, check that the dependency graph does not contain any cycles. • The dynamic segment should also mention ‘BIND_NOW’ on the ‘FLAGS’ line or ‘NOW’ on the ‘FLAGS_1’ line (one is enough). • Ensure that only static TLS relocations (thread-pointer relative offset locations) are used, for example ‘R_AARCH64_TLS_TPREL’ and ‘X86_64_TPOFF64’. As the second-best option, and only if compatibility with non-hardened applications using ‘dlopen’ is needed, GNU2 TLS descriptor relocations can be used (for example, ‘R_AARCH64_TLSDESC’ or ‘R_X86_64_TLSDESC’). • There should not be references to the traditional TLS function symbols ‘__tls_get_addr’, ‘__tls_get_offset’, ‘__tls_get_addr_opt’ in the dynamic symbol table (in the ‘readelf -sDW’ output). Supporting global dynamic TLS relocations (such as ‘R_AARCH64_TLS_DTPMOD’, ‘R_AARCH64_TLS_DTPREL’, ‘R_X86_64_DTPMOD64’, ‘R_X86_64_DTPOFF64’) should not be used, either. • Likewise, the functions ‘dlopen’, ‘dlmopen’, ‘dlclose’ should not be referenced from the dynamic symbol table. • For shared objects, there should be a ‘SONAME’ entry that matches the file name (the base name, i.e., the part after the slash). The ‘SONAME’ string must not contain a slash ‘/’. • For all objects, the dynamic segment (as shown by ‘readelf -dW’) should not contain ‘RPATH’ or ‘RUNPATH’ entries. • Likewise, the dynamic segment should not show any ‘AUDIT’, ‘DEPAUDIT’, ‘AUXILIARY’, ‘FILTER’, or ‘PREINIT_ARRAY’ tags. • If the dynamic segment contains a (deprecated) ‘HASH’ tag, it must also contain a ‘GNU_HASH’ tag. • The ‘INITFIRST’ flag (undeer ‘FLAGS_1’) should not be used. • The program header must not have ‘LOAD’ segments that are writable and executable at the same time. • All produced objects should have a ‘GNU_STACK’ program header that is not marked as executable. (However, on some newer targets, a non-executable stack is the default, so the ‘GNU_STACK’ program header is not required.) 37.3.4 Run-time Considerations ------------------------------ In addition to preparing program binaries in a recommended fashion, the run-time environment should be set up in such a way that problematic dynamic linker features are not used. • Install shared objects using their sonames in a default search path directory (usually ‘/usr/lib64’). Do not use symbolic links. • The default search path must not contain objects with duplicate file names or sonames. • Do not use environment variables (‘LD_...’ variables such as ‘LD_PRELOAD’ or ‘LD_LIBRARY_PATH’, or ‘GLIBC_TUNABLES’) to change default dynamic linker behavior. • Do not install shared objects in non-default locations. (Such locations are listed explicitly in the configuration file for ‘ldconfig’, usually ‘/etc/ld.so.conf’, or in files included from there.) • In relation to the previous item, do not install any objects it ‘glibc-hwcaps’ subdirectories. • Do not configure dynamically-loaded NSS service modules, to avoid accidental internal use of the ‘dlopen’ facility. The ‘files’ and ‘dns’ modules are built in and do not rely on ‘dlopen’. • Do not truncate and overwrite files containing programs and shared objects in place, while they are used. Instead, write the new version to a different path and use ‘rename’ to replace the already-installed version. • Be aware that during a component update procedure that involves multiple object files (shared objects and main programs), concurrently starting processes may observe an inconsistent combination of object files (some already updated, some still at the previous version). For example, this can happen during an update of the GNU C Library itself.  File: libc.info, Node: Internal Probes, Next: Tunables, Prev: Dynamic Linker, Up: Top 38 Internal probes ****************** In order to aid in debugging and monitoring internal behavior, the GNU C Library exposes nearly-zero-overhead SystemTap probes marked with the ‘libc’ provider. These probes are not part of the GNU C Library stable ABI, and they are subject to change or removal across releases. Our only promise with regard to them is that, if we find a need to remove or modify the arguments of a probe, the modified probe will have a different name, so that program monitors relying on the old probe will not get unexpected arguments. * Menu: * Memory Allocation Probes:: Probes in the memory allocation subsystem * Non-local Goto Probes:: Probes in setjmp and longjmp  File: libc.info, Node: Memory Allocation Probes, Next: Non-local Goto Probes, Up: Internal Probes 38.1 Memory Allocation Probes ============================= These probes are designed to signal relatively unusual situations within the virtual memory subsystem of the GNU C Library. -- Probe: memory_sbrk_more (void *$ARG1, size_t $ARG2) This probe is triggered after the main arena is extended by calling ‘sbrk’. Argument $ARG1 is the additional size requested to ‘sbrk’, and $ARG2 is the pointer that marks the end of the ‘sbrk’ area, returned in response to the request. -- Probe: memory_sbrk_less (void *$ARG1, size_t $ARG2) This probe is triggered after the size of the main arena is decreased by calling ‘sbrk’. Argument $ARG1 is the size released by ‘sbrk’ (the positive value, rather than the negative value passed to ‘sbrk’), and $ARG2 is the pointer that marks the end of the ‘sbrk’ area, returned in response to the request. -- Probe: memory_heap_new (void *$ARG1, size_t $ARG2) This probe is triggered after a new heap is ‘mmap’ed. Argument $ARG1 is a pointer to the base of the memory area, where the ‘heap_info’ data structure is held, and $ARG2 is the size of the heap. -- Probe: memory_heap_free (void *$ARG1, size_t $ARG2) This probe is triggered _before_ (unlike the other sbrk and heap probes) a heap is completely removed via ‘munmap’. Argument $ARG1 is a pointer to the heap, and $ARG2 is the size of the heap. -- Probe: memory_heap_more (void *$ARG1, size_t $ARG2) This probe is triggered after a trailing portion of an ‘mmap’ed heap is extended. Argument $ARG1 is a pointer to the heap, and $ARG2 is the new size of the heap. -- Probe: memory_heap_less (void *$ARG1, size_t $ARG2) This probe is triggered after a trailing portion of an ‘mmap’ed heap is released. Argument $ARG1 is a pointer to the heap, and $ARG2 is the new size of the heap. -- Probe: memory_malloc_retry (size_t $ARG1) -- Probe: memory_realloc_retry (size_t $ARG1, void *$ARG2) -- Probe: memory_memalign_retry (size_t $ARG1, size_t $ARG2) -- Probe: memory_calloc_retry (size_t $ARG1) These probes are triggered when the corresponding functions fail to obtain the requested amount of memory from the arena in use, before they call ‘arena_get_retry’ to select an alternate arena in which to retry the allocation. Argument $ARG1 is the amount of memory requested by the user; in the ‘calloc’ case, that is the total size computed from both function arguments. In the ‘realloc’ case, $ARG2 is the pointer to the memory area being resized. In the ‘memalign’ case, $ARG2 is the alignment to be used for the request, which may be stricter than the value passed to the ‘memalign’ function. A ‘memalign’ probe is also used by functions ‘posix_memalign, valloc’ and ‘pvalloc’. Note that the argument order does _not_ match that of the corresponding two-argument functions, so that in all of these probes the user-requested allocation size is in $ARG1. -- Probe: memory_arena_retry (size_t $ARG1, void *$ARG2) This probe is triggered within ‘arena_get_retry’ (the function called to select the alternate arena in which to retry an allocation that failed on the first attempt), before the selection of an alternate arena. This probe is redundant, but much easier to use when it's not important to determine which of the various memory allocation functions is failing to allocate on the first try. Argument $ARG1 is the same as in the function-specific probes, except for extra room for padding introduced by functions that have to ensure stricter alignment. Argument $ARG2 is the arena in which allocation failed. -- Probe: memory_arena_new (void *$ARG1, size_t $ARG2) This probe is triggered when ‘malloc’ allocates and initializes an additional arena (not the main arena), but before the arena is assigned to the running thread or inserted into the internal linked list of arenas. The arena's ‘malloc_state’ internal data structure is located at $ARG1, within a newly-allocated heap big enough to hold at least $ARG2 bytes. -- Probe: memory_arena_reuse (void *$ARG1, void *$ARG2) This probe is triggered when ‘malloc’ has just selected an existing arena to reuse, and (temporarily) reserved it for exclusive use. Argument $ARG1 is a pointer to the newly-selected arena, and $ARG2 is a pointer to the arena previously used by that thread. This occurs within ‘reused_arena’, right after the mutex mentioned in probe ‘memory_arena_reuse_wait’ is acquired; argument $ARG1 will point to the same arena. In this configuration, this will usually only occur once per thread. The exception is when a thread first selected the main arena, but a subsequent allocation from it fails: then, and only then, may we switch to another arena to retry that allocation, and for further allocations within that thread. -- Probe: memory_arena_reuse_wait (void *$ARG1, void *$ARG2, void *$ARG3) This probe is triggered when ‘malloc’ is about to wait for an arena to become available for reuse. Argument $ARG1 holds a pointer to the mutex the thread is going to wait on, $ARG2 is a pointer to a newly-chosen arena to be reused, and $ARG3 is a pointer to the arena previously used by that thread. This occurs within ‘reused_arena’, when a thread first tries to allocate memory or needs a retry after a failure to allocate from the main arena, there isn't any free arena, the maximum number of arenas has been reached, and an existing arena was chosen for reuse, but its mutex could not be immediately acquired. The mutex in $ARG1 is the mutex of the selected arena. -- Probe: memory_arena_reuse_free_list (void *$ARG1) This probe is triggered when ‘malloc’ has chosen an arena that is in the free list for use by a thread, within the ‘get_free_list’ function. The argument $ARG1 holds a pointer to the selected arena. -- Probe: memory_mallopt (int $ARG1, int $ARG2) This probe is triggered when function ‘mallopt’ is called to change ‘malloc’ internal configuration parameters, before any change to the parameters is made. The arguments $ARG1 and $ARG2 are the ones passed to the ‘mallopt’ function. -- Probe: memory_mallopt_mxfast (int $ARG1, int $ARG2) This probe is triggered shortly after the ‘memory_mallopt’ probe, when the parameter to be changed is ‘M_MXFAST’, and the requested value is in an acceptable range. Argument $ARG1 is the requested value, and $ARG2 is the previous value of this ‘malloc’ parameter. -- Probe: memory_mallopt_trim_threshold (int $ARG1, int $ARG2, int $ARG3) This probe is triggered shortly after the ‘memory_mallopt’ probe, when the parameter to be changed is ‘M_TRIM_THRESHOLD’. Argument $ARG1 is the requested value, $ARG2 is the previous value of this ‘malloc’ parameter, and $ARG3 is nonzero if dynamic threshold adjustment was already disabled. -- Probe: memory_mallopt_top_pad (int $ARG1, int $ARG2, int $ARG3) This probe is triggered shortly after the ‘memory_mallopt’ probe, when the parameter to be changed is ‘M_TOP_PAD’. Argument $ARG1 is the requested value, $ARG2 is the previous value of this ‘malloc’ parameter, and $ARG3 is nonzero if dynamic threshold adjustment was already disabled. -- Probe: memory_mallopt_mmap_threshold (int $ARG1, int $ARG2, int $ARG3) This probe is triggered shortly after the ‘memory_mallopt’ probe, when the parameter to be changed is ‘M_MMAP_THRESHOLD’, and the requested value is in an acceptable range. Argument $ARG1 is the requested value, $ARG2 is the previous value of this ‘malloc’ parameter, and $ARG3 is nonzero if dynamic threshold adjustment was already disabled. -- Probe: memory_mallopt_mmap_max (int $ARG1, int $ARG2, int $ARG3) This probe is triggered shortly after the ‘memory_mallopt’ probe, when the parameter to be changed is ‘M_MMAP_MAX’. Argument $ARG1 is the requested value, $ARG2 is the previous value of this ‘malloc’ parameter, and $ARG3 is nonzero if dynamic threshold adjustment was already disabled. -- Probe: memory_mallopt_perturb (int $ARG1, int $ARG2) This probe is triggered shortly after the ‘memory_mallopt’ probe, when the parameter to be changed is ‘M_PERTURB’. Argument $ARG1 is the requested value, and $ARG2 is the previous value of this ‘malloc’ parameter. -- Probe: memory_mallopt_arena_test (int $ARG1, int $ARG2) This probe is triggered shortly after the ‘memory_mallopt’ probe, when the parameter to be changed is ‘M_ARENA_TEST’, and the requested value is in an acceptable range. Argument $ARG1 is the requested value, and $ARG2 is the previous value of this ‘malloc’ parameter. -- Probe: memory_mallopt_arena_max (int $ARG1, int $ARG2) This probe is triggered shortly after the ‘memory_mallopt’ probe, when the parameter to be changed is ‘M_ARENA_MAX’, and the requested value is in an acceptable range. Argument $ARG1 is the requested value, and $ARG2 is the previous value of this ‘malloc’ parameter. -- Probe: memory_mallopt_free_dyn_thresholds (int $ARG1, int $ARG2) This probe is triggered when function ‘free’ decides to adjust the dynamic brk/mmap thresholds. Argument $ARG1 and $ARG2 are the adjusted mmap and trim thresholds, respectively. -- Probe: memory_tunable_tcache_max_bytes (int $ARG1, int $ARG2) This probe is triggered when the ‘glibc.malloc.tcache_max’ tunable is set. Argument $ARG1 is the requested value, and $ARG2 is the previous value of this tunable. -- Probe: memory_tunable_tcache_count (int $ARG1, int $ARG2) This probe is triggered when the ‘glibc.malloc.tcache_count’ tunable is set. Argument $ARG1 is the requested value, and $ARG2 is the previous value of this tunable. -- Probe: memory_tunable_tcache_unsorted_limit (int $ARG1, int $ARG2) This probe is triggered when the ‘glibc.malloc.tcache_unsorted_limit’ tunable is set. Argument $ARG1 is the requested value, and $ARG2 is the previous value of this tunable. -- Probe: memory_tcache_double_free (void *$ARG1, int $ARG2) This probe is triggered when ‘free’ determines that the memory being freed has probably already been freed, and resides in the per-thread cache. Note that there is an extremely unlikely chance that this probe will trigger due to random payload data remaining in the allocated memory matching the key used to detect double frees. This probe actually indicates that an expensive linear search of the tcache, looking for a double free, has happened. Argument $ARG1 is the memory location as passed to ‘free’, Argument $ARG2 is the tcache bin it resides in.  File: libc.info, Node: Non-local Goto Probes, Prev: Memory Allocation Probes, Up: Internal Probes 38.2 Non-local Goto Probes ========================== These probes are used to signal calls to ‘setjmp’, ‘sigsetjmp’, ‘longjmp’ or ‘siglongjmp’. -- Probe: setjmp (void *$ARG1, int $ARG2, void *$ARG3) This probe is triggered whenever ‘setjmp’ or ‘sigsetjmp’ is called. Argument $ARG1 is a pointer to the ‘jmp_buf’ passed as the first argument of ‘setjmp’ or ‘sigsetjmp’, $ARG2 is the second argument of ‘sigsetjmp’ or zero if this is a call to ‘setjmp’ and $ARG3 is a pointer to the return address that will be stored in the ‘jmp_buf’. -- Probe: longjmp (void *$ARG1, int $ARG2, void *$ARG3) This probe is triggered whenever ‘longjmp’ or ‘siglongjmp’ is called. Argument $ARG1 is a pointer to the ‘jmp_buf’ passed as the first argument of ‘longjmp’ or ‘siglongjmp’, $ARG2 is the return value passed as the second argument of ‘longjmp’ or ‘siglongjmp’ and $ARG3 is a pointer to the return address ‘longjmp’ or ‘siglongjmp’ will return to. The ‘longjmp’ probe is triggered at a point where the registers have not yet been restored to the values in the ‘jmp_buf’ and unwinding will show a call stack including the caller of ‘longjmp’ or ‘siglongjmp’. -- Probe: longjmp_target (void *$ARG1, int $ARG2, void *$ARG3) This probe is triggered under the same conditions and with the same arguments as the ‘longjmp’ probe. The ‘longjmp_target’ probe is triggered at a point where the registers have been restored to the values in the ‘jmp_buf’ and unwinding will show a call stack including the caller of ‘setjmp’ or ‘sigsetjmp’.  File: libc.info, Node: Tunables, Next: Language Features, Prev: Internal Probes, Up: Top 39 Tunables *********** “Tunables” are a feature in the GNU C Library that allows application authors and distribution maintainers to alter the runtime library behavior to match their workload. These are implemented as a set of switches that may be modified in different ways. The current default method to do this is via the ‘GLIBC_TUNABLES’ environment variable by setting it to a string of colon-separated NAME=VALUE pairs. For example, the following example enables ‘malloc’ checking and sets the ‘malloc’ trim threshold to 128 bytes: GLIBC_TUNABLES=glibc.malloc.trim_threshold=128:glibc.malloc.check=3 export GLIBC_TUNABLES Tunables are not part of the GNU C Library stable ABI, and they are subject to change or removal across releases. Additionally, the method to modify tunable values may change between releases and across distributions. It is possible to implement multiple 'frontends' for the tunables allowing distributions to choose their preferred method at build time. Finally, the set of tunables available may vary between distributions as the tunables feature allows distributions to add their own tunables under their own namespace. Passing ‘--list-tunables’ to the dynamic loader to print all tunables with minimum and maximum values: $ /lib64/ld-linux-x86-64.so.2 --list-tunables glibc.rtld.nns: 0x4 (min: 0x1, max: 0x10) glibc.elision.skip_lock_after_retries: 3 (min: 0, max: 2147483647) glibc.malloc.trim_threshold: 0x0 (min: 0x0, max: 0xffffffffffffffff) glibc.malloc.perturb: 0 (min: 0, max: 255) glibc.cpu.x86_shared_cache_size: 0x100000 (min: 0x0, max: 0xffffffffffffffff) glibc.pthread.rseq: 1 (min: 0, max: 1) glibc.cpu.prefer_map_32bit_exec: 0 (min: 0, max: 1) glibc.mem.tagging: 0 (min: 0, max: 255) glibc.elision.tries: 3 (min: 0, max: 2147483647) glibc.elision.enable: 0 (min: 0, max: 1) glibc.malloc.hugetlb: 0x0 (min: 0x0, max: 0xffffffffffffffff) glibc.cpu.x86_rep_movsb_threshold: 0x2000 (min: 0x100, max: 0xffffffffffffffff) glibc.malloc.mxfast: 0x0 (min: 0x0, max: 0xffffffffffffffff) glibc.rtld.dynamic_sort: 2 (min: 1, max: 2) glibc.elision.skip_lock_busy: 3 (min: 0, max: 2147483647) glibc.malloc.top_pad: 0x20000 (min: 0x0, max: 0xffffffffffffffff) glibc.cpu.x86_rep_stosb_threshold: 0x800 (min: 0x1, max: 0xffffffffffffffff) glibc.cpu.x86_non_temporal_threshold: 0xc0000 (min: 0x4040, max: 0xfffffffffffffff) glibc.cpu.x86_memset_non_temporal_threshold: 0xc0000 (min: 0x4040, max: 0xfffffffffffffff) glibc.cpu.x86_shstk: glibc.pthread.stack_cache_size: 0x2800000 (min: 0x0, max: 0xffffffffffffffff) glibc.malloc.mmap_max: 0 (min: 0, max: 2147483647) glibc.elision.skip_trylock_internal_abort: 3 (min: 0, max: 2147483647) glibc.cpu.plt_rewrite: 0 (min: 0, max: 2) glibc.malloc.tcache_unsorted_limit: 0x0 (min: 0x0, max: 0xffffffffffffffff) glibc.cpu.x86_ibt: glibc.cpu.hwcaps: glibc.elision.skip_lock_internal_abort: 3 (min: 0, max: 2147483647) glibc.malloc.arena_max: 0x0 (min: 0x1, max: 0xffffffffffffffff) glibc.malloc.mmap_threshold: 0x0 (min: 0x0, max: 0xffffffffffffffff) glibc.cpu.x86_data_cache_size: 0x8000 (min: 0x0, max: 0xffffffffffffffff) glibc.malloc.tcache_count: 0x0 (min: 0x0, max: 0xffffffffffffffff) glibc.malloc.arena_test: 0x0 (min: 0x1, max: 0xffffffffffffffff) glibc.pthread.mutex_spin_count: 100 (min: 0, max: 32767) glibc.rtld.optional_static_tls: 0x200 (min: 0x0, max: 0xffffffffffffffff) glibc.malloc.tcache_max: 0x0 (min: 0x0, max: 0xffffffffffffffff) glibc.malloc.check: 0 (min: 0, max: 3) * Menu: * Tunable names:: The structure of a tunable name * Memory Allocation Tunables:: Tunables in the memory allocation subsystem * Dynamic Linking Tunables:: Tunables in the dynamic linking subsystem * Elision Tunables:: Tunables in elision subsystem * POSIX Thread Tunables:: Tunables in the POSIX thread subsystem * Hardware Capability Tunables:: Tunables that modify the hardware capabilities seen by the GNU C Library * Memory Related Tunables:: Tunables that control the use of memory by the GNU C Library. * gmon Tunables:: Tunables that control the gmon profiler, used in conjunction with gprof  File: libc.info, Node: Tunable names, Next: Memory Allocation Tunables, Up: Tunables 39.1 Tunable names ================== A tunable name is split into three components, a top namespace, a tunable namespace and the tunable name. The top namespace for tunables implemented in the GNU C Library is ‘glibc’. Distributions that choose to add custom tunables in their maintained versions of the GNU C Library may choose to do so under their own top namespace. The tunable namespace is a logical grouping of tunables in a single module. This currently holds no special significance, although that may change in the future. The tunable name is the actual name of the tunable. It is possible that different tunable namespaces may have tunables within them that have the same name, likewise for top namespaces. Hence, we only support identification of tunables by their full name, i.e. with the top namespace, tunable namespace and tunable name, separated by periods.  File: libc.info, Node: Memory Allocation Tunables, Next: Dynamic Linking Tunables, Prev: Tunable names, Up: Tunables 39.2 Memory Allocation Tunables =============================== -- Tunable namespace: glibc.malloc Memory allocation behavior can be modified by setting any of the following tunables in the ‘malloc’ namespace: -- Tunable: glibc.malloc.check This tunable supersedes the ‘MALLOC_CHECK_’ environment variable and is identical in features. This tunable has no effect by default and needs the debug library ‘libc_malloc_debug’ to be preloaded using the ‘LD_PRELOAD’ environment variable. Setting this tunable to a non-zero value less than 4 enables a special (less efficient) memory allocator for the ‘malloc’ family of functions that is designed to be tolerant against simple errors such as double calls of free with the same argument, or overruns of a single byte (off-by-one bugs). Not all such errors can be protected against, however, and memory leaks can result. Any detected heap corruption results in immediate termination of the process. Like ‘MALLOC_CHECK_’, ‘glibc.malloc.check’ has a problem in that it diverges from normal program behavior by writing to ‘stderr’, which could by exploited in SUID and SGID binaries. Therefore, ‘glibc.malloc.check’ is disabled by default for SUID and SGID binaries. -- Tunable: glibc.malloc.top_pad This tunable supersedes the ‘MALLOC_TOP_PAD_’ environment variable and is identical in features. This tunable determines the amount of extra memory in bytes to obtain from the system when any of the arenas need to be extended. It also specifies the number of bytes to retain when shrinking any of the arenas. This provides the necessary hysteresis in heap size such that excessive amounts of system calls can be avoided. The default value of this tunable is ‘131072’ (128 KB). -- Tunable: glibc.malloc.perturb This tunable supersedes the ‘MALLOC_PERTURB_’ environment variable and is identical in features. If set to a non-zero value, memory blocks are initialized with values depending on some low order bits of this tunable when they are allocated (except when allocated by ‘calloc’) and freed. This can be used to debug the use of uninitialized or freed heap memory. Note that this option does not guarantee that the freed block will have any specific values. It only guarantees that the content the block had before it was freed will be overwritten. The default value of this tunable is ‘0’. -- Tunable: glibc.malloc.mmap_threshold This tunable supersedes the ‘MALLOC_MMAP_THRESHOLD_’ environment variable and is identical in features. When this tunable is set, all chunks larger than this value in bytes are allocated outside the normal heap, using the ‘mmap’ system call. This way it is guaranteed that the memory for these chunks can be returned to the system on ‘free’. Note that requests smaller than this threshold might still be allocated via ‘mmap’. If this tunable is not set, the default value is set to ‘131072’ bytes and the threshold is adjusted dynamically to suit the allocation patterns of the program. If the tunable is set, the dynamic adjustment is disabled and the value is set as static. -- Tunable: glibc.malloc.trim_threshold This tunable supersedes the ‘MALLOC_TRIM_THRESHOLD_’ environment variable and is identical in features. The value of this tunable is the minimum size (in bytes) of the top-most, releasable chunk in an arena that will trigger a system call in order to return memory to the system from that arena. If this tunable is not set, the default value is set as 128 KB and the threshold is adjusted dynamically to suit the allocation patterns of the program. If the tunable is set, the dynamic adjustment is disabled and the value is set as static. -- Tunable: glibc.malloc.mmap_max This tunable supersedes the ‘MALLOC_MMAP_MAX_’ environment variable and is identical in features. The value of this tunable is maximum number of chunks to allocate with ‘mmap’. Setting this to zero disables all use of ‘mmap’. The default value of this tunable is ‘65536’. -- Tunable: glibc.malloc.arena_test This tunable supersedes the ‘MALLOC_ARENA_TEST’ environment variable and is identical in features. The ‘glibc.malloc.arena_test’ tunable specifies the number of arenas that can be created before the test on the limit to the number of arenas is conducted. The value is ignored if ‘glibc.malloc.arena_max’ is set. The default value of this tunable is 2 for 32-bit systems and 8 for 64-bit systems. -- Tunable: glibc.malloc.arena_max This tunable supersedes the ‘MALLOC_ARENA_MAX’ environment variable and is identical in features. This tunable sets the number of arenas to use in a process regardless of the number of cores in the system. The default value of this tunable is ‘0’, meaning that the limit on the number of arenas is determined by the number of CPU cores online. For 32-bit systems the limit is twice the number of cores online and on 64-bit systems, it is 8 times the number of cores online. -- Tunable: glibc.malloc.tcache_max The maximum size of a request (in bytes) which may be met via the per-thread cache. The default (and maximum) value is 1032 bytes on 64-bit systems and 516 bytes on 32-bit systems. -- Tunable: glibc.malloc.tcache_count The maximum number of chunks of each size to cache. The default is 7. The upper limit is 65535. If set to zero, the per-thread cache is effectively disabled. The approximate maximum overhead of the per-thread cache is thus equal to the number of bins times the chunk count in each bin times the size of each chunk. With defaults, the approximate maximum overhead of the per-thread cache is approximately 236 KB on 64-bit systems and 118 KB on 32-bit systems. -- Tunable: glibc.malloc.tcache_unsorted_limit When the user requests memory and the request cannot be met via the per-thread cache, the arenas are used to meet the request. At this time, additional chunks will be moved from existing arena lists to pre-fill the corresponding cache. While copies from the fastbins, smallbins, and regular bins are bounded and predictable due to the bin sizes, copies from the unsorted bin are not bounded, and incur additional time penalties as they need to be sorted as they're scanned. To make scanning the unsorted list more predictable and bounded, the user may set this tunable to limit the number of chunks that are scanned from the unsorted list while searching for chunks to pre-fill the per-thread cache with. The default, or when set to zero, is no limit. -- Tunable: glibc.malloc.mxfast One of the optimizations ‘malloc’ uses is to maintain a series of "fast bins" that hold chunks up to a specific size. The default and maximum size which may be held this way is 80 bytes on 32-bit systems or 160 bytes on 64-bit systems. Applications which value size over speed may choose to reduce the size of requests which are serviced from fast bins with this tunable. Note that the value specified includes ‘malloc’'s internal overhead, which is normally the size of one pointer, so add 4 on 32-bit systems or 8 on 64-bit systems to the size passed to ‘malloc’ for the largest bin size to enable. -- Tunable: glibc.malloc.hugetlb This tunable controls the usage of Huge Pages on ‘malloc’ calls. The default value is ‘0’, which disables any additional support on ‘malloc’. Setting its value to ‘1’ enables the use of ‘madvise’ with ‘MADV_HUGEPAGE’ after memory allocation with ‘mmap’. It is enabled only if the system supports Transparent Huge Page (currently only on Linux). Setting its value to ‘2’ enables the use of Huge Page directly with ‘mmap’ with the use of ‘MAP_HUGETLB’ flag. The huge page size to use will be the default one provided by the system. A value larger than ‘2’ specifies huge page size, which will be matched against the system supported ones. If provided value is invalid, ‘MAP_HUGETLB’ will not be used.  File: libc.info, Node: Dynamic Linking Tunables, Next: Elision Tunables, Prev: Memory Allocation Tunables, Up: Tunables 39.3 Dynamic Linking Tunables ============================= -- Tunable namespace: glibc.rtld Dynamic linker behavior can be modified by setting the following tunables in the ‘rtld’ namespace: -- Tunable: glibc.rtld.nns Sets the number of supported dynamic link namespaces (see ‘dlmopen’). Currently this limit can be set between 1 and 16 inclusive, the default is 4. Each link namespace consumes some memory in all thread, and thus raising the limit will increase the amount of memory each thread uses. Raising the limit is useful when your application uses more than 4 dynamic link namespaces as created by ‘dlmopen’ with an lmid argument of ‘LM_ID_NEWLM’. Dynamic linker audit modules are loaded in their own dynamic link namespaces, but they are not accounted for in ‘glibc.rtld.nns’. They implicitly increase the per-thread memory usage as necessary, so this tunable does not need to be changed to allow many audit modules e.g. via ‘LD_AUDIT’. -- Tunable: glibc.rtld.optional_static_tls Sets the amount of surplus static TLS in bytes to allocate at program startup. Every thread created allocates this amount of specified surplus static TLS. This is a minimum value and additional space may be allocated for internal purposes including alignment. Optional static TLS is used for optimizing dynamic TLS access for platforms that support such optimizations e.g. TLS descriptors or optimized TLS access for POWER (‘DT_PPC64_OPT’ and ‘DT_PPC_OPT’). In order to make the best use of such optimizations the value should be as many bytes as would be required to hold all TLS variables in all dynamic loaded shared libraries. The value cannot be known by the dynamic loader because it doesn't know the expected set of shared libraries which will be loaded. The existing static TLS space cannot be changed once allocated at process startup. The default allocation of optional static TLS is 512 bytes and is allocated in every thread. -- Tunable: glibc.rtld.dynamic_sort Sets the algorithm to use for DSO sorting, valid values are ‘1’ and ‘2’. For value of ‘1’, an older O(n^3) algorithm is used, which is long time tested, but may have performance issues when dependencies between shared objects contain cycles due to circular dependencies. When set to the value of ‘2’, a different algorithm is used, which implements a topological sort through depth-first search, and does not exhibit the performance issues of ‘1’. The default value of this tunable is ‘2’. -- Tunable: glibc.rtld.enable_secure Used to run a program as if it were a setuid process. The only valid value is ‘1’ as this tunable can only be used to set and not unset ‘enable_secure’. Setting this tunable to ‘1’ also disables all other tunables. This tunable is intended to facilitate more extensive verification tests for ‘AT_SECURE’ programs and not meant to be a security feature. The default value of this tunable is ‘0’. -- Tunable: glibc.rtld.execstack The GNU C Library will use either the default architecture ABI flags (that might contain the executable bit) or the value of ‘PT_GNU_STACK’ (if present) to define whether to mark the stack non-executable and if the program or any shared library dependency requires an executable stack the loader will change the main stack permission if kernel starts with a non-executable stack. The ‘glibc.rtld.execstack’ can be used to control whether an executable stack is allowed from the main program. Setting the value to ‘0’ disables the ABI auto-negotiation (meaning no executable stacks even if the ABI or ELF header requires it), ‘1’ enables auto-negotiation (although the program might not need an executable stack), while ‘2’ forces an executable stack at process start. This is provided for compatibility reasons, when the program dynamically loads modules with ‘dlopen’ which require an executable stack. When executable stacks are not allowed, and if the main program requires it, the loader will fail with an error message. Some systems do not have separate page protection flags at the hardware level for read access and execute access (sometimes called read-implies-exec). This mode can also be enabled on certain systems where the hardware supports separate protection flags. The the GNU C Library tunable configuration is independent of hardware capabilities and kernel configuration. *NB:* Trying to load a dynamic shared library with ‘dlopen’ or ‘dlmopen’ that requires an executable stack will always fail if the main program does not require an executable stack at loading time. This can be worked around by setting the tunable to ‘2’, where the stack is always executable.  File: libc.info, Node: Elision Tunables, Next: POSIX Thread Tunables, Prev: Dynamic Linking Tunables, Up: Tunables 39.4 Elision Tunables ===================== -- Tunable namespace: glibc.elision Contended locks are usually slow and can lead to performance and scalability issues in multithread code. Lock elision will use memory transactions to under certain conditions, to elide locks and improve performance. Elision behavior can be modified by setting the following tunables in the ‘elision’ namespace: -- Tunable: glibc.elision.enable The ‘glibc.elision.enable’ tunable enables lock elision if the feature is supported by the hardware. If elision is not supported by the hardware this tunable has no effect. Elision tunables are supported for 64-bit Intel, IBM POWER, and z System architectures. -- Tunable: glibc.elision.skip_lock_busy The ‘glibc.elision.skip_lock_busy’ tunable sets how many times to use a non-transactional lock after a transactional failure has occurred because the lock is already acquired. Expressed in number of lock acquisition attempts. The default value of this tunable is ‘3’. -- Tunable: glibc.elision.skip_lock_internal_abort The ‘glibc.elision.skip_lock_internal_abort’ tunable sets how many times the thread should avoid using elision if a transaction aborted for any reason other than a different thread's memory accesses. Expressed in number of lock acquisition attempts. The default value of this tunable is ‘3’. -- Tunable: glibc.elision.skip_lock_after_retries The ‘glibc.elision.skip_lock_after_retries’ tunable sets how many times to try to elide a lock with transactions, that only failed due to a different thread's memory accesses, before falling back to regular lock. Expressed in number of lock elision attempts. This tunable is supported only on IBM POWER, and z System architectures. The default value of this tunable is ‘3’. -- Tunable: glibc.elision.tries The ‘glibc.elision.tries’ sets how many times to retry elision if there is chance for the transaction to finish execution e.g., it wasn't aborted due to the lock being already acquired. If elision is not supported by the hardware this tunable is set to ‘0’ to avoid retries. The default value of this tunable is ‘3’. -- Tunable: glibc.elision.skip_trylock_internal_abort The ‘glibc.elision.skip_trylock_internal_abort’ tunable sets how many times the thread should avoid trying the lock if a transaction aborted due to reasons other than a different thread's memory accesses. Expressed in number of try lock attempts. The default value of this tunable is ‘3’.