Nix 2.36.0
Nix, the purely functional package manager; unstable internal interfaces
Loading...
Searching...
No Matches
unix-modes.hh
1#pragma once
2
3#include <fcntl.h>
4
5namespace nix::unix {
6
15constexpr int traversableDirAccessMode =
16#if defined(O_SEARCH)
17 /* The POSIX way to ask for exactly this. */
18 O_SEARCH
19#elif defined(O_PATH)
20 /* Linux (glibc) lacks `O_SEARCH`, but `O_PATH` suffices. */
21 O_PATH
22#else
23 /* Sadly this requires read permission, but without `O_SEARCH` or
24 `O_PATH` that's unavoidable. */
25 O_RDONLY
26#endif
27 ;
28
35constexpr bool canTraverseWithoutRead = traversableDirAccessMode != O_RDONLY;
36
37} // namespace nix::unix