]> git.hungrycats.org Git - bees/commitdiff
openat2: adjust prototype to match glibc declaration
authorZygo Blaxell <bees@furryterror.org>
Thu, 12 Feb 2026 03:23:35 +0000 (22:23 -0500)
committerZygo Blaxell <bees@furryterror.org>
Sat, 14 Feb 2026 05:23:07 +0000 (00:23 -0500)
glibc 2.43 has added a prototype for openat2 which conficts
with the interim prototype from the kernel commits:

 * glibc 2.43+r5+g856c426a7534-1
 * gcc 15.2.1+r604+g0b99615a8aef-1

```
In file included from /usr/include/bits/fcntl.h:61,
                 from /usr/include/fcntl.h:35,
                 from openat2.cc:18:
/usr/include/bits/fcntl-linux.h:484:12: error: conflicting declaration of C function ‘int openat2(int, const char*, const open_how*, long unsigned int)’
  484 | extern int openat2 (int __dfd, const char * __filename,
      |            ^~~~~~~
In file included from openat2.cc:1:
../include/crucible/openat2.h:48:5: note: previous declaration ‘int openat2(int, const char*, open_how*, size_t)’
   48 | int openat2(int dirfd, const char *pathname, struct open_how *how, size_t size) throw();
      |     ^~~~~~~
In file included from /usr/include/bits/fcntl-linux.h:492:
/usr/include/bits/fcntl-linux-fortify.h:36:1: error: conflicting declaration of C function ‘int openat2(int, const char*, const open_how*, size_t)’
   36 | openat2 (int __dfd, const char *__filename, const struct open_how *__how,
      | ^~~~~~~
../include/crucible/openat2.h:48:5: note: previous declaration ‘int openat2(int, const char*, open_how*, size_t)’
   48 | int openat2(int dirfd, const char *pathname, struct open_how *how, size_t size) throw();
      |     ^~~~~~~
make[1]: *** [Makefile:42: openat2.o] Error 1
make[1]: Leaving directory '/data/src/bees/lib'
make: *** [Makefile:35: lib] Error 2
```

Fix by adding the missing `const` on `open_how`.

Fixes: https://github.com/Zygo/bees/issues/333
Signed-off-by: Zygo Blaxell <bees@furryterror.org>
include/crucible/openat2.h
lib/openat2.cc

index c4081185dbbe3e333714308d0ef1bcc39c995c07..6ccb34ef05b0ef4d66bb73bc78a8d0d1e477945f 100644 (file)
@@ -45,7 +45,7 @@ struct open_how {
 extern "C" {
 
 /// Weak symbol to support libc with no syscall wrapper
-int openat2(int dirfd, const char *pathname, struct open_how *how, size_t size) throw();
+int openat2(int dirfd, const char *pathname, const struct open_how *how, size_t size) throw();
 
 };
 
index 5b76bb0fcfac7db9ba221e30b3cded0f32c95e26..2912f8644bc7eec3d205cb3da0c18823fa6dffc1 100644 (file)
@@ -22,7 +22,7 @@ extern "C" {
 
 int
 __attribute__((weak))
-openat2(int const dirfd, const char *const pathname, struct open_how *const how, size_t const size)
+openat2(int const dirfd, const char *const pathname, const struct open_how *const how, size_t const size)
 throw()
 {
        return syscall(SYS_openat2, dirfd, pathname, how, size);