fcntl.h: fix a missing `struct timespec` definition
commit657c4a9d6c2e649d86307f46ce9d5e44192f6e7a
authorDamien Riegel <damien.riegel@savoirfairelinux.com>
Mon, 27 Feb 2017 17:36:37 +0000 (27 12:36 -0500)
committerWaldemar Brodkorb <wbx@openadk.org>
Tue, 28 Feb 2017 18:23:40 +0000 (28 19:23 +0100)
treeaa43afb4afcb88dd15724355726c473d20d4820a
parent058c263f6bd41ffa18328e0ff60d25d3a028f975
fcntl.h: fix a missing `struct timespec` definition

If a source file is compiled with:

  #define _XOPEN_SOURCE 700
  #define _POSIX_C_SOURCE 200112L

Then including fcntl.h results in the following error:

  In file included from fcntl.h:37:0,
                   from test.c:4:
  sys/stat.h:371:54: error: array type has incomplete element type â€˜struct timespec’
   extern int futimens (int __fd, const struct timespec __times[2]) __THROW;

To fix that, we force the definition of struct timespec in fcntl.h when
__USE_XOPEN2K8 is defined. This mimics the behavior of glibc which
contains the following line in its io/fcntl.h header (included by
fcntlh.h):
  #ifdef __USE_XOPEN2K8
  # include <bits/types/struct_timespec.h>
  #endif

This bug was spotted during the compilation of BoringSSL against uClibc.

Signed-off-by: Damien Riegel <damien.riegel@savoirfairelinux.com>
include/fcntl.h