chiark / gitweb /
missing.h: add missing definitions for __O_TMPFILE
authorYann E. MORIN <yann.morin.1998@free.fr>
Sun, 28 Aug 2016 15:26:42 +0000 (17:26 +0200)
committerSven Eden <yamakuzure@gmx.net>
Wed, 5 Jul 2017 06:50:53 +0000 (08:50 +0200)
commitd467286973adb99d5621c3d9a0942305e314d5dc
tree676785a2107be54aa3ca91823875c8b97e31da6a
parentd93949b9ea71babdcccbe98d33a9b9472ab2d08f
missing.h: add missing definitions for __O_TMPFILE

Currently, a missing __O_TMPFILE was only defined for i386 and x86_64,
leaving any other architectures with an "old" toolchain fail miserably
at build time:
    src/import/export-raw.c: In function 'reflink_snapshot':
    src/import/export-raw.c:271:26: error: 'O_TMPFILE' undeclared (first use in this function)
             new_fd = open(d, O_TMPFILE|O_CLOEXEC|O_NOCTTY|O_RDWR, 0600);
                              ^

__O_TMPFILE (and O_TMPFILE) are available since glibc 2.19. However, a
lot of existing toolchains are still using glibc-2.18, and some even
before that, and it is not really possible to update those toolchains.

Instead of defining it only for i386 and x86_64, define __O_TMPFILE
with the specific values for those archs where it is different from the
generic value. Use the values as found in the Linux kernel (v4.8-rc3,
current as of time of commit).
src/basic/missing.h