GNU Gnulib

Next: , Up: (dir)   [Contents][Index]

GNU Gnulib

This manual is for GNU Gnulib (updated 2024-01-18 11:42:33), which is a library of common routines intended to be shared at the source level.

Copyright © 2004–2024 Free Software Foundation, Inc.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled “GNU Free Documentation License”.

Table of Contents


Next: , Previous: , Up: GNU Gnulib   [Contents][Index]

1 Brief Overview

Gnulib is a source code library that provides basic functionality to programs and libraries. Many software packages make use of Gnulib to avoid reinventing the portability wheel.

Resources:


1.1 Gnulib Basics

While portability across operating systems is not one of GNU’s primary goals, it has helped introduce many people to the GNU system, and is worthwhile when it can be achieved at a low cost. This collection helps lower that cost.

Gnulib is intended to be the canonical source for most of the important “portability” and/or common files for GNU projects. These are files intended to be shared at the source level; Gnulib is not a typical library meant to be installed and linked against. Thus, unlike most projects, Gnulib does not normally generate a source tarball distribution; instead, developers grab modules directly from the source repository.

The easiest, and recommended, way to do this is to use the gnulib-tool script. Since there is no installation procedure for Gnulib, gnulib-tool needs to be run directly in the directory that contains the Gnulib source code. You can do this either by specifying the absolute filename of gnulib-tool, or by using a symbolic link from a place inside your PATH to the gnulib-tool file of your preferred Gnulib checkout. For example:

$ ln -s $HOME/gnu/src/gnulib.git/gnulib-tool $HOME/bin/gnulib-tool

1.2 Git Checkout

Gnulib is available for anonymous checkout. In any Bourne-shell the following should work:

$ git clone https://git.savannah.gnu.org/git/gnulib.git

For a read-write checkout you need to have a login on ‘savannah.gnu.org’ and be a member of the Gnulib project at https://savannah.gnu.org/projects/gnulib. Then, instead of the URL https://git.savannah.gnu.org/git/gnulib.git, use the URL ‘ssh://user@git.savannah.gnu.org/srv/git/gnulib’ where user is your login name on savannah.gnu.org.

git resources:

Overview:

https://en.wikipedia.org/wiki/Git_(software)

Homepage:

https://git-scm.com/

When you use git annotate or git blame with Gnulib, it’s recommended that you use the -w option, in order to ignore massive whitespace changes that happened in 2009.


1.3 Keeping Up-to-date

The best way to work with Gnulib is to check it out of git. To synchronize, you can use git pull.

Subscribing to the bug-gnulib@gnu.org mailing list will help you to plan when to update your local copy of Gnulib (which you use to maintain your software) from git. You can review the archives, subscribe, etc., via https://lists.gnu.org/mailman/listinfo/bug-gnulib.

Sometimes, using an updated version of Gnulib will require you to use newer versions of GNU Automake or Autoconf. You may find it helpful to join the autotools-announce mailing list to be advised of such changes.


1.4 Contributing to Gnulib

All software here is copyrighted by the Free Software Foundation—you need to have filled out an assignment form for a project that uses the module for that contribution to be accepted here.

If you have a piece of code that you would like to contribute, please email bug-gnulib@gnu.org.

Generally we are looking for files that fulfill at least one of the following requirements:

  • If your .c and .h files define functions that are broken or missing on some other system, we should be able to include it.
  • If your functions remove arbitrary limits from existing functions (either under the same name, or as a slightly different name), we should be able to include it.

If your functions define completely new but rarely used functionality, you should probably consider packaging it as a separate library.


1.4.1 Gnulib licensing

Gnulib contains code both under GPL and LGPL. Because several packages that use Gnulib are GPL, the files state they are licensed under GPL. However, to support LGPL projects as well, you may use some of the files under LGPL. The “License:” information in the files under modules/ clarifies the real license that applies to the module source.

Keep in mind that if you submit patches to files in Gnulib, you should license them under a compatible license, which means that sometimes the contribution will have to be LGPL, if the original file is available under LGPL via a “License: LGPL” information in the projects’ modules/ file.


1.4.2 Indent with spaces not TABs

We use space-only indentation in nearly all files. This includes all *.h, *.c, *.y files, except for the regex module. Makefile and ChangeLog files are excluded, since TAB characters are part of their format.

In order to tell your editor to produce space-only indentation, you can use these instructions.

  • For Emacs: Add these lines to your Emacs initialization file ($HOME/.emacs or similar):
    ;; In Gnulib, indent with spaces everywhere (not TABs).
    ;; Exceptions: Makefile and ChangeLog modes.
    (add-hook 'find-file-hook '(lambda ()
      (if (and buffer-file-name
               (string-match "/gnulib\\>" (buffer-file-name))
               (not (string-equal mode-name "Change Log"))
               (not (string-equal mode-name "Makefile")))
          (setq indent-tabs-mode nil))))
    
  • For vi (vim): Add these lines to your $HOME/.vimrc file:
    " Don't use tabs for indentation. Spaces are nicer to work with.
    set expandtab
    

    For Makefile and ChangeLog files, compensate for this by adding this to your $HOME/.vim/after/indent/make.vim file, and similarly for your $HOME/.vim/after/indent/changelog.vim file:

    " Use tabs for indentation, regardless of the global setting.
    set noexpandtab
    
  • For Eclipse: In the “Window|Preferences” dialog (or “Eclipse|Preferences” dialog on Mac OS),
    1. Under “General|Editors|Text Editors”, select the “Insert spaces for tabs” checkbox.
    2. Under “C/C++|Code Style”, select a code style profile that has the “Indentation|Tab policy” combobox set to “Spaces only”, such as the “GNU [built-in]” policy.

    If you use the GNU indent program, pass it the option --no-tabs.


1.4.3 How to add a new module

  • Add the header files and source files to lib/.
  • If the module needs configure-time checks, write an Autoconf macro for it in m4/module.m4. See m4/README for details.
  • Write a module description modules/module, based on modules/TEMPLATE.
  • If the module contributes a section to the end-user documentation, put this documentation in doc/module.texi and add it to the “Files” section of modules/module. Most modules don’t do this; they have only documentation for the programmer (= Gnulib user). Such documentation usually goes into the lib/ source files. It may also go into doc/; but don’t add it to the module description in this case.
  • Add the module to the list in MODULES.html.sh.

You can test that a module builds correctly with:

$ ./gnulib-tool --create-testdir --dir=/tmp/testdir module1 ... moduleN
$ cd /tmp/testdir
$ ./configure && make

Other things:

  • Check the license and copyright year of headers.
  • Check that the source code follows the GNU coding standards; see https://www.gnu.org/prep/standards.
  • Add source files to config/srclist* if they are identical to upstream and should be upgraded in Gnulib whenever the upstream source changes.
  • Include header files in source files to verify the function prototypes.
  • Make sure a replacement function doesn’t cause warnings or clashes on systems that have the function.
  • Autoconf functions can use ‘gl_*’ prefix. The ‘AC_*’ prefix is for autoconf internal functions.
  • Build files only if they are needed on a platform. Look at the alloca and fnmatch modules for how to achieve this. If for some reason you cannot do this, and you have a .c file that leads to an empty .o file on some platforms (through some big #if around all the code), then ensure that the compilation unit is not empty after preprocessing. One way to do this is to #include <stddef.h> or <stdio.h> before the big #if.

1.5 Portability guidelines

Gnulib code is intended to be portable to a wide variety of platforms, not just GNU platforms. Gnulib typically attempts to support a platform as long as it is still supported by its provider, even if the platform is not the latest version. See Target Platforms.

Many Gnulib modules exist so that applications need not worry about undesirable variability in implementations. For example, an application that uses the malloc module need not worry about malloc (0) returning a null pointer on some Standard C platforms; and glob users need not worry about glob silently omitting symbolic links to nonexistent files on some platforms that do not conform to POSIX.

Gnulib code is intended to port without problem to new hosts, e.g., hosts conforming to recent C and POSIX standards. Hence Gnulib code should avoid using constructs that these newer standards no longer require, without first testing for the presence of these constructs. For example, because C11 made variable length arrays optional, Gnulib code should avoid them unless it first uses the vararrays module to check whether they are supported.

The following subsections discuss some exceptions and caveats to the general Gnulib portability guidelines.


1.5.1 C language versions

Currently Gnulib assumes at least a freestanding C99 compiler, possibly operating with a C library that predates C99; with time this assumption will likely be strengthened to later versions of the C standard. Old platforms currently supported include AIX 6.1, HP-UX 11i v1 and Solaris 10, though these platforms are rarely tested. Gnulib itself is so old that it contains many fixes for obsolete platforms, fixes that may be removed in the future.

Because of the freestanding C99 assumption, Gnulib code can include <float.h>, <limits.h>, <stdarg.h>, <stddef.h>, and <stdint.h> unconditionally; <stdbool.h> is also in the C99 freestanding list but is obsolescent as of C23. Gnulib code can also assume the existence of <ctype.h>, <errno.h>, <fcntl.h>, <locale.h>, <signal.h>, <stdio.h>, <stdlib.h>, <string.h>, and <time.h>. Similarly, many modules include <sys/types.h> even though it’s not even in C11; that’s OK since <sys/types.h> has been around nearly forever.

Even if the include files exist, they may not conform to the C standard. However, GCC has a fixincludes script that attempts to fix most conformance problems. Gnulib currently assumes include files largely conform to C99 or better. People still using ancient hosts should use fixincludes or fix their include files manually.

Even if the include files conform, the library itself may not. For example, strtod and mktime have some bugs on some platforms. You can work around some of these problems by requiring the relevant modules, e.g., the Gnulib mktime module supplies a working and conforming mktime.


1.5.2 C99 features assumed by Gnulib

Although the C99 standard specifies many features, Gnulib code is conservative about using them, partly because Gnulib predates the widespread adoption of C99, and partly because many C99 features are not well-supported in practice. C99 features that are reasonably portable nowadays include:

  • A declaration after a statement, or as the first clause in a for statement.
  • long long int.
  • <stdbool.h>, although Gnulib code no longer uses it directly, preferring plain bool via the stdbool module instead. See stdbool.h.
  • <stdint.h>, assuming the stdint module is used. See stdint.h.
  • Compound literals and designated initializers.
  • Variadic macros.
    Note: The handling of __VA_ARGS__ in MSVC differs from the one in ISO C 99, see https://stackoverflow.com/questions/5134523/. But usually this matters only for macros that decompose __VA_ARGS__.
  • static inline functions.
  • __func__, assuming the func module is used. See func.
  • The restrict qualifier, assuming AC_REQUIRE([AC_C_RESTRICT]) is used. This qualifier is sometimes implemented via a macro, so C++ code that uses Gnulib should avoid using restrict as an identifier.
  • Flexible array members (however, see the flexmember module).

1.5.3 C99 features avoided by Gnulib

Gnulib avoids some features even though they are standardized by C99, as they have portability problems in practice. Here is a partial list of avoided C99 features. Many other C99 features are portable only if their corresponding modules are used; Gnulib code that uses such a feature should require the corresponding module.

  • Variable length arrays (VLAs) or variably modified types, without checking whether __STDC_NO_VLA__ is defined. See the vararrays and vla modules.
  • Block-scope variable length arrays, without checking whether either GNULIB_NO_VLA or __STDC_NO_VLA__ is defined. This lets you define GNULIB_NO_VLA to pacify GCC when using its -Wvla-larger-than warnings option, and to avoid large stack usage that may have security implications. GNULIB_NO_VLA does not affect Gnulib’s other uses of VLAs and variably modified types, such as array declarations in function prototype scope.
  • Converting to pointers via integer types other than intptr_t or uintptr_t. Although the C standard says that values of these integer types, if they exist, should be convertible to and from intmax_t and uintmax_t without loss of information, on CHERI platforms such conversions result in integers that, if converted back to a pointer, cannot be dereferenced.
  • extern inline functions, without checking whether they are supported. See Extern inline functions.
  • Type-generic math functions.
  • Universal character names in source code.
  • <iso646.h>, since GNU programs need not worry about deficient source-code encodings.
  • Comments beginning with ‘//’. This is mostly for style reasons.

1.5.4 Other portability assumptions made by Gnulib

Gnulib code makes the following assumptions that go beyond what C and POSIX require:

  • Standard internal types like ptrdiff_t and size_t are no wider than long. The GNU coding standards allow code to make this assumption, POSIX requires implementations to support at least one programming environment where this is true, and such environments are recommended for Gnulib-using applications. When it is easy to port to non-POSIX platforms like MinGW where these types are wider than long, new Gnulib code should do so, e.g., by using ptrdiff_t instead of long. However, it is not always that easy, and no effort has been made to check that all Gnulib modules work on MinGW-like environments.
  • int and unsigned int are at least 32 bits wide. POSIX and the GNU coding standards both require this.
  • Signed integer arithmetic is two’s complement.

    Previously, Gnulib code sometimes also assumed that signed integer arithmetic wraps around, but modern compiler optimizations sometimes do not guarantee this, and Gnulib code with this assumption is now considered to be questionable. See Integer Properties.

    Although some Gnulib modules contain explicit support for ones’ complement and signed magnitude integer representations, which are allowed by C17 and earlier, these modules are the exception rather than the rule. All practical Gnulib targets use two’s complement, which is required by C23.

  • There are no “holes” in integer values: all the bits of an integer contribute to its value in the usual way. In particular, an unsigned type and its signed counterpart have the same number of bits when you count the latter’s sign bit. (As an exception, Gnulib code is portable to CHERI platforms even though this assumption is false for CHERI.)
  • Objects with all bits zero are treated as zero or as null pointers. For example, memset (A, 0, sizeof A) initializes an array A of pointers to null pointers.
  • The types intptr_t and uintptr_t exist, and pointers can be converted to and from these types without loss of information.
  • Addresses and sizes behave as if objects reside in a flat address space. In particular:
    • If two nonoverlapping objects have sizes S and T represented as ptrdiff_t or size_t values, then S + T cannot overflow.
    • A pointer P points within an object O if and only if (char *) &O <= (char *) P && (char *) P < (char *) (&O + 1).
    • Arithmetic on a valid pointer is equivalent to the same arithmetic on the pointer converted to uintptr_t, except that offsets are multiplied by the size of the pointed-to objects. For example, if P + I is a valid expression involving a pointer P and an integer I, then (uintptr_t) (P + I) == (uintptr_t) ((uintptr_t) P + I * sizeof *P). Similar arithmetic can be done with intptr_t, although more care must be taken in case of integer overflow or negative integers.
    • A pointer P has alignment A if and only if (uintptr_t) P % A is zero, and similarly for intptr_t.
    • If an existing object has size S, and if T is sufficiently small (e.g., 8 KiB), then S + T cannot overflow. Overflow in this case would mean that the rest of your program fits into T bytes, which can’t happen in realistic flat-address-space hosts.
    • Adding zero to a null pointer does not change the pointer. For example, 0 + (char *) NULL == (char *) NULL.

Some system platforms violate these assumptions and are therefore not Gnulib porting targets. See Unsupported Platforms.


1.6 High Quality

We develop and maintain a testsuite for Gnulib. The goal is to have a 100% firm interface so that maintainers can feel free to update to the code in git at any time and know that their application will not break. This means that before any change can be committed to the repository, a test suite program must be produced that exposes the bug for regression testing.


1.6.1 Stable Branches

In Gnulib, we don’t use topic branches for experimental work. Therefore, occasionally a broken commit may be pushed in Gnulib. It does not happen often, but it does happen.

To compensate for this, Gnulib offers “stable branches”. These are branches of the Gnulib code that are maintained over some longer period (a year, for example) and include

  • bug fixes,
  • portability enhancements (to existing as well as to new platforms),
  • updates to config.guess and config.sub.

Not included in the stable branches are:

  • new features, such as new modules,
  • optimizations,
  • refactorings,
  • complex or risky changes in general,
  • updates to texinfo.tex,
  • documentation updates.

So far, we have five stable branches:

stable-202401

A stable branch that starts at the beginning of January 2024.

stable-202307

A stable branch that starts at the beginning of July 2023.

stable-202301

A stable branch that starts at the beginning of January 2023. It is no longer updated.

stable-202207

A stable branch that starts at the beginning of July 2022. It is no longer updated.

stable-202201

A stable branch that starts at the beginning of January 2022. It is no longer updated.

The two use-cases of stable branches are thus:

  • You want to protect yourself from occasional breakage in Gnulib.
  • When making a bug-fix release of your code, you can incorporate bug fixes in Gnulib, by pulling in the newest commits from the same stable branch that you were already using for the previous release.

1.6.2 Writing reliable code

When compiling and testing Gnulib and Gnulib-using programs, certain compiler options can help improve reliability. First of all, make it a habit to use ‘-Wall’ in all compilation commands. Beyond that, the manywarnings module enables several forms of static checking in GCC and related compilers (see manywarnings).

For dynamic checking, you can run configure with CFLAGS options appropriate for your compiler. For example:

./configure \
 CPPFLAGS='-Wall'\
 CFLAGS='-g3 -O2'\
' -D_FORTIFY_SOURCE=2'\
' -fsanitize=undefined'\
' -fsanitize-undefined-trap-on-error'

Here:

  • -D_FORTIFY_SOURCE=2 enables extra security hardening checks in the GNU C library.
  • -fsanitize=undefined enables GCC’s undefined behavior sanitizer (ubsan), and
  • -fsanitize-undefined-trap-on-error causes ubsan to abort the program (through an “illegal instruction” signal). This measure stops exploit attempts and also allows you to debug the issue.

Without the -fsanitize-undefined-trap-on-error option, -fsanitize=undefined causes messages to be printed, and execution continues after an undefined behavior situation. The message printing causes GCC-like compilers to arrange for the program to dynamically link to libraries it might not otherwise need. With GCC, instead of -fsanitize-undefined-trap-on-error you can use the -static-libubsan option to arrange for two of the extra libraries (libstdc++ and libubsan) to be linked statically rather than dynamically, though this typically bloats the executable and the remaining extra libraries are still linked dynamically.

It is also good to occasionally run the programs under valgrind (see Running self-tests under valgrind).


Previous: , Up: Brief Overview   [Contents][Index]

1.7 Join the GNU Project

GNU Gnulib is part of the GNU Operating System, developed by the GNU Project.

If you are the author of an awesome program and want to join us in writing Free (libre) Software, please consider making it an official GNU program and become a GNU Maintainer. Instructions on how to do this are here. We are looking forward to hacking with you!

Don’t have a program to contribute? Look at all the other ways to help.

And to learn more about Free (libre) Software in general, please read and share this page.


2 Philosophy

Gnulib’s design and development philosophy is organized around steady, collaborative, and open development of reusable modules that are suitable for a reasonably wide variety of platforms.


2.1 Benefits of using Gnulib

Gnulib is useful to enhance various aspects of a package:

  • Portability: With Gnulib, a package maintainer can program against the POSIX and GNU libc APIs and nevertheless expect good portability to platforms that don’t implement POSIX.
  • Maintainability: When a package uses modules from Gnulib instead of code written specifically for that package, the maintainer has less code to maintain.
  • Security: Gnulib provides functions that are immune against vulnerabilities that plague the uses of the corresponding commonplace functions. For example, asprintf, canonicalize_file_name are not affected by buffer sizing problems that affect sprintf, realpath. openat does not have the race conditions that open has. Etc.
  • Reliability: Gnulib provides functions that combine a call to a system function with a check of the result. Examples are xalloc, xprintf, xstrtod, xgetcwd.
  • Structure: Gnulib offers a way to structure code into modules, typically one include file, one source code file, and one autoconf macro for each functionality. Modularity helps maintainability.

2.2 Library vs. Reusable Code

Classical libraries are installed as binary object code. Gnulib is different: It is used as a source code library. Each package that uses Gnulib thus ships with part of the Gnulib source code. The used portion of Gnulib is tailored to the package: A build tool, called gnulib-tool, is provided that copies a tailored subset of Gnulib into the package.


2.3 Portability and Application Code

One of the goals of Gnulib is to make portable programming easy, on the basis of the standards relevant for GNU (and Unix). The objective behind that is to avoid a fragmentation of the user community into disjoint user communities according to the operating system, and instead allow synergies between users on different operating systems.

Another goal of Gnulib is to provide application code that can be shared between several applications. Some people wonder: "What? glibc doesn’t have a function to copy a file?" Indeed, the scope of a system’s libc is to implement the relevant standards (ISO C, POSIX) and to provide access functions to the kernel’s system calls, and little more.

There is no clear borderline between both areas.

For example, Gnulib has a facility for generating the name of backup files. While this task is entirely at the application level—no standard specifies an API for it—the naïve code has some portability problems because on some platforms the length of file name components is limited to 30 characters or so. Gnulib handles that.

Similarly, Gnulib has a facility for executing a command in a subprocess. It is at the same time a portability enhancement (it works on GNU, Unix, and Windows, compared to the classical fork/exec idiom which is not portable to Windows), as well as an application aid: it takes care of redirecting stdin and/or stdout if desired, and emits an error message if the subprocess failed.


2.4 Target Platforms

Gnulib supports a number of platforms that we call the “reasonable portability targets”. This class consists of widespread operating systems, for three years after their last availability, or—for proprietary operating systems—as long as the vendor provides commercial support for it. Already existing Gnulib code for older operating systems is usually left in place for longer than these three years. So it comes that programs that use Gnulib run pretty well also on these older operating systems.

Some operating systems are not very widespread, but are Free Software and are actively developed. Such platforms are also supported by Gnulib, if that OS’s developers community keeps in touch with the Gnulib developers, by providing bug reports, analyses, or patches. For such platforms, Gnulib supports only the versions of the last year or the last few months, depending on the maturity of said OS project, the number of its users, and how often these users upgrade.

Niche operating systems are generally unsupported by Gnulib, unless some of their developers or users contribute support to Gnulib.

The degree of support Gnulib guarantees for a platform depends on the amount of testing it gets from volunteers. Platforms on which Gnulib is frequently tested are the best supported. Then come platforms with occasional testing, then platforms which are rarely tested. Usually, we fix bugs when they are reported. Except that some rarely tested platforms are also low priority; bug fixes for these platforms can take longer.


2.4.1 Supported Platforms

As of 2023, the list of supported platforms is the following:

  • glibc systems. With glibc 2.19 or newer, they are frequently tested. About the kernels:
    • glibc on Linux is frequently tested.
    • glibc on kFreeBSD is rarely tested.
    • musl libc on Linux is occasionally tested.
  • macOS. In versions 12.5, it’s occasionally tested. In version 10.5, it’s rarely tested.
  • FreeBSD 13.0 or newer is occasionally tested.
  • OpenBSD 7.0 or newer is occasionally tested.
  • NetBSD 9.0 or newer is occasionally tested.
  • AIX 7.1 and 7.2 are occasionally tested.
  • Solaris 10 and 11.4 are occasionally tested. Solaris 9 is rarely tested and low priority.
  • Android is occasionally tested, through the Termux app on Android 11.
  • Cygwin 2.9 is occasionally tested. Cygwin 1.7.x is rarely tested.
  • Native Windows:
    • mingw is occasionally tested. Only the latest version of mingw is tested; older versions are not supported.
    • MSVC 14 (Microsoft Visual Studio 2015 14.0) is occasionally tested. Only “release” builds (compiler option ‘-MD’) are supported, not “debug” builds (compiler option ‘-MDd’).

    Note that some modules are currently unsupported on native Windows: mgetgroups, getugroups, idcache, userspec, openpty, login_tty, forkpty, pt_chown, grantpt, pty, savewd, mkancesdirs, mkdir-p, euidaccess, faccessat. The versions of Windows that are supported are Windows 10 and newer.

  • GNU Hurd 0.9 is rarely tested.
  • IRIX 6.5 is very rarely tested.
  • Minix 3.3.0 is no longer tested.
  • Haiku is no longer tested.
  • uClibc on Linux is no longer tested.
  • QNX is no longer tested.

2.4.2 Formerly Supported Platforms

The following platforms were supported in the past, but are no longer supported:

  • glibc versions 2.1.x and older.
  • Mac OS X 10.4 and older.
  • AIX 6 and older.
  • HP-UX 11.31.
  • IRIX 6.4 and older.
  • OSF/1 5.1.
  • Solaris 8 and older.
  • Interix.
  • BeOS.

Gnulib supports these operating systems only in an unvirtualized environment. When you run an OS inside a virtual machine, you have to be aware that the virtual machine can bring in bugs of its own. For example, floating-point operations on Solaris can behave slightly differently in QEMU than on real hardware. And Haiku’s bash program misbehaves in VirtualBox 3, whereas it behaves fine in VirtualBox 4.

Similarly, running native Windows binaries on GNU/Linux under WINE is rarely tested and low priority: WINE has a set of behaviours and bugs that is slightly different from native Windows.


2.4.3 Unsupported Platforms

Some platforms with C compilers are not supported by Gnulib because the platforms violate Gnulib’s C portability assumptions. See Other portability assumptions made by Gnulib.

These assumptions are not required by the C or POSIX standards but hold on almost all practical porting targets. If you need to port Gnulib code to a platform where these assumptions are not true, we would appreciate hearing of any fixes. We need fixes that do not increase runtime overhead on standard hosts and that are relatively easy to maintain.

These platforms are listed below to illustrate problems that Gnulib and Gnulib-using code would have if it were intended to be portable to all practical POSIX or C platforms.

  • Clang’s -fsanitize=undefined option causes the program to crash if it adds zero to a null pointer – behavior that is undefined in strict C, but which yields a null pointer on all practical porting targets and which the Gnulib portability guidelines allow.

    If you use Clang with -fsanitize=undefined, you can work around the problem by also using ‘-fno-sanitize=pointer-overflow’, although this may also disable some unrelated and useful pointer checks. Perhaps someday the Clang developers will fix the infelicity.

  • The IBM i’s pointers are 128 bits wide and it lacks the two types intptr_t and uintptr_t, which are optional in the C and POSIX standards. However, these two types are required for the XSI extension to POSIX, and many Gnulib modules use them. To work around this compatibility problem, Gnulib-using applications can be run on the IBM i’s PASE emulation environment. The IBM i’s architecture descends from the System/38 (1978).
  • The Unisys ClearPath Dorado’s machine word is 36 bits. Its signed integers use a ones’-complement representation. On these machines, CHAR_BIT == 9 and INT_MIN == -INT_MAX. By default UINT_MAX is 2^{36} - 2, which does not conform to the C requirement that it be one less than a power of two. Although compiler options can raise UINT_MAX to be 2^{36} - 1, this can break system code that uses -0 as a flag value. This platform’s architecture descends from the UNIVAC 1103 (1953).
  • The Unisys ClearPath Libra’s machine word is 48 bits with a 4-bit tag and a 4-bit data extension. Its unsigned int uses the low-order 40 bits of the word, and int uses the low-order 41 bits of the word with a signed-magnitude representation. On these machines, INT_MAX == UINT_MAX, INT_MIN == -INT_MAX, and sizeof (int) == 6. This platform’s architecture descends from the Burroughs B5000 (1961).

The following platforms are not supported by Gnulib. The cost of supporting them would exceed the benefit because they are rarely used, or poorly documented, or have been supplanted by other platforms, or diverge too much from POSIX, or some combination of these and other factors. Please don’t bother sending us patches for them.

  • Windows 95/98/ME.
  • DJGPP and EMX (the 32-bit operating systems running in DOS).
  • MSDOS (the 16-bit operating system).
  • Windows Mobile, Symbian OS, iOS.

2.5 Modules

Gnulib is divided into modules. Every module implements a single facility. Modules can depend on other modules.

A module consists of a number of files and a module description. The files are copied by gnulib-tool into the package that will use it, usually verbatim, without changes. Source code files (.h, .c files) reside in the lib/ subdirectory. Autoconf macro files reside in the m4/ subdirectory. Build scripts reside in the build-aux/ subdirectory.

The module description contains the list of files; gnulib-tool copies these files. It contains the module’s dependencies; gnulib-tool installs them as well. It also contains the autoconf macro invocation (usually a single line or nothing at all); gnulib-tool ensures this is invoked from the package’s configure.ac file. And also a Makefile.am snippet; gnulib-tool collects these into a Makefile.am for the tailored Gnulib part. The module description and include file specification are for documentation purposes; they are combined into MODULES.html.

The module system serves two purposes:

  1. It ensures consistency of the used autoconf macros and Makefile.am rules with the source code. For example, source code which uses the getopt_long function—this is a common way to implement parsing of command line options in a way that complies with the GNU standards—needs the source code (lib/getopt.c and others), the autoconf macro which detects whether the system’s libc already has this function (in m4/getopt.m4), and a few Makefile.am lines that create the substitute getopt.h if not. These three pieces belong together. They cannot be used without each other. The module description and gnulib-tool ensure that they are copied altogether into the destination package.
  2. It allows for scalability. It is well-known since the inception of the MODULA-2 language around 1978 that dissection into modules with dependencies allows for building large sets of code in a maintainable way. The maintainability comes from the facts that:
    • Every module has a single purpose; you don’t worry about other parts of the program while creating, reading or modifying the code of a module.
    • The code you have to read in order to understand a module is limited to the source of the module and the .h files of the modules listed as dependencies. It is for this reason also that we recommend to put the comments describing the functions exported by a module into its .h file.

    In other words, the module is the elementary unit of code in Gnulib, comparable to a class in object-oriented languages like Java or C#.

The module system is the basis of gnulib-tool. When gnulib-tool copies a part of Gnulib into a package, it first compiles a module list, starting with the requested modules and adding all the dependencies, and then collects the files, configure.ac snippets and Makefile.am snippets.


2.6 Various Kinds of Modules

There are modules of various kinds in Gnulib. For a complete list of the modules, see in MODULES.html.

2.6.1 Support for ISO C or POSIX functions.

When a function is not implemented by a system, the Gnulib module provides an implementation under the same name. Examples are the ‘snprintf’ and ‘readlink’ modules.

Similarly, when a function is not correctly implemented by a system, Gnulib provides a replacement. For functions, we use the pattern

#if !HAVE_WORKING_FOO
# define foo rpl_foo
#endif

and implement the foo function under the name rpl_foo. This renaming is needed to avoid conflicts at compile time (in case the system header files declare foo) and at link/run time (because the code making use of foo could end up residing in a shared library, and the executable program using this library could be defining foo itself).

For header files, such as stdint.h, we provide the substitute only if the system doesn’t provide a correct one. The template of this replacement is distributed in a slightly different name, with ‘.in’ inserted before the ‘.h’ extension, so that on systems which do provide a correct header file the system’s one is used.

The modules in this category are supported in C++ mode as well. This means, while the autoconfiguration uses the C compiler, the resulting header files and function substitutes can be used with a matching C++ compiler as well.

2.6.2 Enhancements of ISO C or POSIX functions

These are sometimes POSIX functions with GNU extensions also found in glibc—examples: ‘getopt’, ‘fnmatch’—and often new APIs—for example, for all functions that allocate memory in one way or the other, we have variants which also include the error checking against the out-of-memory condition.

2.6.3 Portable general use facilities

Examples are a module for copying a file—the portability problems relate to the copying of the file’s modification time, access rights, and extended attributes—or a module for extracting the tail component of a file name—here the portability to native Windows requires a different API than the classical POSIX basename function.

2.6.4 Reusable application code

Examples are an error reporting function, a module that allows output of numbers with K/M/G suffixes, or cryptographic facilities.

2.6.5 Object oriented classes

Examples are data structures like ‘list’, or abstract output stream classes that work around the fact that an application cannot implement an stdio FILE with its logic. Here, while staying in C, we use implementation techniques like tables of function pointers, known from the C++ language or from the Linux kernel.

2.6.6 Interfaces to external libraries

Examples are the ‘iconv’ module, which interfaces to the iconv facility, regardless whether it is contained in libc or in an external libiconv. Or the ‘readline’ module, which interfaces to the GNU readline library.

2.6.7 Build / maintenance infrastructure

An example is the ‘maintainer-makefile’ module, which provides extra Makefile tags for maintaining a package.


2.7 Collaborative Development

Gnulib is maintained collaboratively. The mailing list is <bug-gnulib at gnu dot org>. Be warned that some people on the list may be very active at some times and unresponsive at other times.

Every module has one or more maintainers. While issues are discussed collaboratively on the list, the maintainer of a module nevertheless has a veto right regarding changes in his module.

All patches should be posted to the list, regardless whether they are proposed patches or whether they are committed immediately by the maintainer of the particular module. The purpose is not only to inform the other users of the module, but mainly to allow peer review. It is not uncommon that several people contribute comments or spot bugs after a patch was proposed.

Conversely, if you are using Gnulib, and a patch is posted that affects one of the modules that your package uses, you have an interest in proofreading the patch.


Next: , Previous: , Up: Philosophy   [Contents][Index]

2.9 Steady Development

Gnulib modules are continually adapted, to match new practices, to be consistent with newly added modules, or simply as a response to build failure reports.

If you are willing to report an occasional regression, we recommend to use the newest version from git always, except in periods of major changes. Most Gnulib users do this.


2.10 Openness

Gnulib is open in the sense that we gladly accept contributions if they are generally useful, well engineered, and if the contributors have signed the obligatory papers with the FSF.

The module system is open in the sense that a package using Gnulib can

  1. locally patch or override files in Gnulib,
  2. locally add modules that are treated like Gnulib modules by gnulib-tool.

This is achieved by the ‘--local-dir’ option of gnulib-tool (see Extending Gnulib).


Next: , Previous: , Up: GNU Gnulib   [Contents][Index]

3 Invoking gnulib-tool

The gnulib-tool command is the recommended way to import Gnulib modules. It is possible to borrow Gnulib modules in a package without using gnulib-tool, relying only on the meta-information stored in the modules/* files, but with a growing number of modules this becomes tedious. gnulib-tool simplifies the management of source files, Makefile.ams and configure.ac in packages incorporating Gnulib modules.

gnulib-tool is not installed in a standard directory that is contained in the PATH variable. It needs to be run directly in the directory that contains the Gnulib source code. You can do this either by specifying the absolute filename of gnulib-tool, or you can also use a symbolic link from a place inside your PATH to the gnulib-tool file of your preferred and most up-to-date Gnulib checkout, like this:

$ ln -s $HOME/gnu/src/gnulib.git/gnulib-tool $HOME/bin/gnulib-tool

Run ‘gnulib-tool --help’ for information. To get familiar with gnulib-tool without affecting your sources, you can also try some commands with the option ‘--dry-run’; then gnulib-tool will only report which actions it would perform in a real run without changing anything.


3.1 Finding modules

There are four ways of finding the names of Gnulib modules that you can use in your package:


3.2 Initial import

Gnulib assumes that your project uses Autoconf. When using Gnulib, you will need to have Autoconf among your build tools.

Gnulib also assumes that your project’s configure.ac contains the line

AC_CONFIG_HEADERS([config.h])

The config.h file gets generated with platform dependent C macro definitions, and the source files include it (see Changing your sources for use with Gnulib).

Unless you use gnulib-tool’s --gnu-make option, Gnulib also assumes that your project uses Automake at least in a subdirectory of your project. While the use of Automake in your project’s top level directory is an easy way to fulfil the Makefile conventions of the GNU coding standards, Gnulib does not require it.

Invoking ‘gnulib-tool --import’ will copy source files, create a Makefile.am to build them, generate a file gnulib-comp.m4 with Autoconf M4 macro declarations used by configure.ac, and generate a file gnulib-cache.m4 containing the cached specification of how Gnulib is used.

Our example will be a library that uses Autoconf, Automake and Libtool. It calls strdup, and you wish to use gnulib to make the package portable to C99 and C11 (which don’t have strdup).

~/src/libfoo$ gnulib-tool --import strdup
Module list with included dependencies:
  absolute-header
  extensions
  strdup
  string
File list:
  lib/dummy.c
  lib/strdup.c
  lib/string.in.h
  m4/absolute-header.m4
  m4/extensions.m4
  m4/gnulib-common.m4
  m4/strdup.m4
  m4/string_h.m4
Creating directory ./lib
Creating directory ./m4
Copying file lib/dummy.c
Copying file lib/strdup.c
Copying file lib/string.in.h
Copying file m4/absolute-header.m4
Copying file m4/extensions.m4
Copying file m4/gnulib-common.m4
Copying file m4/gnulib-tool.m4
Copying file m4/strdup.m4
Copying file m4/string_h.m4
Creating lib/Makefile.am
Creating m4/gnulib-cache.m4
Creating m4/gnulib-comp.m4
Finished.

You may need to add #include directives for the following .h files.
  #include <string.h>

Don't forget to
  - add "lib/Makefile" to AC_CONFIG_FILES in ./configure.ac,
  - mention "lib" in SUBDIRS in Makefile.am,
  - mention "-I m4" in ACLOCAL_AMFLAGS in Makefile.am,
  - invoke gl_EARLY in ./configure.ac, right after AC_PROG_CC,
  - invoke gl_INIT in ./configure.ac.
~/src/libfoo$

By default, the source code is copied into lib/ and the M4 macros in m4/. You can override these paths by using --source-base=DIRECTORY and --m4-base=DIRECTORY. Some modules also provide other files necessary for building. These files are copied into the directory specified by ‘AC_CONFIG_AUX_DIR’ in configure.ac or by the --aux-dir=DIRECTORY option. If neither is specified, the current directory is assumed.

gnulib-tool can make symbolic links instead of copying the source files. The option to specify for this is ‘--symlink’, or ‘-s’ for short. This can be useful to save a few kilobytes of disk space. But it is likely to introduce bugs when gnulib is updated; it is more reliable to use ‘gnulib-tool --update’ (see below) to update to newer versions of gnulib. Furthermore it requires extra effort to create self-contained tarballs, and it may disturb some mechanism the maintainer applies to the sources. For these reasons, this option is generally discouraged.

gnulib-tool will overwrite any preexisting files, in particular Makefile.am. It is also possible to separate the generated Makefile.am content (for building the gnulib library) into a separate file, say gnulib.mk, that can be included by your handwritten Makefile.am, but this is a more advanced use of gnulib-tool.

Consequently, it is a good idea to choose directories that are not already used by your projects, to separate gnulib imported files from your own files. This approach is also useful if you want to avoid conflicts between other tools (e.g., gettextize that also copy M4 files into your package. Simon Josefsson successfully uses a source base of gl/, and a M4 base of gl/m4/, in several packages.

After the ‘--import’ option on the command line comes the list of Gnulib modules that you want to incorporate in your package. The names of the modules coincide with the filenames in Gnulib’s modules/ directory.

Some Gnulib modules depend on other Gnulib modules. gnulib-tool will automatically add the needed modules as well; you need not list them explicitly. gnulib-tool will also memorize which dependent modules it has added, so that when someday a dependency is dropped, the implicitly added module is dropped as well (unless you have explicitly requested that module).

If you want to cut a dependency, i.e., not add a module although one of your requested modules depends on it, you may use the option ‘--avoid=module’ to do so. Multiple uses of this option are possible. Of course, you will then need to implement the same interface as the removed module.

A few manual steps are required to finish the initial import. gnulib-tool printed a summary of these steps.

First, you must ensure Autoconf can find the macro definitions in gnulib-comp.m4. Use the ACLOCAL_AMFLAGS specifier in your top-level Makefile.am file, as in:

ACLOCAL_AMFLAGS = -I m4

You are now ready to call the M4 macros in gnulib-comp.m4 from configure.ac. The macro gl_EARLY must be called as soon as possible after verifying that the C compiler is working. Typically, this is immediately after AC_PROG_CC, as in:

...
AC_PROG_CC
gl_EARLY
...

The core part of the gnulib checks are done by the macro gl_INIT. Place it further down in the file, typically where you normally check for header files or functions. It must come after other checks which may affect the compiler invocation, such as AC_MINIX. For example:

...
# For gnulib.
gl_INIT
...

gl_INIT will in turn call the macros related with the gnulib functions, be it specific gnulib macros, like gl_FUNC_ALLOCA or Autoconf or Automake macros like AC_FUNC_ALLOCA or AM_FUNC_GETLINE. So there is no need to call those macros yourself when you use the corresponding gnulib modules.

You must also make sure that the gnulib library is built. Add the Makefile in the gnulib source base directory to AC_CONFIG_FILES, as in:

AC_CONFIG_FILES(... lib/Makefile ...)

You must also make sure that make will recurse into the gnulib directory. To achieve this, add the gnulib source base directory to a SUBDIRS Makefile.am statement, as in:

SUBDIRS = lib

or if you, more likely, already have a few entries in SUBDIRS, you can add something like:

SUBDIRS += lib

Finally, you have to add compiler and linker flags in the appropriate source directories, so that you can make use of the gnulib library. Since some modules (‘getopt’, for example) may copy files into the build directory, top_builddir/lib is needed as well as top_srcdir/lib. For example:

...
AM_CPPFLAGS = -I$(top_builddir)/lib -I$(top_srcdir)/lib
...
LDADD = lib/libgnu.a
...

Don’t forget to #include the various header files. In this example, you would need to make sure that ‘#include <string.h>’ is evaluated when compiling all source code files, that want to make use of strdup.

In the usual case where Autoconf is creating a config.h file, you should include config.h first, before any other include file. That way, for example, if config.h defines ‘restrict’ to be the empty string on a non-C99 host, or a macro like ‘_FILE_OFFSET_BITS’ that affects the layout of data structures, the definition is consistent for all include files. Also, on some platforms macros like ‘_FILE_OFFSET_BITS’ and ‘_GNU_SOURCE’ may be ineffective, or may have only a limited effect, if defined after the first system header file is included.

Finally, note that you cannot use AC_LIBOBJ or AC_REPLACE_FUNCS in your configure.ac and expect the resulting object files to be automatically added to lib/libgnu.a. This is because your AC_LIBOBJ and AC_REPLACE_FUNCS invocations from configure.ac augment a variable @LIBOBJS@ (and/or @LTLIBOBJS@ if using Libtool), whereas lib/libgnu.a is built from the contents of a different variable, usually @gl_LIBOBJS@ (or @gl_LTLIBOBJS@ if using Libtool).


3.3 Modified imports

You can at any moment decide to use Gnulib differently than the last time.

There are two ways to change how Gnulib is used. Which one you’ll use, depends on where you keep track of options and module names that you pass to gnulib-tool.

  • If you store the options and module names in a file under your own control, such as autogen.sh, bootstrap, bootstrap.conf, or similar, simply invoke gnulib-tool again, with modified options and more or fewer module names.
  • gnulib-tool remembers which modules were used last time. If you want to rely on gnulib-tool’s own memory of the last used options and module names, you can use the commands gnulib-tool --add-import and gnulib-tool --remove-import.

    So, if you only want to use more Gnulib modules, simply invoke gnulib-tool --add-import new-modules. The list of modules that you pass after ‘--add-import’ is added to the previous list of modules.

    Similarly, if you want to use fewer Gnulib modules, simply invoke gnulib-tool --remove-import unneeded-modules. The list of modules that you pass after ‘--remove-import’ is removed from the previous list of modules. Note that if a module is then still needed as dependency of other modules, it will be used nevertheless. If you want to really not use a module any more, regardless of whether other modules may need it, you need to use the ‘--avoid’ option.

    For other changes, such as different choices of ‘--lib’, ‘--source-base’ or ‘--aux-dir’, the normal way is to modify manually the file gnulib-cache.m4 in the M4 macros directory, then launch ‘gnulib-tool --add-import’.

    The only change for which this doesn’t work is a change of the ‘--m4-base’ directory. Because, when you pass a different value of ‘--m4-base’, gnulib-tool will not find the previous gnulib-cache.m4 file any more. A possible solution is to manually copy the gnulib-cache.m4 into the new M4 macro directory.

    In the gnulib-cache.m4 file, the macros have the following meaning:

    gl_MODULES

    The argument is a space separated list of the requested modules, not including dependencies.

    gl_AVOID

    The argument is a space separated list of modules that should not be used, even if they occur as dependencies. Corresponds to the ‘--avoid’ command line argument.

    gl_SOURCE_BASE

    The argument is the relative file name of the directory containing the gnulib source files (mostly *.c and *.h files). Corresponds to the ‘--source-base’ command line argument.

    gl_M4_BASE

    The argument is the relative file name of the directory containing the gnulib M4 macros (*.m4 files). Corresponds to the ‘--m4-base’ command line argument.

    gl_TESTS_BASE

    The argument is the relative file name of the directory containing the gnulib unit test files. Corresponds to the ‘--tests-base’ command line argument.

    gl_LIB

    The argument is the name of the library to be created. Corresponds to the ‘--lib’ command line argument.

    gl_LGPL

    The presence of this macro without arguments corresponds to the ‘--lgpl’ command line argument. The presence of this macro with an argument (whose value must be 2 or 3) corresponds to the ‘--lgpl=arg’ command line argument.

    gl_LIBTOOL

    The presence of this macro corresponds to the ‘--libtool’ command line argument and to the absence of the ‘--no-libtool’ command line argument. It takes no arguments.

    gl_MACRO_PREFIX

    The argument is the prefix to use for macros in the gnulib-comp.m4 file. Corresponds to the ‘--macro-prefix’ command line argument.


3.4 Simple update

When you want to update to a more recent version of Gnulib, without changing the list of modules or other parameters, a simple call does it:

$ gnulib-tool --add-import

This will create, update or remove files, as needed.

Note: From time to time, changes are made in Gnulib that are not backward compatible. When updating to a more recent Gnulib, you should consult Gnulib’s NEWS file to check whether the incompatible changes affect your project.


3.5 Changing your sources for use with Gnulib

Gnulib contains some header file overrides. This means that when building on systems with deficient header files in /usr/include/, it may create files named string.h, stdlib.h, stdint.h or similar in the build directory. In the other source directories of your package you will usually pass ‘-I’ options to the compiler, so that these Gnulib substitutes are visible and take precedence over the files in /usr/include/.

These Gnulib substitute header files rely on <config.h> being already included. Furthermore <config.h> must be the first include in every compilation unit. This means that to all your source files and likely also to all your tests source files you need to add an ‘#include <config.h>’ at the top. Which source files are affected? Exactly those whose compilation includes a ‘-I’ option that refers to the Gnulib library directory.

This is annoying, but inevitable: On many systems, <config.h> is used to set system dependent flags (such as _GNU_SOURCE on GNU systems), and these flags have no effect after any system header file has been included.


3.7 Finding recommended ISO C and POSIX function substitutes

Gnulib contains a wealth of portability workarounds for ISO C and POSIX functions. They are listed in detail in the chapter ISO C and POSIX Function Substitutes. If you want to know which function substitutes are recommended for your package, you can search your source code for ISO C and POSIX functions that it uses and read the corresponding sections of said documentation chapter. But this is a tedious task. Here is an alternative approach that makes this task easier.

  1. Add the Gnulib module ‘posixcheck’ to the Gnulib imports of your package, as described earlier in this chapter.
  2. Do a make distclean if you previously built in the top-level directory. Then regenerate the Autotools-generated parts of the package.
  3. On a glibc system, build your package. Pay attention to the compiler warnings. Warnings are generated for uses of ISO C and POSIX functions that have portability problems or other important pitfalls and for which you have not yet imported the corresponding Gnulib module. If you get, say, a warning “warning: call to ’close’ declared with attribute warning: close does not portably work on sockets - use gnulib module close for portability”, put ‘close’ on your list of modules to import.
  4. Add the modules you noted to the Gnulib imports of your package.
  5. Optionally, you can do the same steps again, and make sure that there are no warnings left except those that you want to intentionally ignore.
  6. Finally, remove the Gnulib module ‘posixcheck’ from the Gnulib imports, and run make distclean.

3.8 Modifying the build rules of a Gnulib import directory

In some cases, you may want to set additional compiler options for use within the Gnulib import directory. For example, the ‘relocatable’ module operates better if you define the C macros ENABLE_COSTLY_RELOCATABLE and INSTALLDIR during its compilation.

There are two ways to do so: Use of the gnulib-tool option --makefile-name, and a kitchen-sink module.

With the gnulib-tool option --makefile-name, you are telling gnulib-tool to generate an includable Makefile.am portion, rather than a self-contained Makefile.am. For example, when you use --makefile-name=Makefile.gnulib, gnulib-tool will generate Makefile.gnulib, and you will provide a hand-written Makefile.am that includes Makefile.gnulib through a line such as

include Makefile.gnulib

Before this include, you need to initialize this set of Makefile.am variables:

  • AUTOMAKE_OPTIONS
  • SUBDIRS
  • noinst_HEADERS
  • noinst_LIBRARIES
  • noinst_LTLIBRARIES
  • pkgdata_DATA (only with Automake ≥ 1.11.4)
  • EXTRA_DIST
  • BUILT_SOURCES
  • SUFFIXES
  • MOSTLYCLEANFILES
  • MOSTLYCLEANDIRS
  • CLEANFILES
  • DISTCLEANFILES
  • MAINTAINERCLEANFILES
  • AM_CPPFLAGS
  • AM_CFLAGS

AUTOMAKE_OPTIONS should be initialized as described in Changing Automake’s Behavior in GNU Automake. The other variables can be initialized to empty. However, you will most likely want to initialize some of them with non-empty values, in order to achieve the desired customization.

The other approach, the kitchen-sink module, is more advanced. See chapter Extending Gnulib.


3.9 Building directly from the top-level directory

By default, the Gnulib import directory will contain a generated Makefile.am file. After configuring, this produces a generated Makefile in this directory. As a consequence, the build from the top-level directory will use a recursive make invocation for this directory.

Some people prefer a build system where the Makefile in the top-level directory directly builds the artifacts in the subdirectories, without an intermediate make invocation. This is called “non-recursive make” and is supported by Automake. For more details, see https://autotools.io/automake/nonrecursive.html.

Gnulib supports this flavour of build system too. To use it, pass two options to gnulib-tool: ‘--makefile-name’ and ‘--automake-subdir’.

With the gnulib-tool option ‘--makefile-name’, you are telling gnulib-tool to generate an includable Makefile.am portion in the Gnulib import directory, rather than a self-contained Makefile.am. For example, when you use ‘--makefile-name=Makefile.gnulib’, gnulib-tool will generate Makefile.gnulib.

With the option ‘--automake-subdir’, you are telling gnulib-tool that you will include the generated file from the Makefile.am in the top-level directory, rather than from a Makefile.am in the same directory. For example, the top-level Makefile.am might contain this directive:

include lib/Makefile.gnulib

The option ‘--automake-subdir’ is also supported in combination with ‘--with-tests’ (see Bundling the unit tests of the Gnulib modules). Note that in this case, however, the generated unit tests directory will contains a Makefile.am and thus use a recursive make invocation. This is not a problem, since the built artifacts of your package have no dependencies towards the Gnulib unit tests, nor vice versa.


3.10 Using Gnulib for both a library and a program

Your project might build both a library and some accompanying programs in the same source tree. In that case you might want to use different modules for the library than for the programs. Typically the programs might want to make use of getopt-posix or version-etc, while the library wants to stay clear of these modules for technical or licensing reasons.

Let’s assume that your project contains a lib directory where the source of the library resides and a src directory for the sources of the programs as follows.

.
|-- configure.ac
|-- lib
|   |-- foo.c
|   `-- Makefile.am
|-- Makefile.am
`-- src
    |-- bar.c
    `-- Makefile.am

You can now add two instances of Gnulib to your project in separate source trees:

~/src/libfoo$ gnulib-tool --import --lib=libgnu --source-base=gnulib \
              --m4-base=gnulib/m4 --macro-prefix=gl strndup
~/src/libfoo$ gnulib-tool --import --lib=libgnutools \
              --source-base=src/gnulib --m4-base=src/gnulib/m4 \
              --macro-prefix=gl_tools getopt-gnu

The first one will import the module strndup in gnulib and the second one will import getopt-gnu in src/gnulib and you will end up with the following source tree (many files omitted in the interest of brevity):

.
|-- configure.ac
|-- gnulib
|   |-- m4
|   |-- strndup.c
|-- lib
|   |-- foo.c
|   `-- Makefile.am
|-- Makefile.am
`-- src
    |-- bar.c
    |-- gnulib
    |   |-- getopt.c
    |   |-- getopt.in.h
    |   |-- m4
    `-- Makefile.am

As discussed in Bundling the unit tests of the Gnulib modules, you may not use ‘--with-tests’ for this project since the configure.ac is shared.

Integration with your code is basically the same as outlined in Initial import with the one exception that you have to add both the macro gl_EARLY and the macro gl_tools_EARLY to your configure.ac (and of course also both macros gl_INIT and gl_tools_INIT). Obviously the name of the second macro is dependent on the value of the --macro-prefix option in your gnulib-tool invocation.

...
AC_PROG_CC
gl_EARLY
gl_tools_EARLY
...
# For gnulib.
gl_INIT
gl_tools_INIT
...

Also as outlined in Initial import you will have to add compiler and linker flags. For the library you might have to add something along the line of the following to your Makefile.am:

...
AM_CPPFLAGS = -I$(top_srcdir)/gnulib -I$(top_builddir)/gnulib
...
libfoo_la_LIBADD = $(top_builddir)/gnulib/libgnu.la
...

Correspondingly for the programs you will have to add something like this:

...
AM_CPPFLAGS = -I$(top_srcdir)/src/gnulib -I$(top_builddir)/src/gnulib
...
LDADD = $(top_builddir)/src/gnulib/libgnutools.la
...

The name of the library that you have pass in the linker option depends on the --lib option in gnulib-tool invocation.


3.11 Caveat: gettextize and autopoint users

The programs gettextize and autopoint, part of GNU gettext, import or update the internationalization infrastructure. Some of this infrastructure, namely ca. 20 Autoconf macro files and the config.rpath file, is also contained in Gnulib and may be imported by gnulib-tool. The use of gettextize or autopoint will therefore overwrite some of the files that gnulib-tool has imported, and vice versa.

Avoiding to use gettextize (manually, as package maintainer) or autopoint (as part of a script like autoreconf or autogen.sh) is not the solution: These programs also import the infrastructure in the po/ and optionally in the intl/ directory.

The copies of the conflicting files in Gnulib are more up-to-date than the copies brought in by gettextize and autopoint. When a new gettext release is made, the copies of the files in Gnulib will be updated immediately.

The choice of which version of gettext to require depends on the needs of your package. For a package that wants to comply to GNU Coding Standards, the steps are:

  1. When you run gettextize, always use the gettextize from the matching GNU gettext release. For the most recent Gnulib checkout, this is the newest release found on https://ftp.gnu.org/gnu/gettext/. For an older Gnulib snapshot, it is the release that was the most recent release at the time the Gnulib snapshot was taken.
  2. After running gettextize, invoke gnulib-tool and import the gettext module. Also, copy the latest version of gnulib’s build-aux/po/Makefile.in.in to your po/ directory (this is done for you if you use gnulib’s autogen.sh script).
  3. If you get an error message like *** error: gettext infrastructure mismatch: using a Makefile.in.in from gettext version ... but the Autoconf macros are from gettext version ..., it means that a new GNU gettext release was made, and its Autoconf macros were integrated into Gnulib and now mismatch the po/ infrastructure. In this case, fetch and install the new GNU gettext release and run gettextize followed by gnulib-tool.

On the other hand, if your package is not as concerned with compliance to the latest standards, but instead favors development on stable environments, the steps are:

  1. Determine the oldest version of gettext that you intend to support during development (at this time, gnulib recommends going no older than version 0.17). Run autopoint (not gettextize) to copy infrastructure into place (newer versions of gettext will install the older infrastructure that you requested).
  2. Invoke gnulib-tool, and import the gettext-h module.

Regardless of which approach you used to get the infrastructure in place, the following steps must then be used to preserve that infrastructure (gnulib’s autogen.sh script follows these rules):

  1. When a script of yours run autopoint, invoke gnulib-tool afterwards.
  2. When you invoke autoreconf after gnulib-tool, make sure to not invoke autopoint a second time, by setting the AUTOPOINT environment variable, like this:
    $ env AUTOPOINT=true autoreconf --install
    

3.12 Handling Gnulib’s own message translations

Gnulib provides some functions that emit translatable messages using GNU gettext. The ‘gnulib’ domain at the Translation Project collects translations of these messages, which you should incorporate into your own programs.

There are two basic ways to achieve this. The first, and older, method is to list all the source files you use from Gnulib in your own po/POTFILES.in file. This will cause all the relevant translatable strings to be included in your POT file. When you send this POT file to the Translation Project, translators will normally fill in the translations of the Gnulib strings from their “translation memory”, and send you back updated PO files.

However, this process is error-prone: you might forget to list some source files, or the translator might not be using a translation memory and provide a different translation than another translator, or the translation might not be kept in sync between Gnulib and your package. It is also slow and causes substantial extra work, because a human translator must be in the loop for each language and you will need to incorporate their work on request.

For these reasons, a new method was designed and is now recommended. If you pass the --po-base=directory and --po-domain=domain options to gnulib-tool, then gnulib-tool will create a separate directory with its own POTFILES.in, and fetch current translations directly from the Translation Project (using rsync or wget, whichever is available). The POT file in this directory will be called domain-gnulib.pot, depending on the domain you gave to the --po-domain option (typically the same as the package name). This causes these translations to reside in a separate message domain, so that they do not clash either with the translations for the main part of your package nor with those of other packages on the system that use possibly different versions of Gnulib. When you use these options, the functions in Gnulib are built in such a way that they will always use this domain regardless of the default domain set by textdomain.

In order to use this method, you must—in each program that might use Gnulib code—add an extra line to the part of the program that initializes locale-dependent behavior. Where you would normally write something like:

  setlocale (LC_ALL, "");
  bindtextdomain (PACKAGE, LOCALEDIR);
  textdomain (PACKAGE);

you should add an additional bindtextdomain call to inform gettext of where the MO files for the extra message domain may be found:

  bindtextdomain (PACKAGE "-gnulib", LOCALEDIR);

(This example assumes that the domain that you specified to gnulib-tool is the same as the value of the PACKAGE preprocessor macro.)

Since you do not change the textdomain call, the default message domain for your program remains the same and your own use of gettext functions will not be affected.


3.13 Integration with Version Control Systems

If a project stores its source files in a version control system (VCS), such as CVS, Subversion, or Git, one needs to decide which files to commit.

In principle, all files created by gnulib-tool, except gnulib-cache.m4, can be treated like generated source files, like for example a parser.c file generated from parser.y. Alternatively, they can be considered source files and updated manually.

Here are the three different approaches in common use. Each has its place, and you should use whichever best suits your particular project and development methods.

  1. In projects which commit all source files, whether generated or not, into their VCS, the gnulib-tool generated files should all be committed. In this case, you should pass the option ‘--no-vc-files’ to gnulib-tool, which avoids alteration of VCS-related files such as .gitignore.

    Gnulib also contains files generated by make (and removed by make clean), using information determined by configure. For a Gnulib source file of the form lib/foo.in.h, the corresponding lib/foo.h is such a make-generated file. These should not be checked into the VCS, but instead added to .gitignore or equivalent.

  2. In projects which customarily omit from their VCS all files that are generated from other source files, none of these files and directories are added into the VCS. As described in Modified imports, there are two ways to keep track of options and module names that are passed to gnulib-tool. The command for restoring the omitted files depends on it:
    • If they are stored in a file other than gnulib-cache.m4, such as autogen.sh, bootstrap, bootstrap.conf, or similar, the restoration command is the entire gnulib-tool ... --import ... invocation with all options and module names.
    • If the project relies on gnulib-tool’s memory of the last used options and module names, then the file gnulib-cache.m4 in the M4 macros directory must be added to the VCS, and the restoration command is:
      $ gnulib-tool --update
      

      The ‘--update’ option operates much like the ‘--add-import’ option, but it does not offer the possibility to change the way Gnulib is used. Also it does not report in the ChangeLogs the files that it had to add because they were missing.

    Most packages nowadays use the first among these two approaches. Over time, three ways of handling version control have evolved.

    In the cases (A) and (B), a “git submodule” is used to reference the precise commit of the gnulib repository, so that each developer running ‘./bootstrap --pull’ or autopull.sh will get the same version of all gnulib-provided files.

    The alternative is to always follow the newest Gnulib automatically. Note that this can cause breakages at unexpected moments, namely when a broken commit is pushed in Gnulib. It does not happen often, but it does happen.

    • (A) In this approach, the developers use a git submodule manually.

      The location of the submodule can be chosen to fit the package’s needs; here’s how to initially create the submodule in the directory gnulib:

      $ git submodule add -- https://git.savannah.gnu.org/git/gnulib.git gnulib
      

      Thereafter, the developer will run this command to update the submodule to the recorded checkout level:

      $ git submodule update --init gnulib
      

      Use this sequence to update to a newer version of gnulib:

      $ git submodule update --remote gnulib
      $ git add gnulib
      $ ./bootstrap --bootstrap-sync
      

      If multiple submodules are used, the following may be useful:

      $ git config alias.syncsub "submodule foreach git pull origin master"
      $ git syncsub
      
    • (B) In this approach, the build-aux/bootstrap or autopull.sh program (see Programs for developing in Git checkouts) is used to aid a developer in using this setup. You copy this program (and if it’s autopull.sh, its companion files) into your package and place the copy or copies under version control. The program can be customized using bootstrap.conf which you also put under version control.
    • (C) In this approach, you write the autopull.sh and autogen.sh files by hand.

      autopull.sh is most easily written as a script that invokes

      ./gitsub.sh pull || exit 1
      

      where gitsub.sh is described in Programs for developing in Git checkouts.

      autogen.sh typically contains an explicit gnulib-tool invocation, followed by

      aclocal -I m4 \
        && autoconf \
        && autoheader && touch config.h.in \
        && automake --add-missing --copy \
        && rm -rf autom4te.cache \
        || exit $?
      
  3. Some projects take a “middle road”: they do commit Gnulib source files as in the first approach, but they do not commit other derived files, such as a Makefile.in generated by Automake. This increases the size and complexity of the repository, but can help occasional contributors by not requiring them to have a full Gnulib checkout to do a build, and all developers by ensuring that all developers are working with the same version of Gnulib in the repository. It also supports multiple Gnulib instances within a project. It remains important not to commit the make-generated files, as described above.

3.14 Bundling the unit tests of the Gnulib modules

You can bundle the unit tests of the Gnulib modules together with your package, through the ‘--with-tests’ option. Together with ‘--with-tests’, you also specify the directory for these tests through the ‘--tests-base’ option. Of course, you need to add this directory to the SUBDIRS variable in the Makefile.am of the parent directory.

The advantage of having the unit tests bundled is that when your program has a problem on a particular platform, running the unit tests may help determine quickly if the problem is on Gnulib’s side or on your package’s side. Also, it helps verifying Gnulib’s portability, of course.

The unit tests will be compiled and run when the user runs ‘make check’. When the user runs only ‘make’, the unit tests will not be compiled.

In the SUBDIRS variable, it is useful to put the Gnulib tests directory after the directory containing the other tests, not before:

SUBDIRS = gnulib-lib src man tests gnulib-tests

This will ensure that on platforms where there are test failures in either directory, users will see and report the failures from the tests of your program.

Note: In packages which use more than one invocation of gnulib-tool in the scope of the same configure.ac, you cannot use ‘--with-tests’. You will have to use a separate configure.ac in this case.


3.15 Avoiding unnecessary checks and compilations

In some cases, a module is needed by another module only on specific platforms. But when a module is present, its Autoconf checks are always executed, and its Makefile.am additions are always enabled. So it can happen that some Autoconf checks are executed and some source files are compiled, although no other module needs them on this particular platform, just in case some other module would need them.

The option ‘--conditional-dependencies’ enables an optimization of configure checks and Makefile.am snippets that avoids this. With this option, whether a module is considered “present” is no longer decided when gnulib-tool is invoked, but later, when configure is run. This applies to modules that were added as dependencies while gnulib-tool was run; modules that were passed on the command line explicitly are always “present”.

For example, the timegm module needs, on platforms where the system’s timegm function is missing or buggy, a replacement that is based on a function mktime_internal. The module mktime-internal that provides this function provides it on all platforms. So, by default, the file mktime-internal.c will be compiled on all platforms, even on glibc and BSD systems which have a working timegm function. When the option ‘--conditional-dependencies’ is given, on the other hand, and if mktime-internal was not explicitly required on the command line, the file mktime-internal.c will only be compiled on the platforms where the timegm needs them.

Conditional dependencies are specified in the module description by putting the condition on the same line as the dependent module, enclosed in brackets. The condition is a boolean shell expression that can assume that the configure.ac snippet from the module description has already been executed. In the example above, the dependency from timegm to mktime-internal is written like this:

Depends-on:
...
mktime-internal [test $HAVE_TIMEGM = 0 || test $REPLACE_TIMEGM = 1]
...

Note: The option ‘--conditional-dependencies’ cannot be used together with the option ‘--with-tests’. It also cannot be used when a package uses gnulib-tool for several subdirectories, with different values of ‘--source-base’, in the scope of a single configure.ac file.


4 Writing modules

This chapter explains how to write modules of your own, either to extend Gnulib for your own package (see Extending Gnulib), or for inclusion in gnulib proper.

The guidelines in this chapter do not necessarily need to be followed for using gnulib-tool. They merely represent a set of good practices. Following them will result in a good structure of your modules and in consistency with gnulib.


4.1 Source code files

Every API (C functions or variables) provided should be declared in a header file (.h file) and implemented in one or more implementation files (.c files). The separation has the effect that users of your module need to read only the contents of the .h file and the module description in order to understand what the module is about and how to use it—not the entire implementation. Furthermore, users of your module don’t need to repeat the declarations of the functions in their code, and are likely to receive notification through compiler errors if you make incompatible changes to the API (like, adding a parameter or changing the return type of a function).


4.2 Header files

The .h file should declare the C functions and variables that the module provides.

The .h file should be stand-alone. That is, it does not require other .h files to be included before. Rather, it includes all necessary .h files by itself.

It is a tradition to use CPP tricks to avoid parsing the same header file more than once, which might cause warnings. The trick is to wrap the content of the header file (say, foo.h) in a block, as in:

#ifndef FOO_H
# define FOO_H
...
body of header file goes here
...
#endif /* FOO_H */

Whether to use FOO_H or _FOO_H is a matter of taste and style. The C99 and C11 standards reserve all identifiers that begin with an underscore and either an uppercase letter or another underscore, for any use. Thus, in theory, an application might not safely assume that _FOO_H has not already been defined by a library. On the other hand, using FOO_H will likely lead the higher risk of collisions with other symbols (e.g., KEY_H, XK_H, BPF_H, which are CPP macro constants, or COFF_LONG_H, which is a CPP macro function). Your preference may depend on whether you consider the header file under discussion as part of the application (which has its own namespace for CPP symbols) or a supporting library (that shouldn’t interfere with the application’s CPP symbol namespace).

Adapting C header files for use in C++ applications can use another CPP trick, as in:

# ifdef __cplusplus
extern "C"
{
# endif
...
body of header file goes here
...
# ifdef __cplusplus
}
# endif

The idea here is that __cplusplus is defined only by C++ implementations, which will wrap the header file in an ‘extern "C"’ block. Again, whether to use this trick is a matter of taste and style. While the above can be seen as harmless, it could be argued that the header file is written in C, and any C++ application using it should explicitly use the ‘extern "C"’ block itself. Your preference might depend on whether you consider the API exported by your header file as something available for C programs only, or for C and C++ programs alike.

Note that putting a #include in an extern "C" { ... } block yields a syntax error in C++ mode on some platforms (e.g., glibc systems with g++ v3.3 to v4.2, AIX, IRIX). For this reason, it is recommended to place the #include before the extern "C" block.


4.3 Implementation files

The .c file or files implement the functions and variables declared in the .h file.

Include ordering

Every implementation file must start with ‘#include <config.h>’. This is necessary for activating the preprocessor macros that are defined on behalf of the Autoconf macros. Some of these preprocessor macros, such as _GNU_SOURCE, would have no effect if defined after a system header file has already been included.

Then comes the ‘#include "..."’ specifying the header file that is being implemented. Putting this right after ‘#include <config.h>’ has the effect that it verifies that the header file is self-contained.

Then come the system and application headers. It is customary to put all the system headers before all application headers, so as to minimize the risk that a preprocessor macro defined in an application header confuses the system headers on some platforms.

In summary:

  • First comes #include <config.h>.
  • Second comes the #include "..." specifying the module being implemented.
  • Then come all the #include <...> of system or system-replacement headers, in arbitrary order.
  • Then come all the #include "..." of gnulib and application headers, in arbitrary order.

4.4 Specification

The specification of a function should answer at least the following questions:

  • What is the purpose of the function?
  • What are the arguments?
  • What is the return value?
  • What happens in case of failure? (Exit? A specific return value? Errno set?)
  • Memory allocation policy: If pointers to memory are returned, are they freshly allocated and supposed to be freed by the caller?

Where to put the specification describing exported functions? Three practices are used in gnulib:

  • The specification can be as comments in the header file, just above the function declaration.
  • The specification can be as comments in the implementation file, just above the function definition.
  • The specification can be in texinfo format, so that it gets included in the gnulib manual.

In any case, the specification should appear in just one place, unless you can ensure that the multiple copies will always remain identical.

The advantage of putting it in the header file is that the user only has to read the include file normally never needs to peek into the implementation file(s).

The advantage of putting it in the implementation file is that when reviewing or changing the implementation, you have both elements side by side.

The advantage of texinfo formatted documentation is that it is easily published in HTML or Info format.

Currently (as of 2020), 70% of gnulib uses the first practice, 25% of gnulib uses the second practice, and a small minority uses the texinfo practice.


4.5 Module description

For the module description, you can start from an existing module’s description, or from a blank one: module/TEMPLATE for a normal module, or module/TEMPLATE-TESTS for a unit test module. Some more fields are possible but rarely used. Use module/TEMPLATE-EXTENDED if you want to use one of them.

Module descriptions have the following fields. Absent fields are equivalent to fields with empty contents.

Description

This field should contain a concise description of the module’s functionality. One sentence is enough. For example, if it defines a single function ‘frob’, the description can be ‘frob() function: frobnication.’ Gnulib’s documentation generator will automatically convert the first part to a hyperlink when it has this form.

Status

This field is either empty/absent, or contains the word ‘obsolete’. In the latter case, gnulib-tool will, unless the option --with-obsolete is given, omit it when it used as a dependency. It is good practice to also notify the user about an obsolete module. This is done by putting into the ‘Notice’ section (see below) text like ‘This module is obsolete.

Notice

This field contains text that gnulib-tool will show to the user when the module is used. This can be a status indicator like ‘This module is obsolete.’ or additional advice. Do not abuse this field.

Applicability

This field is either empty/absent, or contains the word ‘all’. It describes to which Makefile.am the module is applied. By default, a normal module is applied to source_base/Makefile.am (normally lib/Makefile.am), whereas a module ending in -tests is applied to tests_base/Makefile.am (normally tests/Makefile.am). If this field is ‘all’, it is applied to both Makefile.ams. This is useful for modules which provide Makefile.am macros rather than compiled source code.

Files

This field contains a newline separated list of the files that are part of the module. gnulib-tool copies these files into the package that uses the module.

This list is typically ordered by importance: First comes the header file, then the implementation files, then other files.

It is possible to have the same file mentioned in multiple modules. That is, if the maintainers of that module agree on the purpose and future of said file.

Depends-on

This field contains a newline separated list of the modules that are required for the proper working of this module. gnulib-tool includes each required module automatically, unless it is specified with option --avoid or it is marked as obsolete and the option --with-obsolete is not given.

A test modules foo-tests implicitly depends on the corresponding non-test module foo. foo implicitly depends on foo-tests if the latter exists and if the option --with-tests has been given.

Tests modules can depend on non-tests modules. Non-tests modules should not depend on tests modules. (Recall that tests modules are built in a separate directory.)

Each listed required module may be declared a conditional dependency. This is indicated by placing the condition for the dependency on the same line, enclosed in brackets, after the name of the required module. The condition is a shell expression that is run after the module’s configure.ac statements. For example:

strtoull   [test $ac_cv_func_strtoumax = no]

Lines starting with # are recognized as comments and are ignored.

configure.ac-early

This field contains configure.ac stuff (Autoconf macro invocations and shell statements) that are logically placed early in the configure.ac file: right after the AC_PROG_CC invocation. This section is adequate for statements that modify CPPFLAGS, as these can affect the results of other Autoconf macros.

configure.ac

This field contains configure.ac stuff (Autoconf macro invocations and shell statements).

It is forbidden to add items to the CPPFLAGS variable here, other than temporarily, as these could affect the results of other Autoconf macros.

We avoid adding items to the LIBS variable, other than temporarily. Instead, the module can export an Autoconf-substituted variable that contains link options. The user of the module can then decide to which executables to apply which link options. Recall that a package can build executables of different kinds and purposes; having all executables link against all libraries is inappropriate.

If the statements in this section grow larger than a couple of lines, we recommend moving them to a .m4 file of their own.

Makefile.am

This field contains Makefile.am statements. Variables like lib_SOURCES are transformed to match the name of the library being built in that directory. For example, lib_SOURCES may become libgnu_a_SOURCES (for a plain library) or libgnu_la_SOURCES (for a libtool library). Therefore, the normal way of having an implementation file lib/foo.c compiled unconditionally is to write

lib_SOURCES += foo.c
Include

This field contains the preprocessor statements that users of the module need to add to their source code files. Typically it’s a single include statement. A shorthand is allowed: You don’t need to write the word “#include”, just the name of the include file in the way it will appear in an include statement. Example:

"foo.h"
Link

This field contains the set of libraries that are needed when linking libraries or executables that use this module. Often this will be written as a reference to a Makefile variable. Please write them one per line, so that gnulib-tool can remove duplicates when presenting a summary to the user. Example:

$(POW_LIBM)
$(LTLIBICONV) when linking with libtool, $(LIBICONV) otherwise

When this field is omitted, it defaults to the union of the Link field of the dependencies.

License

This field specifies the license that governs the source code parts of this module. See Copyright for details. Be sure to place, in every source code file, a copyright notice and the appropriate license notice, taken from the etc/license-notices/ directory.

Maintainer

This field specifies the persons who have a definitive say about proposed changes to this module. You don’t need to mention email addresses here: they can be inferred from the ChangeLog file.

Please put at least one person here. We don’t like unmaintained modules.


4.6 Autoconf macros

For a module foo, an Autoconf macro file m4/foo.m4 is typically created when the Autoconf macro invocations for the module are longer than one or two lines.

The name of the main entry point into this Autoconf macro file is typically gl_FOO. For modules outside Gnulib that are not likely to be moved into Gnulib, please use a prefix specific to your package: gt_ for GNU gettext, cu_ for GNU coreutils, etc.

For modules that define a function foo, the entry point is called gl_FUNC_FOO instead of gl_FOO. For modules that provide a header file with multiple functions, say foo.h, the entry point is called gl_FOO_H or gl_HEADER_FOO_H. This convention is useful because sometimes a header and a function name coincide (for example, fcntl and fcntl.h).

For modules that provide a replacement, it is useful to split the Autoconf macro into two macro definitions: one that detects whether the replacement is needed and requests the replacement by setting a HAVE_FOO variable to 0 or a REPLACE_FOO variable to 1 (this is the entry point, say gl_FUNC_FOO), and one that arranges for the macros needed by the replacement code lib/foo.c (typically called gl_PREREQ_FOO). The reason of this separation is

  1. to make it easy to update the Autoconf macros when you have modified the source code file: after changing lib/foo.c, all you have to review is the Depends-on section of the module description and the gl_PREREQ_FOO macro in the Autoconf macro file.
  2. The Autoconf macros are often large enough that splitting them eases maintenance.

4.7 Making proper use of AC_LIBOBJ

Source files that provide a replacement should be only compiled on the platforms that need this replacement. While it is actually possible to compile a .c file whose contents is entirely #ifdef’ed out on the platforms that don’t need the replacement, this practice is discouraged because

  • It makes the build time longer than needed, by invoking the compiler for nothing.
  • It produces a .o file that suggests that a replacement was needed.
  • Empty object files produce a linker warning on some platforms: MSVC.

The typical idiom for invoking AC_LIBOBJ is thus the following, in the module description:

if test $HAVE_FOO = 0 || test $REPLACE_FOO = 1; then
  AC_LIBOBJ([foo])
  gl_PREREQ_FOO
fi

Important: Do not place AC_LIBOBJ invocations in the Autoconf macros in the m4/ directory. The purpose of the Autoconf macros is to determine what features or bugs the platform has, and to make decisions about which replacements are needed. The purpose of the configure.ac and Makefile.am sections of the module descriptions is to arrange for the replacements to be compiled. Source file names do not belong in the m4/ directory.

When an AC_LIBOBJ invocation is unconditional, it is simpler to just have the source file compiled through an Automake variable augmentation: In the Makefile.am section write

lib_SOURCES += foo.c

When a module description contains an AC_LIBOBJ([foo]) invocation, you must list the source file lib/foo.c in the Files section. This is needed even if the module depends on another module that already lists lib/foo.c in its Files section – because your module might be used among the test modules (in the directory specified through ‘--tests-base’) and the other module among the main modules (in the directory specified through ‘--source-base’), and in this situation, the AC_LIBOBJ([foo]) of your module can only be satisfied by having foo.c be present in the tests source directory as well.


4.8 Unit test modules

A unit test that is a simple C program usually has a module description as simple as this:

Files:
tests/test-foo.c
tests/macros.h

Depends-on:

configure.ac:

Makefile.am:
TESTS += test-foo
check_PROGRAMS += test-foo

The test program tests/test-foo.c often has the following structure:

  • First comes the obligatory ‘#include <config.h>’.
  • Second comes the include of the header file that declares the API being tested. Including it here verifies that said header file is self-contained.
  • Then come other includes. In particular, the file macros.h is often used here. It contains a convenient ASSERT macro.

The body of the test, then, contains many ASSERT invocations. When a test fails, the ASSERT macro prints the line number of the failing statement, thus giving you, the developer, an idea of which part of the test failed, even when you don’t have access to the machine where the test failed and the reporting user cannot run a debugger.

Sometimes it is convenient to write part of the test as a shell script. (For example, in areas related to process control or interprocess communication, or when different locales should be tried.) In these cases, the typical module description is like this:

Files:
tests/test-foo.sh
tests/test-foo.c
tests/macros.h

Depends-on:

configure.ac:

Makefile.am:
TESTS += test-foo.sh
TESTS_ENVIRONMENT += FOO_BAR='@FOO_BAR@'
check_PROGRAMS += test-foo

Here, the TESTS_ENVIRONMENT variable can be used to pass values determined by configure or by the Makefile to the shell script, as environment variables. The Autoconf values EXEEXT and srcdir are already provided as environment variables, through an initial value of TESTS_ENVIRONMENT that gnulib-tool puts in place.

Regardless of the specific form of the unit test, the following guidelines should be respected:

  • A test indicates success by exiting with exit code 0. It should normally not produce output in this case. (Output to temporary files that are cleaned up at the end of the test are possible, of course.)
  • A test indicates failure by exiting with an exit code different from 0 and 77, typically 1. It is useful to print a message about the failure in this case. The ASSERT macro already does so.
  • A test indicates "skip", that is, that most of its interesting functionality could not be performed, through a return code of 77. A test should also print a message to stdout or stderr about the reason for skipping. For example:
      fputs ("Skipping test: multithreading not enabled\n", stderr);
      return 77;
    

    Such a message helps detecting bugs in the autoconf macros: A simple message ‘SKIP: test-foo’ does not sufficiently catch the attention of the user.


4.9 Incompatible changes

Incompatible changes to Gnulib modules should be mentioned in Gnulib’s NEWS file. Incompatible changes here mean that existing source code may not compile or work any more.

We don’t mean changes in the binary interface (ABI), since

  1. Gnulib code is used in source-code form.
  2. The user who distributes libraries that contain Gnulib code is supposed to bump the version number in the way described in the Libtool documentation before every release.

5 Extending Gnulib

Gnulib modules are intended to be suitable for widespread use. Most problems with Gnulib can and should be fixed in a generic way, so that all of Gnulib’s users can benefit from the change. But occasionally a problem arises that is difficult or undesirable to fix generically, or a project that uses Gnulib may need to work around an issue before the Gnulib maintainers commit a final fix. Maintainers may also want to add their own pools of modules to projects as Gnulib “staging areas.”

The obvious way to make local changes to Gnulib modules is to use gnulib-tool to check out pristine modules, then to modify the results in-place. This works well enough for short-lived experiments. It is harder to keep modified versions of Gnulib modules for a long time, even though Git (or another distributed version control systems) can help out a lot with this during the development process.

Git, however, doesn’t address the distribution issue. When a package “foobar” needs a modified version of, say, stdint.in.h, it either has to put a comment into foobar/autogen.sh saying “Attention! This doesn’t work with a pristine Gnulib, you need this and that patch after checking out Gnulib,” or it has to use the ‘--avoid=stdint’ option and provide the modified stdint module in a different directory.

The --local-dir option to gnulib-tool solves this problem. It allows the package to override or augment Gnulib. This means:

In a release tarball, you can distribute the contents of this --local-dir directory that will be combinable with newer versions of Gnulib, barring incompatible changes to Gnulib.

If the --local-dir=directory option is specified, then gnulib-tool looks in directory whenever it reads a file from the Gnulib directory. Suppose gnulib-tool is looking for file. Then:

You can specify the --local-dir multiple times. In this case, the first specified directory has the highest precedence. That is, a file found in one directory will shadow any file and file.diff in the later directories and in the Gnulib directory. And a file file.diff found in one directory will be applied on top of the combination of file and file.diff files found in the later directories and in the Gnulib directory.

Please make wise use of this option. It also allows you to easily hold back modifications you make to Gnulib macros in cases it may be better to share them.


6 Miscellaneous Notes


6.1 Out of memory handling

The gnulib API does not have a standard error code for the out of memory error condition. Instead of adding a non-standard error code, gnulib has chosen to adopt a different strategy. Out of memory handling happens in rare situations, but performing the out of memory error handling after almost all API function invocations pollute your source code and might make it harder to spot more serious problems. The strategy chosen improves code readability and robustness.

For most applications, aborting the application with an error message when the out of memory situation occurs is the best that can be wished for. This is how the library behaves by default (using the ‘xalloc-die’ module).

However, we realize that some applications may not want to abort execution in any situation. Gnulib supports a hook to let the application regain control and perform its own cleanups when an out of memory situation has occurred. The application can define a function (having a void prototype, i.e., no return value and no parameters) and set the library variable xalloc_die to that function. The variable should be declared as follows.

extern void (*xalloc_die) (void);

Gnulib will invoke this function if an out of memory error occurs. Note that the function should not return. Of course, care must be taken to not allocate more memory, as that will likely also fail.


6.2 Obsolete modules

Modules can be marked obsolete. This means that the problems they fix don’t occur any more on the platforms that are reasonable porting targets now. gnulib-tool warns when obsolete modules are mentioned on the command line, and by default ignores dependencies from modules to obsolete modules. When you pass the option --with-obsolete to gnulib-tool, dependencies to obsolete modules will be included, however, unless blocked through an --avoid option. This option is useful if your package should be portable even to very old platforms.

In order to mark a module obsolete, you need to add this to the module description:

Status:
obsolete

Notice:
This module is obsolete.

6.3 Extra tests modules

Test modules can be marked with some special status attributes. When a test module has such an attribute, gnulib-tool --import will not include it by default.

The supported status attributes are:

c++-test

Indicates that the test is testing C++ interoperability. Such a test is useful in a C++ or mixed C/C++ package, but is useless in a C package.

longrunning-test

Indicates that the test takes a long time to compile or execute (more than five minutes or so). Such a test is better avoided in a release that is made for the general public.

privileged-test

Indicates that the test will request special privileges, for example, ask for the superuser password. Such a test may hang when run non-interactively and is therefore better avoided in a release that is made for the general public.

unportable-test

Indicates that the test is known to fail on some systems, and that there is no workaround about it. Such a test is better avoided in a release that is made for the general public.

gnulib-tool --import --with-tests will not include tests marked with these attributes by default. When gnulib-tool is invoked with one of the options --with-c++-tests, --with-longrunning-tests, --with-privileged-tests, --with-unportable-tests, it will include tests despite the corresponding special status attribute. When gnulib-tool receives the option --with-all-tests, it will include all tests regardless of their status attributes.

gnulib-tool --create-testdir --with-tests and gnulib-tool --create-megatestdir --with-tests by default include all tests of modules specified on the command line, regardless of their status attributes. Tests of modules occurring as dependencies are not included by default if they have one of these status attributes. The options --with-c++-tests, --with-longrunning-tests, --with-privileged-tests, --with-unportable-tests are recognized here as well. Additionally, gnulib-tool also understands the options --without-c++-tests, --without-longrunning-tests, --without-privileged-tests, --without-unportable-tests.

In order to mark a module with a status attribute, you need to add it to the module description, like this:

Status:
longrunning-test

If only a part of a test deserves a particular status attribute, you can split the module into a primary and a secondary test module, say foo-tests and foo-extra-tests. Then add a dependency from foo-tests to foo-extra-tests, and mark the foo-extra-tests with the particular status attribute.


6.4 Modules that modify the way other modules work

The normal way to design modules is that each module has its own code, and the module dependencies provide the facilities on which this code can rely. But sometimes it is necessary to use more advanced techniques. For example:

  • You may want to have optional module dependencies: Let module A use facilities provided by module B, if module B is present, but without requiring that module B is present.
  • A module can indicate support for particular behaviours. For example, Gnulib has a module ‘sigpipe’ that requests POSIX compatible SIGPIPE behaviour from all other modules – something that is not enabled by default. Or consider the ‘nonblocking’ module, that is an indicator that all I/O functions should handle non-blocking file descriptors – something that, equally, is not enabled by default.
  • A module can indicate to other modules that they can rely on certain guarantees, and thus omit specific code. For example, when Gnulib’s ‘malloc-gnu’ module is present, you can omit code that test n against zero when you call malloc (n).

Be aware that these advanced techniques likely cause breakage in the situation of multiple gnulib-tool invocations in the scope of a single configure file. This is because the question “is module B present?” does not have a unique answer in such situations. gnulib-tool has support for these techniques in the situation of --create-testdir --single-configure, which basically has two gnulib-tool invocations, one for a set of modules that end up in gllib, and one for the set of modules that end up in gltests. But you should be aware that this does not cover the general situation.

Which technique to use, depends on the answer to the question: “If my module occurs among the modules of gltests, should it have an effect on the modules in gllib?”

If the answer is “no”, your module description should invoke the Autoconf macro gl_MODULE_INDICATOR. This Autoconf macro takes one argument: the name of your module. The effect of gl_MODULE_INDICATOR([my-module]) is to define, in config.h, a C macro GNULIB_MY_MODULE that indicates whether your macro is considered to be present. This works even when your macro is used in gltests: GNULIB_MY_MODULE will then evaluate to 1 in gltests but to 0 in gllib.

If the answer is “yes”, you have two techniques available. The first one is to invoke a similar Autoconf macro, named gl_MODULE_INDICATOR_FOR_TESTS. It works similarly. However, when your macro is used in gltests, GNULIB_MY_MODULE will evaluate to 1 both in gltests and in gllib.

The second one is to define a shell variable in the configure file that tells whether your module is present, through use of m4_divert_text. The Autoconf macros of a dependency module will initialize this shell variable, through ‘m4_divert_text([DEFAULTS], [my_shell_var=no])’. The Autoconf macros of your module will override this value, through ‘m4_divert_text([INIT_PREPARE], [my_shell_var=yes])’. Then you can use my_shell_var in the Autoconf macros of both modules. You can find more details about this technique in the Gnulib module getopt-gnu.

Reminder: These techniques are advanced. They have the potential to cause lots of headaches if you apply them incorrectly.


6.5 A C++ namespace for gnulib

The function definitions provided by Gnulib (.c code) are meant to be compiled by a C compiler. The header files (.h files), on the other hand, can be used in either C or C++.

By default, when used in a C++ compilation unit, the .h files declare the same symbols and overrides as in C mode, except that functions defined by Gnulib or by the system are declared as ‘extern "C"’.

It is also possible to indicate to Gnulib to provide many of its symbols in a dedicated C++ namespace. If you define the macro GNULIB_NAMESPACE to an identifier, many functions will be defined in the namespace specified by the identifier instead of the global namespace. For example, after you have defined

#define GNULIB_NAMESPACE gnulib

at the beginning of a compilation unit, Gnulib’s <fcntl.h> header file will make available the open function as gnulib::open. The symbol open will still refer to the system’s open function, with its platform specific bugs and limitations.

The symbols provided in the Gnulib namespace are those for which the corresponding header file contains a _GL_CXXALIAS_RPL or _GL_CXXALIAS_SYS macro invocation.

The benefits of this namespace mode are:

  • Gnulib defines fewer symbols as preprocessor macros. For example, on a platform where open has to be overridden, Gnulib normally does #define open rpl_open. If your package has a class with a member open, for example a class foo with a method foo::open, then if you define this member in a compilation unit that includes <fcntl.h> and use it in a compilation unit that does not include <fcntl.h>, or vice versa, you will get a link error. Worse: You will not notice this problem on the platform where the system’s open function works fine. This problem goes away in namespace mode.
  • It provides a safety check whether the set of modules your package requests from Gnulib is sufficient. For example, if you use the function gnulib::open in your code, and you forgot to request the module ‘open’ from Gnulib, you will get a compilation error (regardless of the platform).

The drawback of this namespace mode is that the system provided symbols in the global namespace are still present, even when they contain bugs that Gnulib fixes. For example, if you call open (...) in your code, it will invoke the possibly buggy system function, even if you have requested the module ‘open’ from gnulib-tool.

You can turn on the namespace mode in some compilation units and keep it turned off in others. This can be useful if your package consists of an application layer that does not need to invoke POSIX functions and an operating system interface layer that contains all the OS function calls. In such a situation, you will want to turn on the namespace mode for the application layer—to avoid many preprocessor macro definitions—and turn it off for the OS interface layer—to avoid the drawback of the namespace mode, mentioned above.


6.6 License Texinfo sources

Gnulib provides copies of the GNU GPL, GNU LGPL, GNU Affero GPL, and GNU FDL licenses in Texinfo form. (The master location is https://www.gnu.org/licenses/). These Texinfo documents do not have any node names and structures built into them; for your manual, you should @include them in an appropriate @node.

The conventional name for the GPL node is ‘Copying’ and for the FDL ‘GNU Free Documentation License’. The LGPL doesn’t seem to have a conventional node name.

Of course the license texts themselves should not be changed at all.

The recommended way to make use of these license files, consistently with current practice, is as follows:

  • The code license (GNU GPL, GNU LGPL, or GNU Affero GPL) is usually present as a file in the top-level directory. This is true not only for the release tarballs, but also in the VCS repository. The file is typically named ‘COPYING’ for the GNU GPL, or ‘COPYING.LIB’ or ‘COPYING.LESSER’ for the GNU LGPL. The presence of this file fulfills a legal obligation; see https://www.gnu.org/licenses/gpl-faq.html#WhyMustIInclude.

    To make use of the code license in your documentation, you may request one of the modules gpl-3.0, gpl-2.0, lgpl-3.0, lgpl-2.1, agpl-3.0, through a gnulib-tool invocation. Or you may copy the relevant Texinfo file directly into your VCS repository. Both approaches are equally good. The Texinfo file changes very rarely.

  • The documentation license file (GNU FDL) is usually not present as a file in the top-level directory, because that would be ambiguous: When you use the GNU FDL, you need to specify the Invariant Sections, the Front-Cover Texts, and the Back-Cover Texts.

    To make use of this documentation license, copy the relevant Texinfo file (doc/fdl-1.3.texi) into your VCS repository. This makes sure that anyone who receives a copy of your VCS repository has also received a copy of the documentation license. In the documentation, also state what are the Invariant Sections, the Front-Cover Texts, and the Back-Cover Texts.

We recommend to place the licenses as appendices at the end of the manual, right before any indices. For the FDL, we suggest the following @menu entry:

* GNU Free Documentation License::  License for copying this manual

For any @detailmenu entries, we suggest the following:

Copying This Manual

* GNU Free Documentation License::     Copying and sharing this manual

And for actual inclusion of the FDL itself, we suggest the following:

@node GNU Free Documentation License
@appendix GNU Free Documentation License

@include fdl.texi

6.7 Building gnulib

If you wish to help the gnulib development effort with build logs for your favorite platform, you may perform these steps:

  1. Prerequisites tools

    Install the proper development tools. To build and test all of Gnulib, you will need development tools for the programming languages C, C++, Java, and Perl, along with standard POSIX utilities such as awk, make and sh. You will also need development tools that include Autoconf, Automake, Bison, Gettext, Git, GNU M4, Gperf, Libtool, and Texinfo. Some of these tools are needed only by some modules. More details can be found in Gnulib’s DEPENDENCIES file.

  2. Obtain Gnulib

    See https://www.gnu.org/software/gnulib/ for how to get the current Gnulib sources via Git.

  3. Create gnulib directory

    On a machine with GNU development tools installed and with a gnulib git checkout, use

    gnulib-tool --create-megatestdir --with-tests --dir=...
    

    Note: The created directory uses ca. 512 MB on disk.

  4. Transfer gnulib directory

    Transfer this directory to a build machine (HP-UX, Cygwin, or whatever). Often it is easier to transfer one file, and this can be achieved by running, inside the directory the following commands:

    ./configure
    make dist
    

    And then transferring the dummy-0.tar.gz file.

  5. Build modules

    On the build machine, run ./do-autobuild (or "nohup ./do-autobuild"). It creates a directory logs/ with a log file for each module.


7 Building the ISO C and POSIX Substitutes

This section shows a radically different way to use Gnulib.

You can extract the ISO C / POSIX substitutes part of gnulib by running the command

gnulib-tool --create-testdir --source-base=lib \
            --dir=/tmp/posixlib `posix-modules`

The command ‘posix-modules’ is found in the same directory as gnulib-tool.

The resulting directory can be built on a particular platform, independently of the program being ported. Then you can configure and build any program, by setting CPPFLAGS and LDFLAGS at configure time accordingly: set CPPFLAGS="-I.../posixlib/lib", plus any essential type definitions and flags that you find in .../posixlib/config.h, and set LDFLAGS=".../posixlib/lib/libgnu.a".

This way of using Gnulib is useful when you don’t want to modify the program’s source code, or when the program uses a mix between C and C++ sources (requiring separate builds of the posixlib for the C compiler and for the C++ compiler).


8 ISO C Keyword Substitutes

This chapter describes which keywords specified by ISO C are substituted by Gnulib.


8.1 alignof and alignas

Gnulib module: alignasof

The alignasof module arranges for alignas and alignof to be more like standard C.

Portability problems fixed by Gnulib:

  • Pre-C11 platforms lack alignas and alignof.
  • On pre-C23 platforms, <stdalign.h> must be included before using alignas or alignof. See stdalign.h.

Portability problems not fixed by Gnulib:

  • On pre-C23 platforms, alignas and alignof are macros.

8.2 bool

Gnulib module: stdbool

Portability problems fixed by Gnulib:

  • The keywords bool, true, and false are not available: gcc 12 and other compilers predating C23.

Portability problems not fixed by Gnulib:

  • On pre-C23 platforms, the keyword substitutes are macros.
  • On pre-C23 platforms, the keyword substitutes assume C99 or later.

8.3 nullptr

Gnulib module: nullptr

The nullptr module arranges for nullptr to act like standard C and C++.

The nullptr keyword yields a null pointer. It differs from the NULL macro, in that NULL might be an integer whereas nullptr is of a special nullptr_t type with only one value, namely nullptr itself. Using nullptr can help some compilers emit more sensible warnings, can avoid the need to cast a null pointer passed to a function prototyped with an ellipsis, and removes the need to include <stddef.h> merely to define NULL.

Portability problems fixed by Gnulib:

  • Some platforms lack nullptr: For C: GCC 12, Clang 15, and other pre-2023 C compilers. For C++: pre-2011 C++ compilers.

Portability problems not fixed by Gnulib:

  • On older platforms, nullptr is a macro instead of a keyword.
  • On older platforms, nullptr does not have the type nullptr_t. In C, it has type void *; in C++ it has an integer type.
  • On older platforms Gnulib cannot easily emulate nullptr_t, so null pointer type checking is more error prone. In C, _Generic expressions cannot reliably distinguish the type of nullptr from integer or void * types. C++ overloading has similar limitations.

8.4 static_assert

Gnulib module: assert-h

The assert-h module arranges for both static_assert and <assert.h> to be like standard C. See assert.h.

Portability problems fixed by Gnulib:

  • Pre-C11 platforms lack static_assert.
  • On pre-C23 platforms, <assert.h> must be included before using static_assert.

Portability problems not fixed by Gnulib:

  • On pre-C23 platforms, static_assert is a macro.

9 ISO C and POSIX Header File Substitutes

This chapter describes which header files specified by ISO C or POSIX are substituted by Gnulib, which portability pitfalls are fixed by Gnulib, and which (known) portability problems are not worked around by Gnulib.

The notation “Gnulib module: —” means that Gnulib does not provide a module providing a substitute for the header file. When the list “Portability problems not fixed by Gnulib” is empty, such a module is not needed: No portability problems are known. Otherwise, it indicates that such a module would be useful but is not available: No one so far found this header file important enough to contribute a substitute for it. If you need this particular header file, you may write to <bug-gnulib at gnu dot org>.


9.1 aio.h

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/aio.h.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This header file is missing on some platforms: NetBSD 3.0, OpenBSD 6.7, Minix 3.1.8, Cygwin, mingw, MSVC 14, Android 9.0.

9.2 arpa/inet.h

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/arpa_inet.h.html

Gnulib module: arpa_inet

Portability problems fixed by Gnulib:

  • This header file is missing on some platforms: mingw, MSVC 14.

Portability problems not fixed by Gnulib:


9.3 assert.h

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/assert.h.html

Gnulib module: assert-h

See also the Gnulib modules assert and verify.

Portability problems fixed by Gnulib:

  • On older C platforms <assert.h> must be included before using static_assert. For example, GCC versions before 13 do not support the static_assert keyword that was standardized by C23.
  • On older platforms static_assert does not allow the second string-literal argument to be omitted. For example, GCC versions before 9.1 do not support the single-argument static_assert that was standardized by C23 and C++17.
  • Even-older platforms do not support static_assert at all. For example, GCC versions before 4.6 and G++ versions before 4.3 do not support the two-argument form, which was standardized by C11 and C++11.
  • Older C platforms might not support the obsolescent _Static_assert keyword or macro. This portability problem should not matter with code using this module, as such code should use static_assert instead.

Portability problems not fixed by Gnulib:

  • A static_assert can also be used within a struct or union specifier, in place of an ordinary declaration of a member of the struct or union. The Gnulib substitute can be used only as an ordinary declaration in code intended to be portable to C99 or earlier.
  • In C23 and C++11 and later, static_assert is a keyword. In C11 and C17 it is a macro. Any Gnulib substitute is also a macro.
  • In C99 and later, assert can be applied to any scalar expression. In C89, the argument to assert is of type int.

9.4 complex.h

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/complex.h.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This header file is missing on some platforms: NetBSD 3.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Cygwin 1.7.7, mingw, MSVC 9.

9.5 cpio.h

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/cpio.h.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This header file is missing on some platforms: Minix 3.1.8, Cygwin 2.4.x, mingw, MSVC 14.

9.6 ctype.h

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/ctype.h.html

Gnulib module: ctype

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:


9.7 dirent.h

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/dirent.h.html

Gnulib module: dirent

Portability problems fixed by Gnulib:

  • This header file is missing on some platforms: MSVC 14.
  • The type ino_t is missing on some platforms: glibc 2.23 and others.

Portability problems not fixed by Gnulib:

  • Although many systems define a struct dirent member named d_type and directory entry type macros like DT_DIR and DT_LNK, some do not: Minix 3.1.8, AIX 7.2, HP-UX 11, IRIX 6.5, Solaris 11.4, mingw.
  • On systems with d_type, not every filesystem supports d_type, and those lacking support will set it to DT_UNKNOWN.
  • Some systems define a struct dirent member named d_namlen containing the string length of d_name, but others do not: glibc 2.23 on Linux, Minix 3.1.8, Solaris 11.4, Cygwin. All of these, except Cygwin, have a member d_reclen instead, that has a different semantics.
  • Some systems define a struct dirent member named d_off containing a magic cookie suitable as an argument to seekdir, but others do not: glibc 2.23 on Hurd, macOS 11.1, FreeBSD 11.0, NetBSD 9.0, OpenBSD 6.7, AIX 5.1, HP-UX 11, Cygwin, mingw.
  • Some systems define a struct dirent member named d_reclen containing the number of bytes in the directory entry record, but others do not. This member has limited utility, as it is an implementation detail.

9.8 dlfcn.h

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/dlfcn.h.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This header file is missing on some platforms: Minix 3.1.8, mingw, MSVC 14.

9.9 errno.h

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/errno.h.html

Gnulib module: errno

Portability problems fixed by Gnulib:

  • The macro EOVERFLOW is not defined on some platforms: OpenBSD 4.0, mingw, MSVC 9.
  • The macro ENOLINK is not defined on some platforms: OpenBSD 6.7, mingw, MSVC 9.
  • The macro EMULTIHOP is not defined on some platforms: OpenBSD 6.7, mingw, MSVC 14.
  • The macro ECANCELED is not defined on some platforms: OpenBSD 4.0, Cygwin, mingw, MSVC 9.
  • The macros ENOMSG, EIDRM, EPROTO, EBADMSG, ENOTSUP are not defined on some platforms: OpenBSD 4.0, mingw, MSVC 9.
  • The macro ESTALE is not defined on some platforms: mingw, MSVC 14.
  • The macro EDQUOT is not defined on some platforms: NonStop Kernel, mingw, MSVC 14.
  • The macros ENETRESET, ECONNABORTED are not defined on some platforms: Minix 3.1.8, mingw, MSVC 9.
  • The macros EWOULDBLOCK, ETXTBSY, ELOOP, ENOTSOCK, EDESTADDRREQ, EMSGSIZE, EPROTOTYPE, ENOPROTOOPT, EPROTONOSUPPORT, EOPNOTSUPP, EAFNOSUPPORT, EADDRINUSE, EADDRNOTAVAIL, ENETDOWN, ENETUNREACH, ECONNRESET, ENOBUFS, EISCONN, ENOTCONN, ETIMEDOUT, ECONNREFUSED, EHOSTUNREACH, EALREADY, EINPROGRESS are not defined on some platforms: mingw, MSVC 9.
  • The macros EOWNERDEAD, ENOTRECOVERABLE are not defined on some platforms: glibc/Linux 2.3.6, glibc/Hurd 2.15, glibc/kFreeBSD 2.15, Mac OS X 10.5, FreeBSD 6.0, NetBSD 9.0, OpenBSD 6.0, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Cygwin, mingw without pthreads-win32, MSVC 9.
  • The macro EILSEQ is not defined on some platforms: LynxOS 178 2.2.2.

Portability problems not fixed by Gnulib:


9.10 fcntl.h

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/fcntl.h.html

Gnulib module: fcntl-h

Portability problems fixed by Gnulib:

  • The type pid_t is not defined on some platforms: MSVC 14.
  • The type mode_t is not defined on some platforms: MSVC 14.
  • O_CLOEXEC’ is not defined on some platforms: Mac OS X 10.6, FreeBSD 8.4, NetBSD 5.1, OpenBSD 4.9, Minix 3.1.8, AIX 7.1, HP-UX 11.31, IRIX 6.5, Solaris 10, Cygwin 1.7.1, mingw, MSVC 14.
  • O_DIRECTORY’, ‘O_DSYNC’, ‘O_NOCTTY’, ‘O_NOFOLLOW’, ‘O_RSYNC’, ‘O_SYNC’, and ‘O_TTY_INIT’ are not defined on some platforms. When not otherwise defined, Gnulib defines these macros to 0, which is generally safe.
  • O_NONBLOCK’ is not defined on some platforms. If the ‘nonblocking’ module is in use, gnulib guarantees a working non-zero value; otherwise, the gnulib replacement is 0.
  • O_EXEC’ and ‘O_SEARCH’ are not defined on some platforms. Gnulib defines these macros to ‘O_RDONLY’, which is typically 0. The ‘O_PATH’ macro of GNU/Linux is not a suitable substitute, as fchmod fails with ‘errno==EBADF’ when invoked on a file descriptor that was opened with ‘O_PATH’.
  • O_ACCMODE’ is not defined on some platforms: MSVC 14.
  • The ‘O_ACCMODE’ mask mistakenly omits ‘O_SEARCH’ and ‘O_EXEC’ on some platforms: Cygwin.
  • O_BINARY’, ‘O_TEXT’ (not specified by POSIX, but essential for portability to native Windows platforms) are defined on some platforms but not on others. Gnulib defines these macros to 0 on GNU and other platforms that do not distinguish between text and binary I/O.
  • O_CLOEXEC’, ‘O_NOFOLLOW’, and ‘O_TTY_INIT’ are defined to values that are too large for an int on some platforms: AIX 7.1 with XL C 12.1.
  • O_DIRECT’, ‘O_IGNORE_CTTY’, ‘O_NDELAY’, ‘O_NOATIME’, ‘O_NOLINK’, ‘O_NOLINKS’, and ‘O_NOTRANS’ (not specified by POSIX) are defined on some platforms but not on others. When not otherwise defined, Gnulib defines these macros to 0, which is generally safe.
  • FD_CLOEXEC’, ‘F_DUPFD’, and ‘F_GETFD’ are not defined on some platforms: mingw, MSVC 14.
  • F_DUPFD_CLOEXEC’ is not defined on some platforms: Mac OS X 10.5, FreeBSD 6.0, NetBSD 5.0, OpenBSD 6.7, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 11 2010-11, Cygwin 1.7.1, mingw, MSVC 14.
  • AT_FDCWD’, ‘AT_EACCESS’, ‘AT_SYMLINK_NOFOLLOW’, ‘AT_SYMLINK_FOLLOW’, and ‘AT_REMOVEDIR’ are not defined on many platforms: glibc 2.3.6, Mac OS X 10.5, FreeBSD 6.0, NetBSD 5.0, OpenBSD 6.7, AIX 5.1, HP-UX 11, IRIX 6.5, Cygwin 1.5.x, mingw, MSVC 14.
  • AT_FDCWD’ is defined with a value too large for an int on some platforms: Solaris 11.3.

Portability problems not fixed by Gnulib:

  • O_PATH’ is not defined on some platforms: glibc 2.13, macOS 13, FreeBSD 13.0, NetBSD 9.2, OpenBSD 7.1, Minix 3.3.0, AIX 7.3, HP-UX 11.31, IRIX 6.5, Solaris 11.4, Cygwin 2.9, mingw, MSVC 14.
  • F_SETFD’, ‘F_GETFL’, ‘F_SETFL’, ‘F_GETLK’, ‘F_SETLK’, ‘F_SETLKW’, ‘F_GETOWN’, and ‘F_SETOWN’ are not defined on some platforms: mingw, MSVC 14.
  • POSIX_FADV_DONTNEED’, ‘POSIX_FADV_NOREUSE’, ‘POSIX_FADV_NORMAL’, ‘POSIX_FADV_RANDOM’, ‘POSIX_FADV_SEQUENTIAL’, and ‘POSIX_FADV_WILLNEED’ are not defined on some platforms.

9.11 fenv.h

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/fenv.h.html

Gnulib module: fenv

Portability problems fixed by Gnulib:

  • This header file is missing on some platforms: FreeBSD 5.2.1, NetBSD 5.0, OpenBSD 3.8, AIX 5.1, IRIX 6.5, Cygwin 1.7.7, MSVC 9.

Portability problems not fixed by Gnulib:

  • On MSVC, the values of the rounding direction macros have changed: In MSVC 14, FE_UPWARD is 0x100 and FE_DOWNWARD is 0x200, whereas in MSVC 14.30, it’s the opposite.

9.12 float.h

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/float.h.html

Gnulib module: float

Portability problems fixed by Gnulib:

  • The conversion from int to long double in incorrect on some platforms: glibc 2.7 on Linux/SPARC64.
  • The values of LDBL_* macros are incorrect on some platforms: On OpenBSD 4.0 and MirBSD 10, they are the same as the values of the DBL_* macros, although ‘long double’ is a larger type than ‘double’. On FreeBSD/x86 6.4, they represent the incorrect 53-bit precision assumptions in the compiler, not the real 64-bit precision at runtime. On Linux/PowerPC with GCC 4.4, on AIX 7.1 with GCC 4.2, and on IRIX 6.5, they don’t reflect the “double double” representation of long double correctly.

Portability problems not fixed by Gnulib:

  • The macro FLT_ROUNDS is a constant expression and does not represent the current rounding mode on some platforms: glibc 2.11, HP-UX 11, mingw.

9.13 fmtmsg.h

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/fmtmsg.h.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This header file is missing on some platforms: OpenBSD 6.7, Minix 3.1.8, Cygwin, mingw, MSVC 14, Android 9.0.

9.14 fnmatch.h

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/fnmatch.h.html

Gnulib module: fnmatch-h, fnmatch-gnu

Portability problems fixed by Gnulib module fnmatch-h:

  • This header file is missing on some platforms: mingw, MSVC 14.

Portability problems fixed by Gnulib module fnmatch-gnu, together with module fnmatch-h:

  • The macros FNM_LEADING_DIR and FNM_CASEFOLD are not defined on some platforms: AIX 7.2, HP-UX 11.31, IRIX 6.5, Solaris 10.
  • The macro FNM_EXTMATCH is not defined on all non-glibc platforms: musl libc, macOS 12.5, FreeBSD 14.0, NetBSD 9.3, OpenBSD 7.2, Minix 3.3, AIX 7.2, HP-UX 11.31, IRIX 6.5, Solaris 11.4, Cygwin 3.4.6, Android 13.
  • The macro FNM_FILE_NAME is not defined on some platforms: NetBSD 9.3, AIX 7.2, HP-UX 11.31, IRIX 6.5, Solaris 10.

Portability problems not fixed by Gnulib:


9.15 ftw.h

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/ftw.h.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This header file is missing on some platforms: FreeBSD 5.2.1, NetBSD 3.0, Minix 3.1.8, mingw, MSVC 14.

9.16 glob.h

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/glob.h.html

Gnulib module: glob-h

Portability problems fixed by Gnulib:

  • This header file is missing on some platforms: mingw, MSVC 14.

Portability problems not fixed by Gnulib:


9.17 grp.h

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/grp.h.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This header file is missing on some platforms: mingw, MSVC 14.

9.18 iconv.h

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/iconv.h.html

Gnulib module: iconv

Portability problems fixed by Gnulib:

  • The <iconv.h> from GNU libiconv is not found if installed in $PREFIX/include.

Portability problems not fixed by Gnulib:

  • This header file is missing on some platforms: FreeBSD 6.0, OpenBSD 6.7, Minix 3.1.8, mingw, MSVC 14, when GNU libiconv is not installed.

9.19 inttypes.h

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/inttypes.h.html

Gnulib module: inttypes

Portability problems fixed by Gnulib:

  • This header file is missing on some platforms: MSVC 9.
  • This header file is very incomplete on some platforms.
  • The declarations of imaxabs and imaxdiv are missing on some platforms: NetBSD 3.0, OpenBSD 6.7, AIX 5.1, HP-UX 11, IRIX 6.5.
  • The declarations of strtoimax and strtoumax are missing on some platforms: OpenBSD 6.7, AIX 5.1 (missing only strtoumax).
  • On some hosts that predate C++11, when using C++ one must define __STDC_FORMAT_MACROS to make visible the declarations of format macros such as PRIdMAX.

Portability problems not fixed by Gnulib:


9.20 iso646.h

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/iso646.h.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This header file is missing on some platforms: Minix 3.1.8, HP-UX 11.00, IRIX 6.5, Cygwin, mingw.

9.21 langinfo.h

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/langinfo.h.html

Gnulib module: langinfo

Portability problems fixed by Gnulib:

  • This header file is missing on some platforms: Minix 3.1.8, mingw, MSVC 14.
  • The constant CODESET is not defined on some platforms: OpenBSD 6.7.
  • The constants ALTMON_1 to ALTMON_12 are not defined on some platforms: glibc 2.26, musl libc, macOS 11.1, NetBSD 8.0, OpenBSD 6.5, AIX 7.2, HP-UX 11.31, IRIX 6.5, Solaris 11.4, Haiku, Cygwin 2.9.
  • The constants ERA, ERA_D_FMT, ERA_D_T_FMT, ERA_T_FMT, ALT_DIGITS are not defined on some platforms: OpenBSD 6.7.

Portability problems not fixed by Gnulib:


9.22 libgen.h

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/libgen.h.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This header file is missing on some platforms: mingw, MSVC 14.

The Gnulib module dirname provides similar API, with functions base_name and dir_name that also work with Windows file names.


9.23 limits.h

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/limits.h.html

Gnulib module: limits-h or gethostname

Portability problems fixed by Gnulib module limits-h:

  • The macros LLONG_MIN, LLONG_MAX, ULLONG_MAX are not defined on some platforms: older glibc systems (e.g. Fedora 1), AIX 5.1, HP-UX 11, IRIX 6.5, OpenVMS.
  • The macro MB_LEN_MAX is not defined on some platforms: pcc 1.2.0.DEVEL 20220331.
  • The macros WORD_BIT, LONG_BIT are not defined on some platforms: glibc 2.11 without -D_GNU_SOURCE, Cygwin, mingw, MSVC 14.
  • Macros like CHAR_WIDTH are not defined on some platforms: glibc 2.24, NetBSD 9.0, many others.
  • The macros BOOL_MAX and BOOL_WIDTH are not defined on some platforms: glibc 2.32, many others.
  • The macro BOOL_MAX is not defined with some compilers: clang 15.0.6.
  • The macro SSIZE_MAX is not defined on some platforms: MSVC 14.

Portability problems fixed by Gnulib module gethostname:

  • The HOST_NAME_MAX macro is not defined on some platforms: macOS 11.1, FreeBSD 14.0, NetBSD 9.0, OpenBSD 6.7, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 11.4, Cygwin 1.5.x, mingw, MSVC 14.

Portability problems not fixed by Gnulib:

  • The macro SSIZE_MAX has the wrong type, albeit with the correct value: 32-bit glibc 2.24 (on some architectures), Cygwin 2.5.2.

For PATH_MAX, Gnulib provides a module pathmax with a header file "pathmax.h". It defines PATH_MAX to a constant on platforms with a file name length limit.


9.24 locale.h

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/locale.h.html

Gnulib module: locale

Portability problems fixed by Gnulib:

  • The definition of ‘LC_MESSAGES’ is missing on some platforms: mingw, MSVC 14.
  • The locale_t type is not defined on some platforms: glibc 2.11, macOS 11.1.
  • The struct lconv type does not contain any members on some platforms: Android up to 2014.
  • The struct lconv type does not contain the members int_p_cs_precedes, int_p_sign_posn, int_p_sep_by_space, int_n_cs_precedes, int_n_sign_posn, int_n_sep_by_space on some platforms: glibc, OpenBSD 4.9, HP-UX 11, IRIX 6.5, Solaris 11.4, Cygwin 1.5.x, mingw, MSVC 14.
  • Some platforms provide a NULL macro that cannot be used in arbitrary expressions: NetBSD 5.0

Portability problems not fixed by Gnulib:


9.25 math.h

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/math.h.html

Gnulib module: math

Portability problems fixed by Gnulib:

  • The conversion from int to long double in incorrect on some platforms: glibc 2.7 on Linux/SPARC64.
  • The macro NAN is not defined on some platforms: OpenBSD 4.0, AIX 5.1, IRIX 6.5.
  • The macro NAN is not exposed outside of C99 compilation on some platforms: glibc.
  • The macros NAN and HUGE_VAL expand to a function address rather than a floating point constant on some platforms: Solaris 10.
  • The macros HUGE_VALF and HUGE_VALL are not defined on some platforms: glibc/HPPA, glibc/SPARC, AIX 5.1, IRIX 6.5, Solaris 9, MSVC 9.
  • The macros FP_ILOGB0 and FP_ILOGBNAN are not defined on some platforms: NetBSD 5.1, AIX 5.1, IRIX 6.5, Solaris 9, MSVC 9.
  • The macros FP_ILOGB0 and FP_ILOGBNAN have wrong values on some platforms: Haiku 2022.
  • The macros NAN, HUGE_VALL, and INFINITY are not defined on some platforms: OpenVMS.

Portability problems not fixed by Gnulib:

  • NAN is not a compile time constant with some compilers: OpenVMS.
  • The macro or variable math_errhandling is not defined on some platforms: glibc 2.11, OpenBSD 4.9, NetBSD 5.1, UP-UX 11, IRIX 6.5, Cygwin 1.7.9, mingw, MSVC 9.

9.26 monetary.h

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/monetary.h.html

Gnulib module: monetary

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This header file is missing on some platforms: NetBSD 3.0, OpenBSD 6.7, Minix 3.1.8, Cygwin 1.7.1, mingw, MSVC 14, Android 9.0.
  • This header file has a syntax error in C++ mode on some platforms: NetBSD 8.0.

9.27 mqueue.h

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/mqueue.h.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This header file is missing on some platforms: macOS 11.1, FreeBSD 6.0, NetBSD 3.0, OpenBSD 6.7, Minix 3.1.8, Cygwin 1.5.x, mingw, MSVC 14, Android 9.0.

9.28 ndbm.h

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/ndbm.h.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This header file is missing on some platforms: mingw, MSVC 14, Android 9.0.

9.29 net/if.h

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/net_if.h.html

Gnulib module: net_if

Portability problems fixed by Gnulib:

  • This header file is missing on some platforms: mingw, MSVC 14.
  • This header file is not self-contained on some platforms (needing <sys/socket.h> to be included first): Mac OS X 10.5, FreeBSD 8.2, OpenBSD 5.2.

Portability problems not fixed by Gnulib:


9.30 netdb.h

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/netdb.h.html

Gnulib module: netdb

Portability problems fixed by Gnulib:

  • This header file is missing on some platforms: mingw, MSVC 14.
  • This header file is incomplete on some platforms: Cygwin 1.5.x, Haiku.
  • This header file does not define the type socklen_t on some platforms: IRIX 6.5.
  • This header file does not define AI_ALL, AI_V4MAPPED on some platforms: NetBSD 9.0.
  • This header file does not define AI_ADDRCONFIG on some platforms: NetBSD 5.0.

Portability problems not fixed by Gnulib:


9.31 netinet/in.h

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/netinet_in.h.html

Gnulib module: netinet_in

Portability problems fixed by Gnulib:

  • This header file is missing on some platforms: mingw, MSVC 14.
  • This header file is not self-contained on some platforms (it requires <sys/types.h> to be included first): OpenBSD 4.6.

Portability problems not fixed by Gnulib:


9.32 netinet/tcp.h

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/netinet_tcp.h.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This header file is missing on some platforms: mingw, MSVC 14.

9.33 nl_types.h

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/nl_types.h.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This header file is missing on some platforms: Minix 3.1.8, Cygwin, mingw, MSVC 14, Android 9.0.

9.34 poll.h

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/poll.h.html

Gnulib module: poll-h

Portability problems fixed by Gnulib:

  • This header file is missing on some platforms: mingw, MSVC 14.

Portability problems not fixed by Gnulib:


9.35 pthread.h

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/pthread.h.html

Gnulib module: pthread-h

Portability problems fixed by Gnulib:

  • This header file is missing on some platforms. Minix 3.1.8, mingw 2.x, MSVC 14. But the provided replacement covers only the essential POSIX threads API. Furthermore it is just a dummy on some of these platforms: Minix 3.1.8.
  • This header pollutes the namespace with some broken macro implementations for various functions such as strtok_r and gmtime_r: mingw 3.0.

Portability problems not fixed by Gnulib:

  • This header file lacks the declaration of pthread_atfork on some platforms: IRIX 6.5.

9.36 pwd.h

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/pwd.h.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This header file is missing on some platforms: mingw, MSVC 14.

9.37 regex.h

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/regex.h.html

Gnulib module: regex

Portability problems fixed by Gnulib:

  • This header file is missing on some platforms: mingw, MSVC 14.

Portability problems not fixed by Gnulib:

  • This header file is not self-contained on some platforms: it requires <sys/types.h> to be included first.

9.38 sched.h

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sched.h.html

Gnulib module: sched

Portability problems fixed by Gnulib:

  • This header file is missing on some platforms: Minix 3.1.8, mingw, MSVC 14.
  • This header file does not define the type pid_t on some platforms: glibc 2.11, macOS 11.1.
  • struct sched_param is not defined on some platforms: Haiku.
  • SCHED_FIFO, SCHED_RR, SCHED_OTHER are not defined on some platforms: Haiku.

Portability problems not fixed by Gnulib:


9.39 search.h

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/search.h.html

Gnulib module: search

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This header file is missing on some platforms: Minix 3.1.8.

9.40 semaphore.h

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/semaphore.h.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This header file is missing on some platforms: Minix 3.1.8, mingw, MSVC 14.

9.41 setjmp.h

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/setjmp.h.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:


9.42 signal.h

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/signal.h.html

Gnulib module: signal-h

Portability problems fixed by Gnulib:

  • volatile sig_atomic_t is rejected by older compilers on some platforms: AIX.
  • sigset_t is missing on some platforms: MSVC 14.
  • sigset_t is only declared in <sys/types.h> on some platforms: mingw.
  • struct sigaction and siginfo_t are missing on some platforms: mingw, MSVC 14.
  • The type pid_t is not defined on some platforms: MSVC 14.
  • The signal SIGPIPE is not defined on some platforms: mingw, MSVC 14.
  • The macros SA_RESETHAND and SA_RESTART are not defined on some platforms: NonStop.
  • The type sighandler_t (a GNU extension) is not defined on most non-glibc platforms: macOS 11.1, FreeBSD 14.0, NetBSD 9.0, OpenBSD 6.7, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 11.4, Cygwin, mingw, MSVC 14.

Portability problems not fixed by Gnulib:

  • Many signals are not defined on some platforms: mingw, MSVC 14.
  • The macro SIGBUS is set to the same value as SIGSEGV, rather than being a distinct signal, on some platforms: Haiku.

9.43 spawn.h

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/spawn.h.html

Gnulib module: spawn

Portability problems fixed by Gnulib:

  • This header file is missing on some platforms: FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Cygwin 1.7.25, mingw, MSVC 14.

Portability problems not fixed by Gnulib:


9.44 stdalign.h

POSIX specification:
Not in POSIX yet, but we expect it will be, at least temporarily until it becomes obsolete due to its phasing out starting in C23. ISO C23 (latest free draft http://www.open-std.org/jtc1/sc22/wg14/www/docs/n3047.pdf) sections 6.5.3.4, 6.7.5, 7.15. C++11 (latest free draft http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n3242.pdf) section 18.10.

Gnulib module: alignasof

Portability problems fixed by Gnulib:

  • On older C platforms <stdalign.h> must be included before using alignas or alignof. For example, GCC versions before 13 do not support these keywords, which were standardized by C23. On C23 and later platforms, <stdalign.h> has no effect and need not be included. (Gnulib-using code should not include <stdalign.h> without also employing Gnulib’s now-deprecated stdalign module.)
  • This header file is missing on many platforms: FreeBSD 6.4, NetBSD 7.1, OpenBSD 6.7, Minix 3.3.0, AIX 7.1, HP-UX 11.31, IRIX 6.5, Solaris 11.3, mingw, MSVC 14, Android 9.0.
  • Clang 3.0’s <stdalign.h> does not define alignof.
  • The alignof macro returns too large values for the types double and long long in GCC 4.7.0.
  • Older C platforms might not support the obsolescent _Alignas and _Alignof keywords or macros. This portability problem should not matter with code using this module, as such code should use alignas and alignof instead.
  • In C11 and C17, <stdalign.h> defines the macros __alignas_is_defined and __alignof_is_defined to 1. In C23, these macros are not defined. This portability problem should not matter with code using Gnulib’s alignasof module, as such code should use alignas and alignof without checking these two macros. (Gnulib’s now-deprecated stdalign module defines these two macros.)

Portability problems not fixed by Gnulib:

  • In C11 and later, the operand of alignof must be a parenthesized type. Recent versions of GCC support an extension in which the operand can also be a unary expression, as with sizeof. The Gnulib substitute does not support this extension.
  • On most pre-C11 platforms, the operand of alignof cannot be a structure type containing a flexible array member.
  • The alignas keyword or macro is not always supported. Supported compilers include any compiler supporting C11 or later, which includes GCC, IBM C, Sun C 5.9 and later, and MSVC 7.0 and later.
  • Some compilers do not support alignment via alignas of auto variables (i.e., variables on the stack). They diagnose and ignore the alignment: Sun C 5.11.
  • Some linkers do not support operands of alignas that are greater than 8: mingw.
  • Some compilers require the operand of alignas to be a single integer constant, not an expression: MSVC 7.0 through at least 10.0.
  • The Sun C 5.13 (2014) compiler sometimes mishandles the alignment of multiple external variables that are declared close together with alignas. The bug is fixed in Sun C 5.15, also known as Oracle Developer Studio 12.6 (2017).
  • You cannot assume that alignas and alignof are reserved words; they might be macros.

9.45 stdarg.h

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/stdarg.h.html

Gnulib module: stdarg

Portability problems fixed by Gnulib:

  • Some compilers (e.g., AIX 5.3 cc) need to be in c99 mode for the builtin va_copy to work.

Portability problems not fixed by Gnulib:


9.46 stdatomic.h

POSIX specification:
Not in POSIX yet, but we expect it will be. ISO C11 (latest free draft http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf) section 7.17.

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This header file is missing on many platforms: glibc with GCC 4.8.x or clang 2.8, FreeBSD 6.4, NetBSD 7.0, OpenBSD 6.5, OpenBSD 6.9 with gcc, Minix 3.3.0, AIX 7.2 with xlc or xlclang, HP-UX 11.31, IRIX 6.5, Solaris 11.3 with Oracle Studio 12.4 (Sun C 5.13), Cygwin 1.5.19, mingw, MSVC 14.
  • Linus Torvalds believes that “no compiler writer will get the C/C++ memory model right”; see https://lkml.org/lkml/2018/6/7/761.

9.47 stdbool.h

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/stdbool.h.html

Gnulib module: stdbool-c99

The stdbool-c99 module is present only for programs that formerly used the old stdbool module for C99 compatibility, and that for some reason cannot use the current stdbool module for C23 compatibility.

Portability problems fixed by Gnulib:

  • This header file is missing on some platforms: AIX 5.1, HP-UX 11, IRIX 6.5.
  • This header file is not usable in C++ mode with the vendor compiler on Solaris 10.
  • Some compilers have bugs relating to ‘bool’.
  • This header file defines true incorrectly on some platforms: OpenBSD 4.7 with gcc 2.95.

Portability problems not fixed by Gnulib:

  • _Bool’ cannot be used before <stdbool.h> is included, or if the program is intended to be compiled by a C++ compiler. (With the advent of C23, ‘_Bool’ is obsolescent anyway.)
  • You cannot assume that _Bool is a typedef; it might be a macro. For example, C23 allows _Bool to be a macro.
  • Bit-fields of type ‘bool’ are not supported. Portable code should use ‘unsigned int foo : 1;’ rather than ‘bool foo : 1;’.
  • Casts and automatic conversions to ‘bool’ don’t test against the zero value or the null pointer, as they should. Such casts should only be used if the value is known to be equal to 0 or 1.
  • You cannot assume that casting a floating point literal to ‘bool’ will result in a constant expression.

9.48 stdckdint.h

POSIX specification:
Not in POSIX yet, but we expect it will be. ISO draft C23 (https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3047.pdf) section 7.20.

Gnulib module: stdckdint

Portability problems fixed by Gnulib:

  • This header file is missing on many platforms: glibc 2.29, macOS 11.1, FreeBSD 13.2, NetBSD 9.0, OpenBSD 6.7, Minix 3.3.0, AIX 7.3.1, HP-UX 11.31, IRIX 6.5, Solaris 11.4, Cygwin 2.9.0, mingw, MSVC 14, Android 9.0.

Portability problems not fixed by Gnulib:

  • In draft C23, arguments of stdckdint.h macros can have side effects.

9.49 stddef.h

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/stddef.h.html

Gnulib module: stddef

Portability problems fixed by Gnulib:

  • Some platforms fail to provide unreachable, which was added in C23: GCC 13, clang 15, AIX with xlc 12.1, Solaris with Sun C 5.15, and others.
  • Some platforms fail to provide max_align_t, which was added in C11: NetBSD 8.0, Solaris 11.0, and others.
  • max_align_t does not have the expected alignment on some platforms: NetBSD 8.0/x86, AIX 7.2 with xlc in 64-bit mode.
  • Some old platforms fail to provide wchar_t.
  • Some platforms provide a NULL macro that cannot be used in arbitrary expressions: NetBSD 5.0
  • Some platforms provide a NULL macro whose value does not have the size of a pointer: AIX 7.2 with xlc in 64-bit mode.
  • When this header file is provided by TinyCC 0.9.27 on glibc or macOS systems, it does not fulfil the expectations of other system header files.

Portability problems not fixed by Gnulib:

  • Some platforms fail to provide nullptr_t, which Gnulib cannot usefully emulate: GCC 12, Clang 15, and other pre-2023 C compilers.
  • Some platforms provide an offsetof macro that cannot be used in arbitrary expressions: Solaris 11.4 This problem can be worked around by parenthesizing the offsetof expression in the unlikely case you use it with sizeof or ‘[]’.

9.50 stdint.h

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/stdint.h.html

Gnulib module: stdint

Portability problems fixed by Gnulib:

  • This header file is missing on some platforms: OpenBSD 3.8, AIX 5.1, HP-UX 11.11, IRIX 6.5, MSVC 9.
  • This header file is very incomplete on some platforms.
  • The values of SIG_ATOMIC_MIN and SIG_ATOMIC_MAX are incorrect on some platforms: FreeBSD 6.2/ia64, FreeBSD 13.0/arm64.
  • The value of WINT_MAX is incorrect on some platforms: mingw.
  • The values of INT8_MAX, UINT8_MAX etc. are not usable in preprocessor expressions on some platforms: HP-UX 11.23.
  • The values of INTPTR_MAX and UINTPTR_MAX, although correctly defined in <stdint.h>, are replaced by empty values when <limits.h> or <inttypes.h> gets included later on some platforms: Solaris 9 with GCC 4.5 or newer.
  • The macros WCHAR_MIN and WCHAR_MAX are not defined in <stdint.h> (only in <wchar.h>) on some platforms: Dragonfly.
  • On some hosts that predate C++11, when using C++ one must define __STDC_CONSTANT_MACROS to make visible the definitions of constant macros such as INTMAX_C, and one must define __STDC_LIMIT_MACROS to make visible the definitions of limit macros such as INTMAX_MAX.
  • The macro SIZE_MAX has the wrong type, albeit with the correct value: 32-bit glibc 2.24 (on s390 architecture), Mac OS X 10.7.
  • Macros like INTMAX_WIDTH are not defined on some platforms: glibc 2.24, NetBSD 9.0, many others.

Portability problems not fixed by Gnulib:

  • {uint,int}_fast{8,16,32,64}_t may not correspond to the fastest types available on the system. Other <stdint.h> substitutes may define these types differently, so public header files should avoid these types.
  • Macros are used instead of typedefs.
  • Some C preprocessors mishandle constants that do not fit in long int. For example, as of 2007, Sun C mishandled #if LLONG_MIN < 0 on a platform with 32-bit long int and 64-bit long long int; this bug was fixed on or before Oracle Developer Studio 12.6 (Sun C 5.15 SunOS_sparc 2017/05/30). Some older preprocessors mishandle constants ending in LL. To work around these problems, compute the value of expressions like LONG_MAX < LLONG_MAX at configure-time rather than at #if-time.

The stdint module uses #include_next. If you wish to install the generated stdint.h file under another name, typically in order to be able to use some of the types defined by stdint.h in your public header file, you could use the following Makefile.am-snippet:


BUILT_SOURCES += idn-int.h
DISTCLEANFILES += idn-int.h
nodist_include_HEADERS += idn-int.h

idn-int.h:
	if test -n "$(STDINT_H)"; then \
		sed -e s/include_next/include/ gl/stdint.h > idn-int.h; \
	else \
		echo '#include <stdint.h>' > idn-int.h; \
	fi

9.51 stdio.h

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/stdio.h.html

Gnulib module: stdio

Portability problems fixed by Gnulib:

  • The type off_t is missing on some platforms: glibc 2.8, eglibc 2.11.2 and others.
  • The type ssize_t is missing on some platforms: glibc 2.8, Mac OS X 10.5, Solaris 10, MSVC 14, and others.
  • The type va_list is missing on some platforms: glibc 2.8, OpenBSD 4.0, Solaris 11.4, and others.
  • Some platforms provide a NULL macro that cannot be used in arbitrary expressions: NetBSD 5.0

Portability problems not fixed by Gnulib:


9.52 stdlib.h

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/stdlib.h.html

Gnulib module: stdlib, system-posix

Portability problems fixed by the Gnulib module stdlib:

  • The macros EXIT_SUCCESS and EXIT_FAILURE are not defined on some platforms.
  • Some platforms provide a NULL macro that cannot be used in arbitrary expressions: NetBSD 5.0
  • The value of MB_CUR_MAX is too small (3 instead of 4) in UTF-8 locales on some platforms: Solaris 10.

Portability problems fixed by the Gnulib module system-posix:

  • The macros WIFSIGNALED, WIFEXITED, WIFSTOPPED, WTERMSIG, WEXITSTATUS, WNOHANG, WUNTRACED, WSTOPSIG are not defined in this header file (only in <sys/wait.h>) on some platforms: MirBSD 10.

Portability problems not fixed by Gnulib:

  • The definition of the type once_flag, of the macro ONCE_FLAG_INIT, and the declaration of the function call_once, that are required by ISO C 23, are not provided. To get them, import Gnulib module call_once and include <threads.h> rather than <stdlib.h>.
  • System status macros such as WEXITSTATUS require an lvalue argument on some platforms. macOS 11.1.

9.53 stdnoreturn.h

POSIX specification:
Not in POSIX yet, but we expect it will be. ISO C11 (latest free draft http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf) sections 7.23.

Gnulib module: stdnoreturn

Portability problems fixed by Gnulib:

  • This header file is missing on many platforms: FreeBSD 6.4, NetBSD 7.1, OpenBSD 6.7, Minix 3.3.0, AIX 7.1, HP-UX 11.31, IRIX 6.5, Solaris 11.3, Cygwin 2.9.0, mingw, MSVC 14, Android 9.0.
  • This file conflicts with some system header files, such as <stdlib.h> and <process.h>, on some platforms: MSVC/clang.

Portability problems not fixed by Gnulib:

  • <stdnoreturn.h> and the noreturn macro are obsolescent in C23.
  • <stdnoreturn.h> cannot be #included in C++ mode on some platforms: FreeBSD 13.1.
  • <stdnoreturn.h> should be #included before ‘_Noreturn’ is used.
  • You cannot assume that _Noreturn is a reserved word; it might be a macro.
  • When the macro lint is defined, standard headers define _Noreturn (and therefore noreturn) to be a macro that expands to the empty token sequence on some platforms: Cygwin 2.5.1, FreeBSD 10.3.
  • On Cygwin 1.7.30 and MSVC 14, noreturn expands to the empty token sequence, to avoid problems with standard headers that use noreturn in combination with __attribute__ or __declspec. Although the resulting code operates correctly, the compiler is not informed whether noreturn functions do not return, so it may generate incorrect warnings at compile-time, or code that is slightly less optimized. This problem does not occur with _Noreturn.
  • Circa 2012 bleeding-edge GCC with -Werror=old-style-declaration requires _Noreturn or noreturn before the returned type in a declaration, and therefore rejects valid but unusually-worded declarations such as void _Noreturn foo (void);.

9.54 string.h

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/string.h.html

Gnulib module: string

Portability problems fixed by Gnulib:

  • Some platforms provide a NULL macro that cannot be used in arbitrary expressions: NetBSD 5.0

Portability problems not fixed by Gnulib:


9.55 strings.h

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/strings.h.html

Gnulib module: strings

Portability problems fixed by Gnulib:

  • This header file is not self-contained on some platforms: Minix 3.1.8.

Portability problems not fixed by Gnulib:

  • This header file is missing on some platforms: MSVC 14.
  • This header file defines symbols, such as ‘index’, often used for variables, making debugging harder.

9.56 stropts.h

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/stropts.h.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This header file is missing on some platforms: macOS 11.1, FreeBSD 14.0, NetBSD 9.0, OpenBSD 6.7, Minix 3.1.8, Cygwin, mingw, MSVC 14, Android 9.0.

9.57 sys/ipc.h

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_ipc.h.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This header file is missing on some platforms: mingw, MSVC 14.

9.58 sys/mman.h

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_mman.h.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This header file is missing on some platforms: mingw, MSVC 14.

9.59 sys/msg.h

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_msg.h.html

Gnulib module: sys_msg

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This header file is missing on some platforms: Minix 3.1.8, mingw, MSVC 14.

9.60 sys/resource.h

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_resource.h.html

Gnulib module: sys_resource

Portability problems fixed by Gnulib:

  • This header file is missing on some platforms: mingw, MSVC 14.
  • On some platforms, this header file requires that <sys/types.h> and <sys/time.h> already be included: FreeBSD 5.0.
  • On some platforms, this header file does not define the RUSAGE_SELF and RUSAGE_CHILDREN constants: OpenVMS.

Portability problems not fixed by Gnulib:

  • On some platforms, this header does not define some or all of the symbolic constants required by POSIX. For example, OpenVMS and Android do not define RLIM_SAVED_CUR or RLIM_SAVED_MAX.

9.61 sys/select.h

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_select.h.html

Gnulib module: sys_select

Portability problems fixed by Gnulib:

  • This header file is missing on some platforms: HP-UX 11.11, NonStop Kernel, mingw, MSVC 14.
  • This header file is not self-contained on some platforms: it requires <sys/types.h> to be included first.
  • This header file is not self-contained—it requires <string.h> before FD_ZERO can be used—on some platforms: AIX 7.1, Solaris 11.4.

Portability problems not fixed by Gnulib:


9.62 sys/sem.h

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_sem.h.html

Gnulib module: sys_sem

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This header file is missing on some platforms: mingw, MSVC 14.

9.63 sys/shm.h

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_shm.h.html

Gnulib module: sys_shm

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This header file is missing on some platforms: mingw, MSVC 14.

9.64 sys/socket.h

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_socket.h.html

Gnulib module: sys_socket

Portability problems fixed by Gnulib:

  • This header file is missing on some platforms: mingw, MSVC 14.
  • This header file is not self-contained on some platforms: it requires <sys/types.h> to be included first.
  • This header file does not define the type socklen_t on some platforms: IRIX 6.5.
  • This header file does not define the type struct iovec on some platforms: OpenBSD 4.4.
  • This header file is lacking the SHUT_RD, SHUT_WR, SHUT_RDWR macros on some platforms, despite having the shutdown functions: emx+gcc.
  • The struct sockaddr_storage type does not have a member ss_family on some platforms: AIX 7.1.
  • The CMSG_SPACE and CMSG_LEN macros are not provided on some platforms: OpenVMS.
  • This header file does not define the SO_REUSEPORT macro on some platforms: Minix 3.1.8, Solaris 10, Cygwin, mingw, MSVC 14.

Portability problems not fixed by Gnulib:

  • This header file does not declare the msg_control and msg_controllen members of struct msghdr on some platforms. This can be detected by the absence of the CMSG_FIRSTHDR macro: gnulib replacement header, old BSD

9.65 sys/stat.h

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_stat.h.html

Gnulib module: sys_stat

Portability problems fixed by Gnulib module sys_stat:

  • The type mode_t is not defined on some platforms: MSVC 14.
  • Some macros, such as S_IFMT or S_IFIFO, are missing on some platforms.
  • The macros S_ISBLK, S_ISCHR, S_ISDIR, S_ISFIFO, S_ISLNK, S_ISREG, S_ISSOCK are broken on some platforms.
  • Some platforms define macros, such as S_ISDOOR, that are not defined on other platforms.
  • The functions lstat and mkdir are not declared on some platforms: mingw, MSVC 14.
  • The macros UTIME_NOW and UTIME_OMIT are missing on some platforms.
  • On some platforms, struct stat does not include st_atim, st_mtim, or st_ctim members. Use the gnulib module ‘stat-time’ for accessors to portably get at subsecond resolution.

Portability problems fixed by Gnulib module sys_stat, together with module windows-stat-inodes:

  • On Windows platforms (excluding Cygwin), st_ino is always 0.

On platforms where off_t is a 32-bit type, struct stat cannot represent the size of files or block devices 2 GiB or lager and may not work correctly on directories 2 GiB or larger. Also, on platforms where ino_t is a 32-bit type, struct stat cannot represent larger inode numbers. See Large File Support, for how to address these problems.

See Avoiding the year 2038 problem, for portability issues with the time_t components of struct stat.

Portability problems not fixed by Gnulib:

  • The macro S_IFBLK is missing on some platforms: MSVC 14.
  • On OpenVMS, st_ino is an array of three ino_t values, not a single value. b are known to represent the same file.
  • On some platforms, two different files may have the same st_dev and st_ino values, even when st_ino is nonzero:
    • GNU/Linux NFS servers that export all local file systems as a single NFS file system, if a local st_dev exceeds 255, or if a local st_ino exceeds 16777215.
    • Network Appliance NFS servers in snapshot directories; see Network Appliance bug #195.
    • ClearCase MVFS; see bug id ATRia04618.
  • On some file systems, st_size contains bogus information for symlinks; use the Gnulib module areadlink-with-size for a better way to get symlink contents.

To partially work around porting problems with Microsoft Windows and OpenVMS, you can use the Gnulib same-inode module to test whether two struct stat objects are known to represent the same file. For example, psame_inode (&a, &b) is true if the struct stat objects a and b are known to represent the same file.

Another partial workaround is to compare other file metadata such as st_mode and st_mtime on platforms where st_dev and st_ino not uniquely identify a file. However, this does not work reliably on files whose metadata are being changed by other programs, or where the metadata happen to be equal.


9.66 sys/statvfs.h

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_statvfs.h.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This header file is missing on some platforms: OpenBSD 3.8, mingw, MSVC 14.

9.67 sys/time.h

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_time.h.html

Gnulib module: sys_time

Portability problems fixed by Gnulib:

  • This header file is missing on some platforms: MSVC 14.
  • struct timeval’ is not defined on some platforms.
  • struct timeval’ is defined with a tv_sec type that is narrower than time_t on some native Windows platforms: mingw64 in 64-bit mode, mingw64 in 32-bit mode when __MINGW_USE_VC2005_COMPAT is defined, MSVC 14 in 64-bit mode, MSVC 14 in 32-bit mode when _USE_32BIT_TIME_T is not defined.

See Avoiding the year 2038 problem, for portability issues with time_t and the time_t component of struct timeval.

Portability problems not fixed by Gnulib:

  • struct timeval’ is defined with a tv_sec type that is wider than time_t: OpenBSD 5.1 in 64-bit mode.

9.68 sys/timeb.h

POSIX specification:
https://pubs.opengroup.org/onlinepubs/009695399/basedefs/sys/timeb.h.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This header file is missing on some platforms: OpenBSD 6.7, Android 9.0.

9.69 sys/times.h

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_times.h.html

Gnulib module: sys_times

Portability problems fixed by Gnulib:

  • This header file is missing on some platforms: mingw, MSVC 14.

Portability problems not fixed by Gnulib:


9.70 sys/types.h

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_types.h.html

Gnulib module: sys_types

Portability problems fixed by Gnulib:

  • The type pid_t is not defined on some platforms: MSVC 14.
  • The type size_t is not defined in this file on some platforms: MSVC 14.
  • The type ssize_t is not defined on some platforms: MSVC 14.
  • The type mode_t is not defined on some platforms: MSVC 14.
  • Some systems leak definitions of major, minor, and makedev through this header; however, when sys/sysmacros.h exists, that file should also be included to avoid deprecation warnings from the versions in this header: glibc 2.25.

See Avoiding the year 2038 problem, for portability issues with time_t.

Portability problems not fixed by Gnulib:

  • On some platforms the types blksize_t and suseconds_t are signed integer types that are wider than long: glibc x32

This module, together with the module largefile, also defines the type off_t to a 64-bit integer type on some platforms: mingw, MSVC 14.


9.71 sys/uio.h

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_uio.h.html

Gnulib module: sys_uio

Portability problems fixed by Gnulib:

  • This header file is missing on some platforms: mingw, MSVC 14.
  • This header file is not self-contained (it requires <sys/types.h> to be included first) on some platforms: OpenBSD 4.4.

Portability problems not fixed by Gnulib:


9.72 sys/un.h

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_un.h.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This header file is missing on some platforms: mingw, MSVC 14.
  • This header requires <code>sys/socket.h</code> to be included first on some platforms: Cygwin 1.7.18.

9.73 sys/utsname.h

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_utsname.h.html

Gnulib module: sys_utsname

Portability problems fixed by Gnulib:

  • This header file is missing on some platforms: mingw, MSVC 14.
  • This header file is not self-contained on some platforms: Minix 3.1.8.

Portability problems not fixed by Gnulib:


9.74 sys/wait.h

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_wait.h.html

Gnulib module: sys_wait

Portability problems fixed by Gnulib:

  • This header file is missing on some platforms: mingw, MSVC 14.

Portability problems not fixed by Gnulib:

  • System status macros such as WEXITSTATUS require an lvalue argument on some platforms. macOS 11.1.

9.75 syslog.h

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/syslog.h.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This header file is missing on some platforms: mingw, MSVC 14.

9.76 tar.h

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/tar.h.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This header file is missing on some platforms: Cygwin 1.5.x, mingw, MSVC 14.

9.77 termios.h

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/termios.h.html

Gnulib module: termios

Portability problems fixed by Gnulib:

  • This header file is missing on some platforms: mingw, MSVC 14.
  • This header does not declare pid_t on all platforms: glibc on some architectures, FreeBSD 6.4, OpenBSD 4.9, Cygwin 1.7.11.

Portability problems not fixed by Gnulib:

  • The types struct termios, cc_t, speed_t, tcflag_t are not defined on some platforms: mingw, MSVC 14.

9.78 tgmath.h

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/tgmath.h.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This header file is missing on some platforms: Mac OS X 10.5, FreeBSD 5.2.1, NetBSD 9.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Cygwin 1.7.9, mingw, MSVC 14, Android 9.0.

9.79 threads.h

Defines the multithreading facility of ISO C11.

Gnulib module: threads-h

Portability problems fixed by Gnulib:

  • This header file is missing on many platforms: glibc 2.27, macOS 11.1, FreeBSD 9.3, NetBSD 8.0, OpenBSD 6.7, Minix 3.1.8, AIX 7.1, HP-UX 11.31, IRIX 6.5, Solaris 11.3, Cygwin 2.2.x, mingw, MSVC 14, Android 9.0.
  • This header file defines thrd_start_t incorrectly on some platforms: AIX 7.2.
  • This header file does not define TSS_DTOR_ITERATIONS on some platforms: AIX 7.2.

Portability problems not fixed by Gnulib:

  • There is no way to define a working thread_local macro on some platforms:
    • Mac OS X 10.5,
    • OpenBSD 6.5,
    • AIX 7.1 with gcc (but it works with ‘xlc -qthreaded -qtls’),
    • HP-UX 11.31 with cc (but it works with gcc),
    • IRIX 6.5,
    • Android 4.3.

9.80 time.h

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/time.h.html

Gnulib module: time-h

Portability problems fixed by Gnulib:

  • struct timespec’ is not defined on some platforms.
  • The macro TIME_UTC is not defined on many platforms: glibc 2.15, macOS 10.13, FreeBSD 11.0, NetBSD 7.1, OpenBSD 6.0, Minix 3.1.8, AIX 7.1, HP-UX 11.31, IRIX 6.5, Solaris 11.3, Cygwin 2.9, mingw, MSVC 14, Android 9.0.
  • Some platforms provide a NULL macro that cannot be used in arbitrary expressions: NetBSD 5.0.

Portability problems fixed by the Gnulib module year2038:

  • On some platforms where time_t defaults to 32-bit but can be changed to 64-bit, functions like stat can fail with errno == EOVERFLOW when a 32-bit timestamp is out of range, such as with a file timestamp in the far future or past: glibc 2.34+ atop 32-bit x86 or ARM Linux. See Avoiding the year 2038 problem.

Portability problems not fixed by Gnulib:

  • On platforms where time_t is always 32-bit, functions like stat can fail with errno == EOVERFLOW when a timestamp is out of range, such as with a file timestamp in the far future or past; on other such platforms, the functions silently return the low-order 32 bits of the correct timestamp. These platforms will be obsolete when 32-bit time_t rolls around, which will occur in 2038 for the typical case when time_t is signed. See Avoiding the year 2038 problem.
  • On some platforms the tv_nsec member of struct timespec is not of type long, but is of type long long instead: glibc x32

9.81 trace.h

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/trace.h.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This header file is missing on some platforms: macOS 11.1, FreeBSD 14.0, NetBSD 9.0, OpenBSD 6.7, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 11.4, Cygwin, mingw, MSVC 14, Android 9.0.

9.82 uchar.h

Defines the types char16_t, char32_t and declares the functions mbrtoc16, c16rtomb, mbrtoc32, c32rtomb.

Gnulib module: uchar or uchar-c23

Portability problems fixed by either Gnulib module uchar or uchar-c23:

  • This header file is missing on many non-glibc platforms: glibc 2.15, macOS 11.1, FreeBSD 6.4, NetBSD 9.0, OpenBSD 6.7, Minix 3.1.8, AIX 7.1, HP-UX 11.31, IRIX 6.5, Solaris 11.3, Cygwin, mingw, MSVC 9.
  • This file is not self-contained on some platforms: Haiku.
  • This file produces compilation errors in C++ mode on some platforms: AIX 7.2 with xlclang++.

Portability problems fixed by Gnulib module uchar-c23:

  • char32_t values may not be Unicode code points. This is the case in ISO C 11 compliant but not ISO C 23 compliant implementations.

Portability problems not fixed by Gnulib:


9.83 ucontext.h

POSIX specification:
https://pubs.opengroup.org/onlinepubs/009695399/basedefs/ucontext.h.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This header file is missing on some platforms: OpenBSD 6.7, Cygwin 1.7.35, mingw, MSVC 14.

9.84 ulimit.h

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/ulimit.h.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This header file is missing on some platforms: OpenBSD 6.7, Minix 3.1.8, Cygwin, mingw, MSVC 14, Android 9.0.

9.85 unistd.h

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/unistd.h.html

Gnulib module: unistd

Portability problems fixed by Gnulib:

  • This header file is missing on some platforms: MSVC 14.
  • The SEEK_* macros are not defined in this file on some platforms: mingw.
  • The *_FILENO macros are not defined in this file on some platforms: OS/2 EMX, mingw.
  • The _exit function is not declared in this file on some platforms: mingw.
  • Some platforms provide a NULL macro that cannot be used in arbitrary expressions: NetBSD 5.0

Portability problems not fixed by Gnulib:


9.86 utime.h

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/utime.h.html

Gnulib module: utime-h

Portability problems fixed by Gnulib:

  • This header file is missing on some platforms: MSVC 14.

Portability problems not fixed by Gnulib:


9.87 utmpx.h

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/utmpx.h.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This header file is missing on some platforms: FreeBSD 8.4, OpenBSD 7.2, Minix 3.1.8, mingw, MSVC 14, Android 13.0.
  • While some platforms have the struct utmpx field ut_user, older platforms have the field ut_name.
  • The struct utmpx field ut_exit does not exist on some platforms: macOS, FreeBSD, AIX, Cygwin.
  • The struct utmpx field ut_session does not exist on some platforms: macOS, FreeBSD, AIX, HP-UX, Cygwin.
  • The struct utmpx field ut_addr or ut_addr_v6 or ut_ss does not exist on some platforms: macOS, FreeBSD, AIX, IRIX, Solaris.
  • On some platforms, this API does not support timestamps past the year 2038: glibc 2.38 on 32-bit platforms like x86 and ARM where time_t was historically 32 bits.
  • On some platforms, this header misbehaves if the year2038 or year2038-recommended modules are used and the program is configured without the --disable-year2038 option. The readutmp module works around this problem: glibc 2.38 on 32-bit platforms like x86 and ARM where time_t was historically 32 bits. See Avoiding the year 2038 problem.

9.88 wchar.h

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/wchar.h.html

Gnulib module: wchar

Portability problems fixed by Gnulib:

  • This header file cannot be included on some platforms: Linux uClibc built without wide character support.
  • The type wint_t is incorrect on some platforms: mingw, MSVC 14.
  • Some platforms provide a NULL macro that cannot be used in arbitrary expressions: NetBSD 5.0

Portability problems not fixed by Gnulib:

  • This header file leads to link errors and endless recursions or endless loops on some platforms: glibc version 2.5 or older, together with gcc version 4.3 or newer and the option ‘-std=c99’ or ‘-std=gnu99’.

9.89 wctype.h

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/wctype.h.html

Gnulib module: wctype-h

Portability problems fixed by Gnulib:

  • This header file is missing on some platforms: HP-UX 11.00.
  • The type wint_t is incorrect on some platforms: mingw, MSVC 14.
  • The functions isw* are missing on some platforms: FreeBSD 4.11.
  • The function iswblank is declared but not defined on some platforms: IRIX 6.5.30.

Portability problems not fixed by Gnulib:


9.90 wordexp.h

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/wordexp.h.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This header file is missing on some platforms: OpenBSD 6.7, Minix 3.1.8, Cygwin 1.5.x, mingw, MSVC 14, Android 9.0.

10 ISO C and POSIX Function Substitutes

This chapter describes which functions and function-like macros specified by ISO C (including ISO TS 18661-1) or POSIX are substituted by Gnulib, which portability pitfalls are fixed by Gnulib, and which (known) portability problems are not worked around by Gnulib.

The notation “Gnulib module: —” means that Gnulib does not provide a module providing a substitute for the function. When the list “Portability problems not fixed by Gnulib” is empty, such a module is not needed: No portability problems are known. Otherwise, it indicates that such a module would be useful but is not available: No one so far found this function important enough to contribute a substitute for it. If you need this particular function, you may write to <bug-gnulib at gnu dot org>.


10.1 FD_CLR

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/FD_CLR.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:


10.2 FD_ISSET

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/FD_ISSET.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:


10.3 FD_SET

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/FD_SET.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:


10.4 FD_ZERO

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/FD_ZERO.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:


10.5 _Exit

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/_Exit.html

Gnulib module: _Exit

Portability problems fixed by Gnulib:

  • This function is missing on some platforms: Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin 1.5.x, Android 4.4.

Portability problems not fixed by Gnulib:


10.6 _exit

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/_exit.html

Gnulib module: unistd

Portability problems fixed by Gnulib:

  • This function is declared in a different header file (namely, <stdlib.h>) on some platforms: mingw, MSVC 14.

Portability problems not fixed by Gnulib:


10.7 _longjmp

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/_longjmp.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: mingw, MSVC 14.
  • POSIX says this function is obsolescent and it is planned to be removed in POSIX 202x.

Note: Despite its being removed from POSIX, in 2023 on all systems which have _setjmp, it is the fastest way to save the registers but not the signal mask (up to 30 times faster than setjmp on some systems).


10.8 _setjmp

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/_setjmp.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • POSIX says this function is obsolescent and it is planned to be removed in POSIX 202x.

Note: Despite its being removed from POSIX, in 2023 on all systems which have _setjmp, it is the fastest way to save the registers but not the signal mask (up to 30 times faster than setjmp on some systems).


10.9 _tolower

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/_tolower.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: macOS 11.1, Minix 3.1.8, Android 4.4.
  • POSIX says this function is obsolescent and it is planned to be removed in POSIX 202x. Use the function tolower instead.

10.10 _toupper

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/_toupper.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: macOS 11.1, Minix 3.1.8, Android 4.4.
  • POSIX says this function is obsolescent and it is planned to be removed in POSIX 202x. Use the function toupper instead.

10.11 a64l

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/a64l.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 6.0, Minix 3.1.8, mingw, MSVC 14, Android 9.0.
  • This function was not correctly implemented in glibc versions before 2.2.5.

10.12 abort

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/abort.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • Some platforms mistakenly close all stdio streams prior to raising SIGABRT: Cygwin 1.5.x.
  • Some platforms always print a message to stderr, even if a SIGABRT handler uses longjmp to resume execution at a safe point: mingw, MSVC 14.

10.13 abs

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/abs.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: Android 4.3.

10.14 accept

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/accept.html

Gnulib module: accept

Portability problems fixed by Gnulib:

  • On Windows platforms (excluding Cygwin), the descriptors returned by the accept function cannot be used in calls to read, write, and close; you have to use recv, send, closesocket in these cases instead.
  • On Windows platforms (excluding Cygwin), error codes from this function are not placed in errno, and WSAGetLastError must be used instead.
  • On HP-UX 11, in 64-bit mode, when the macro _HPUX_ALT_XOPEN_SOCKET_API is not defined, this function behaves incorrectly because it is declared to take a pointer to a 64-bit wide socklen_t entity but in fact considers it as a pointer to a 32-bit wide unsigned int entity.

Portability problems not fixed by Gnulib:

  • Some platforms don’t have a socklen_t type; in this case this function’s third argument type is ‘int *’.
  • On some platforms, this function’s third argument type is ‘void *’, not ‘socklen_t *’: Solaris 10.

10.15 access

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/access.html

Gnulib module: access

Portability problems fixed by Gnulib:

  • This function does not support the X_OK mode on some platforms: MSVC 14.
  • This function does not reject trailing slashes on symlinks to non-directories on some platforms: Mac OS X 10.5.

Portability problems not fixed by Gnulib:

  • This function uses the effective id instead of the real id on some platforms: Cygwin 1.5.x.

Other problems of this function:

  • There is an inherent race between calling this function and performing some action based on the results; you should think twice before trusting this function, especially in a set-uid or set-gid program.
  • This function does not have an option for not following symbolic links (like stat versus lstat). If you need this option, use the Gnulib module faccessat with the AT_EACCESS flag.
  • On native Windows, files whose basename does not contain a ‘.’ cannot be executed through execlp or execvp. Nevertheless, this function may return true for such files.
  • On Windows, different facilities for executing a program have different ways of finding an executable file, by trying various suffixes. For example, execlp and execvp search for files with the suffixes .com, .exe, .bat, .cmd, when the file with the given file name does not exist. Whereas cmd.exe searches according to the PATHEXT environment variable. This function does not perform any search; it merely looks at the file with the given file name.

10.16 acos

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/acos.html

Gnulib module: acos

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:


10.17 acosf

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/acosf.html

Gnulib module: acosf

Portability problems fixed by Gnulib:

  • This function is missing on some platforms: Minix 3.1.8, AIX 5.1, Solaris 9.
  • This function is only defined as a macro with arguments on some platforms: MSVC 14.

Portability problems not fixed by Gnulib:


10.18 acosh

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/acosh.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: Minix 3.1.8, mingw, MSVC 9.

10.19 acoshf

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/acoshf.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, mingw, MSVC 9.

10.20 acoshl

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/acoshl.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin 1.7.x, mingw, MSVC 9, Android 4.4.

10.21 acosl

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/acosl.html

Gnulib module: acosl

Portability problems fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin 1.7.x, Android 4.4.
  • This function is only defined as a macro with arguments on some platforms: MSVC 14.

Portability problems not fixed by Gnulib:


10.22 aio_cancel

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/aio_cancel.html

Gnulib module: —

Portability problems fixed by Gnulib:

  • On platforms where off_t is a 32-bit type, this function may not work correctly on files 2 GiB and larger. See Large File Support.

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: NetBSD 3.0, OpenBSD 6.7, Minix 3.1.8, Cygwin 2.9, mingw, MSVC 14, Android 9.0.

10.23 aio_error

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/aio_error.html

Gnulib module: —

Portability problems fixed by Gnulib:

  • On platforms where off_t is a 32-bit type, this function may not work correctly on files 2 GiB and larger. See Large File Support.

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: NetBSD 3.0, OpenBSD 6.7, Minix 3.1.8, AIX 5.1, Cygwin 2.9, mingw, MSVC 14, Android 9.0.

10.24 aio_fsync

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/aio_fsync.html

Gnulib module: —

Portability problems fixed by Gnulib:

  • On platforms where off_t is a 32-bit type, this function may not work correctly on files 2 GiB and larger. See Large File Support.

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 6.0, NetBSD 3.0, OpenBSD 6.7, Minix 3.1.8, AIX 5.1, Cygwin 2.9, mingw, MSVC 14, Android 9.0.

10.25 aio_read

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/aio_read.html

Gnulib module: —

Portability problems fixed by Gnulib:

  • On platforms where off_t is a 32-bit type, this function may not work correctly on files 2 GiB and larger. See Large File Support.

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: NetBSD 3.0, OpenBSD 6.7, Minix 3.1.8, Cygwin 2.9, mingw, MSVC 14, Android 9.0.

10.26 aio_return

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/aio_return.html

Gnulib module: —

Portability problems fixed by Gnulib:

  • On platforms where off_t is a 32-bit type, this function may not work correctly on files 2 GiB and larger. See Large File Support.

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: NetBSD 3.0, OpenBSD 6.7, Minix 3.1.8, AIX 5.1, Cygwin 2.9, mingw, MSVC 14, Android 9.0.

10.27 aio_suspend

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/aio_suspend.html

Gnulib module: —

Portability problems fixed by Gnulib:

  • On platforms where off_t is a 32-bit type, this function may not work correctly on files 2 GiB and larger. See Large File Support.

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: NetBSD 3.0, OpenBSD 6.7, Minix 3.1.8, Cygwin 2.9, mingw, MSVC 14, Android 9.0.

10.28 aio_write

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/aio_write.html

Gnulib module: —

Portability problems fixed by Gnulib:

  • On platforms where off_t is a 32-bit type, this function may not work correctly on files 2 GiB and larger. See Large File Support.

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: NetBSD 3.0, OpenBSD 6.7, Minix 3.1.8, Cygwin 2.9, mingw, MSVC 14, Android 9.0.

10.29 alarm

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/alarm.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function has no impact if <code>SIGALRM</code> is inherited as ignored; programs should use <code>signal (SIGALRM, SIG_DFL)</code> if it is important to ensure the alarm will fire.
  • Use of this function in multi-threaded applications is not advised.
  • This function is missing on some platforms: mingw (2011), MSVC 14.
  • This function is conditionally declared in the non-standard <io.h> header on some platforms: mingw (2012 or newer).

10.30 aligned_alloc

Documentation:
man aligned_alloc

Gnulib module: aligned_alloc

Portability problems fixed by Gnulib:

  • This function fails if the alignment argument is smaller than sizeof (void *) on some platforms: macOS 11.1, AIX 7.3.1.

Portability problems not fixed by Gnulib:

  • On some platforms, aligned_alloc crashes if the requested size is not a multiple of the alignment: AddressSanitizer (gcc 11.2 or clang 13).
  • This function is missing on many older platforms: glibc 2.15, macOS 10.13, FreeBSD 6.4, NetBSD 7.1, OpenBSD 6.0, Minix 3.1.8, AIX 7.1, HP-UX 11.31, IRIX 6.5, Solaris 11.3, Cygwin 1.7.x, mingw, MSVC 14, Android 8.1.

Gnulib has partial substitutes for aligned_alloc that do not crash even if the AddressSanitizer bug is present:

  • The Gnulib module alignalloc provides a portable function alignalloc that is a near-substitute for glibc aligned_alloc, except that the result must be freed with alignfree rather than plain free.
  • The Gnulib module aligned-malloc provides functions for allocating and freeing blocks of suitably aligned memory.
  • The Gnulib module pagealign_alloc provides a similar API for allocating and freeing blocks of memory aligned on a system page boundary.

10.31 alphasort

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/alphasort.html

Gnulib module: alphasort

Portability problems fixed by Gnulib:

  • This function is missing on some platforms: Minix 3.1.8, Solaris 9, mingw, MSVC 14.

Portability problems not fixed by Gnulib:

  • The parameters of this function are declared as const void * on some platforms: glibc 2.3.6, macOS 10.7, FreeBSD 6.0, NetBSD 7.1, OpenBSD 6.7.
  • The parameters of this function are declared as void * on some platforms: AIX 5.1.

10.32 asctime

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/asctime.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is deprecated in C23. Likewise, POSIX says this function is obsolescent and it is planned to be removed in a future version. Portable applications can use strftime (or even sprintf) instead.
  • This function may overflow its internal buffer if an invalid year is passed.

10.33 asctime_r

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/asctime_r.html

Future POSIX removal:
https://www.austingroupbugs.net/view.php?id=1410

Gnulib module: extensions

Portability problems fixed by Gnulib:

  • This function has an incompatible declaration on some platforms: Solaris 11.4 (when _POSIX_PTHREAD_SEMANTICS is not defined).

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: mingw, MSVC 14.
  • POSIX says this function is obsolescent and it is planned to be removed in a future version. Use the function strftime (or even sprintf) instead.
  • This function may put more than 26 bytes into the argument buffer if an invalid year is passed.

10.34 asin

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/asin.html

Gnulib module: asin

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:


10.35 asinf

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/asinf.html

Gnulib module: asinf

Portability problems fixed by Gnulib:

  • This function is missing on some platforms: Minix 3.1.8, AIX 5.1, Solaris 9.
  • This function is only defined as a macro with arguments on some platforms: MSVC 14.

Portability problems not fixed by Gnulib:


10.36 asinh

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/asinh.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: Minix 3.1.8, mingw, MSVC 9.

10.37 asinhf

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/asinhf.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, mingw, MSVC 9.

10.38 asinhl

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/asinhl.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin 1.7.x, mingw, MSVC 9, Android 4.4.

10.39 asinl

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/asinl.html

Gnulib module: asinl

Portability problems fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin 1.7.x, Android 4.4.
  • This function is only defined as a macro with arguments on some platforms: MSVC 14.

Portability problems not fixed by Gnulib:


10.40 assert

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/assert.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

Extension: Gnulib offers a module ‘assert’ that allows the installer to disable assertions through a ‘configure’ option: ‘--disable-assert’.


10.41 atan

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/atan.html

Gnulib module: atan

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:


10.42 atan2

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/atan2.html

Gnulib module: atan2

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:


10.43 atan2f

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/atan2f.html

Gnulib module: atan2f

Portability problems fixed by Gnulib:

  • This function is missing on some platforms: Minix 3.1.8, AIX 5.1, Solaris 9.
  • This function is only defined as a macro with arguments on some platforms: MSVC 14.

Portability problems not fixed by Gnulib:


10.44 atan2l

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/atan2l.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin 1.7.x, Android 4.4.
  • This function is only defined as a macro with arguments on some platforms: MSVC 14.

10.45 atanf

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/atanf.html

Gnulib module: atanf

Portability problems fixed by Gnulib:

  • This function is missing on some platforms: Minix 3.1.8, AIX 5.1, Solaris 9.
  • This function is only defined as a macro with arguments on some platforms: MSVC 14.

Portability problems not fixed by Gnulib:


10.46 atanh

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/atanh.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: Minix 3.1.8, mingw, MSVC 9.

10.47 atanhf

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/atanhf.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, mingw, MSVC 9.

10.48 atanhl

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/atanhl.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin 1.7.x, mingw, MSVC 9, Android 4.4.

10.49 atanl

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/atanl.html

Gnulib module: atanl

Portability problems fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin 1.7.x, Android 4.4.
  • This function is only defined as a macro with arguments on some platforms: MSVC 14.

Portability problems not fixed by Gnulib:


10.50 atexit

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/atexit.html

Gnulib module: atexit

Portability problems fixed by Gnulib:

  • This function is missing on some old platforms.

Portability problems not fixed by Gnulib:


10.51 atof

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/atof.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: Android 4.4.
  • This function mis-parses strings with leading ‘+’ on some old platforms: Old versions of Linux.
  • This function returns a positive value for negative underflow on some platforms: glibc 2.4, Mingw, Cygwin.
  • This function fails to do a valid parse of ‘-0x’ on some platforms: glibc 2.4, Cygwin < 1.5.25-11.
  • This function fails to parse Infinities and plain NaNs on some platforms: Mingw, OpenBSD 4.0.
  • This function fails to parse NaN() on some platforms: Mingw, OpenBSD 4.0, Cygwin < 1.5.25-11.
  • This function fails to parse NaN(n-char-sequence) on some platforms: Mingw, OpenBSD 4.0.
  • This function fails to parse C99 hexadecimal floating point on some platforms: Mingw, OpenBSD 4.0.
  • This function fails to correctly parse very long strings on some platforms: Mingw, Cygwin.

10.52 atoi

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/atoi.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:


10.53 atol

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/atol.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:


10.54 atoll

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/atoll.html

Gnulib module: atoll

Portability problems fixed by Gnulib:

  • This function is missing on some platforms: Minix 3.1.8, AIX 5.1, HP-UX 11.23, MSVC 9.

Portability problems not fixed by Gnulib:


10.55 basename

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/basename.html

LSB specification:
https://refspecs.linuxbase.org/LSB_5.0.0/LSB-Core-generic/LSB-Core-generic/baselib-basename-3.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: IRIX 6.5, mingw, MSVC 14.
  • glibc and Android have two different functions basename: the POSIX version and the GNU version.
  • basename assumes file names in POSIX syntax; it does not work with file names in Windows syntax.

The Gnulib module basename-lgpl provides similar API, with a function last_component, that also works with Windows file names.


10.56 bind

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/bind.html

Gnulib module: bind

Portability problems fixed by Gnulib:

  • On Windows platforms (excluding Cygwin), error codes from this function are not placed in errno, and WSAGetLastError must be used instead.

Portability problems not fixed by Gnulib:


10.57 bsearch

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/bsearch.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:


10.58 btowc

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/btowc.html

Gnulib module: btowc

Portability problems fixed by Gnulib:

  • This function is missing on some platforms: Minix 3.1.8, HP-UX 11.00, mingw.
  • This function returns WEOF for a NUL argument on some platforms: Cygwin 1.7.2.
  • This function does not return WEOF for an EOF argument on some platforms: IRIX 6.5.
  • In the C or POSIX locales, this function is not consistent with Gnulib’s mbrtowc and can return WEOF: glibc 2.35, MirOS BSD #10.
  • In the C or POSIX locales, this function is not consistent with mbrtowc on some platforms: mingw.

Portability problems not fixed by Gnulib:

  • On Windows and 32-bit AIX platforms, wchar_t is a 16-bit type and therefore cannot accommodate all Unicode characters. However, the Gnulib function btoc32, provided by Gnulib module btoc32, operates on 32-bit wide characters and therefore does not have this limitation.

10.59 c8rtomb

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on most platforms: glibc 2.29, macOS 11.1, FreeBSD 14.0, NetBSD 9.0, OpenBSD 6.7, Minix 3.3.0, AIX 7.1, HP-UX 11.31, IRIX 6.5, Solaris 11.4, Cygwin 2.9, mingw, MSVC 14, Android 9.0.

10.60 c16rtomb

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on most non-glibc platforms: glibc 2.15, macOS 11.1, FreeBSD 6.4, NetBSD 9.0, OpenBSD 6.7, Minix 3.1.8, AIX 7.1, HP-UX 11.31, IRIX 6.5, Solaris 11.3, Cygwin 2.9, mingw, MSVC 9, Android 4.4.

10.61 c32rtomb

Gnulib module: c32rtomb

Portability problems fixed by Gnulib:

  • This function is missing on most non-glibc platforms: glibc 2.15, macOS 11.1, FreeBSD 6.4, NetBSD 9.0, OpenBSD 6.7, Minix 3.1.8, AIX 7.1, HP-UX 11.31, IRIX 6.5, Solaris 11.3, Cygwin 2.9, mingw, MSVC 9, Android 4.4.
  • This function returns 0 when the first argument is NULL in some locales on some platforms: AIX 7.2.

Portability problems not fixed by Gnulib:

  • This function is only defined as an inline function on some platforms: Haiku 2020.

10.62 cabs

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/cabs.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: Minix 3.1.8, HP-UX 11, Solaris 9.

10.63 cabsf

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/cabsf.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: Minix 3.1.8, AIX 5.1, HP-UX 11, Solaris 9, mingw, MSVC 9.

10.64 cabsl

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/cabsl.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 6.0, NetBSD 9.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin 1.7.x, mingw, MSVC 9, Android 5.1.

10.65 cacos

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/cacos.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin 1.7.7, mingw, MSVC 9, Android 5.1.

10.66 cacosf

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/cacosf.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin 1.7.7, mingw, MSVC 9, Android 5.1.

10.67 cacosh

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/cacosh.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin 1.7.7, mingw, MSVC 9, Android 5.1.

10.68 cacoshf

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/cacoshf.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin 1.7.7, mingw, MSVC 9, Android 5.1.

10.69 cacoshl

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/cacoshl.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 11.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin 1.7.x, mingw, MSVC 9, Android 7.1.

10.70 cacosl

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/cacosl.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 11.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin 1.7.x, mingw, MSVC 9, Android 7.1.

10.71 calloc

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/calloc.html

Gnulib module: calloc-posix

Portability problems fixed by Gnulib:

  • Upon failure, the function does not set errno to ENOMEM on some platforms: mingw, MSVC 14.
  • On some platforms, calloc (n, s) can succeed even if multiplying n by s would exceed PTRDIFF_MAX or SIZE_MAX. Although failing to check for exceeding PTRDIFF_MAX is arguably allowed by POSIX it can lead to undefined behavior later, so calloc-posix does not allow going over the limit.

Extension: Gnulib provides a module ‘calloc-gnu’ that substitutes a calloc implementation that behaves more like the glibc implementation. It fixes this portability problem:

  • calloc (0, s) and calloc (n, 0) return NULL on success on some platforms: AIX 7.2.

10.72 call_once

Documentation:
https://www.gnu.org/software/libc/manual/html_node/Call-Once.html.

Gnulib module: call_once

Portability problems fixed by Gnulib:

  • This function is missing on many platforms: glibc 2.27, macOS 11.1, FreeBSD 9.3, NetBSD 8.0, OpenBSD 6.7, Minix 3.1.8, AIX 7.1, HP-UX 11.31, IRIX 6.5, Solaris 11.3, Cygwin 2.9, mingw, MSVC 14, Android 9.0.

Portability problems not fixed by Gnulib:

  • This function does not work on some platforms: Haiku.

10.73 canonicalize

Documentation:
https://www.gnu.org/software/libc/manual/html_node/FP-Bit-Twiddling.html.

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on all non-glibc platforms: glibc 2.24, macOS 11.1, FreeBSD 14.0, NetBSD 9.0, OpenBSD 6.7, Minix 3.1.8, AIX 7.1, HP-UX 11.31, IRIX 6.5, Solaris 11.4, Cygwin 2.9, mingw, MSVC 14, Android 9.0.

10.74 canonicalizef

Documentation:
https://www.gnu.org/software/libc/manual/html_node/FP-Bit-Twiddling.html.

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on all non-glibc platforms: glibc 2.24, macOS 11.1, FreeBSD 14.0, NetBSD 9.0, OpenBSD 6.7, Minix 3.1.8, AIX 7.1, HP-UX 11.31, IRIX 6.5, Solaris 11.4, Cygwin 2.9, mingw, MSVC 14, Android 9.0.

10.75 canonicalizel

Documentation:
https://www.gnu.org/software/libc/manual/html_node/FP-Bit-Twiddling.html.

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on all non-glibc platforms: glibc 2.24, macOS 11.1, FreeBSD 14.0, NetBSD 9.0, OpenBSD 6.7, Minix 3.1.8, AIX 7.1, HP-UX 11.31, IRIX 6.5, Solaris 11.4, Cygwin 2.9, mingw, MSVC 14, Android 9.0.

10.76 carg

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/carg.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin 1.7.7, mingw, MSVC 9.

10.77 cargf

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/cargf.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin 1.7.7, mingw, MSVC 9.

10.78 cargl

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/cargl.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin 1.7.x, mingw, MSVC 9, Android 5.1.

10.79 casin

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/casin.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin 1.7.7, mingw, MSVC 9, Android 5.1.

10.80 casinf

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/casinf.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin 1.7.7, mingw, MSVC 9, Android 5.1.

10.81 casinh

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/casinh.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin 1.7.7, mingw, MSVC 9, Android 5.1.

10.82 casinhf

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/casinhf.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin 1.7.7, mingw, MSVC 9, Android 5.1.

10.83 casinhl

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/casinhl.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 11.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin 1.7.x, mingw, MSVC 9, Android 7.1.

10.84 casinl

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/casinl.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 11.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin 1.7.x, mingw, MSVC 9, Android 7.1.

10.85 catan

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/catan.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin 1.7.7, mingw, MSVC 9, Android 5.1.

10.86 catanf

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/catanf.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin 1.7.7, mingw, MSVC 9, Android 5.1.

10.87 catanh

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/catanh.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin 1.7.7, mingw, MSVC 9, Android 5.1.

10.88 catanhf

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/catanhf.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin 1.7.7, mingw, MSVC 9, Android 5.1.

10.89 catanhl

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/catanhl.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 11.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin 1.7.x, mingw, MSVC 9, Android 7.1.

10.90 catanl

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/catanl.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 11.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin 1.7.x, mingw, MSVC 9, Android 7.1.

10.91 catclose

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/catclose.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: Minix 3.1.8, Cygwin 2.9, mingw, MSVC 14, Android 7.1.

10.92 catgets

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/catgets.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: Minix 3.1.8, Cygwin 2.9, mingw, MSVC 14, Android 7.1.

10.93 catopen

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/catopen.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: Minix 3.1.8, Cygwin 2.9, mingw, MSVC 14, Android 7.1.

10.94 cbrt

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/cbrt.html

Gnulib module: cbrt

Portability problems fixed by Gnulib:

  • This function is missing on some platforms: Minix 3.1.8, MSVC 9.

Portability problems not fixed by Gnulib:


10.95 cbrtf

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/cbrtf.html

Gnulib module: cbrtf

Portability problems fixed by Gnulib:

  • This function is missing on some platforms: Minix 3.1.8, AIX 5.1, Solaris 9, MSVC 9.
  • This function is not declared on some platforms: IRIX 6.5.
  • This function returns a wrong value for a minus zero on some platforms: IRIX 6.5.

Portability problems not fixed by Gnulib:


10.96 cbrtl

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/cbrtl.html

Gnulib module: cbrtl or cbrtl-ieee

Portability problems fixed by either Gnulib module cbrtl or cbrtl-ieee

  • This function is missing on some platforms: FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, Solaris 9, Cygwin 1.7.x, MSVC 9, Android 4.4.
  • This function is not declared on some platforms: IRIX 6.5.
  • This function produces grossly wrong results on some platforms: OpenBSD 5.1/SPARC.

Portability problems fixed by Gnulib module cbrtl-ieee:

  • This function returns a positive zero for a minus zero argument on some platforms: IRIX 6.5.

Portability problems not fixed by Gnulib:


10.97 ccos

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/ccos.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin 1.7.7, mingw, MSVC 9.

10.98 ccosf

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/ccosf.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin 1.7.7, mingw, MSVC 9.

10.99 ccosh

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/ccosh.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin 1.7.7, mingw, MSVC 9.

10.100 ccoshf

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/ccoshf.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin 1.7.7, mingw, MSVC 9.

10.101 ccoshl

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/ccoshl.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 14.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin 1.7.x, mingw, MSVC 9, Android 7.1.

10.102 ccosl

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/ccosl.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 14.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin 1.7.x, mingw, MSVC 9, Android 7.1.

10.103 ceil

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/ceil.html

Gnulib module: ceil or ceil-ieee

Portability problems fixed by either Gnulib module ceil or ceil-ieee:

Portability problems fixed by Gnulib module ceil-ieee:

  • This function returns a positive zero for an argument between -1 and 0 on some platforms: AIX 7.1.

Portability problems not fixed by Gnulib:


10.104 ceilf

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/ceilf.html

Gnulib module: ceilf or ceilf-ieee

Portability problems fixed by either Gnulib module ceilf or ceilf-ieee:

  • This function is missing on some platforms: Minix 3.1.8, AIX 5.1, HP-UX 11, Solaris 9.
  • This function is only defined as a macro with arguments on some platforms: MSVC 14.

Portability problems fixed by Gnulib module ceilf-ieee:

  • This function returns a positive zero for an argument between -1 and 0 on some platforms: macOS 10.13, AIX 7.1.

Portability problems not fixed by Gnulib:


10.105 ceill

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/ceill.html

Gnulib module: ceill or ceill-ieee

Portability problems fixed by either Gnulib module ceill or ceill-ieee:

  • This function is missing on some platforms: FreeBSD 5.2.1, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin 1.7.x.
  • This function is only defined as a macro with arguments on some platforms: MSVC 14.
  • This function returns a wrong result for small arguments on some platforms: OpenBSD 5.6.

Portability problems fixed by Gnulib module ceill-ieee:

Portability problems not fixed by Gnulib:


10.106 cexp

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/cexp.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin 1.7.7, mingw, MSVC 9.

10.107 cexpf

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/cexpf.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin 1.7.7, mingw, MSVC 9.

10.108 cexpl

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/cexpl.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 13.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin 1.7.x, mingw, MSVC 9, Android 7.1.

10.109 cfgetispeed

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/cfgetispeed.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: mingw, MSVC 14, Android 4.4.

10.110 cfgetospeed

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/cfgetospeed.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: mingw, MSVC 14, Android 4.4.

10.111 cfsetispeed

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/cfsetispeed.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: mingw, MSVC 14, Android 4.4.

10.112 cfsetospeed

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/cfsetospeed.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: mingw, MSVC 14, Android 4.4.

10.113 chdir

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/chdir.html

Gnulib module: chdir

Portability problems fixed by Gnulib:

  • This function is declared in different header files (namely, <io.h> or <direct.h>) on some platforms: mingw, MSVC 14.

Portability problems not fixed by Gnulib:


10.114 chmod

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/chmod.html

Gnulib module: chmod

Portability problems fixed by Gnulib:

  • This function does not fail when the file name argument ends in a slash and (without the slash) names a non-directory, on some platforms: AIX 7.2, IRIX 6.5.
  • This function fails with a wrong error code (EINVAL instead of ENOTDIR) when the file name argument ends in a slash and (without the slash) names a non-directory, on some platforms: mingw, MSVC.

Portability problems not fixed by Gnulib:

  • This function sometimes fails with EACCES when the failure is due to lack of appropriate privileges (EPERM), not to search permission denied on the file name prefix (EACCES): Linux kernel 5.15 with glibc 2.35 and a CIFS v1 file system (see https://bugs.gnu.org/65599).

10.115 chown

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/chown.html

Gnulib module: chown

Portability problems fixed by Gnulib:

  • Some platforms fail to detect trailing slash on non-directories, as in chown("link-to-file/",uid,gid): macOS 12.5, FreeBSD 7.2, AIX 7.3.1, Solaris 9.
  • Some platforms fail to update the change time when at least one argument was not -1, but no ownership changes resulted: OpenBSD 7.2.
  • When passed an argument of -1, some implementations really set the owner user/group id of the file to this value, rather than leaving that id of the file alone: some very old platforms.
  • When applied to a symbolic link, some implementations don’t dereference the symlink, i.e. they behave like lchown: some very old platforms.
  • This function is missing on some platforms; however, the replacement always fails with ENOSYS: mingw, MSVC 14.

Portability problems not fixed by Gnulib:

  • This function sometimes fails with EACCES when the failure is due to lack of appropriate privileges (EPERM), not to search permission denied on the file name prefix (EACCES): Linux kernel 5.15 with glibc 2.35 and a CIFS v1 file system (see https://bugs.gnu.org/65599).

10.116 cimag

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/cimag.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 5.2.1, NetBSD 3.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin 1.7.7, mingw, MSVC 9.

10.117 cimagf

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/cimagf.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 5.2.1, NetBSD 3.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin 1.7.7, mingw, MSVC 9.

10.118 cimagl

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/cimagl.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 5.2.1, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin 1.7.x, mingw, MSVC 9, Android 5.1.

10.119 clearerr

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/clearerr.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:


10.120 clock

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/clock.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:


10.121 clock_getcpuclockid

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/clock_getcpuclockid.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: Mac OS X 10.11, FreeBSD 6.0, NetBSD 7.1, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 11.4, Cygwin 1.7.9, mingw, MSVC 14, Android 5.1.

10.122 clock_getres

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/clock_getres.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: Mac OS X 10.11, Minix 3.1.8, mingw, MSVC 14.
  • On many platforms, this function returns a value other than the clock resolution of clock_gettime, i.e., the minimum distance between differing timestamps. For example, on AIX 7.2 it returns 10 milliseconds even though the clock resolution is 1 microsecond. Conversely, on GNU/Linux it typically returns 1 nanosecond even though the clock resolution may be greater.

The Gnulib module gettime-res is a partial substitute; it implements the CLOCK_REALTIME functionality of clock_getres, and fixes the too-high resolution bug of platforms like AIX 7.2.


10.123 clock_gettime

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/clock_gettime.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: Mac OS X 10.11, Minix 3.1.8, mingw, MSVC 14.
  • This function leaves the upper 32 bits of the tv_sec field of the result uninitialized on some platforms: mingw in 32-bit mode.

The Gnulib modules gettime and timespec_get are partial substitutes; they implement the CLOCK_REALTIME functionality of clock_gettime.


10.124 clock_nanosleep

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/clock_nanosleep.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: Mac OS X 10.11, FreeBSD 11.0, NetBSD 5.0, OpenBSD 6.7, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin 1.7.9, mingw, MSVC 14.

10.125 clock_settime

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/clock_settime.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: Mac OS X 10.11, Minix 3.1.8, Cygwin 1.7.9, mingw, MSVC 14.

10.126 clog

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/clog.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 11.0, NetBSD 3.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin 1.7.7, mingw, MSVC 9, Android 7.1.

10.127 clogf

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/clogf.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 11.0, NetBSD 3.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin 1.7.7, mingw, MSVC 9, Android 7.1.

10.128 clogl

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/clogl.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 11.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin 1.7.x, mingw, MSVC 9, Android 7.1.

10.129 close

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/close.html

Gnulib module: close

Portability problems fixed by Gnulib:

  • This function is declared in a different header file (namely, <io.h>) on some platforms: MSVC 14.
  • This function crashes when invoked with invalid arguments on some platforms: MSVC 14.
  • On Windows platforms (excluding Cygwin), socket and accept do not return file descriptors that can be closed by close. Instead, closesocket must be used.

Portability problems not fixed by Gnulib:


10.130 closedir

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/closedir.html

Gnulib module: closedir

Portability problems fixed by Gnulib:

  • This function is missing on some platforms: MSVC 14.

Portability problems not fixed by Gnulib:


10.131 closelog

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/closelog.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: mingw, MSVC 14.

10.132 cnd_broadcast

Documentation:
https://www.gnu.org/software/libc/manual/html_node/ISO-C-Condition-Variables.html.

Gnulib module: cnd

Portability problems fixed by Gnulib:

  • This function is missing on many platforms: glibc 2.27, macOS 11.1, FreeBSD 9.3, NetBSD 8.0, OpenBSD 6.7, Minix 3.1.8, AIX 7.1, HP-UX 11.31, IRIX 6.5, Solaris 11.3, Cygwin 2.9, mingw, MSVC 14, Android 9.0.

Portability problems not fixed by Gnulib:


10.133 cnd_destroy

Documentation:
https://www.gnu.org/software/libc/manual/html_node/ISO-C-Condition-Variables.html.

Gnulib module: cnd

Portability problems fixed by Gnulib:

  • This function is missing on many platforms: glibc 2.27, macOS 11.1, FreeBSD 9.3, NetBSD 8.0, OpenBSD 6.7, Minix 3.1.8, AIX 7.1, HP-UX 11.31, IRIX 6.5, Solaris 11.3, Cygwin 2.9, mingw, MSVC 14, Android 9.0.

Portability problems not fixed by Gnulib:


10.134 cnd_init

Documentation:
https://www.gnu.org/software/libc/manual/html_node/ISO-C-Condition-Variables.html.

Gnulib module: cnd

Portability problems fixed by Gnulib:

  • This function is missing on many platforms: glibc 2.27, macOS 11.1, FreeBSD 9.3, NetBSD 8.0, OpenBSD 6.7, Minix 3.1.8, AIX 7.1, HP-UX 11.31, IRIX 6.5, Solaris 11.3, Cygwin 2.9, mingw, MSVC 14, Android 9.0.

Portability problems not fixed by Gnulib:


10.135 cnd_signal

Documentation:
https://www.gnu.org/software/libc/manual/html_node/ISO-C-Condition-Variables.html.

Gnulib module: cnd

Portability problems fixed by Gnulib:

  • This function is missing on many platforms: glibc 2.27, macOS 11.1, FreeBSD 9.3, NetBSD 8.0, OpenBSD 6.7, Minix 3.1.8, AIX 7.1, HP-UX 11.31, IRIX 6.5, Solaris 11.3, Cygwin 2.9, mingw, MSVC 14, Android 9.0.

Portability problems not fixed by Gnulib:


10.136 cnd_timedwait

Documentation:
https://www.gnu.org/software/libc/manual/html_node/ISO-C-Condition-Variables.html.

Gnulib module: cnd

Portability problems fixed by Gnulib:

  • This function is missing on many platforms: glibc 2.27, macOS 11.1, FreeBSD 9.3, NetBSD 8.0, OpenBSD 6.7, Minix 3.1.8, AIX 7.1, HP-UX 11.31, IRIX 6.5, Solaris 11.3, Cygwin 2.9, mingw, MSVC 14, Android 9.0.

Portability problems not fixed by Gnulib:


10.137 cnd_wait

Documentation:
https://www.gnu.org/software/libc/manual/html_node/ISO-C-Condition-Variables.html.

Gnulib module: cnd

Portability problems fixed by Gnulib:

  • This function is missing on many platforms: glibc 2.27, macOS 11.1, FreeBSD 9.3, NetBSD 8.0, OpenBSD 6.7, Minix 3.1.8, AIX 7.1, HP-UX 11.31, IRIX 6.5, Solaris 11.3, Cygwin 2.9, mingw, MSVC 14, Android 9.0.

Portability problems not fixed by Gnulib:


10.138 confstr

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/confstr.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: Minix 3.1.8, Cygwin 1.5.x, mingw, MSVC 14, Android 9.0.

10.139 conj

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/conj.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 5.2.1, NetBSD 3.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin 1.7.7, mingw, MSVC 9.

10.140 conjf

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/conjf.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 5.2.1, NetBSD 3.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin 1.7.7, mingw, MSVC 9.

10.141 conjl

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/conjl.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 5.2.1, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin 1.7.x, mingw, MSVC 9, Android 5.1.

10.142 connect

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/connect.html

Gnulib module: connect

Portability problems fixed by Gnulib:

  • On Windows platforms (excluding Cygwin), error codes from this function are not placed in errno, and WSAGetLastError must be used instead.

Portability problems not fixed by Gnulib:


10.143 copysign

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/copysign.html

Gnulib module: copysign

Portability problems fixed by Gnulib:

  • This function is missing on some platforms: Minix 3.1.8, MSVC 9.

Portability problems not fixed by Gnulib:


10.144 copysignf

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/copysignf.html

Gnulib module: copysignf

Portability problems fixed by Gnulib:

  • This function is missing on some platforms: Minix 3.1.8, AIX 5.1, older IRIX 6.5, Solaris 9, MSVC 9.
  • This function is not declared on some platforms: IRIX 6.5.

Portability problems not fixed by Gnulib:


10.145 copysignl

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/copysignl.html

Gnulib module: copysignl

Portability problems fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 5.2.1, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, older IRIX 6.5, Solaris 9, Cygwin 1.7.x, MSVC 9.

Portability problems not fixed by Gnulib:


10.146 cos

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/cos.html

Gnulib module: cos

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:


10.147 cosf

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/cosf.html

Gnulib module: cosf

Portability problems fixed by Gnulib:

  • This function is missing on some platforms: Minix 3.1.8, AIX 5.1, Solaris 9.
  • This function is only defined as a macro with arguments on some platforms: MSVC 14.

Portability problems not fixed by Gnulib:


10.148 cosh

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/cosh.html

Gnulib module: cosh

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:


10.149 coshf

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/coshf.html

Gnulib module: coshf

Portability problems fixed by Gnulib:

  • This function is missing on some platforms: Minix 3.1.8, AIX 5.1, Solaris 9.
  • This function is only defined as a macro with arguments on some platforms: MSVC 14.

Portability problems not fixed by Gnulib:


10.150 coshl

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/coshl.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin 1.7.x, Android 4.4.
  • This function is only defined as a macro with arguments on some platforms: MSVC 14.

10.151 cosl

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/cosl.html

Gnulib module: cosl

Portability problems fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin 1.7.x, Android 4.4.
  • This function is only defined as a macro with arguments on some platforms: MSVC 14.

Portability problems not fixed by Gnulib:


10.152 cpow

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/cpow.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 11.0, NetBSD 3.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin 1.7.7, mingw, MSVC 9, Android 7.1.

10.153 cpowf

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/cpowf.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 11.0, NetBSD 3.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin 1.7.7, mingw, MSVC 9, Android 7.1.

10.154 cpowl

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/cpowl.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 11.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin 1.7.x, mingw, MSVC 9, Android 7.1.

10.155 cproj

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/cproj.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin 1.7.7, mingw, MSVC 9.
  • The glibc implementation is or was broken.

10.156 cprojf

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/cprojf.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin 1.7.7, mingw, MSVC 9.
  • The glibc implementation is or was broken.

10.157 cprojl

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/cprojl.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin 1.7.x, mingw, MSVC 9, Android 5.1.
  • The glibc implementation is or was broken.

10.158 creal

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/creal.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 5.2.1, NetBSD 3.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin 1.7.7, mingw, MSVC 9.

10.159 crealf

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/crealf.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 5.2.1, NetBSD 3.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin 1.7.7, mingw, MSVC 9.

10.160 creall

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/creall.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 5.2.1, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin 1.7.x, mingw, MSVC 9, Android 5.1.

10.161 creat

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/creat.html

Gnulib module: creat

Portability problems fixed by Gnulib:

  • This function does not support modes with execution bits (such as 0700) on some platforms: MSVC 14.
  • On platforms where off_t is a 32-bit type, creat may not work correctly with files 2 GiB and larger. See Large File Support.
  • This function does not fail when the file name argument ends in a slash and (without the slash) names a nonexistent file, on some platforms: FreeBSD 7.2, AIX 7.1, HP-UX 11.31, Solaris 9.

Portability problems not fixed by Gnulib:

  • On Windows, this function returns a file handle in O_TEXT mode. If you need a file handle in O_BINARY mode, you need to use the function open instead.

10.162 crypt

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/crypt.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: glibc 2.34, FreeBSD 6.0, NetBSD 5.0, Cygwin 2.9, mingw, MSVC 14, Android 9.0.
  • This function is not declared in <unistd.h> (without -D_GNU_SOURCE) on some platforms: glibc (at least 2.11–2.13).

10.163 csin

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/csin.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin 1.7.7, mingw, MSVC 9.

10.164 csinf

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/csinf.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin 1.7.7, mingw, MSVC 9.

10.165 csinh

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/csinh.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin 1.7.7, mingw, MSVC 9.

10.166 csinhf

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/csinhf.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin 1.7.7, mingw, MSVC 9.

10.167 csinhl

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/csinhl.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 14.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin 1.7.x, mingw, MSVC 9, Android 7.1.

10.168 csinl

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/csinl.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 14.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin 1.7.x, mingw, MSVC 9, Android 7.1.

10.169 csqrt

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/csqrt.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin 1.7.7, mingw, MSVC 9.

10.170 csqrtf

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/csqrtf.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin 1.7.7, mingw, MSVC 9.

10.171 csqrtl

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/csqrtl.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin 1.7.x, mingw, MSVC 9, Android 5.1.

10.172 ctan

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/ctan.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin 1.7.7, mingw, MSVC 9.

10.173 ctanf

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/ctanf.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin 1.7.7, mingw, MSVC 9.

10.174 ctanh

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/ctanh.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin 1.7.7, mingw, MSVC 9.

10.175 ctanhf

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/ctanhf.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin 1.7.7, mingw, MSVC 9.

10.176 ctanhl

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/ctanhl.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 14.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin 1.7.x, mingw, MSVC 9, Android 7.1.

10.177 ctanl

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/ctanl.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 14.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin 1.7.x, mingw, MSVC 9, Android 7.1.

10.178 ctermid

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/ctermid.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: mingw, MSVC 14, Android 7.1.

10.179 ctime

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/ctime.html

Gnulib module: ctime

Portability problems fixed by Gnulib:

  • On native Windows platforms (mingw, MSVC), this function works incorrectly when the environment variable TZ has been set by Cygwin.

Portability problems not fixed by Gnulib:

  • This function is deprecated in C23. Likewise, POSIX says this function is obsolescent and it is planned to be removed in a future version. Portable applications can use localtime_r and strftime (or even sprintf) instead.
  • This function may overflow its internal buffer if an invalid year is passed.
  • The ctime function need not be reentrant, and consequently is not required to be thread safe. Implementations of ctime typically write the timestamp into static buffer. If two threads call ctime at roughly the same time, you might end up with the wrong date in one of the threads, or some undefined string. There is a reentrant interface ctime_r.
  • Native Windows platforms (mingw, MSVC) support only a subset of time zones supported by GNU or specified by POSIX. See tzset.

A more flexible function is strftime. However, note that it is locale dependent.


10.180 ctime_r

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/ctime_r.html

Future POSIX removal:
https://www.austingroupbugs.net/view.php?id=1410

Gnulib module: extensions

Portability problems fixed by Gnulib:

  • This function has an incompatible declaration on some platforms: Solaris 11.4 (when _POSIX_PTHREAD_SEMANTICS is not defined).

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: mingw, MSVC 14.
  • POSIX says this function is obsolescent and it is planned to be removed in a future version. Use the functions localtime_r and strftime (or even sprintf) instead.
  • This function may put more than 26 bytes into the argument buffer if an invalid year is passed.

ctime_r takes a pre-allocated buffer and length of the buffer, and returns NULL on errors. The input buffer should be at least 26 bytes in size. The output string is locale-independent. However, years can have more than 4 digits if time_t is sufficiently wide, so the length of the required output buffer is not easy to determine. Increasing the buffer size when ctime_r returns NULL is not necessarily sufficient. The NULL return value could mean some other error condition, which will not go away by increasing the buffer size.

A more flexible function is strftime. However, note that it is locale dependent.


10.181 daddl

Documentation:
https://www.gnu.org/software/libc/manual/html_node/Misc-FP-Arithmetic.html.

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on all non-glibc platforms: glibc 2.27, macOS 11.1, FreeBSD 14.0, NetBSD 9.0, OpenBSD 6.7, Minix 3.1.8, AIX 7.1, HP-UX 11.31, IRIX 6.5, Solaris 11.4, Cygwin 2.9, mingw, MSVC 14, Android 9.0.

10.182 daylight

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/daylight.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This variable is missing on some platforms: FreeBSD 14.0, OpenBSD 3.8, IRIX 6.5.
  • The address of this variable is not a compile-time constant on some platforms: Cygwin, mingw.
  • Native Windows platforms (mingw, MSVC) support only a subset of time zones supported by GNU or specified by POSIX. See tzset.

A more portable way of getting the UTC offset is to use strftime with the %z format. See strftime.


10.183 dbm_clearerr

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/dbm_clearerr.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: glibc 2.3.6, HP-UX 11.11, Cygwin 2.9, mingw, MSVC 14, Android 9.0.

10.184 dbm_close

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/dbm_close.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: glibc 2.3.6, Cygwin 2.9, mingw, MSVC 14, Android 9.0.

10.185 dbm_delete

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/dbm_delete.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: glibc 2.3.6, Cygwin 2.9, mingw, MSVC 14, Android 9.0.

10.186 dbm_error

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/dbm_error.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: glibc 2.3.6, HP-UX 11.11, Cygwin 2.9, mingw, MSVC 14, Android 9.0.

10.187 dbm_fetch

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/dbm_fetch.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: glibc 2.3.6, Cygwin 2.9, mingw, MSVC 14, Android 9.0.

10.188 dbm_firstkey

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/dbm_firstkey.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: glibc 2.3.6, Cygwin 2.9, mingw, MSVC 14, Android 9.0.

10.189 dbm_nextkey

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/dbm_nextkey.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: glibc 2.3.6, Cygwin 2.9, mingw, MSVC 14, Android 9.0.

10.190 dbm_open

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/dbm_open.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: glibc 2.3.6, Cygwin 2.9, mingw, MSVC 14, Android 9.0.

10.191 dbm_store

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/dbm_store.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: glibc 2.3.6, Cygwin 2.9, mingw, MSVC 14, Android 9.0.

10.192 ddivl

Documentation:
https://www.gnu.org/software/libc/manual/html_node/Misc-FP-Arithmetic.html.

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on all non-glibc platforms: glibc 2.27, macOS 11.1, FreeBSD 14.0, NetBSD 9.0, OpenBSD 6.7, Minix 3.1.8, AIX 7.1, HP-UX 11.31, IRIX 6.5, Solaris 11.4, Cygwin 2.9, mingw, MSVC 14, Android 9.0.

10.193 difftime

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/difftime.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:


10.194 dirfd

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/dirfd.html

Gnulib module: dirfd

Portability problems fixed by Gnulib:

  • This function is missing on some platforms: Minix 3.1.8, AIX 7.1, HP-UX 11, Solaris 10, mingw, MSVC 14.

Portability problems not fixed by Gnulib:

  • This function always fails on some platforms: mingw.
  • There is a dirfd macro but no function, and the macro does not work with an argument of type void *, as a function would: NetBSD 9.2.

10.195 dirname

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/dirname.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: IRIX 6.5, mingw, MSVC 14.
  • dirname assumes file names in POSIX syntax; it does not work with file names in Windows syntax.

The Gnulib module dirname provides similar API, with functions dir_name and mdir_name, that also works with Windows file names.


10.196 div

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/div.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:


10.197 dlclose

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/dlclose.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: Minix 3.1.8, mingw, MSVC 14.

10.198 dlerror

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/dlerror.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: Minix 3.1.8, mingw, MSVC 14.

10.199 dlopen

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/dlopen.html

LSB specification:
https://refspecs.linuxbase.org/LSB_5.0.0/LSB-Core-generic/LSB-Core-generic/baselib-dlopen-1.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: Minix 3.1.8, mingw, MSVC 14.
  • If the file name argument is not absolute, the file is searched for. The search algorithm is system specific.

10.200 dlsym

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/dlsym.html

LSB specification:
https://refspecs.linuxbase.org/LSB_5.0.0/LSB-Core-generic/LSB-Core-generic/baselib-dlsym-1.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: Minix 3.1.8, mingw, MSVC 14.
  • The visibility of symbols loaded in dependent shared libraries or present in the main executable is system dependent.

10.201 dmull

Documentation:
https://www.gnu.org/software/libc/manual/html_node/Misc-FP-Arithmetic.html.

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on all non-glibc platforms: glibc 2.27, macOS 11.1, FreeBSD 14.0, NetBSD 9.0, OpenBSD 6.7, Minix 3.1.8, AIX 7.1, HP-UX 11.31, IRIX 6.5, Solaris 11.4, Cygwin 2.9, mingw, MSVC 14, Android 9.0.

10.202 dprintf

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/dprintf.html

Gnulib module: dprintf or dprintf-posix or dprintf-gnu

Portability problems fixed by either Gnulib module dprintf or dprintf-posix or dprintf-gnu:

  • This function is missing on many non-glibc platforms: Mac OS X 10.5, FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 11.3, Cygwin 1.5.x, mingw, MSVC 14.

Portability problems fixed by either Gnulib module dprintf-posix or dprintf-gnu:

  • This function does not support size specifiers as in C23 (w8, w16, w32, w64, wf8, wf16, wf32, wf64) on some platforms: glibc, musl libc, macOS 12.5, FreeBSD 13.2, NetBSD 9.0, OpenBSD 7.2, AIX 7.2, Solaris 11.4, Cygwin 2.9.0.
  • printf "%f", "%e", "%g" of Infinity and NaN yields an incorrect result on some platforms: Solaris 11.4.
  • This function does not support the ‘a’ and ‘A’ directives on some platforms: glibc-2.3.6, Solaris 11.4.
  • This function does not support the ‘b’ directive, required by ISO C23, on some platforms: glibc 2.34, musl libc, macOS 12.5, FreeBSD 13.2, NetBSD 9.0, OpenBSD 7.2, AIX 7.2, Solaris 11.4, Cygwin 2.9.0.
  • This function does not support the ‘n’ directive on some platforms: glibc when used with _FORTIFY_SOURCE >= 2 (set by default on Ubuntu), Android, OpenBSD, macOS 11.1.
  • This function does not support precisions in the ‘ls’ directive correctly on some platforms: Solaris 11.4.
  • printf "%010f" of NaN and Infinity yields an incorrect result (padded with zeroes, or wrong capitalization) on some platforms: Solaris 11.4.
  • printf "%#.0x" or "%#.0X" with a zero argument yields an incorrect result (non-empty) on some platforms: Mac OS X 10.6.
  • This function does not support precisions larger than 512 or 1024 in integer, floating-point and pointer output on some platforms: AIX 7.1.
  • This function produces wrong output for the ‘lc’ directive with a NUL wide character argument on some platforms: musl libc 1.2.4.

Portability problems fixed by Gnulib module dprintf-gnu:

  • This function does not support the ‘B’ directive on some platforms: glibc 2.34, FreeBSD 13.2, NetBSD 9.0, OpenBSD 7.2, macOS 12.5, AIX 7.2, Solaris 11.4, and others.

Portability problems not fixed by Gnulib:

  • The %m directive is not portable, use %s mapped to an argument of strerror(errno) (or a version of strerror_r) instead.
  • Formatting noncanonical ‘long double’ numbers produces nonmeaningful results on some platforms: glibc and others, on x86, x86_64, IA-64 CPUs.
  • When formatting an integer with grouping flag, this function inserts thousands separators even in the "C" locale on some platforms: NetBSD 5.1.
  • On some platforms, this function does not set errno or the stream error indicator on attempts to write to a read-only stream: Cygwin 1.7.9.

10.203 drand48

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/drand48.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: Minix 3.1.8, mingw, MSVC 14.

10.204 dsubl

Documentation:
https://www.gnu.org/software/libc/manual/html_node/Misc-FP-Arithmetic.html.

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on all non-glibc platforms: glibc 2.27, macOS 11.1, FreeBSD 14.0, NetBSD 9.0, OpenBSD 6.7, Minix 3.1.8, AIX 7.1, HP-UX 11.31, IRIX 6.5, Solaris 11.4, Cygwin 2.9, mingw, MSVC 14, Android 9.0.

10.205 dup

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/dup.html

Gnulib module: dup

Portability problems fixed by Gnulib:

  • This function is declared in a different header file (namely, <io.h>) on some platforms: MSVC 14.
  • This function crashes when invoked with invalid arguments on some platforms: MSVC 14.

Portability problems not fixed by Gnulib:


10.206 dup2

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/dup2.html

Gnulib module: dup2

Portability problems fixed by Gnulib:

  • This function is declared in a different header file (namely, <io.h>) on some platforms: MSVC 14.
  • This function always returns 0 for success on some platforms: mingw, MSVC 14.
  • This function can hang when duplicating an fd to itself on some platforms: mingw, MSVC 14.
  • This function crashes when invoked with invalid arguments on some platforms: Cygwin 1.7.17, MSVC 14.
  • This function crashes when invoked with valid arguments on some platforms: Cygwin 1.7.25.
  • This function fails with EINVAL when duplicating an fd to itself: Android.
  • This function resets the FD_CLOEXEC flag when duplicating an fd to itself on some platforms: Haiku.
  • This function returns 0 for dup2 (1, 1) on some platforms: Cygwin 1.5.x.
  • This function may return -EBADF instead of -1 on some platforms: Linux releases between July 2008 and May 2009 (versions 2.6.27 to 2.6.29).
  • This function returns EMFILE instead of EBADF for large targets, which interferes with using dup2(fd,fd)==fd) as the minimal EBADF filter: AIX 7.1, FreeBSD 6.1, Cygwin 1.5.

Portability problems not fixed by Gnulib:


10.207 duplocale

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/duplocale.html

Gnulib module: duplocale

Portability problems fixed by Gnulib:

  • The argument LC_GLOBAL_LOCALE is not supported on some platforms: glibc 2.11, AIX 7.1.
  • With the argument LC_GLOBAL_LOCALE, this function returns a wrong result on some platforms: NetBSD 7.1.

Portability problems not fixed by Gnulib:

  • This function is missing on many platforms: FreeBSD 9.0, NetBSD 5.0, OpenBSD 6.1, Minix 3.1.8, AIX 6.1, HP-UX 11, IRIX 6.5, Solaris 11.3, Cygwin 2.5.x, mingw, MSVC 14, Android 4.4.
  • This function is useless because the locale_t type is not defined on some platforms: z/OS.
  • With the argument LC_GLOBAL_LOCALE, this function returns a wrong result on some platforms: Haiku.

10.208 encrypt

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/encrypt.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: NetBSD 5.0, OpenBSD 6.7, Minix 3.1.8, Cygwin 2.9, mingw, MSVC 14, Android 9.0.
  • This function is not declared in <unistd.h> (without -D_GNU_SOURCE) on some platforms: glibc (at least 2.11–2.13).
  • POSIX 202x says this function is obsolescent and it is planned to be removed in a future version.

10.209 endgrent

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/endgrent.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: mingw, MSVC 14, Android 7.1.

10.210 endhostent

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/endhostent.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: mingw, MSVC 14, Android 8.1.

10.211 endnetent

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/endnetent.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: Cygwin 2.9, mingw, MSVC 14, Android 8.1.

10.212 endprotoent

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/endprotoent.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: mingw, MSVC 14, Android 8.1.

10.213 endpwent

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/endpwent.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: mingw, MSVC 14.

10.214 endservent

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/endservent.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: mingw, MSVC 14.

10.215 endutxent

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/endutxent.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 6.0, OpenBSD 6.7, Minix 3.1.8, mingw, MSVC 14, Android 9.0.

10.216 environ

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/environ.html

Gnulib module: environ

Portability problems fixed by Gnulib:

  • POSIX does not require this variable to be declared, and it is indeed not declared on some platforms: macOS 11.1, FreeBSD 14.0, NetBSD 5.0, OpenBSD 3.8, IRIX 6.5, Solaris 11.4.
  • On macOS, this variable is not declared. Up to Mac OS X 10.4, one can use
    extern char **environ;
    

    to get the variable declared. This does not work any more, however, in shared libraries on macOS 11.1. Here is a workaround: Instead, one can use

    #include <crt_externs.h>
    #define environ (*_NSGetEnviron())
    

    This works at all versions of macOS.

  • On Cygwin in 64-bit mode, references to this variable cause a link error when the option -Wl,--disable-auto-import is in use.

Portability problems not fixed by Gnulib:

  • The address of this variable is not a compile-time constant on some platforms: mingw.
  • Assigning NULL to environ to clear all variables is not portable; better is to assign environ to one-element array containing a NULL pointer. That said, an empty environment is not portable either, as some systems may require particular environment variables (such as PATH) to be present in order to operate consistently.

10.217 erand48

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/erand48.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: Minix 3.1.8, mingw, MSVC 14.

10.218 erf

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/erf.html

Gnulib module: erf

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: Minix 3.1.8, MSVC 9.

10.219 erfc

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/erfc.html

Gnulib module: erfc

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: Minix 3.1.8, MSVC 9.

10.220 erfcf

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/erfcf.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, MSVC 9.

10.221 erfcl

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/erfcl.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 6.0, NetBSD 7.1, OpenBSD 3.8, Minix 3.1.8, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin 1.7.x, mingw, MSVC 9, Android 4.4.

10.222 erff

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/erff.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, MSVC 9.

10.223 erfl

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/erfl.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 6.0, NetBSD 7.1, OpenBSD 3.8, Minix 3.1.8, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin 1.7.x, mingw, MSVC 9, Android 4.4.

10.224 errno

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/errno.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • On Windows, the socket functions don’t set errno; their error code is available through WSAGetLastError() instead.

10.225 execl

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/execl.html

Gnulib module: execl

Portability problems fixed by Gnulib:

  • On Windows platforms (excluding Cygwin), this function does not pass command-line arguments correctly if they contain space, tab, backslash, or double-quote characters.
  • On Windows platforms (excluding Cygwin), this function spawns an asynchronous child process and then exits the current process immediately. As a consequence, the parent of the current process 1. may incorrectly proceed as if its child had exited, and 2. will never see the child’s exit status.
  • On Windows platforms (excluding Cygwin), the return type of this function is intptr_t, not int.

Note: The Gnulib replacement for this function is not async-safe, that is, it must not be invoked from a signal handler.

Portability problems not fixed by Gnulib:

  • On some platforms, a script without executable permission is still run: Cygwin 1.5.x.

10.226 execle

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/execle.html

Gnulib module: execle

Portability problems fixed by Gnulib:

  • On Windows platforms (excluding Cygwin), this function does not pass command-line arguments correctly if they contain space, tab, backslash, or double-quote characters.
  • On Windows platforms (excluding Cygwin), this function spawns an asynchronous child process and then exits the current process immediately. As a consequence, the parent of the current process 1. may incorrectly proceed as if its child had exited, and 2. will never see the child’s exit status.
  • On Windows platforms (excluding Cygwin), the return type of this function is intptr_t, not int.

Note: The Gnulib replacement for this function is not async-safe, that is, it must not be invoked from a signal handler.

Portability problems not fixed by Gnulib:

  • On some platforms, a script without executable permission is still run: Cygwin 1.5.x.

10.227 execlp

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/execlp.html

Gnulib module: execlp

Portability problems fixed by Gnulib:

  • On Windows platforms (excluding Cygwin), this function does not pass command-line arguments correctly if they contain space, tab, backslash, or double-quote characters.
  • On Windows platforms (excluding Cygwin), this function spawns an asynchronous child process and then exits the current process immediately. As a consequence, the parent of the current process 1. may incorrectly proceed as if its child had exited, and 2. will never see the child’s exit status.
  • On Windows platforms (excluding Cygwin), the return type of this function is intptr_t, not int.

Portability problems not fixed by Gnulib:

  • On some platforms, a script without executable permission is still run: Cygwin 1.5.x.

10.228 execv

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/execv.html

Gnulib module: execv

Portability problems fixed by Gnulib:

  • On Windows platforms (excluding Cygwin), this function does not pass command-line arguments correctly if they contain space, tab, backslash, or double-quote characters.
  • On Windows platforms (excluding Cygwin), this function spawns an asynchronous child process and then exits the current process immediately. As a consequence, the parent of the current process 1. may incorrectly proceed as if its child had exited, and 2. will never see the child’s exit status.
  • On Windows platforms (excluding Cygwin), the return type of this function is intptr_t, not int.

Note: The Gnulib replacement for this function is not async-safe, that is, it must not be invoked from a signal handler.

Portability problems not fixed by Gnulib:

  • On some platforms, a script without executable permission is still run: Cygwin 1.5.x.

10.229 execve

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/execve.html

Gnulib module: execve

Portability problems fixed by Gnulib:

  • On Windows platforms (excluding Cygwin), this function does not pass command-line arguments correctly if they contain space, tab, backslash, or double-quote characters.
  • On Windows platforms (excluding Cygwin), this function spawns an asynchronous child process and then exits the current process immediately. As a consequence, the parent of the current process 1. may incorrectly proceed as if its child had exited, and 2. will never see the child’s exit status.
  • On Windows platforms (excluding Cygwin), the return type of this function is intptr_t, not int.

Note: The Gnulib replacement for this function is not async-safe, that is, it must not be invoked from a signal handler.

Portability problems not fixed by Gnulib:

  • On some platforms, a script without executable permission is still run: Cygwin 1.5.x.

10.230 execvp

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/execvp.html

Gnulib module: execvp

Portability problems fixed by Gnulib:

  • On Windows platforms (excluding Cygwin), this function does not pass command-line arguments correctly if they contain space, tab, backslash, or double-quote characters.
  • On Windows platforms (excluding Cygwin), this function spawns an asynchronous child process and then exits the current process immediately. As a consequence, the parent of the current process 1. may incorrectly proceed as if its child had exited, and 2. will never see the child’s exit status.
  • On Windows platforms (excluding Cygwin), the return type of this function is intptr_t, not int.

Portability problems not fixed by Gnulib:

  • On some platforms, a script without executable permission is still run: Cygwin 1.5.x.

10.231 exit

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/exit.html

Gnulib module: stdlib

Portability problems fixed by Gnulib:

  • Some problems with the macros EXIT_SUCCESS and EXIT_FAILURE, see stdlib.h.

Portability problems not fixed by Gnulib:


10.232 exp

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/exp.html

Gnulib module: exp

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:


10.233 exp2

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/exp2.html

Gnulib module: exp2

Portability problems fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 5.2.1, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, older IRIX 6.5, Solaris 9, MSVC 9.
  • This function is not declared on some platforms: IRIX 6.5.
  • This function returns grossly wrong results on some platforms: OpenBSD 4.9.

Portability problems not fixed by Gnulib:


10.234 exp2f

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/exp2f.html

Gnulib module: exp2f

Portability problems fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 5.2.1, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, older IRIX 6.5, Solaris 9, MSVC 9.
  • This function is not declared on some platforms: IRIX 6.5.

Portability problems not fixed by Gnulib:


10.235 exp2l

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/exp2l.html

Gnulib module: exp2l or exp2l-ieee

Portability problems fixed by either Gnulib module exp2l or exp2l-ieee:

  • This function is missing on some platforms: FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, older IRIX 6.5, Solaris 9, Cygwin 1.7.x, MSVC 9, Android 4.4.
  • This function is not declared on some platforms: IRIX 6.5.
  • This function produces results which are accurate to only 16 digits on some platforms: NetBSD 9.0.

Portability problems fixed by Gnulib module exp2l-ieee:

  • This function returns a wrong value for a NaN argument on some platforms: OpenBSD 4.9.
  • This function returns a wrong value for a negative infinity argument on some platforms: IRIX 6.5.

Portability problems not fixed by Gnulib:


10.236 expf

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/expf.html

Gnulib module: expf

Portability problems fixed by Gnulib:

  • This function is missing on some platforms: Minix 3.1.8, AIX 5.1, Solaris 9.
  • This function is only defined as a macro with arguments on some platforms: MSVC 14.

Portability problems not fixed by Gnulib:


10.237 expl

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/expl.html

Gnulib module: expl

Portability problems fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin 1.7.x, Android 4.4.
  • This function returns 0.0 for all arguments on some platforms: Haiku 2017.
  • This function returns NaN for small operands on some platforms: OpenBSD 5.4.
  • This function is only defined as a macro with arguments on some platforms: MSVC 14.
  • This function produces results which are accurate to only 16 digits on some platforms: musl libc 1.2.2/arm64, musl libc 1.2.2/s390x, NetBSD 9.0.

Portability problems not fixed by Gnulib:


10.238 expm1

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/expm1.html

Gnulib module: expm1 or expm1-ieee

Portability problems fixed by either Gnulib module expm1 or expm1-ieee:

  • This function is missing on some platforms: Minix 3.1.8, mingw, MSVC 9.

Portability problems fixed by Gnulib module expm1-ieee:

  • This function has problems when the argument is minus zero on some platforms: AIX 7.1.

Portability problems not fixed by Gnulib:


10.239 expm1f

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/expm1f.html

Gnulib module: expm1f or expm1f-ieee

Portability problems fixed by either Gnulib module expm1f or expm1f-ieee:

  • This function is missing on some platforms: Minix 3.1.8, AIX 5.1, HP-UX 11, Solaris 9, mingw, MSVC 9.
  • This function produces wrong results for arguments <= -17.32868 on some platforms: IRIX 6.5.

Portability problems fixed by Gnulib module expm1f-ieee:

  • This function returns a positive zero for a minus zero argument on some platforms: AIX 7.2.

Portability problems not fixed by Gnulib:


10.240 expm1l

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/expm1l.html

Gnulib module: expm1l

Portability problems fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 6.0, NetBSD 9.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, older IRIX 6.5, Solaris 9, Cygwin 1.7.x, mingw, MSVC 9, Android 4.4.
  • This function is not declared on some platforms: IRIX 6.5.
  • This function produces results which are accurate to only 16 digits on some platforms: musl libc 1.2.2/arm64, musl libc 1.2.2/s390x, Mac OS X 10.5, NetBSD 8.0.

Portability problems not fixed by Gnulib:


10.241 fabs

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/fabs.html

Gnulib module: fabs

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:


10.242 fabsf

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/fabsf.html

Gnulib module: fabsf

Portability problems fixed by Gnulib:

  • This function is missing on some platforms: AIX 5.1, Solaris 9.
  • This function is only defined as a macro with arguments on some platforms: MSVC 14.

Portability problems not fixed by Gnulib:


10.243 fabsl

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/fabsl.html

Gnulib module: fabsl

Portability problems fixed by Gnulib:

  • This function is missing on some platforms: NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin 1.7.x.
  • This function is only defined as a macro with arguments on some platforms: MSVC 14.
  • This function returns a minus zero for a minus zero argument on some platforms: IRIX 6.5 with gcc 4.2.4.

Portability problems not fixed by Gnulib:


10.244 faccessat

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/faccessat.html

Gnulib module: faccessat

Portability problems fixed by Gnulib:

  • This function is missing on some platforms: glibc 2.3.6, macOS 10.12, FreeBSD 7.4, NetBSD 6.1.5, OpenBSD 4.9, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 10, Cygwin 1.5.x, mingw, MSVC 14, Android 4.0.4.
  • On some platforms, faccessat (dfd, "file/", amode, flag) succeeds instead of failing when file is not a directory. macOS 11.1.

Portability problems not fixed by Gnulib:

  • The replacement does not always take ACLs into account.
  • The replacement is not safe to be used in libraries.
  • The replacement is not multithread-safe.
  • The replacement does not support the AT_SYMLINK_NOFOLLOW flag, which is supported by GNU faccessat.
  • On some platforms, faccessat can mishandle AT_EACCESS after a process starts as root and then becomes non-root: GNU/Linux with glibc 2.32.

Other problems of this function:

  • There is an inherent race between calling this function and performing some action based on the results; you should think twice before trusting this function, especially in a set-uid or set-gid program.

10.245 fadd

Documentation:
https://www.gnu.org/software/libc/manual/html_node/Misc-FP-Arithmetic.html.

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on all non-glibc platforms: glibc 2.27, macOS 11.1, FreeBSD 14.0, NetBSD 9.0, OpenBSD 6.7, Minix 3.1.8, AIX 7.1, HP-UX 11.31, IRIX 6.5, Solaris 11.4, Cygwin 2.9, mingw, MSVC 14, Android 9.0.

10.246 faddl

Documentation:
https://www.gnu.org/software/libc/manual/html_node/Misc-FP-Arithmetic.html.

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on all non-glibc platforms: glibc 2.27, macOS 11.1, FreeBSD 14.0, NetBSD 9.0, OpenBSD 6.7, Minix 3.1.8, AIX 7.1, HP-UX 11.31, IRIX 6.5, Solaris 11.4, Cygwin 2.9, mingw, MSVC 14, Android 9.0.

10.247 fattach

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/fattach.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: macOS 11.1, FreeBSD 14.0, NetBSD 9.0, OpenBSD 6.7, Minix 3.1.8, Cygwin 2.9, mingw, MSVC 14, Android 9.0.

10.248 fchdir

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/fchdir.html

Gnulib module: fchdir

Portability problems fixed by Gnulib:

  • This function is missing on some platforms: mingw, MSVC 14. But the replacement function is not safe to be used in libraries and is not multithread-safe.

Portability problems not fixed by Gnulib:


10.249 fchmod

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/fchmod.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: mingw, MSVC 14.
  • This function sometimes fails with EACCES when the failure is due to lack of appropriate privileges (EPERM), not to search permission denied on the file name prefix (EACCES): Linux kernel 5.15 with glibc 2.35 and a CIFS v1 file system (see https://bugs.gnu.org/65599).

10.250 fchmodat

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/fchmodat.html

Gnulib module: fchmodat

Portability problems fixed by Gnulib:

  • This function is missing on some platforms: glibc 2.3.6, Mac OS X 10.5, FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 10, Cygwin 1.5.x, mingw, MSVC 14. But the replacement function is not safe to be used in libraries and is not multithread-safe.
  • This function does not fail when the file name argument ends in a slash and (without the slash) names a non-directory, on some platforms: AIX 7.2.
  • When given the AT_SYMLINK_NOFOLLOW flag, this function fails with errno set to ENOTSUP, even when the file is not a symbolic link: GNU/Linux with glibc 2.31, Cygwin 2.9.

Portability problems not fixed by Gnulib:

  • Some platforms do not allow changing the access bits on symbolic links.
  • If the AT_SYMLINK_NOFOLLOW flag is specified, this function can fail with errno set to EMFILE or ENFILE, and it fails with errno set to EOPNOTSUPP if the /proc file system is not mounted: GNU/Linux with glibc 2.34.
  • This function sometimes fails with EACCES when the failure is due to lack of appropriate privileges (EPERM), not to search permission denied on the file name prefix (EACCES): Linux kernel 5.15 with glibc 2.35 and a CIFS v1 file system (see https://bugs.gnu.org/65599).

10.251 fchown

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/fchown.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: mingw, MSVC 14.
  • This function sometimes fails with EACCES when the failure is due to lack of appropriate privileges (EPERM), not to search permission denied on the file name prefix (EACCES): Linux kernel 5.15 with glibc 2.35 and a CIFS v1 file system (see https://bugs.gnu.org/65599).

10.252 fchownat

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/fchownat.html

Gnulib module: fchownat

Portability problems fixed by Gnulib:

  • This function is missing on some platforms: glibc 2.3.6, Mac OS X 10.5, FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Cygwin 1.5.x, mingw, MSVC 14. But the replacement function is not safe to be used in libraries and is not multithread-safe. Also, the replacement may fail to change symlinks if lchown is unsupported, or fail altogether if chown is unsupported.
  • This function is declared in <sys/stat.h>, not in <unistd.h>, on some platforms: Android 4.3.
  • Some platforms fail to detect trailing slash on non-directories, as in fchown(dir,"link-to-file/",uid,gid,flag): Solaris 9.
  • Some platforms mistakenly dereference symlinks when using AT_SYMLINK_NOFOLLOW: Linux kernel 2.6.17.
  • This function does not fail for an empty filename on some platforms: Linux with glibc < 2.11.

Portability problems not fixed by Gnulib:

  • This function sometimes fails with EACCES when the failure is due to lack of appropriate privileges (EPERM), not to search permission denied on the file name prefix (EACCES): Linux kernel 5.15 with glibc 2.35 and a CIFS v1 file system (see https://bugs.gnu.org/65599).

10.253 fclose

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/fclose.html

Gnulib module: fclose

Portability problems fixed by Gnulib:

  • On some platforms, this function fails to set the file position of a seekable input stream to the byte after the last one actually read: glibc 2.34, FreeBSD, AIX 7.2.
  • This function crashes if the stream’s file descriptor has already been closed on some platforms: MSVC 14.
  • On Windows platforms (excluding Cygwin), socket and accept followed by fdopen do not return streams that can be closed by fclose.

Portability problems not fixed by Gnulib:

  • On Windows platforms (excluding Cygwin), this function does not set errno upon failure.

10.254 fcntl

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/fcntl.html

LSB specification:
https://refspecs.linuxbase.org/LSB_5.0.0/LSB-Core-generic/LSB-Core-generic/baselib-fcntl-3.html

Gnulib module: fcntl

Portability problems fixed by Gnulib:

  • This function is missing on some platforms: mingw, MSVC 14.
  • This function does not support F_DUPFD_CLOEXEC on some platforms: glibc with Linux kernels before 2.6.24, Mac OS X 10.5, FreeBSD 6.0, NetBSD 5.0, OpenBSD 6.7, AIX 7.1, HP-UX 11, IRIX 6.5, Solaris 11 2010-11, Cygwin 1.7.1. Note that the gnulib replacement code is functional but not atomic.
  • The F_DUPFD_CLOEXEC action of this function does not set the FD_CLOEXEC flag on some platforms: NetBSD 9.0.
  • The F_DUPFD_CLOEXEC action of this function sets the FD_CLOEXEC flag on the wrong file descriptor on some platforms: Haiku.
  • The F_DUPFD action of this function does not reject out-of-range targets properly on some platforms: AIX 7.1, Cygwin 1.5.x, Haiku.
  • The F_DUPFD action of this function mistakenly clears FD_CLOEXEC on the source descriptor on some platforms: Haiku.

Portability problems not fixed by Gnulib:

  • The replacement function does not support F_SETFD, F_GETFL, F_SETFL, F_GETOWN, F_SETOWN, F_GETLK, F_SETLK, and F_SETLKW on some platforms: mingw, MSVC 14.
  • When a file does not support locking (such as on an NFS file system that does not support file locking), calls with F_SETLK and F_SETLKW fail with errno set to different values on different systems: EINVAL on OpenIndiana (as suggested by the POSIX 1003.1-2017 fcntl specification), ENOLCK on GNU/Linux, and EOPNOTSUPP on FreeBSD.

10.255 fdatasync

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/fdatasync.html

Gnulib module: fdatasync

Portability problems fixed by Gnulib:

  • This function is present but not declared on some platforms: Mac OS X 10.7.
  • This function is missing on some platforms: Mac OS X 10.5, FreeBSD 11.0, OpenBSD 3.8, Minix 3.1.8, mingw, MSVC 14, Android 2.2.

Portability problems not fixed by Gnulib:


10.256 fdetach

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/fdetach.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: macOS 11.1, FreeBSD 14.0, NetBSD 9.0, OpenBSD 6.7, Minix 3.1.8, Cygwin 2.9, mingw, MSVC 14, Android 9.0.

10.257 fdim

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/fdim.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 5.2.1, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, IRIX 6.5, Solaris 9, MSVC 9.

10.258 fdimf

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/fdimf.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 5.2.1, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, MSVC 9.

10.259 fdiml

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/fdiml.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 5.2.1, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin 1.7.x, MSVC 9.

10.260 fdiv

Documentation:
https://www.gnu.org/software/libc/manual/html_node/Misc-FP-Arithmetic.html.

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on all non-glibc platforms: glibc 2.27, macOS 11.1, FreeBSD 14.0, NetBSD 9.0, OpenBSD 6.7, Minix 3.1.8, AIX 7.1, HP-UX 11.31, IRIX 6.5, Solaris 11.4, Cygwin 2.9, mingw, MSVC 14, Android 9.0.

10.261 fdivl

Documentation:
https://www.gnu.org/software/libc/manual/html_node/Misc-FP-Arithmetic.html.

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on all non-glibc platforms: glibc 2.27, macOS 11.1, FreeBSD 14.0, NetBSD 9.0, OpenBSD 6.7, Minix 3.1.8, AIX 7.1, HP-UX 11.31, IRIX 6.5, Solaris 11.4, Cygwin 2.9, mingw, MSVC 14, Android 9.0.

10.262 fdopen

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/fdopen.html

Gnulib module: fdopen

Portability problems fixed by Gnulib:

  • This function crashes when invoked with invalid arguments on some platforms: MSVC 14.
  • On Windows platforms (excluding Cygwin), this function does not set errno upon failure.

Portability problems not fixed by Gnulib:


10.263 fdopendir

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/fdopendir.html

Gnulib module: fdopendir

Portability problems fixed by Gnulib:

  • This function is missing on some platforms: glibc 2.3.6, Mac OS X 10.5, FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Cygwin 1.5.x, mingw, MSVC 14. But the replacement function is not safe to be used in libraries and is not multithread-safe. Also, the replacement does not guarantee that ‘dirfd(fdopendir(n))==n’ (dirfd might fail, or return a different file descriptor than n).
  • This function exists but is not declared on some platforms: FreeBSD 7.3.
  • This function does not reject non-directory file descriptors on some platforms: GNU/Hurd.
  • This function mistakenly closes non-directory file descriptors on some platforms: FreeBSD 8.1.

Portability problems not fixed by Gnulib:


10.264 feclearexcept

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/feclearexcept.html

Gnulib module: fenv-exceptions-tracking-c99

Portability problems fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, IRIX 6.5, Solaris 9, Cygwin 1.7.7, MSVC 9, Android 4.4.
  • This function is broken on some platforms: OpenBSD 7.4/mips64, Minix 3.3/i386.

Portability problems not fixed by Gnulib:


10.265 fegetenv

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/fegetenv.html

Gnulib module: fenv-environment

Portability problems fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 5.2.1, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, IRIX 6.5, Solaris 9, Cygwin 1.7.7, MSVC 9, Android 4.4.
  • This function clears all exception trap bits on some platforms: glibc 2.19/x86_64, Mac OS X 10.5/i386, Mac OS X 10.5/x86_64.
  • This function does not save the exception trap bits on some platforms: AIX 7.3.

Portability problems not fixed by Gnulib:


10.266 fegetexceptflag

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/fegetexceptflag.html

Gnulib module: fenv-exceptions-state-c99

Portability problems fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, IRIX 6.5, Solaris 9, Cygwin 1.7.7, MSVC 9, Android 4.4.

Portability problems not fixed by Gnulib:


10.267 fegetmode

Documentation:
https://www.gnu.org/software/libc/manual/html_node/Control-Functions.html.

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

  • This function is missing on all non-glibc platforms: glibc 2.24, macOS 11.1, FreeBSD 14.0, NetBSD 9.0, OpenBSD 6.7, Minix 3.1.8, AIX 7.1, HP-UX 11.31, IRIX 6.5, Solaris 11.4, Cygwin 2.9, mingw, MSVC 14, Android 9.0.

10.268 fegetround

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/fegetround.html

Gnulib module: fenv-rounding

Portability problems fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, AIX 5.1, IRIX 6.5, Solaris 9, Cygwin 1.7.7, MSVC 9, Android 4.4.

Portability problems not fixed by Gnulib:


10.269 feholdexcept

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/feholdexcept.html

Gnulib module: fenv-environment

Portability problems fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 5.2.1, NetBSD 5.0, OpenBSD 3.8, AIX 5.1, IRIX 6.5, Solaris 9, Cygwin 1.7.7, MSVC 9, Android 4.4.
  • This function does not work on some platforms: glibc 2.5, FreeBSD 12.2/arm64.
  • This function does not save the exception trap bits on some platforms: AIX 7.3.
  • This function does not clear the exception trap bits on some platforms: musl libc, mingw.
  • This function may fail on some platforms: MSVC 14.

Portability problems not fixed by Gnulib:


10.270 feof

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/feof.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:


10.271 feraiseexcept

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/feraiseexcept.html

Gnulib module: fenv-exceptions-tracking-c99

Portability problems fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 5.2.1, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, IRIX 6.5, Solaris 9, Cygwin 1.7.7, MSVC 9, Android 4.4.
  • This function does not detect failures on glibc 2.19/arm.
  • This function does not trigger traps on Cygwin 3.4.9/x86_64.

Portability problems not fixed by Gnulib:


10.272 ferror

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/ferror.html

Gnulib module: —

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:


10.273 fesetenv

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/fesetenv.html

Gnulib module: fenv-environment

Portability problems fixed by Gnulib:

  • This function is missing on some platforms: FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, IRIX 6.5, Solaris 9, Cygwin 1.7.7, MSVC 9, Android 4.4.
  • This function does not work on some platforms: FreeBSD 12.2/arm64.
  • This function does not restore the floating-point exception trap bits on some platforms: musl libc/i386, musl libc/x86_64, AIX 7.3, Solaris 10 and 11, MSVC 14.
  • The macro FE_DFL_ENV cannot be used because it leads to a link error on some platforms: NetBSD 9.3/hppa, NetBSD 9.3/sparc, Cygwin 2.9.0.
  • This function, when called with FE_DFL_ENV argument, has no effect on the x86 mxcsr register and thus on floating-point operations performed in the SSE unit on some platforms: mingw 10.

Portability problems not fixed by Gnulib:


10.274 fesetexcept

Documentation:
https://www.gnu.org/software/libc/manual/html_node/Status-bit-operations.html.

Gnulib module: fenv-exceptions-tracking-c23

Portability problems fixed by Gnulib:

  • This function is missing on all non-glibc platforms: glibc 2.24, macOS 11.1, FreeBSD 14.0, NetBSD 9.0, OpenBSD 6.7, Minix 3.1.8, AIX 7.1, HP-UX 11.31, IRIX 6.5, Solaris 11.4, Cygwin 2.9, mingw, MSVC 14, Android 9.0.
  • This function triggers floating-point exception traps although it shouldn’t, on glibc 2.37/i386, glibc 2.37/powerpc.

Portability problems not fixed by Gnulib:


Next: