diff options
Diffstat (limited to 'gl/fcntl.in.h')
| -rw-r--r-- | gl/fcntl.in.h | 59 |
1 files changed, 49 insertions, 10 deletions
diff --git a/gl/fcntl.in.h b/gl/fcntl.in.h index c5068ed4..52727074 100644 --- a/gl/fcntl.in.h +++ b/gl/fcntl.in.h | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* Like <fcntl.h>, but with non-working flags defined to 0. | 1 | /* Like <fcntl.h>, but with non-working flags defined to 0. |
| 2 | 2 | ||
| 3 | Copyright (C) 2006-2025 Free Software Foundation, Inc. | 3 | Copyright (C) 2006-2026 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
| 6 | it under the terms of the GNU Lesser General Public License as | 6 | it under the terms of the GNU Lesser General Public License as |
| @@ -122,7 +122,6 @@ _GL_CXXALIAS_SYS (creat, int, (const char *filename, mode_t mode)); | |||
| 122 | # endif | 122 | # endif |
| 123 | _GL_CXXALIASWARN (creat); | 123 | _GL_CXXALIASWARN (creat); |
| 124 | #elif defined GNULIB_POSIXCHECK | 124 | #elif defined GNULIB_POSIXCHECK |
| 125 | # undef creat | ||
| 126 | /* Assume creat is always declared. */ | 125 | /* Assume creat is always declared. */ |
| 127 | _GL_WARN_ON_USE (creat, "creat is not always POSIX compliant - " | 126 | _GL_WARN_ON_USE (creat, "creat is not always POSIX compliant - " |
| 128 | "use gnulib module creat for portability"); | 127 | "use gnulib module creat for portability"); |
| @@ -165,7 +164,6 @@ _GL_CXXALIAS_SYS (fcntl, int, (int fd, int action, ...)); | |||
| 165 | # endif | 164 | # endif |
| 166 | _GL_CXXALIASWARN (fcntl); | 165 | _GL_CXXALIASWARN (fcntl); |
| 167 | #elif defined GNULIB_POSIXCHECK | 166 | #elif defined GNULIB_POSIXCHECK |
| 168 | # undef fcntl | ||
| 169 | # if HAVE_RAW_DECL_FCNTL | 167 | # if HAVE_RAW_DECL_FCNTL |
| 170 | _GL_WARN_ON_USE (fcntl, "fcntl is not always POSIX compliant - " | 168 | _GL_WARN_ON_USE (fcntl, "fcntl is not always POSIX compliant - " |
| 171 | "use gnulib module fcntl for portability"); | 169 | "use gnulib module fcntl for portability"); |
| @@ -196,7 +194,6 @@ _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...)); | |||
| 196 | _GL_CXXALIASWARN (open); | 194 | _GL_CXXALIASWARN (open); |
| 197 | # endif | 195 | # endif |
| 198 | #elif defined GNULIB_POSIXCHECK | 196 | #elif defined GNULIB_POSIXCHECK |
| 199 | # undef open | ||
| 200 | /* Assume open is always declared. */ | 197 | /* Assume open is always declared. */ |
| 201 | _GL_WARN_ON_USE (open, "open is not always POSIX compliant - " | 198 | _GL_WARN_ON_USE (open, "open is not always POSIX compliant - " |
| 202 | "use gnulib module open for portability"); | 199 | "use gnulib module open for portability"); |
| @@ -242,13 +239,51 @@ _GL_CXXALIAS_SYS (openat, int, | |||
| 242 | # endif | 239 | # endif |
| 243 | _GL_CXXALIASWARN (openat); | 240 | _GL_CXXALIASWARN (openat); |
| 244 | #elif defined GNULIB_POSIXCHECK | 241 | #elif defined GNULIB_POSIXCHECK |
| 245 | # undef openat | ||
| 246 | # if HAVE_RAW_DECL_OPENAT | 242 | # if HAVE_RAW_DECL_OPENAT |
| 247 | _GL_WARN_ON_USE (openat, "openat is not portable - " | 243 | _GL_WARN_ON_USE (openat, "openat is not portable - " |
| 248 | "use gnulib module openat for portability"); | 244 | "use gnulib module openat for portability"); |
| 249 | # endif | 245 | # endif |
| 250 | #endif | 246 | #endif |
| 251 | 247 | ||
| 248 | #if @GNULIB_OPENAT2@ | ||
| 249 | # if !defined RESOLVE_NO_XDEV && defined __has_include | ||
| 250 | # if __has_include (<linux/openat2.h>) | ||
| 251 | # include <linux/openat2.h> | ||
| 252 | # endif | ||
| 253 | # endif | ||
| 254 | # ifndef RESOLVE_NO_XDEV | ||
| 255 | struct open_how | ||
| 256 | { | ||
| 257 | # ifdef __UINT64_TYPE__ | ||
| 258 | __UINT64_TYPE__ flags, mode, resolve; | ||
| 259 | # else | ||
| 260 | unsigned long long int flags, mode, resolve; | ||
| 261 | # endif | ||
| 262 | }; | ||
| 263 | # define RESOLVE_NO_XDEV 0x01 | ||
| 264 | # define RESOLVE_NO_MAGICLINKS 0x02 | ||
| 265 | # define RESOLVE_NO_SYMLINKS 0x04 | ||
| 266 | # define RESOLVE_BENEATH 0x08 | ||
| 267 | # define RESOLVE_IN_ROOT 0x10 | ||
| 268 | # define RESOLVE_CACHED 0x20 | ||
| 269 | # endif | ||
| 270 | |||
| 271 | # if !@HAVE_OPENAT2@ | ||
| 272 | _GL_FUNCDECL_SYS (openat2, int, | ||
| 273 | (int fd, char const *file, struct open_how const *how, | ||
| 274 | size_t size), | ||
| 275 | _GL_ARG_NONNULL ((2, 3))); | ||
| 276 | # endif | ||
| 277 | _GL_CXXALIAS_SYS (openat2, int, | ||
| 278 | (int fd, char const *file, struct open_how const *how, | ||
| 279 | size_t size)); | ||
| 280 | _GL_CXXALIASWARN (openat2); | ||
| 281 | #elif defined GNULIB_POSIXCHECK | ||
| 282 | # if HAVE_RAW_DECL_OPENAT2 | ||
| 283 | _GL_WARN_ON_USE (openat2, "openat2 is not portable - " | ||
| 284 | "use gnulib module openat2 for portability"); | ||
| 285 | # endif | ||
| 286 | #endif | ||
| 252 | 287 | ||
| 253 | /* Fix up the FD_* macros, only known to be missing on mingw. */ | 288 | /* Fix up the FD_* macros, only known to be missing on mingw. */ |
| 254 | 289 | ||
| @@ -293,11 +328,6 @@ _GL_WARN_ON_USE (openat, "openat is not portable - " | |||
| 293 | # endif | 328 | # endif |
| 294 | #endif | 329 | #endif |
| 295 | 330 | ||
| 296 | #if !defined O_DIRECT && defined O_DIRECTIO | ||
| 297 | /* Tru64 spells it 'O_DIRECTIO'. */ | ||
| 298 | # define O_DIRECT O_DIRECTIO | ||
| 299 | #endif | ||
| 300 | |||
| 301 | #if !defined O_CLOEXEC && defined O_NOINHERIT | 331 | #if !defined O_CLOEXEC && defined O_NOINHERIT |
| 302 | /* Mingw spells it 'O_NOINHERIT'. */ | 332 | /* Mingw spells it 'O_NOINHERIT'. */ |
| 303 | # define O_CLOEXEC O_NOINHERIT | 333 | # define O_CLOEXEC O_NOINHERIT |
| @@ -460,6 +490,15 @@ _GL_WARN_ON_USE (openat, "openat is not portable - " | |||
| 460 | # define AT_NO_AUTOMOUNT 0 | 490 | # define AT_NO_AUTOMOUNT 0 |
| 461 | #endif | 491 | #endif |
| 462 | 492 | ||
| 493 | /* errno when openat+O_NOFOLLOW fails because the file is a symlink. */ | ||
| 494 | #if defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ | ||
| 495 | # define _GL_OPENAT_ESYMLINK EMLINK | ||
| 496 | #elif defined __NetBSD__ | ||
| 497 | # define _GL_OPENAT_ESYMLINK EFTYPE | ||
| 498 | #else | ||
| 499 | # define _GL_OPENAT_ESYMLINK ELOOP | ||
| 500 | #endif | ||
| 501 | |||
| 463 | #endif /* _@GUARD_PREFIX@_FCNTL_H */ | 502 | #endif /* _@GUARD_PREFIX@_FCNTL_H */ |
| 464 | #endif /* _@GUARD_PREFIX@_FCNTL_H */ | 503 | #endif /* _@GUARD_PREFIX@_FCNTL_H */ |
| 465 | #endif | 504 | #endif |
