Home / Function/ canExecuteExecutable() — netty Function Reference

canExecuteExecutable() — netty Function Reference

Architecture documentation for the canExecuteExecutable() function in NativeLibraryLoader.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  c99af081_4b91_92aa_6d30_6467f872c8bf["canExecuteExecutable()"]
  de042f19_4521_b2c5_59ac_95649b4bada4["NoexecVolumeDetector"]
  c99af081_4b91_92aa_6d30_6467f872c8bf -->|defined in| de042f19_4521_b2c5_59ac_95649b4bada4
  d92afe83_049b_d0b5_f35c_dd5834c38908["load()"]
  d92afe83_049b_d0b5_f35c_dd5834c38908 -->|calls| c99af081_4b91_92aa_6d30_6467f872c8bf
  style c99af081_4b91_92aa_6d30_6467f872c8bf fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

common/src/main/java/io/netty/util/internal/NativeLibraryLoader.java lines 516–539

        private static boolean canExecuteExecutable(File file) throws IOException {
            // If we can already execute, there is nothing to do.
            if (file.canExecute()) {
                return true;
            }

            // On volumes, with noexec set, even files with the executable POSIX permissions will fail to execute.
            // The File#canExecute() method honors this behavior, probaby via parsing the noexec flag when initializing
            // the UnixFileStore, though the flag is not exposed via a public API.  To find out if library is being
            // loaded off a volume with noexec, confirm or add executalbe permissions, then check File#canExecute().
            Set<PosixFilePermission> existingFilePermissions = Files.getPosixFilePermissions(file.toPath());
            Set<PosixFilePermission> executePermissions =
                    EnumSet.of(PosixFilePermission.OWNER_EXECUTE,
                            PosixFilePermission.GROUP_EXECUTE,
                            PosixFilePermission.OTHERS_EXECUTE);
            if (existingFilePermissions.containsAll(executePermissions)) {
                return false;
            }

            Set<PosixFilePermission> newPermissions = EnumSet.copyOf(existingFilePermissions);
            newPermissions.addAll(executePermissions);
            Files.setPosixFilePermissions(file.toPath(), newPermissions);
            return file.canExecute();
        }

Domain

Subdomains

Called By

Frequently Asked Questions

What does canExecuteExecutable() do?
canExecuteExecutable() is a function in the netty codebase, defined in common/src/main/java/io/netty/util/internal/NativeLibraryLoader.java.
Where is canExecuteExecutable() defined?
canExecuteExecutable() is defined in common/src/main/java/io/netty/util/internal/NativeLibraryLoader.java at line 516.
What calls canExecuteExecutable()?
canExecuteExecutable() is called by 1 function(s): load.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free