private static boolean isMusl()

in jvmti-access/src/main/java/co/elastic/otel/JvmtiAccess.java [208:226]


  private static boolean isMusl() {
    Path mapFilesDir = Paths.get("/proc/self/map_files");
    try (DirectoryStream<Path> dirStream = Files.newDirectoryStream(mapFilesDir)) {
      for (Path file : dirStream) {
        try {
          if (file.toRealPath().toString().toLowerCase().contains("musl")) {
            return true;
          }
        } catch (IOException e) {
          // ignore
        }
      }
      return false;
    } catch (Exception ignored) {
      // fall back to checking for alpine linux in the event we're using an older kernel which
      // may not fail the above check
      return isAlpineLinux();
    }
  }