From: Zygo Blaxell Date: Thu, 12 Feb 2026 03:23:35 +0000 (-0500) Subject: openat2: adjust prototype to match glibc declaration X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=14c82dce8a7e9714d6f9cd03229e0fb55460aa25;p=bees openat2: adjust prototype to match glibc declaration 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 --- diff --git a/include/crucible/openat2.h b/include/crucible/openat2.h index c4081185..6ccb34ef 100644 --- a/include/crucible/openat2.h +++ b/include/crucible/openat2.h @@ -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(); }; diff --git a/lib/openat2.cc b/lib/openat2.cc index 5b76bb0f..2912f864 100644 --- a/lib/openat2.cc +++ b/lib/openat2.cc @@ -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);