| 1 | /* openat2 definition. Linux specific. |
| 2 | Copyright (C) 2025-2026 Free Software Foundation, Inc. |
| 3 | This file is part of the GNU C Library. |
| 4 | |
| 5 | The GNU C Library is free software; you can redistribute it and/or |
| 6 | modify it under the terms of the GNU Lesser General Public |
| 7 | License as published by the Free Software Foundation; either |
| 8 | version 2.1 of the License, or (at your option) any later version. |
| 9 | |
| 10 | The GNU C Library is distributed in the hope that it will be useful, |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | Lesser General Public License for more details. |
| 14 | |
| 15 | You should have received a copy of the GNU Lesser General Public |
| 16 | License along with the GNU C Library; if not, see |
| 17 | <https://www.gnu.org/licenses/>. */ |
| 18 | |
| 19 | #ifndef _FCNTL_H |
| 20 | # error "Never use <bits/openat2.h> directly; include <fcntl.h> instead." |
| 21 | #endif |
| 22 | |
| 23 | #ifndef __glibc_has_open_how |
| 24 | /* Arguments for how openat2 should open the target path. */ |
| 25 | struct open_how |
| 26 | { |
| 27 | __uint64_t flags; |
| 28 | __uint64_t mode; |
| 29 | __uint64_t resolve; |
| 30 | }; |
| 31 | #endif |
| 32 | |
| 33 | /* how->resolve flags for openat2. */ |
| 34 | #ifndef RESOLVE_NO_XDEV |
| 35 | # define RESOLVE_NO_XDEV 0x01 /* Block mount-point crossings |
| 36 | (includes bind-mounts). */ |
| 37 | #endif |
| 38 | #ifndef RESOLVE_NO_MAGICLINKS |
| 39 | # define RESOLVE_NO_MAGICLINKS 0x02 /* Block traversal through procfs-style |
| 40 | "magic-links". */ |
| 41 | #endif |
| 42 | #ifndef RESOLVE_NO_SYMLINKS |
| 43 | # define RESOLVE_NO_SYMLINKS 0x04 /* Block traversal through all symlinks. */ |
| 44 | #endif |
| 45 | #ifndef RESOLVE_BENEATH |
| 46 | # define RESOLVE_BENEATH 0x08 /* Block "lexical" trickery like |
| 47 | "..", symlinks, and absolute |
| 48 | paths which escape the dirfd. */ |
| 49 | #endif |
| 50 | #ifndef RESOLVE_IN_ROOT |
| 51 | # define RESOLVE_IN_ROOT 0x10 /* Make all jumps to "/" and ".." |
| 52 | be scoped inside the dirfd |
| 53 | (similar to chroot). */ |
| 54 | #endif |
| 55 | #ifndef RESOLVE_CACHED |
| 56 | # define RESOLVE_CACHED 0x20 /* Only complete if resolution can be |
| 57 | completed through cached lookup. May |
| 58 | return -EAGAIN if that's not |
| 59 | possible. */ |
| 60 | #endif |
| 61 | |