math.h

title: math.h(7p)

text:
# math.h(7p)

## PROLOG
This manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (consult the corresponding Linux manual page for details of Linux behavior), or the interface may not be implemented on Linux.

## NAME
math.h — mathematical declarations

## SYNOPSIS

```
#include <math.h>
```

## DESCRIPTION
Some of the functionality described on this reference page extends the ISO C standard. Applications shall define the appropriate feature test macro (see the System Interfaces volume of POSIX.1‐2017, Section 2.2, The Compilation Environment) to enable the visibility of these symbols in this header.

The <math.h> header shall define at least the following types:

float_t

A real-floating type at least as wide as float.

double_t

A real-floating type at least as wide as double, and at least as wide as float_t.

If FLT_EVAL_METHOD equals 0, float_t and double_t shall be float and double, respectively; if FLT_EVAL_METHOD equals 1, they shall both be double; if FLT_EVAL_METHOD equals 2, they shall both be long double; for other values of FLT_EVAL_METHOD, they are otherwise implementation-defined.

The <math.h> header shall define the following macros, where real-floating indicates that the argument shall be an expression of real-floating type:

```
int fpclassify(real-floating x);
int isfinite(real-floating x);
int isgreater(real-floating x, real-floating y);
int isgreaterequal(real-floating x, real-floating y);
int isinf(real-floating x);
int isless(real-floating x, real-floating y);
int islessequal(real-floating x, real-floating y);
int islessgreater(real-floating x, real-floating y);
int isnan(real-floating x);
int isnormal(real-floating x);
int isunordered(real-floating x, real-floating y);
int signbit(real-floating x);
```

The <math.h> header shall define the following symbolic constants. The values shall have type double and shall be accurate to at least the precision of the double type.

M_E

Value of e

M_LOG2E

Value of log_2 e

M_LOG10E

Value of log_10 e

M_LN2

Value of log_e 2

M_LN10

Value of log_e 10

M_PI

Value of π

M_PI_2

Value of π/2

M_PI_4

Value of π/4

M_1_PI

Value of 1/π

M_2_PI

Value of 2/π

M_2_SQRTPI

Value of 2/π

M_SQRT2

Value of 2

M_SQRT1_2

Value of 1/2

The <math.h> header shall define the following symbolic constant:

MAXFLOAT

Same value as FLT_MAX in <float.h>.

The <math.h> header shall define the following macros:

HUGE_VAL

A positive double constant expression, not necessarily representable as a float. Used as an error value returned by the mathematics library. HUGE_VAL evaluates to +infinity on systems supporting IEEE Std 754‐1985.

HUGE_VALF

A positive float constant expression. Used as an error value returned by the mathematics library. HUGE_VALF evaluates to +infinity on systems supporting IEEE Std 754‐1985.

HUGE_VALL

A positive long double constant expression. Used as an error value returned by the mathematics library. HUGE_VALL evaluates to +infinity on systems supporting IEEE Std 754‐1985.

INFINITY

A constant expression of type float representing positive or unsigned infinity, if available; else a positive constant of type float that overflows at translation time.

NAN

A constant expression of type float representing a quiet NaN. This macro is only defined if the implementation supports quiet NaNs for the float type.

The following macros shall be defined for number classification. They represent the mutually-exclusive kinds of floating-point values. They expand to integer constant expressions with distinct values. Additional implementation-defined floating-point classifications, with macro definitions beginning with FP_ and an uppercase letter, may also be specified by the implementation.

FP_INFINITE FP_NAN FP_NORMAL FP_SUBNORMAL FP_ZERO

The following optional macros indicate whether the fma() family of functions are fast compared with direct code:

FP_FAST_FMA FP_FAST_FMAF FP_FAST_FMAL

If defined, the FP_FAST_FMA macro shall expand to the integer constant 1 and shall indicate that the fma() function generally executes about as fast as, or faster than, a multiply and an add of double operands. If undefined, the speed of execution is unspecified. The other macros have the equivalent meaning for the float and long double versions.

The following macros shall expand to integer constant expressions whose values are returned by ilogb(x) if x is zero or NaN, respectively. The value of FP_ILOGB0 shall be either {INT_MIN} or -{INT_MAX}. The value of FP_ILOGBNAN shall be either {INT_MAX} or {INT_MIN}.

FP_ILOGB0 FP_ILOGBNAN

The following macros shall expand to the integer constants 1 and 2, respectively;

MATH_ERRNO MATH_ERREXCEPT

The following macro shall expand to an expression that has type int and the value MATH_ERRNO, MATH_ERREXCEPT, or the bitwise-inclusive OR of both:

math_errhandling

The value of math_errhandling is constant for the duration of the program. It is unspecified whether math_errhandling is a macro or an identifier with external linkage. If a macro definition is suppressed or a program defines an identifier with the name math_errhandling , the behavior is undefined. If the expression (math_errhandling & MATH_ERREXCEPT) can be non-zero, the implementation shall define the macros FE_DIVBYZERO, FE_INVALID, and FE_OVERFLOW in <fenv.h>.

The following shall be declared as functions and may also be defined as macros. Function prototypes shall be provided.

```
double      acos(double);
float       acosf(float);
double      acosh(double);
float       acoshf(float);
long double acoshl(long double);
long double acosl(long double);
double      asin(double);
float       asinf(float);
double      asinh(double);
float       asinhf(float);
long double asinhl(long double);
long double asinl(long double);
double      atan(double);
double      atan2(double, double);
float       atan2f(float, float);
long double atan2l(long double, long double);
float       atanf(float);
double      atanh(double);
float       atanhf(float);
long double atanhl(long double);
long double atanl(long double);
double      cbrt(double);
float       cbrtf(float);
long double cbrtl(long double);
double      ceil(double);
float       ceilf(float);
long double ceill(long double);
double      copysign(double, double);
float       copysignf(float, float);
long double copysignl(long double, long double);
double      cos(double);
float       cosf(float);
double      cosh(double);
float       coshf(float);
long double coshl(long double);
long double cosl(long double);
double      erf(double);
double      erfc(double);
float       erfcf(float);
long double erfcl(long double);
float       erff(float);
long double erfl(long double);
double      exp(double);
double      exp2(double);
float       exp2f(float);
long double exp2l(long double);
float       expf(float);
long double expl(long double);
double      expm1(double);
float       expm1f(float);
long double expm1l(long double);
double      fabs(double);
float       fabsf(float);
long double fabsl(long double);
double      fdim(double, double);
float       fdimf(float, float);
long double fdiml(long double, long double);
double      floor(double);
float       floorf(float);
long double floorl(long double);
double      fma(double, double, double);
float       fmaf(float, float, float);
long double fmal(long double, long double, long double);
double      fmax(double, double);
float       fmaxf(float, float);
long double fmaxl(long double, long double);
double      fmin(double, double);
float       fminf(float, float);
long double fminl(long double, long double);
double      fmod(double, double);
float       fmodf(float, float);
long double fmodl(long double, long double);
double      frexp(double, int *);
float       frexpf(float, int *);
long double frexpl(long double, int *);
double      hypot(double, double);
float       hypotf(float, float);
long double hypotl(long double, long double);
int         ilogb(double);
int         ilogbf(float);
int         ilogbl(long double);
double      j0(double);
double      j1(double);
double      jn(int, double);
double      ldexp(double, int);
float       ldexpf(float, int);
long double ldexpl(long double, int);
double      lgamma(double);
float       lgammaf(float);
long double lgammal(long double);
long long   llrint(double);
long long   llrintf(float);
long long   llrintl(long double);
long long   llround(double);
long long   llroundf(float);
long long   llroundl(long double);
double      log(double);
double      log10(double);
float       log10f(float);
long double log10l(long double);
double      log1p(double);
float       log1pf(float);
long double log1pl(long double);
double      log2(double);
float       log2f(float);
long double log2l(long double);
double      logb(double);
float       logbf(float);
long double logbl(long double);
float       logf(float);
long double logl(long double);
long        lrint(double);
long        lrintf(float);
long        lrintl(long double);
long        lround(double);
long        lroundf(float);
long        lroundl(long double);
double      modf(double, double *);
float       modff(float, float *);
long double modfl(long double, long double *);
double      nan(const char *);
float       nanf(const char *);
long double nanl(const char *);
double      nearbyint(double);
float       nearbyintf(float);
long double nearbyintl(long double);
double      nextafter(double, double);
float       nextafterf(float, float);
long double nextafterl(long double, long double);
double      nexttoward(double, long double);
float       nexttowardf(float, long double);
long double nexttowardl(long double, long double);
double      pow(double, double);
float       powf(float, float);
long double powl(long double, long double);
double      remainder(double, double);
float       remainderf(float, float);
long double remainderl(long double, long double);
double      remquo(double, double, int *);
float       remquof(float, float, int *);
long double remquol(long double, long double, int *);
double      rint(double);
float       rintf(float);
long double rintl(long double);
double      round(double);
float       roundf(float);
long double roundl(long double);
double      scalbln(double, long);
float       scalblnf(float, long);
long double scalblnl(long double, long);
double      scalbn(double, int);
float       scalbnf(float, int);
long double scalbnl(long double, int);
double      sin(double);
float       sinf(float);
double      sinh(double);
float       sinhf(float);
long double sinhl(long double);
long double sinl(long double);
double      sqrt(double);
float       sqrtf(float);
long double sqrtl(long double);
double      tan(double);
float       tanf(float);
double      tanh(double);
float       tanhf(float);
long double tanhl(long double);
long double tanl(long double);
double      tgamma(double);
float       tgammaf(float);
long double tgammal(long double);
double      trunc(double);
float       truncf(float);
long double truncl(long double);
double      y0(double);
double      y1(double);
double      yn(int, double);
```

The following external variable shall be defined:

```
extern int signgam;
```

The behavior of each of the functions defined in <math.h> is specified in the System Interfaces volume of POSIX.1‐2017 for all representable values of its input arguments, except where stated otherwise. Each function shall execute as if it were a single operation without generating any externally visible exceptional conditions.

The following sections are informative.

## APPLICATION USAGE
The FP_CONTRACT pragma can be used to allow (if the state is on) or disallow (if the state is off) the implementation to contract expressions. Each pragma can occur either outside external declarations or preceding all explicit declarations and statements inside a compound statement. When outside external declarations, the pragma takes effect from its occurrence until another FP_CONTRACT pragma is encountered, or until the end of the translation unit. When inside a compound statement, the pragma takes effect from its occurrence until another FP_CONTRACT pragma is encountered (including within a nested compound statement), or until the end of the compound statement; at the end of a compound statement the state for the pragma is restored to its condition just before the compound statement. If this pragma is used in any other context, the behavior is undefined. The default state (on or off) for the pragma is implementation-defined.

Applications should use FLT_MAX as described in the <float.h> header instead of the obsolescent MAXFLOAT.

Note that if FLT_EVAL_METHOD is neither 0 nor 1, then some constants might not compare equal as expected; for example, (double)M_PI == M_PI can fail.

## RATIONALE
Before the ISO/IEC 9899:1999 standard, the math library was defined only for the floating type double. All the names formed by appending 'f' or 'l' to a name in <math.h> were reserved to allow for the definition of float and long double libraries; and the ISO/IEC 9899:1999 standard provides for all three versions of math functions.

The functions ecvt(), fcvt(), and gcvt() have been dropped from the ISO C standard since their capability is available through sprintf().

## FUTURE DIRECTIONS
None.

## SEE ALSO
<float.h>, <stddef.h>, <sys_types.h>

The System Interfaces volume of POSIX.1‐2017, Section 2.2, The Compilation Environment, acos(), acosh(), asin(), asinh(), atan(), atan2(), atanh(), cbrt(), ceil(), copysign(), cos(), cosh(), erf(), erfc(), exp(), exp2(), expm1(), fabs(), fdim(), floor(), fma(), fmax(), fmin(), fmod(), fpclassify(), frexp(), hypot(), ilogb(), isfinite(), isgreater(), isgreaterequal(), isinf(), isless(), islessequal(), islessgreater(), isnan(), isnormal(), isunordered(), j0(), ldexp(), lgamma(), llrint(), llround(), log(), log10(), log1p(), log2(), logb(), lrint(), lround(), modf(), nan(), nearbyint(), nextafter(), pow(), remainder(), remquo(), rint(), round(), scalbln(), signbit(), sin(), sinh(), sqrt(), tan(), tanh(), tgamma(), trunc(), y0()

## COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html .

Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html .


monetary.h

package: man-pages-posix-devel

title: monetary.h(7p)

text:
# monetary.h(7p)

## PROLOG
This manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (consult the corresponding Linux manual page for details of Linux behavior), or the interface may not be implemented on Linux.

## NAME
monetary.h — monetary types

## SYNOPSIS

```
#include <monetary.h>
```

## DESCRIPTION
The <monetary.h> header shall define the locale_t type as described in <locale.h>.

The <monetary.h> header shall define the size_t type as described in <stddef.h>.

The <monetary.h> header shall define the ssize_t type as described in <sys/types.h>.

The following shall be declared as functions and may also be defined as macros. Function prototypes shall be provided for use with ISO C standard compilers.

```
ssize_t  strfmon(char *restrict, size_t, const char *restrict, ...);
ssize_t  strfmon_l(char *restrict, size_t, locale_t,

             const char *restrict, ...);
```

The following sections are informative.

## APPLICATION USAGE
None.

## RATIONALE
None.

## FUTURE DIRECTIONS
None.

## SEE ALSO
<locale.h>, <stddef.h>, <sys_types.h>

The System Interfaces volume of POSIX.1‐2017, strfmon()

## COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html .

Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html .


mqueue.h

title: mqueue.h(7p)

text:
# mqueue.h(7p)

## PROLOG
This manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (consult the corresponding Linux manual page for details of Linux behavior), or the interface may not be implemented on Linux.

## NAME
mqueue.h — message queues (REALTIME)

## SYNOPSIS

```
#include <mqueue.h>
```

## DESCRIPTION
The <mqueue.h> header shall define the mqd_t type, which is used for message queue descriptors. This is not an array type.

The <mqueue.h> header shall define the pthread_attr_t, size_t, and ssize_t types as described in <sys/types.h>.

The <mqueue.h> header shall define the struct timespec structure as described in <time.h>.

The tag sigevent shall be declared as naming an incomplete structure type, the contents of which are described in the <signal.h> header.

The <mqueue.h> header shall define the mq_attr structure, which is used in getting and setting the attributes of a message queue. Attributes are initially set when the message queue is created. An mq_attr structure shall have at least the following fields:

```
long    mq_flags    Message queue flags.
long    mq_maxmsg   Maximum number of messages.
long    mq_msgsize  Maximum message size.
long    mq_curmsgs  Number of messages currently queued.
```

The following shall be declared as functions and may also be defined as macros. Function prototypes shall be provided.

```
int      mq_close(mqd_t);
int      mq_getattr(mqd_t, struct mq_attr *);
int      mq_notify(mqd_t, const struct sigevent *);
mqd_t    mq_open(const char *, int, ...);
ssize_t  mq_receive(mqd_t, char *, size_t, unsigned *);
int      mq_send(mqd_t, const char *, size_t, unsigned);
int      mq_setattr(mqd_t, const struct mq_attr *restrict,

             struct mq_attr *restrict);
ssize_t  mq_timedreceive(mqd_t, char *restrict, size_t,

             unsigned *restrict, const struct timespec *restrict);
int      mq_timedsend(mqd_t, const char *, size_t, unsigned,

             const struct timespec *);
int      mq_unlink(const char *);
```

Inclusion of the <mqueue.h> header may make visible symbols defined in the headers <fcntl.h>, <signal.h>, and <time.h>.

The following sections are informative.

## APPLICATION USAGE
None.

## RATIONALE
None.

## FUTURE DIRECTIONS
None.

## SEE ALSO
<fcntl.h>, <signal.h>, <sys_types.h>, <time.h>

The System Interfaces volume of POSIX.1‐2017, mq_close(), mq_getattr(), mq_notify(), mq_open(), mq_receive(), mq_send(), mq_setattr(), mq_unlink()

## COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html .

Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html .


ndbm.h

title: ndbm.h(7p)

text:
# ndbm.h(7p)

## PROLOG
This manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (consult the corresponding Linux manual page for details of Linux behavior), or the interface may not be implemented on Linux.

## NAME
ndbm.h — definitions for ndbm database operations

## SYNOPSIS

```
#include <ndbm.h>
```

## DESCRIPTION
The <ndbm.h> header shall define the datum type as a structure, which shall include at least the following members:

```
void   *dptr  A pointer to the application's data.
size_t  dsize The size of the object pointed to by dptr.
```

The <ndbm.h> header shall define the size_t type as described in <stddef.h>.

The <ndbm.h> header shall define the DBM type.

The <ndbm.h> header shall define the following symbolic constants as possible values for the store_mode argument to dbm_store():

DBM_INSERT

Insertion of new entries only.

DBM_REPLACE

Allow replacing existing entries.

The following shall be declared as functions and may also be defined as macros. Function prototypes shall be provided.

```
int     dbm_clearerr(DBM *);
void    dbm_close(DBM *);
int     dbm_delete(DBM *, datum);
int     dbm_error(DBM *);
datum   dbm_fetch(DBM *, datum);
datum   dbm_firstkey(DBM *);
datum   dbm_nextkey(DBM *);
DBM    *dbm_open(const char *, int, mode_t);
int     dbm_store(DBM *, datum, datum, int);
```

The <ndbm.h> header shall define the mode_t type through typedef, as described in <sys/types.h>.

The following sections are informative.

## APPLICATION USAGE
None.

## RATIONALE
None.

## FUTURE DIRECTIONS
None.

## SEE ALSO
<stddef.h>, <sys_types.h>

The System Interfaces volume of POSIX.1‐2017, dbm_clearerr()

## COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html .

Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html .


title: net_if.h(7p)

text:
# net_if.h(7p)

## PROLOG
This manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (consult the corresponding Linux manual page for details of Linux behavior), or the interface may not be implemented on Linux.

## NAME
net/if.h — sockets local interfaces

## SYNOPSIS

```
#include <net/if.h>
```

## DESCRIPTION
The <net/if.h> header shall define the if_nameindex structure, which shall include at least the following members:

```
unsigned  if_index  Numeric index of the interface.
char     *if_name   Null-terminated name of the interface.
```

The <net/if.h> header shall define the following symbolic constant for the length of a buffer containing an interface name (including the terminating NULL character):

IF_NAMESIZE

Interface name length.

The following shall be declared as functions and may also be defined as macros. Function prototypes shall be provided.

```
void                  if_freenameindex(struct if_nameindex *);
char                 *if_indextoname(unsigned, char *);
struct if_nameindex  *if_nameindex(void);
unsigned              if_nametoindex(const char *);
```

The following sections are informative.

## APPLICATION USAGE
None.

## RATIONALE
None.

## FUTURE DIRECTIONS
None.

## SEE ALSO
The System Interfaces volume of POSIX.1‐2017, if_freenameindex(), if_indextoname(), if_nameindex(), if_nametoindex()

## COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html .

Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html .


netdb.h

title: netdb.h(7p)

text:
# netdb.h(7p)

## PROLOG
This manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (consult the corresponding Linux manual page for details of Linux behavior), or the interface may not be implemented on Linux.

## NAME
netdb.h — definitions for network database operations

## SYNOPSIS

```
#include <netdb.h>
```

## DESCRIPTION
The <netdb.h> header may define the in_port_t type and the in_addr_t type as described in <netinet/in.h>.

The <netdb.h> header shall define the hostent structure, which shall include at least the following members:

```
char   *h_name       Official name of the host.
char  **h_aliases    A pointer to an array of pointers to

                     alternative host names, terminated by a

                     null pointer.
int     h_addrtype   Address type.
int     h_length     The length, in bytes, of the address.
char  **h_addr_list  A pointer to an array of pointers to network

                     addresses (in network byte order) for the host,

                     terminated by a null pointer.
```

The <netdb.h> header shall define the netent structure, which shall include at least the following members:

```
char     *n_name      Official, fully-qualified (including the

                      domain) name of the host.
char    **n_aliases   A pointer to an array of pointers to

                      alternative network names, terminated by a

                      null pointer.
int       n_addrtype  The address type of the network.
uint32_t  n_net       The network number, in host byte order.
```

The <netdb.h> header shall define the uint32_t type as described in <inttypes.h>.

The <netdb.h> header shall define the protoent structure, which shall include at least the following members:

```
char   *p_name     Official name of the protocol.
char  **p_aliases  A pointer to an array of pointers to

                   alternative protocol names, terminated by

                   a null pointer.
int     p_proto    The protocol number.
```

The <netdb.h> header shall define the servent structure, which shall include at least the following members:

```
char   *s_name     Official name of the service.
char  **s_aliases  A pointer to an array of pointers to

                   alternative service names, terminated by

                   a null pointer.
int     s_port     A value which, when converted to uint16_t,

                   yields the port number in network byte order

                   at which the service resides.
char   *s_proto    The name of the protocol to use when

                   contacting the service.
```

The <netdb.h> header shall define the IPPORT_RESERVED symbolic constant with the value of the highest reserved Internet port number.

### Address Information Structure
The <netdb.h> header shall define the addrinfo structure, which shall include at least the following members:

```
int               ai_flags      Input flags.
int               ai_family     Address family of socket.
int               ai_socktype   Socket type.
int               ai_protocol   Protocol of socket.
socklen_t         ai_addrlen    Length of socket address.
struct sockaddr  *ai_addr       Socket address of socket.
char             *ai_canonname  Canonical name of service location.
struct addrinfo  *ai_next       Pointer to next in list.
```

The <netdb.h> header shall define the following symbolic constants that evaluate to bitwise-distinct integer constants for use in the flags field of the addrinfo structure:

AI_PASSIVE

Socket address is intended for bind().

AI_CANONNAME

Request for canonical name.

AI_NUMERICHOST

Return numeric host address as name.

AI_NUMERICSERV

Inhibit service name resolution.

AI_V4MAPPED

If no IPv6 addresses are found, query for IPv4 addresses and return them to the caller as IPv4-mapped IPv6 addresses.

AI_ALL

Query for both IPv4 and IPv6 addresses.

AI_ADDRCONFIG

Query for IPv4 addresses only when an IPv4 address is configured; query for IPv6 addresses only when an IPv6 address is configured.

The <netdb.h> header shall define the following symbolic constants that evaluate to bitwise-distinct integer constants for use in the flags argument to getnameinfo():

NI_NOFQDN

Only the nodename portion of the FQDN is returned for local hosts.

NI_NUMERICHOST

The numeric form of the node's address is returned instead of its name.

NI_NAMEREQD

Return an error if the node's name cannot be located in the database.

NI_NUMERICSERV

The numeric form of the service address is returned instead of its name.

NI_NUMERICSCOPE

For IPv6 addresses, the numeric form of the scope identifier is returned instead of its name.

NI_DGRAM

Indicates that the service is a datagram service (SOCK_DGRAM).

### Address Information Errors
The <netdb.h> header shall define the following symbolic constants for use as error values for getaddrinfo() and getnameinfo(). The values shall be suitable for use in #if preprocessing directives.

EAI_AGAIN

The name could not be resolved at this time. Future attempts may succeed.

EAI_BADFLAGS

The flags had an invalid value.

EAI_FAIL

A non-recoverable error occurred.

EAI_FAMILY

The address family was not recognized or the address length was invalid for the specified family.

EAI_MEMORY

There was a memory allocation failure.

EAI_NONAME

The name does not resolve for the supplied parameters.

NI_NAMEREQD is set and the host's name cannot be located, or both nodename and servname were null.

EAI_SERVICE

The service passed was not recognized for the specified socket type.

EAI_SOCKTYPE

The intended socket type was not recognized.

EAI_SYSTEM

A system error occurred. The error code can be found in errno.

EAI_OVERFLOW

An argument buffer overflowed.

The following shall be declared as functions and may also be defined as macros. Function prototypes shall be provided.

```
void              endhostent(void);
void              endnetent(void);
void              endprotoent(void);
void              endservent(void);
void              freeaddrinfo(struct addrinfo *);
const char       *gai_strerror(int);
int               getaddrinfo(const char *restrict, const char *restrict,

                      const struct addrinfo *restrict,

                      struct addrinfo **restrict);
struct hostent   *gethostent(void);
int               getnameinfo(const struct sockaddr *restrict, socklen_t,

                      char *restrict, socklen_t, char *restrict,

                      socklen_t, int);
struct netent    *getnetbyaddr(uint32_t, int);
struct netent    *getnetbyname(const char *);
struct netent    *getnetent(void);
struct protoent  *getprotobyname(const char *);
struct protoent  *getprotobynumber(int);
struct protoent  *getprotoent(void);
struct servent   *getservbyname(const char *, const char *);
struct servent   *getservbyport(int, const char *);
struct servent   *getservent(void);
void              sethostent(int);
void              setnetent(int);
void              setprotoent(int);
void              setservent(int);
```

The <netdb.h> header shall define the socklen_t type through typedef, as described in <sys/socket.h>.

Inclusion of the <netdb.h> header may also make visible all symbols from <netinet/in.h>, <sys/socket.h>, and <inttypes.h>.

The following sections are informative.

## APPLICATION USAGE
None.

## RATIONALE
None.

## FUTURE DIRECTIONS
None.

## SEE ALSO
<inttypes.h>, <netinet_in.h>, <sys_socket.h>

The System Interfaces volume of POSIX.1‐2017, bind(), endhostent(), endnetent(), endprotoent(), endservent(), freeaddrinfo(), gai_strerror(), getnameinfo()

## COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html .

Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html .


title: netinet_in.h(7p)

text:
# netinet_in.h(7p)

## PROLOG
This manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (consult the corresponding Linux manual page for details of Linux behavior), or the interface may not be implemented on Linux.

## NAME
netinet/in.h — Internet address family

## SYNOPSIS

```
#include <netinet/in.h>
```

## DESCRIPTION
The <netinet/in.h> header shall define the following types:

in_port_t

Equivalent to the type uint16_t as described in <inttypes.h>.

in_addr_t

Equivalent to the type uint32_t as described in <inttypes.h>.

The <netinet_in.h> header shall define the sa_family_t type as described in <sys/socket.h>.

The <netinet_in.h> header shall define the uint8_t and uint32_t types as described in <inttypes.h>. Inclusion of the <netinet/in.h> header may also make visible all symbols from <inttypes.h> and <sys/socket.h>.

The <netinet/in.h> header shall define the in_addr structure, which shall include at least the following member:

```
in_addr_t  s_addr
```

The <netinet/in.h> header shall define the sockaddr_in structure, which shall include at least the following members:

```
sa_family_t     sin_family   AF_INET.
in_port_t       sin_port     Port number.
struct in_addr  sin_addr     IP address.
```

The sin_port and sin_addr members shall be in network byte order.

The sockaddr_in structure is used to store addresses for the Internet address family. Pointers to this type shall be cast by applications to struct sockaddr * for use with socket functions.

The <netinet/in.h> header shall define the in6_addr structure, which shall include at least the following member:

```
uint8_t s6_addr[16]
```

This array is used to contain a 128-bit IPv6 address, stored in network byte order.

The <netinet/in.h> header shall define the sockaddr_in6 structure, which shall include at least the following members:

```
sa_family_t      sin6_family    AF_INET6.
in_port_t        sin6_port      Port number.
uint32_t         sin6_flowinfo  IPv6 traffic class and flow information.
struct in6_addr  sin6_addr      IPv6 address.
uint32_t         sin6_scope_id  Set of interfaces for a scope.
```

The sin6_port and sin6_addr members shall be in network byte order.

Prior to calling a function in this standard which reads values from a sockaddr_in6 structure (for example, bind() or connect()), the application shall ensure that all members of the structure, including any additional non-standard members, if any, are initialized. If the sockaddr_in6 structure has a non-standard member, and that member has a value other than the value that would result from default initialization, the behavior of any function in this standard that reads values from the sockaddr_in6 structure is implementation-defined. All functions in this standard that return data in a sockaddr_in6 structure (for example, getaddrinfo() or accept()) shall initialize the structure in a way that meets the above requirements, and shall ensure that each non-standard member, if any, has a value that produces the same behavior as default initialization would in all functions in this standard which read values from a sockaddr_in6 structure.

The sin6_scope_id field is a 32-bit integer that identifies a set of interfaces as appropriate for the scope of the address carried in the sin6_addr field. For a link scope sin6_addr, the application shall ensure that sin6_scope_id is a link index. For a site scope sin6_addr, the application shall ensure that sin6_scope_id is a site index. The mapping of sin6_scope_id to an interface or set of interfaces is implementation-defined.

The <netinet/in.h> header shall declare the following external variable:

```
const struct in6_addr in6addr_any
```

This variable is initialized by the system to contain the wildcard IPv6 address. The <netinet/in.h> header also defines the IN6ADDR_ANY_INIT macro. This macro must be constant at compile time and can be used to initialize a variable of type struct in6_addr to the IPv6 wildcard address.

The <netinet/in.h> header shall declare the following external variable:

```
const struct in6_addr in6addr_loopback
```

This variable is initialized by the system to contain the loopback IPv6 address. The <netinet/in.h> header also defines the IN6ADDR_LOOPBACK_INIT macro. This macro must be constant at compile time and can be used to initialize a variable of type struct in6_addr to the IPv6 loopback address.

The <netinet/in.h> header shall define the ipv6_mreq structure, which shall include at least the following members:

```
struct in6_addr  ipv6mr_multiaddr  IPv6 multicast address.
unsigned         ipv6mr_interface  Interface index.
```

The <netinet/in.h> header shall define the following symbolic constants for use as values of the level argument of getsockopt() and setsockopt():

IPPROTO_IP

Internet protocol.

IPPROTO_IPV6

Internet Protocol Version 6.

IPPROTO_ICMP

Control message protocol.

IPPROTO_RAW

Raw IP Packets Protocol.

IPPROTO_TCP

Transmission control protocol.

IPPROTO_UDP

User datagram protocol.

The <netinet/in.h> header shall define the following symbolic constant for use as a local address in the structure passed to bind():

INADDR_ANY

IPv4 wildcard address.

The <netinet/in.h> header shall define the following symbolic constant for use as a destination address in the structures passed to connect(), sendmsg(), and sendto():

INADDR_BROADCAST

IPv4 broadcast address.

The <netinet/in.h> header shall define the following symbolic constant, with the value specified, to help applications declare buffers of the proper size to store IPv4 addresses in string form:

INET_ADDRSTRLEN

16. Length of the string form for IP.

The htonl(), htons(), ntohl(), and ntohs() functions shall be available as described in <arpa/inet.h>. Inclusion of the <netinet/in.h> header may also make visible all symbols from <arpa/inet.h>.

The <netinet/in.h> header shall define the following symbolic constant, with the value specified, to help applications declare buffers of the proper size to store IPv6 addresses in string form:

INET6_ADDRSTRLEN

46. Length of the string form for IPv6.

The <netinet/in.h> header shall define the following symbolic constants, with distinct integer values, for use in the option_name argument in the getsockopt() or setsockopt() functions at protocol level IPPROTO_IPV6:

IPV6_JOIN_GROUP

Join a multicast group.

IPV6_LEAVE_GROUP

Quit a multicast group.

IPV6_MULTICAST_HOPS

Multicast hop limit.

IPV6_MULTICAST_IF

Interface to use for outgoing multicast packets.

IPV6_MULTICAST_LOOP

Multicast packets are delivered back to the local application.

IPV6_UNICAST_HOPS

Unicast hop limit.

IPV6_V6ONLY

Restrict AF_INET6 socket to IPv6 communications only.

The <netinet/in.h> header shall define the following macros that test for special IPv6 addresses. Each macro is of type int and takes a single argument of type const struct in6_addr *:

IN6_IS_ADDR_UNSPECIFIED

Unspecified address.

IN6_IS_ADDR_LOOPBACK

Loopback address.

IN6_IS_ADDR_MULTICAST

Multicast address.

IN6_IS_ADDR_LINKLOCAL

Unicast link-local address.

IN6_IS_ADDR_SITELOCAL

Unicast site-local address.

IN6_IS_ADDR_V4MAPPED

IPv4 mapped address.

IN6_IS_ADDR_V4COMPAT

IPv4-compatible address.

IN6_IS_ADDR_MC_NODELOCAL

Multicast node-local address.

IN6_IS_ADDR_MC_LINKLOCAL

Multicast link-local address.

IN6_IS_ADDR_MC_SITELOCAL

Multicast site-local address.

IN6_IS_ADDR_MC_ORGLOCAL

Multicast organization-local address.

IN6_IS_ADDR_MC_GLOBAL

Multicast global address.

The following sections are informative.

## APPLICATION USAGE
Although applications are required to initialize all members (including any non-standard ones) of a sockaddr_in6 structure, the same is not required for the sockaddr_in structure, since historically many applications only initialized the standard members. Despite this, applications are encouraged to initialize sockaddr_in structures in a manner similar to the required initialization of sockaddr_in6 structures.

Although it is common practice to initialize a sockaddr_in6 structure using:

```
struct sockaddr_in6 sa;
memset(&sa, 0, sizeof sa);
```

this method is not portable according to this standard, because the structure can contain pointer or floating-point members that are not required to have an all-bits-zero representation after default initialization. Portable methods make use of default initialization; for example:

```
struct sockaddr_in6 sa = { 0 };
```

or:

```
static struct sockaddr_in6 sa_init;
struct sockaddr_in6 sa = sa_init;
```

A future version of this standard may require that a pointer object with an all-bits-zero representation is a null pointer, and that sockaddr_in6 does not have any floating-point members if a floating-point object with an all-bits-zero representation does not have the value 0.0.

## RATIONALE
The INADDR_ANY and INADDR_BROADCAST values are byte-order-neutral and thus their byte order is not specified. Many implementations have additional constants as extensions, such as INADDR_LOOPBACK, that are not byte-order-neutral. Traditionally, these constants are in host byte order, requiring the use of htonl() when using them in a sockaddr_in structure.

## FUTURE DIRECTIONS
None.

## SEE ALSO
Section 4.10, Host and Network Byte Orders, <arpa_inet.h>, <inttypes.h>, <sys_socket.h>

The System Interfaces volume of POSIX.1‐2017, connect(), getsockopt(), htonl(), sendmsg(), sendto(), setsockopt()

## COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html .

Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html .


title: netinet_tcp.h(7p)

text:
# netinet_tcp.h(7p)

## PROLOG
This manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (consult the corresponding Linux manual page for details of Linux behavior), or the interface may not be implemented on Linux.

## NAME
netinet/tcp.h — definitions for the Internet Transmission Control Protocol (TCP)

## SYNOPSIS

```
#include <netinet/tcp.h>
```

## DESCRIPTION
The <netinet/tcp.h> header shall define the following symbolic constant for use as a socket option at the IPPROTO_TCP level:

TCP_NODELAY

Avoid coalescing of small segments.

The implementation need not allow the value of the option to be set via setsockopt() or retrieved via getsockopt().

The following sections are informative.

## APPLICATION USAGE
None.

## RATIONALE
None.

## FUTURE DIRECTIONS
None.

## SEE ALSO
<sys_socket.h>

The System Interfaces volume of POSIX.1‐2017, getsockopt(), setsockopt()

## COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html .

Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html .


title: nl_types.h(7p)

text:
# nl_types.h(7p)

## PROLOG
This manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (consult the corresponding Linux manual page for details of Linux behavior), or the interface may not be implemented on Linux.

## NAME
nl_types.h — data types

## SYNOPSIS

```
#include <nl_types.h>
```

## DESCRIPTION
The <nl_types.h> header shall define at least the following types:

nl_catd

Used by the message catalog functions catopen(), catgets(), and catclose() to identify a catalog descriptor.

nl_item

Used by nl_langinfo() to identify items of langinfo data. Values of objects of type nl_item are defined in <langinfo.h>.

The <nl_types.h> header shall define at least the following symbolic constants:

NL_SETD

Used by gencat when no $set directive is specified in a message text source file. This constant can be passed as the value of set_id on subsequent calls to catgets() (that is, to retrieve messages from the default message set). The value of NL_SETD is implementation-defined.

NL_CAT_LOCALE

Value that must be passed as the oflag argument to catopen() to ensure that message catalog selection depends on the LC_MESSAGES locale category, rather than directly on the LANG environment variable.

The following shall be declared as functions and may also be defined as macros. Function prototypes shall be provided.

```
int       catclose(nl_catd);
char     *catgets(nl_catd, int, int, const char *);
nl_catd   catopen(const char *, int);
```

The following sections are informative.

## APPLICATION USAGE
None.

## RATIONALE
None.

## FUTURE DIRECTIONS
None.

## SEE ALSO
<langinfo.h>

The System Interfaces volume of POSIX.1‐2017, catclose(), catgets(), catopen(), nl_langinfo()

The Shell and Utilities volume of POSIX.1‐2017, gencat

## COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html .

Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html .


poll.h

title: poll.h(7p)

text:
# poll.h(7p)

## PROLOG
This manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (consult the corresponding Linux manual page for details of Linux behavior), or the interface may not be implemented on Linux.

## NAME
poll.h — definitions for the poll() function

## SYNOPSIS

```
#include <poll.h>
```

## DESCRIPTION
The <poll.h> header shall define the pollfd structure, which shall include at least the following members:

```
int    fd       The following descriptor being polled.
short  events   The input event flags (see below).
short  revents  The output event flags (see below).
```

The <poll.h> header shall define the following type through typedef:

nfds_t

An unsigned integer type used for the number of file descriptors.

The implementation shall support one or more programming environments in which the width of nfds_t is no greater than the width of type long. The names of these programming environments can be obtained using the confstr() function or the getconf utility.

The <poll.h> header shall define the following symbolic constants, zero or more of which may be OR'ed together to form the events or revents members in the pollfd structure:

POLLIN

Data other than high-priority data may be read without blocking.

POLLRDNORM

Normal data may be read without blocking.

POLLRDBAND

Priority data may be read without blocking.

POLLPRI

High priority data may be read without blocking.

POLLOUT

Normal data may be written without blocking.

POLLWRNORM

Equivalent to POLLOUT.

POLLWRBAND

Priority data may be written.

POLLERR

An error has occurred (revents only).

POLLHUP

Device has been disconnected (revents only).

POLLNVAL

Invalid fd member (revents only).

The significance and semantics of normal, priority, and high-priority data are file and device-specific.

The following shall be declared as a function and may also be defined as a macro. A function prototype shall be provided.

```
int   poll(struct pollfd [], nfds_t, int);
```

The following sections are informative.

## APPLICATION USAGE
None.

## RATIONALE
None.

## FUTURE DIRECTIONS
None.

## SEE ALSO
The System Interfaces volume of POSIX.1‐2017, confstr(), poll()

The Shell and Utilities volume of POSIX.1‐2017, getconf

## COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html .

Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html .


pthread.h

title: pthread.h(7p)

text:
# pthread.h(7p)

## PROLOG
This manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (consult the corresponding Linux manual page for details of Linux behavior), or the interface may not be implemented on Linux.

## NAME
pthread.h — threads

## SYNOPSIS

```
#include <pthread.h>
```

## DESCRIPTION
The <pthread.h> header shall define the following symbolic constants:

```
PTHREAD_BARRIER_SERIAL_THREAD
PTHREAD_CANCEL_ASYNCHRONOUS
PTHREAD_CANCEL_ENABLE
PTHREAD_CANCEL_DEFERRED
PTHREAD_CANCEL_DISABLE
PTHREAD_CANCELED
PTHREAD_CREATE_DETACHED
PTHREAD_CREATE_JOINABLE
PTHREAD_EXPLICIT_SCHED
PTHREAD_INHERIT_SCHED
PTHREAD_MUTEX_DEFAULT
PTHREAD_MUTEX_ERRORCHECK
PTHREAD_MUTEX_NORMAL
PTHREAD_MUTEX_RECURSIVE
PTHREAD_MUTEX_ROBUST
PTHREAD_MUTEX_STALLED
PTHREAD_ONCE_INIT
PTHREAD_PRIO_INHERIT
PTHREAD_PRIO_NONE
PTHREAD_PRIO_PROTECT
PTHREAD_PROCESS_SHARED
PTHREAD_PROCESS_PRIVATE
PTHREAD_SCOPE_PROCESS
PTHREAD_SCOPE_SYSTEM
```

The <pthread.h> header shall define the following compile-time constant expressions valid as initializers for the following types:

Name

Initializer for Type

PTHREAD_COND_INITIALIZER

pthread_cond_t

PTHREAD_MUTEX_INITIALIZER

pthread_mutex_t

PTHREAD_RWLOCK_INITIALIZER

pthread_rwlock_t

The <pthread.h> header shall define the pthread_attr_t, pthread_barrier_t, pthread_barrierattr_t, pthread_cond_t, pthread_condattr_t, pthread_key_t, pthread_mutex_t, pthread_mutexattr_t, pthread_once_t, pthread_rwlock_t, pthread_rwlockattr_t, pthread_spinlock_t, and pthread_t types as described in <sys/types.h>.

The following shall be declared as functions and may also be defined as macros. Function prototypes shall be provided.

```
int   pthread_atfork(void (*)(void), void (*)(void),

          void(*)(void));
int   pthread_attr_destroy(pthread_attr_t *);
int   pthread_attr_getdetachstate(const pthread_attr_t *, int *);
int   pthread_attr_getguardsize(const pthread_attr_t *restrict,

          size_t *restrict);
int   pthread_attr_getinheritsched(const pthread_attr_t *restrict,

          int *restrict);
int   pthread_attr_getschedparam(const pthread_attr_t *restrict,

          struct sched_param *restrict);
int   pthread_attr_getschedpolicy(const pthread_attr_t *restrict,

          int *restrict);
int   pthread_attr_getscope(const pthread_attr_t *restrict,

          int *restrict);
int   pthread_attr_getstack(const pthread_attr_t *restrict,

          void **restrict, size_t *restrict);
int   pthread_attr_getstacksize(const pthread_attr_t *restrict,

          size_t *restrict);
int   pthread_attr_init(pthread_attr_t *);
int   pthread_attr_setdetachstate(pthread_attr_t *, int);
int   pthread_attr_setguardsize(pthread_attr_t *, size_t);
int   pthread_attr_setinheritsched(pthread_attr_t *, int);
int   pthread_attr_setschedparam(pthread_attr_t *restrict,

          const struct sched_param *restrict);
int   pthread_attr_setschedpolicy(pthread_attr_t *, int);
int   pthread_attr_setscope(pthread_attr_t *, int);
int   pthread_attr_setstack(pthread_attr_t *, void *, size_t);
int   pthread_attr_setstacksize(pthread_attr_t *, size_t);
int   pthread_barrier_destroy(pthread_barrier_t *);
int   pthread_barrier_init(pthread_barrier_t *restrict,

          const pthread_barrierattr_t *restrict, unsigned);
int   pthread_barrier_wait(pthread_barrier_t *);
int   pthread_barrierattr_destroy(pthread_barrierattr_t *);
int   pthread_barrierattr_getpshared(

          const pthread_barrierattr_t *restrict, int *restrict);
int   pthread_barrierattr_init(pthread_barrierattr_t *);
int   pthread_barrierattr_setpshared(pthread_barrierattr_t *, int);
int   pthread_cancel(pthread_t);
int   pthread_cond_broadcast(pthread_cond_t *);
int   pthread_cond_destroy(pthread_cond_t *);
int   pthread_cond_init(pthread_cond_t *restrict,

          const pthread_condattr_t *restrict);
int   pthread_cond_signal(pthread_cond_t *);
int   pthread_cond_timedwait(pthread_cond_t *restrict,

          pthread_mutex_t *restrict, const struct timespec *restrict);
int   pthread_cond_wait(pthread_cond_t *restrict,

          pthread_mutex_t *restrict);
int   pthread_condattr_destroy(pthread_condattr_t *);
int   pthread_condattr_getclock(const pthread_condattr_t *restrict,

          clockid_t *restrict);
int   pthread_condattr_getpshared(const pthread_condattr_t *restrict,

          int *restrict);
int   pthread_condattr_init(pthread_condattr_t *);
int   pthread_condattr_setclock(pthread_condattr_t *, clockid_t);
int   pthread_condattr_setpshared(pthread_condattr_t *, int);
int   pthread_create(pthread_t *restrict, const pthread_attr_t *restrict,

          void *(*)(void*), void *restrict);
int   pthread_detach(pthread_t);
int   pthread_equal(pthread_t, pthread_t);
void  pthread_exit(void *);
int   pthread_getconcurrency(void);
int   pthread_getcpuclockid(pthread_t, clockid_t *);
int   pthread_getschedparam(pthread_t, int *restrict,

          struct sched_param *restrict);
void *pthread_getspecific(pthread_key_t);
int   pthread_join(pthread_t, void **);
int   pthread_key_create(pthread_key_t *, void (*)(void*));
int   pthread_key_delete(pthread_key_t);
int   pthread_mutex_consistent(pthread_mutex_t *);
int   pthread_mutex_destroy(pthread_mutex_t *);
int   pthread_mutex_getprioceiling(const pthread_mutex_t *restrict,

          int *restrict);
int   pthread_mutex_init(pthread_mutex_t *restrict,

          const pthread_mutexattr_t *restrict);
int   pthread_mutex_lock(pthread_mutex_t *);
int   pthread_mutex_setprioceiling(pthread_mutex_t *restrict, int,

          int *restrict);
int   pthread_mutex_timedlock(pthread_mutex_t *restrict,

          const struct timespec *restrict);
int   pthread_mutex_trylock(pthread_mutex_t *);
int   pthread_mutex_unlock(pthread_mutex_t *);
int   pthread_mutexattr_destroy(pthread_mutexattr_t *);
int   pthread_mutexattr_getprioceiling(

          const pthread_mutexattr_t *restrict, int *restrict);
int   pthread_mutexattr_getprotocol(const pthread_mutexattr_t *restrict,

          int *restrict);
int   pthread_mutexattr_getpshared(const pthread_mutexattr_t *restrict,

          int *restrict);
int   pthread_mutexattr_getrobust(const pthread_mutexattr_t *restrict,

          int *restrict);
int   pthread_mutexattr_gettype(const pthread_mutexattr_t *restrict,

          int *restrict);
int   pthread_mutexattr_init(pthread_mutexattr_t *);
int   pthread_mutexattr_setprioceiling(pthread_mutexattr_t *, int);
int   pthread_mutexattr_setprotocol(pthread_mutexattr_t *, int);
int   pthread_mutexattr_setpshared(pthread_mutexattr_t *, int);
int   pthread_mutexattr_setrobust(pthread_mutexattr_t *, int);
int   pthread_mutexattr_settype(pthread_mutexattr_t *, int);
int   pthread_once(pthread_once_t *, void (*)(void));
int   pthread_rwlock_destroy(pthread_rwlock_t *);
int   pthread_rwlock_init(pthread_rwlock_t *restrict,

          const pthread_rwlockattr_t *restrict);
int   pthread_rwlock_rdlock(pthread_rwlock_t *);
int   pthread_rwlock_timedrdlock(pthread_rwlock_t *restrict,

          const struct timespec *restrict);
int   pthread_rwlock_timedwrlock(pthread_rwlock_t *restrict,

          const struct timespec *restrict);
int   pthread_rwlock_tryrdlock(pthread_rwlock_t *);
int   pthread_rwlock_trywrlock(pthread_rwlock_t *);
int   pthread_rwlock_unlock(pthread_rwlock_t *);
int   pthread_rwlock_wrlock(pthread_rwlock_t *);
int   pthread_rwlockattr_destroy(pthread_rwlockattr_t *);
int   pthread_rwlockattr_getpshared(

          const pthread_rwlockattr_t *restrict, int *restrict);
int   pthread_rwlockattr_init(pthread_rwlockattr_t *);
int   pthread_rwlockattr_setpshared(pthread_rwlockattr_t *, int);
pthread_t

      pthread_self(void);
int   pthread_setcancelstate(int, int *);
int   pthread_setcanceltype(int, int *);
int   pthread_setconcurrency(int);
int   pthread_setschedparam(pthread_t, int,

          const struct sched_param *);
int   pthread_setschedprio(pthread_t, int);
int   pthread_setspecific(pthread_key_t, const void *);
int   pthread_spin_destroy(pthread_spinlock_t *);
int   pthread_spin_init(pthread_spinlock_t *, int);
int   pthread_spin_lock(pthread_spinlock_t *);
int   pthread_spin_trylock(pthread_spinlock_t *);
int   pthread_spin_unlock(pthread_spinlock_t *);
void  pthread_testcancel(void);
```

The following may be declared as functions, or defined as macros, or both. If functions are declared, function prototypes shall be provided.

pthread_cleanup_pop() pthread_cleanup_push()

Inclusion of the <pthread.h> header shall make symbols defined in the headers <sched.h> and <time.h> visible.

The following sections are informative.

## APPLICATION USAGE
None.

## RATIONALE
None.

## FUTURE DIRECTIONS
None.

## SEE ALSO
<sched.h>, <sys_types.h>, <time.h>

The System Interfaces volume of POSIX.1‐2017, pthread_atfork(), pthread_attr_destroy(), pthread_attr_getdetachstate(), pthread_attr_getguardsize(), pthread_attr_getinheritsched(), pthread_attr_getschedparam(), pthread_attr_getschedpolicy(), pthread_attr_getscope(), pthread_attr_getstack(), pthread_attr_getstacksize(), pthread_barrier_destroy(), pthread_barrier_wait(), pthread_barrierattr_destroy(), pthread_barrierattr_getpshared(), pthread_cancel(), pthread_cleanup_pop(), pthread_cond_broadcast(), pthread_cond_destroy(), pthread_cond_timedwait(), pthread_condattr_destroy(), pthread_condattr_getclock(), pthread_condattr_getpshared(), pthread_create(), pthread_detach(), pthread_equal(), pthread_exit(), pthread_getconcurrency(), pthread_getcpuclockid(), pthread_getschedparam(), pthread_getspecific(), pthread_join(), pthread_key_create(), pthread_key_delete(), pthread_mutex_consistent(), pthread_mutex_destroy(), pthread_mutex_getprioceiling(), pthread_mutex_lock(), pthread_mutex_timedlock(), pthread_mutexattr_destroy(), pthread_mutexattr_getprioceiling(), pthread_mutexattr_getprotocol(), pthread_mutexattr_getpshared(), pthread_mutexattr_getrobust(), pthread_mutexattr_gettype(), pthread_once(), pthread_rwlock_destroy(), pthread_rwlock_rdlock(), pthread_rwlock_timedrdlock(), pthread_rwlock_timedwrlock(), pthread_rwlock_trywrlock(), pthread_rwlock_unlock(), pthread_rwlockattr_destroy(), pthread_rwlockattr_getpshared(), pthread_self(), pthread_setcancelstate(), pthread_setschedprio(), pthread_spin_destroy(), pthread_spin_lock(), pthread_spin_unlock()

## COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html .

Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html .


pwd.h

title: pwd.h(7p)

text:
# pwd.h(7p)

## PROLOG
This manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (consult the corresponding Linux manual page for details of Linux behavior), or the interface may not be implemented on Linux.

## NAME
pwd.h — password structure

## SYNOPSIS

```
#include <pwd.h>
```

## DESCRIPTION
The <pwd.h> header shall define the struct passwd, structure, which shall include at least the following members:

```
char    *pw_name   User's login name.
uid_t    pw_uid    Numerical user ID.
gid_t    pw_gid    Numerical group ID.
char    *pw_dir    Initial working directory.
char    *pw_shell  Program to use as shell.
```

The <pwd.h> header shall define the gid_t, uid_t, and size_t types as described in <sys/types.h>.

The following shall be declared as functions and may also be defined as macros. Function prototypes shall be provided.

```
void           endpwent(void);
struct passwd *getpwent(void);
struct passwd *getpwnam(const char *);
int            getpwnam_r(const char *, struct passwd *, char *,

                   size_t, struct passwd **);
struct passwd *getpwuid(uid_t);
int            getpwuid_r(uid_t, struct passwd *, char *,

                   size_t, struct passwd **);
void           setpwent(void);
```

The following sections are informative.

## APPLICATION USAGE
None.

## RATIONALE
None.

## FUTURE DIRECTIONS
None.

## SEE ALSO
<sys_types.h>

The System Interfaces volume of POSIX.1‐2017, endpwent(), getpwnam(), getpwuid()

## COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html .

Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html .


regex.h

title: regex.h(7p)

text:
# regex.h(7p)

## PROLOG
This manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (consult the corresponding Linux manual page for details of Linux behavior), or the interface may not be implemented on Linux.

## NAME
regex.h — regular expression matching types

## SYNOPSIS

```
#include <regex.h>
```

## DESCRIPTION
The <regex.h> header shall define the structures and symbolic constants used by the regcomp(), regexec(), regerror(), and regfree() functions.

The <regex.h> header shall define the regex_t structure type, which shall include at least the following member:

```
size_t    re_nsub    Number of parenthesized subexpressions.
```

The <regex.h> header shall define the size_t type as described in <sys/types.h>.

The <regex.h> header shall define the regoff_t type as a signed integer type that can hold the largest value that can be stored in either a ptrdiff_t type or a ssize_t type.

The <regex.h> header shall define the regmatch_t structure type, which shall include at least the following members:

```
regoff_t    rm_so    Byte offset from start of string

                     to start of substring.
regoff_t    rm_eo    Byte offset from start of string of the

                     first character after the end of substring.
```

The <regex.h> header shall define the following symbolic constants for the cflags parameter to the regcomp() function:

REG_EXTENDED

Use Extended Regular Expressions.

REG_ICASE

Ignore case in match.

REG_NOSUB

Report only success or fail in regexec().

REG_NEWLINE

Change the handling of <newline>.

The <regex.h> header shall define the following symbolic constants for the eflags parameter to the regexec() function:

REG_NOTBOL

The <circumflex> character ('^'), when taken as a special character, does not match the beginning of string.

REG_NOTEOL

The <dollar-sign> ('$'), when taken as a special character, does not match the end of string.

The <regex.h> header shall define the following symbolic constants as error return values:

REG_NOMATCH

regexec() failed to match.

REG_BADPAT

Invalid regular expression.

REG_ECOLLATE

Invalid collating element referenced.

REG_ECTYPE

Invalid character class type referenced.

REG_EESCAPE

Trailing <backslash> character in pattern.

REG_ESUBREG

Number in \digit invalid or in error.

REG_EBRACK

"[]" imbalance.

REG_EPAREN

"\(\)" or "()" imbalance.

REG_EBRACE

"\{\}" imbalance.

REG_BADBR

Content of "\{\}" invalid: not a number, number too large, more than two numbers, first larger than second.

REG_ERANGE

Invalid endpoint in range expression.

REG_ESPACE

Out of memory.

REG_BADRPT

'?', '*', or '+' not preceded by valid regular expression.

The following shall be declared as functions and may also be defined as macros. Function prototypes shall be provided.

```
int    regcomp(regex_t *restrict, const char *restrict, int);
size_t regerror(int, const regex_t *restrict, char *restrict, size_t);
int    regexec(const regex_t *restrict, const char *restrict, size_t,

           regmatch_t [restrict], int);
void   regfree(regex_t *);
```

The implementation may define additional macros or constants using names beginning with REG_.

The following sections are informative.

## APPLICATION USAGE
None.

## RATIONALE
None.

## FUTURE DIRECTIONS
None.

## SEE ALSO
<sys_types.h>

The System Interfaces volume of POSIX.1‐2017, regcomp()

## COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html .

Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html .


sched.h

title: sched.h(7p)

text:
# sched.h(7p)

## PROLOG
This manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (consult the corresponding Linux manual page for details of Linux behavior), or the interface may not be implemented on Linux.

## NAME
sched.h — execution scheduling

## SYNOPSIS

```
#include <sched.h>
```

## DESCRIPTION
The <sched.h> header shall define the pid_t type as described in <sys/types.h>.

The <sched.h> header shall define the time_t type as described in <sys/types.h>.

The <sched.h> header shall define the timespec structure as described in <time.h>.

The <sched.h> header shall define the sched_param structure, which shall include the scheduling parameters required for implementation of each supported scheduling policy. This structure shall include at least the following member:

```
int       sched_priority        Process or thread execution scheduling priority.
```

The sched_param structure defined in <sched.h> shall include the following members in addition to those specified above:

```
int             sched_ss_low_priority Low scheduling priority for

                                      sporadic server.
struct timespec sched_ss_repl_period  Replenishment period for

                                      sporadic server.
struct timespec sched_ss_init_budget  Initial budget for sporadic server.
int             sched_ss_max_repl     Maximum pending replenishments for

                                      sporadic server.
```

Each process or thread is controlled by an associated scheduling policy and priority. Associated with each policy is a priority range. Each policy definition specifies the minimum priority range for that policy. The priority ranges for each policy may overlap the priority ranges of other policies.

Four scheduling policies are defined; others may be defined by the implementation. The four standard policies are indicated by the values of the following symbolic constants:

SCHED_FIFO

First in-first out (FIFO) scheduling policy.

SCHED_RR

Round robin scheduling policy.

SCHED_SPORADIC

Sporadic server scheduling policy.

SCHED_OTHER

Another scheduling policy.

The values of these constants are distinct.

The following shall be declared as functions and may also be defined as macros. Function prototypes shall be provided.

```
int    sched_get_priority_max(int);
int    sched_get_priority_min(int);
int    sched_getparam(pid_t, struct sched_param *);
int    sched_getscheduler(pid_t);
int    sched_rr_get_interval(pid_t, struct timespec *);
int    sched_setparam(pid_t, const struct sched_param *);
int    sched_setscheduler(pid_t, int, const struct sched_param *);
int    sched_yield(void);
```

Inclusion of the <sched.h> header may make visible all symbols from the <time.h> header.

The following sections are informative.

## APPLICATION USAGE
None.

## RATIONALE
None.

## FUTURE DIRECTIONS
None.

## SEE ALSO
<sys_types.h>, <time.h>

The System Interfaces volume of POSIX.1‐2017, sched_get_priority_max(), sched_getparam(), sched_getscheduler(), sched_rr_get_interval(), sched_setparam(), sched_setscheduler(), sched_yield()

## COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html .

Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html .


search.h

title: search.h(7p)

text:
# search.h(7p)

## PROLOG
This manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (consult the corresponding Linux manual page for details of Linux behavior), or the interface may not be implemented on Linux.

## NAME
search.h — search tables

## SYNOPSIS

```
#include <search.h>
```

## DESCRIPTION
The <search.h> header shall define the ENTRY type for structure entry which shall include the following members:

```
char    *key
void    *data
```

and shall define ACTION and VISIT as enumeration data types through type definitions as follows:

```
enum { FIND, ENTER } ACTION;
enum { preorder, postorder, endorder, leaf } VISIT;
```

The <search.h> header shall define the size_t type as described in <sys/types.h>.

The following shall be declared as functions and may also be defined as macros. Function prototypes shall be provided.

```
int    hcreate(size_t);
void   hdestroy(void);
ENTRY *hsearch(ENTRY, ACTION);
void   insque(void *, void *);
void  *lfind(const void *, const void *, size_t *,

          size_t, int (*)(const void *, const void *));
void  *lsearch(const void *, void *, size_t *,

          size_t, int (*)(const void *, const void *));
void   remque(void *);
void  *tdelete(const void *restrict, void **restrict,

          int(*)(const void *, const void *));
void  *tfind(const void *, void *const *,

          int(*)(const void *, const void *));
void  *tsearch(const void *, void **,

          int(*)(const void *, const void *));
void   twalk(const void *,

          void (*)(const void *, VISIT, int ));
```

The following sections are informative.

## APPLICATION USAGE
None.

## RATIONALE
None.

## FUTURE DIRECTIONS
None.

## SEE ALSO
<sys_types.h>

The System Interfaces volume of POSIX.1‐2017, hcreate(), insque(), lsearch(), tdelete()

## COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html .

Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html .


semaphore.h

title: semaphore.h(7p)

text:
# semaphore.h(7p)

## PROLOG
This manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (consult the corresponding Linux manual page for details of Linux behavior), or the interface may not be implemented on Linux.

## NAME
semaphore.h — semaphores

## SYNOPSIS

```
#include <semaphore.h>
```

## DESCRIPTION
The <semaphore.h> header shall define the sem_t type, used in performing semaphore operations. The semaphore may be implemented using a file descriptor, in which case applications are able to open up at least a total of {OPEN_MAX} files and semaphores.

The <semaphore.h> header shall define the symbolic constant SEM_FAILED which shall have type sem_t *.

The following shall be declared as functions and may also be defined as macros. Function prototypes shall be provided.

```
int    sem_close(sem_t *);
int    sem_destroy(sem_t *);
int    sem_getvalue(sem_t *restrict, int *restrict);
int    sem_init(sem_t *, int, unsigned);
sem_t *sem_open(const char *, int, ...);
int    sem_post(sem_t *);
int    sem_timedwait(sem_t *restrict, const struct timespec *restrict);
int    sem_trywait(sem_t *);
int    sem_unlink(const char *);
int    sem_wait(sem_t *);
```

Inclusion of the <semaphore.h> header may make visible symbols defined in the <fcntl.h> and <time.h> headers.

The following sections are informative.

## APPLICATION USAGE
None.

## RATIONALE
None.

## FUTURE DIRECTIONS
None.

## SEE ALSO
<fcntl.h>, <sys_types.h>, <time.h>

The System Interfaces volume of POSIX.1‐2017, sem_close(), sem_destroy(), sem_getvalue(), sem_init(), sem_open(), sem_post(), sem_timedwait(), sem_trywait(), sem_unlink()

## COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html .

Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html .


setjmp.h

title: setjmp.h(7p)

text:
# setjmp.h(7p)

## PROLOG
This manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (consult the corresponding Linux manual page for details of Linux behavior), or the interface may not be implemented on Linux.

## NAME
setjmp.h — stack environment declarations

## SYNOPSIS

```
#include <setjmp.h>
```

## DESCRIPTION
Some of the functionality described on this reference page extends the ISO C standard. Applications shall define the appropriate feature test macro (see the System Interfaces volume of POSIX.1‐2017, Section 2.2, The Compilation Environment) to enable the visibility of these symbols in this header.

The <setjmp.h> header shall define the array types jmp_buf and sigjmp_buf.

The following shall be declared as functions and may also be defined as macros. Function prototypes shall be provided.

```
void   _longjmp(jmp_buf, int);
void   longjmp(jmp_buf, int);
void   siglongjmp(sigjmp_buf, int);
```

The following may be declared as functions, or defined as macros, or both. If functions are declared, function prototypes shall be provided.

```
int    _setjmp(jmp_buf);
int    setjmp(jmp_buf);
int    sigsetjmp(sigjmp_buf, int);
```

The following sections are informative.

## APPLICATION USAGE
None.

## RATIONALE
None.

## FUTURE DIRECTIONS
None.

## SEE ALSO
The System Interfaces volume of POSIX.1‐2017, Section 2.2, The Compilation Environment, _longjmp(), longjmp(), setjmp(), siglongjmp(), sigsetjmp()

## COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html .

Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html .


signal.h

title: signal.h(7p)

text:
# signal.h(7p)

## PROLOG
This manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (consult the corresponding Linux manual page for details of Linux behavior), or the interface may not be implemented on Linux.

## NAME
signal.h — signals

## SYNOPSIS

```
#include <signal.h>
```

## DESCRIPTION
Some of the functionality described on this reference page extends the ISO C standard. Applications shall define the appropriate feature test macro (see the System Interfaces volume of POSIX.1‐2017, Section 2.2, The Compilation Environment) to enable the visibility of these symbols in this header.

The <signal.h> header shall define the following macros, which shall expand to constant expressions with distinct values that have a type compatible with the second argument to, and the return value of, the signal() function, and whose values shall compare unequal to the address of any declarable function.

SIG_DFL

Request for default signal handling.

SIG_ERR

Return value from signal() in case of error.

SIG_HOLD

Request that signal be held.

SIG_IGN

Request that signal be ignored.

The <signal.h> header shall define the pthread_t, size_t, and uid_t types as described in <sys/types.h>.

The <signal.h> header shall define the timespec structure as described in <time.h>.

The <signal.h> header shall define the following data types:

sig_atomic_t

Possibly volatile-qualified integer type of an object that can be accessed as an atomic entity, even in the presence of asynchronous interrupts.

sigset_t

Integer or structure type of an object used to represent sets of signals.

pid_t

As described in <sys/types.h>.

The <signal.h> header shall define the pthread_attr_t type as described in <sys/types.h>.

The <signal.h> header shall define the sigevent structure, which shall include at least the following members:

```
int              sigev_notify            Notification type.
int              sigev_signo             Signal number.
union sigval     sigev_value             Signal value.
void           (*sigev_notify_function)(union sigval)

                                         Notification function.
pthread_attr_t *sigev_notify_attributes  Notification attributes.
```

The <signal.h> header shall define the following symbolic constants for the values of sigev_notify:

SIGEV_NONE

No asynchronous notification is delivered when the event of interest occurs.

SIGEV_SIGNAL

A queued signal, with an application-defined value, is generated when the event of interest occurs.

SIGEV_THREAD

A notification function is called to perform notification.

The sigval union shall be defined as:

```
int    sival_int    Integer signal value.
void  *sival_ptr    Pointer signal value.
```

The <signal.h> header shall declare the SIGRTMIN and SIGRTMAX macros, which shall expand to positive integer expressions with type int, but which need not be constant expressions. These macros specify a range of signal numbers that are reserved for application use and for which the realtime signal behavior specified in this volume of POSIX.1‐2017 is supported. The signal numbers in this range do not overlap any of the signals specified in the following table.

The range SIGRTMIN through SIGRTMAX inclusive shall include at least {RTSIG_MAX} signal numbers.

It is implementation-defined whether realtime signal behavior is supported for other signals.

The <signal.h> header shall define the following macros that are used to refer to the signals that occur in the system. Signals defined here begin with the letters SIG followed by an uppercase letter. The macros shall expand to positive integer constant expressions with type int and distinct values. The value 0 is reserved for use as the null signal (see kill()). Additional implementation-defined signals may occur in the system.

The ISO C standard only requires the signal names SIGABRT, SIGFPE, SIGILL, SIGINT, SIGSEGV, and SIGTERM to be defined. An implementation need not generate any of these six signals, except as a result of explicit use of interfaces that generate signals, such as raise(), kill(), the General Terminal Interface (see Section 11.1.9, Special Characters), and the kill utility, unless otherwise stated (see, for example, the System Interfaces volume of POSIX.1‐2017, Section 2.8.3.3, Memory Protection).

The following signals shall be supported on all implementations (default actions are explained below the table):

Signal

Default Action

Description

SIGABRT

A

Process abort signal.

SIGALRM

T

Alarm clock.

SIGBUS

A

Access to an undefined portion of a memory object.

SIGCHLD

I

Child process terminated, stopped,

or continued.

SIGCONT

C

Continue executing, if stopped.

SIGFPE

A

Erroneous arithmetic operation.

SIGHUP

T

Hangup.

SIGILL

A

Illegal instruction.

SIGINT

T

Terminal interrupt signal.

SIGKILL

T

Kill (cannot be caught or ignored).

SIGPIPE

T

Write on a pipe with no one to read it.

SIGQUIT

A

Terminal quit signal.

SIGSEGV

A

Invalid memory reference.

SIGSTOP

S

Stop executing (cannot be caught or ignored).

SIGTERM

T

Termination signal.

SIGTSTP

S

Terminal stop signal.

SIGTTIN

S

Background process attempting read.

SIGTTOU

S

Background process attempting write.

SIGUSR1

T

User-defined signal 1.

SIGUSR2

T

User-defined signal 2.

SIGPOLL

T

Pollable event.

SIGPROF

T

Profiling timer expired.

SIGSYS

A

Bad system call.

SIGTRAP

A

Trace/breakpoint trap.

SIGURG

I

High bandwidth data is available at a socket.

SIGVTALRM

T

Virtual timer expired.

SIGXCPU

A

CPU time limit exceeded.

SIGXFSZ

A

File size limit exceeded.

The default actions are as follows:

T

Abnormal termination of the process.

A

Abnormal termination of the process with additional actions.

I

Ignore the signal.

S

Stop the process.

C

Continue the process, if it is stopped; otherwise, ignore the signal.

The effects on the process in each case are described in the System Interfaces volume of POSIX.1‐2017, Section 2.4.3, Signal Actions.

The <signal.h> header shall declare the sigaction structure, which shall include at least the following members:

```
void   (*sa_handler)(int)  Pointer to a signal-catching function

                           or one of the SIG_IGN or SIG_DFL.
sigset_t sa_mask           Set of signals to be blocked during execution

                           of the signal handling function.
int      sa_flags          Special flags.
void   (*sa_sigaction)(int, siginfo_t *, void *)

                           Pointer to a signal-catching function.
```

The storage occupied by sa_handler and sa_sigaction may overlap, and a conforming application shall not use both simultaneously.

The <signal.h> header shall define the following macros which shall expand to integer constant expressions that need not be usable in #if preprocessing directives:

SIG_BLOCK

The resulting set is the union of the current set and the signal set pointed to by the argument set.

SIG_UNBLOCK

The resulting set is the intersection of the current set and the complement of the signal set pointed to by the argument set.

SIG_SETMASK

The resulting set is the signal set pointed to by the argument set.

The <signal.h> header shall also define the following symbolic constants:

SA_NOCLDSTOP

Do not generate SIGCHLD when children stop

or stopped children continue.

SA_ONSTACK

Causes signal delivery to occur on an alternate stack.

SA_RESETHAND

Causes signal dispositions to be set to SIG_DFL on entry to signal handlers.

SA_RESTART

Causes certain functions to become restartable.

SA_SIGINFO

Causes extra information to be passed to signal handlers at the time of receipt of a signal.

SA_NOCLDWAIT

Causes implementations not to create zombie processes or status information on child termination. See sigaction().

SA_NODEFER

Causes signal not to be automatically blocked on entry to signal handler.

SS_ONSTACK

Process is executing on an alternate signal stack.

SS_DISABLE

Alternate signal stack is disabled.

MINSIGSTKSZ

Minimum stack size for a signal handler.

SIGSTKSZ

Default size in bytes for the alternate signal stack.

The <signal.h> header shall define the mcontext_t type through typedef.

The <signal.h> header shall define the ucontext_t type as a structure that shall include at least the following members:

```
ucontext_t *uc_link     Pointer to the context that is resumed

                        when this context returns.
sigset_t    uc_sigmask  The set of signals that are blocked when this

                        context is active.
stack_t     uc_stack    The stack used by this context.
mcontext_t  uc_mcontext A machine-specific representation of the saved

                        context.
```

The <signal.h> header shall define the stack_t type as a structure, which shall include at least the following members:

```
void     *ss_sp       Stack base or pointer.
size_t    ss_size     Stack size.
int       ss_flags    Flags.
```

The <signal.h> header shall define the siginfo_t type as a structure, which shall include at least the following members:

```
int           si_signo  Signal number.
int           si_code   Signal code.
int           si_errno  If non-zero, an errno value associated with

                        this signal, as described in <errno.h>.
pid_t         si_pid    Sending process ID.
uid_t         si_uid    Real user ID of sending process.
void         *si_addr   Address of faulting instruction.
int           si_status Exit value or signal.
long          si_band   Band event for SIGPOLL.
union sigval  si_value  Signal value.
```

The <signal.h> header shall define the symbolic constants in the Code column of the following table for use as values of si_code that are signal-specific or non-signal-specific reasons why the signal was generated.

Signal

Code

Reason

SIGILL

ILL_ILLOPC

Illegal opcode.

ILL_ILLOPN

Illegal operand.

ILL_ILLADR

Illegal addressing mode.

ILL_ILLTRP

Illegal trap.

ILL_PRVOPC

Privileged opcode.

ILL_PRVREG

Privileged register.

ILL_COPROC

Coprocessor error.

ILL_BADSTK

Internal stack error.

SIGFPE

FPE_INTDIV

Integer divide by zero.

FPE_INTOVF

Integer overflow.

FPE_FLTDIV

Floating-point divide by zero.

FPE_FLTOVF

Floating-point overflow.

FPE_FLTUND

Floating-point underflow.

FPE_FLTRES

Floating-point inexact result.

FPE_FLTINV

Invalid floating-point operation.

FPE_FLTSUB

Subscript out of range.

SIGSEGV

SEGV_MAPERR

Address not mapped to object.

SEGV_ACCERR

Invalid permissions for mapped object.

SIGBUS

BUS_ADRALN

Invalid address alignment.

BUS_ADRERR

Nonexistent physical address.

BUS_OBJERR

Object-specific hardware error.

SIGTRAP

TRAP_BRKPT

Process breakpoint.

TRAP_TRACE

Process trace trap.

SIGCHLD

CLD_EXITED

Child has exited.

CLD_KILLED

Child has terminated abnormally and did not create a core file.

CLD_DUMPED

Child has terminated abnormally and created a core file.

CLD_TRAPPED

Traced child has trapped.

CLD_STOPPED

Child has stopped.

CLD_CONTINUED

Stopped child has continued.

SIGPOLL

POLL_IN

Data input available.

POLL_OUT

Output buffers available.

POLL_MSG

Input message available.

POLL_ERR

I/O error.

POLL_PRI

High priority input available.

POLL_HUP

Device disconnected.

Any

SI_USER

Signal sent by kill().

SI_QUEUE

Signal sent by sigqueue().

SI_TIMER

Signal generated by expiration of a timer set by timer_settime().

SI_ASYNCIO

Signal generated by completion of an asynchronous I/O

request.

SI_MESGQ

Signal generated by arrival of a message on an empty message

queue.

Implementations may support additional si_code values not included in this list, may generate values included in this list under circumstances other than those described in this list, and may contain extensions or limitations that prevent some values from being generated. Implementations do not generate a different value from the ones described in this list for circumstances described in this list.

In addition, the following signal-specific information shall be available:

Signal

Member

Value

SIGILL

void * si_addr

Address of faulting instruction.

SIGFPE

SIGSEGV

void * si_addr

Address of faulting memory reference.

SIGBUS

SIGCHLD

pid_t si_pid

Child process ID.

int si_status

If si_code is equal to CLD_EXITED, then si_status holds the exit value of the process; otherwise, it is equal to the signal that caused the process to change state. The exit value in si_status shall be equal to the full exit value (that is, the value passed to _exit(), _Exit(), or exit(), or returned from main()); it shall not be limited to the least significant eight bits of the value.

uid_t si_uid

Real user ID of the process that sent the signal.

SIGPOLL

long si_band

Band event for POLL_IN, POLL_OUT, or POLL_MSG.

For some implementations, the value of si_addr may be inaccurate.

The following shall be declared as functions and may also be defined as macros. Function prototypes shall be provided.

```
int    kill(pid_t, int);
int    killpg(pid_t, int);
void   psiginfo(const siginfo_t *, const char *);
void   psignal(int, const char *);
int    pthread_kill(pthread_t, int);
int    pthread_sigmask(int, const sigset_t *restrict,

           sigset_t *restrict);
int    raise(int);
int    sigaction(int, const struct sigaction *restrict,

           struct sigaction *restrict);
int    sigaddset(sigset_t *, int);
int    sigaltstack(const stack_t *restrict, stack_t *restrict);
int    sigdelset(sigset_t *, int);
int    sigemptyset(sigset_t *);
int    sigfillset(sigset_t *);
int    sighold(int);
int    sigignore(int);
int    siginterrupt(int, int);
int    sigismember(const sigset_t *, int);
void (*signal(int, void (*)(int)))(int);
int    sigpause(int);
int    sigpending(sigset_t *);
int    sigprocmask(int, const sigset_t *restrict, sigset_t *restrict);
int    sigqueue(pid_t, int, union sigval);
int    sigrelse(int);
void (*sigset(int, void (*)(int)))(int);
int    sigsuspend(const sigset_t *);
int    sigtimedwait(const sigset_t *restrict, siginfo_t *restrict,

           const struct timespec *restrict);
int    sigwait(const sigset_t *restrict, int *restrict);
int    sigwaitinfo(const sigset_t *restrict, siginfo_t *restrict);
```

Inclusion of the <signal.h> header may make visible all symbols from the <time.h> header.

The following sections are informative.

## APPLICATION USAGE
On systems not supporting the XSI option, the si_pid and si_uid members of siginfo_t are only required to be valid when si_code is SI_USER or SI_QUEUE. On XSI-conforming systems, they are also valid for all si_code values less than or equal to 0; however, it is unspecified whether SI_USER and SI_QUEUE have values less than or equal to zero, and therefore XSI applications should check whether si_code has the value SI_USER or SI_QUEUE or is less than or equal to 0 to tell whether si_pid and si_uid are valid.

## RATIONALE
None.

## FUTURE DIRECTIONS
The SIGPOLL and SIGPROF signals may be removed in a future version.

## SEE ALSO
<errno.h>, <stropts.h>, <sys_types.h>, <time.h>

The System Interfaces volume of POSIX.1‐2017, Section 2.2, The Compilation Environment, alarm(), ioctl(), kill(), killpg(), psiginfo(), pthread_kill(), pthread_sigmask(), raise(), sigaction(), sigaddset(), sigaltstack(), sigdelset(), sigemptyset(), sigfillset(), sighold(), siginterrupt(), sigismember(), signal(), sigpending(), sigqueue(), sigsuspend(), sigtimedwait(), sigwait(), timer_create(), wait(), waitid()

The Shell and Utilities volume of POSIX.1‐2017, kill

## COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html .

Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html .