From 4a76567dc63777ebb28a691b463e52d2091d2b47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20L=C3=A4ubrich?= Date: Mon, 6 Mar 2023 05:54:49 +0100 Subject: [PATCH] Add a fragment that supports linux native polling using panama This adds native polling support for linux with the inotify API. --- .../.classpath | 11 + .../.project | 28 + .../org.eclipse.core.resources.prefs | 3 + .../.settings/org.eclipse.jdt.core.prefs | 9 + .../META-INF/MANIFEST.MF | 10 + .../META-INF/versions/17/OSGI-INF/MANIFEST.MF | 3 + .../META-INF/versions/19/OSGI-INF/MANIFEST.MF | 3 + .../README.MD | 10 + .../about.html | 36 ++ .../build.properties | 4 + .../fragment.properties | 16 + .../fragment.xml | 12 + .../refresh/linux/LinuxRefreshProvider.java | 23 + .../refresh/linux/inotify/RuntimeHelper.java | 218 ++++++++ .../refresh/linux/inotify/__fsid_t.java | 33 ++ .../refresh/linux/inotify/constants$0.java | 47 ++ .../refresh/linux/inotify/inotify_event.java | 98 ++++ .../refresh/linux/inotify/inotify_h.java | 483 +++++++++++++++++ .../refresh/linux/inotify/Constants$root.java | 23 + .../refresh/linux/inotify/RuntimeHelper.java | 235 +++++++++ .../refresh/linux/inotify/__fsid_t.java | 33 ++ .../refresh/linux/inotify/constants$0.java | 43 ++ .../refresh/linux/inotify/inotify_event.java | 98 ++++ .../refresh/linux/inotify/inotify_h.java | 490 ++++++++++++++++++ 24 files changed, 1969 insertions(+) create mode 100644 resources/bundles/org.eclipse.core.resources.linux.x86_64/.classpath create mode 100644 resources/bundles/org.eclipse.core.resources.linux.x86_64/.project create mode 100644 resources/bundles/org.eclipse.core.resources.linux.x86_64/.settings/org.eclipse.core.resources.prefs create mode 100644 resources/bundles/org.eclipse.core.resources.linux.x86_64/.settings/org.eclipse.jdt.core.prefs create mode 100644 resources/bundles/org.eclipse.core.resources.linux.x86_64/META-INF/MANIFEST.MF create mode 100644 resources/bundles/org.eclipse.core.resources.linux.x86_64/META-INF/versions/17/OSGI-INF/MANIFEST.MF create mode 100644 resources/bundles/org.eclipse.core.resources.linux.x86_64/META-INF/versions/19/OSGI-INF/MANIFEST.MF create mode 100644 resources/bundles/org.eclipse.core.resources.linux.x86_64/README.MD create mode 100644 resources/bundles/org.eclipse.core.resources.linux.x86_64/about.html create mode 100644 resources/bundles/org.eclipse.core.resources.linux.x86_64/build.properties create mode 100644 resources/bundles/org.eclipse.core.resources.linux.x86_64/fragment.properties create mode 100644 resources/bundles/org.eclipse.core.resources.linux.x86_64/fragment.xml create mode 100644 resources/bundles/org.eclipse.core.resources.linux.x86_64/src/org/eclipse/core/internal/resources/refresh/linux/LinuxRefreshProvider.java create mode 100644 resources/bundles/org.eclipse.core.resources.linux.x86_64/src17/org/eclipse/core/internal/resources/refresh/linux/inotify/RuntimeHelper.java create mode 100644 resources/bundles/org.eclipse.core.resources.linux.x86_64/src17/org/eclipse/core/internal/resources/refresh/linux/inotify/__fsid_t.java create mode 100644 resources/bundles/org.eclipse.core.resources.linux.x86_64/src17/org/eclipse/core/internal/resources/refresh/linux/inotify/constants$0.java create mode 100644 resources/bundles/org.eclipse.core.resources.linux.x86_64/src17/org/eclipse/core/internal/resources/refresh/linux/inotify/inotify_event.java create mode 100644 resources/bundles/org.eclipse.core.resources.linux.x86_64/src17/org/eclipse/core/internal/resources/refresh/linux/inotify/inotify_h.java create mode 100644 resources/bundles/org.eclipse.core.resources.linux.x86_64/src19/org/eclipse/core/internal/resources/refresh/linux/inotify/Constants$root.java create mode 100644 resources/bundles/org.eclipse.core.resources.linux.x86_64/src19/org/eclipse/core/internal/resources/refresh/linux/inotify/RuntimeHelper.java create mode 100644 resources/bundles/org.eclipse.core.resources.linux.x86_64/src19/org/eclipse/core/internal/resources/refresh/linux/inotify/__fsid_t.java create mode 100644 resources/bundles/org.eclipse.core.resources.linux.x86_64/src19/org/eclipse/core/internal/resources/refresh/linux/inotify/constants$0.java create mode 100644 resources/bundles/org.eclipse.core.resources.linux.x86_64/src19/org/eclipse/core/internal/resources/refresh/linux/inotify/inotify_event.java create mode 100644 resources/bundles/org.eclipse.core.resources.linux.x86_64/src19/org/eclipse/core/internal/resources/refresh/linux/inotify/inotify_h.java diff --git a/resources/bundles/org.eclipse.core.resources.linux.x86_64/.classpath b/resources/bundles/org.eclipse.core.resources.linux.x86_64/.classpath new file mode 100644 index 00000000000..80bc9f18aba --- /dev/null +++ b/resources/bundles/org.eclipse.core.resources.linux.x86_64/.classpath @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/resources/bundles/org.eclipse.core.resources.linux.x86_64/.project b/resources/bundles/org.eclipse.core.resources.linux.x86_64/.project new file mode 100644 index 00000000000..7459983941b --- /dev/null +++ b/resources/bundles/org.eclipse.core.resources.linux.x86_64/.project @@ -0,0 +1,28 @@ + + + org.eclipse.core.resources.linux.x86_64 + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/resources/bundles/org.eclipse.core.resources.linux.x86_64/.settings/org.eclipse.core.resources.prefs b/resources/bundles/org.eclipse.core.resources.linux.x86_64/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 00000000000..7d991be5dbd --- /dev/null +++ b/resources/bundles/org.eclipse.core.resources.linux.x86_64/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,3 @@ +eclipse.preferences.version=1 +encoding/=UTF-8 +encoding/fragment.properties=ISO-8859-1 diff --git a/resources/bundles/org.eclipse.core.resources.linux.x86_64/.settings/org.eclipse.jdt.core.prefs b/resources/bundles/org.eclipse.core.resources.linux.x86_64/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000000..c9545f06a41 --- /dev/null +++ b/resources/bundles/org.eclipse.core.resources.linux.x86_64/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,9 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/resources/bundles/org.eclipse.core.resources.linux.x86_64/META-INF/MANIFEST.MF b/resources/bundles/org.eclipse.core.resources.linux.x86_64/META-INF/MANIFEST.MF new file mode 100644 index 00000000000..8210d7c00a2 --- /dev/null +++ b/resources/bundles/org.eclipse.core.resources.linux.x86_64/META-INF/MANIFEST.MF @@ -0,0 +1,10 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: %linuxFragmentName +Bundle-SymbolicName: org.eclipse.core.resources.linux.x86_64 +Bundle-Vendor: %providerName +Bundle-Version: 1.0.0.qualifier +Eclipse-PlatformFilter: (& (osgi.os=linux) (osgi.arch=x86_64)) +Fragment-Host: org.eclipse.core.resources;bundle-version="3.18.200" +Automatic-Module-Name: org.eclipse.core.resources.linux.x86.64 +Bundle-RequiredExecutionEnvironment: JavaSE-11 diff --git a/resources/bundles/org.eclipse.core.resources.linux.x86_64/META-INF/versions/17/OSGI-INF/MANIFEST.MF b/resources/bundles/org.eclipse.core.resources.linux.x86_64/META-INF/versions/17/OSGI-INF/MANIFEST.MF new file mode 100644 index 00000000000..ed1f1cf228e --- /dev/null +++ b/resources/bundles/org.eclipse.core.resources.linux.x86_64/META-INF/versions/17/OSGI-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Import-Package: jdk.incubator.foreign +Require-Capability: (&(osgi.ee=JavaSE)(version=17)) \ No newline at end of file diff --git a/resources/bundles/org.eclipse.core.resources.linux.x86_64/META-INF/versions/19/OSGI-INF/MANIFEST.MF b/resources/bundles/org.eclipse.core.resources.linux.x86_64/META-INF/versions/19/OSGI-INF/MANIFEST.MF new file mode 100644 index 00000000000..c9198a8f0ca --- /dev/null +++ b/resources/bundles/org.eclipse.core.resources.linux.x86_64/META-INF/versions/19/OSGI-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Import-Package: jdk.incubator.foreign +Require-Capability: (&(osgi.ee=JavaSE)(version=19)) \ No newline at end of file diff --git a/resources/bundles/org.eclipse.core.resources.linux.x86_64/README.MD b/resources/bundles/org.eclipse.core.resources.linux.x86_64/README.MD new file mode 100644 index 00000000000..0b0dcae7c01 --- /dev/null +++ b/resources/bundles/org.eclipse.core.resources.linux.x86_64/README.MD @@ -0,0 +1,10 @@ +# Linux native binding for platform.resources + +This fragment provides native binding to the linux host system using the [Project Panama](https://openjdk.org/projects/panama/). +The wrapped API is the inotify API (https://man7.org/linux/man-pages/man7/inotify.7.html) + +Generate the code: +- sudo apt-get install libinotifytools0-dev +- get a suitable jextract from https://jdk.java.net/panama/ (Java 19) or https://jdk.java.net/panama/17/ (Java 17) +- enter the src directory +- jextract --source -t org.eclipse.core.internal.resources.refresh.linux.inotify /usr/include/inotifytools/inotify.h \ No newline at end of file diff --git a/resources/bundles/org.eclipse.core.resources.linux.x86_64/about.html b/resources/bundles/org.eclipse.core.resources.linux.x86_64/about.html new file mode 100644 index 00000000000..164f781a8fd --- /dev/null +++ b/resources/bundles/org.eclipse.core.resources.linux.x86_64/about.html @@ -0,0 +1,36 @@ + + + + +About + + +

About This Content

+ +

November 30, 2017

+

License

+ +

+ The Eclipse Foundation makes available all content in this plug-in + ("Content"). Unless otherwise indicated below, the Content + is provided to you under the terms and conditions of the Eclipse + Public License Version 2.0 ("EPL"). A copy of the EPL is + available at http://www.eclipse.org/legal/epl-2.0. + For purposes of the EPL, "Program" will mean the Content. +

+ +

+ If you did not receive this Content directly from the Eclipse + Foundation, the Content is being redistributed by another party + ("Redistributor") and different terms and conditions may + apply to your use of any object code in the Content. Check the + Redistributor's license that was provided with the Content. If no such + license exists, contact the Redistributor. Unless otherwise indicated + below, the terms and conditions of the EPL still apply to any source + code in the Content and such source code may be obtained at http://www.eclipse.org. +

+ + + \ No newline at end of file diff --git a/resources/bundles/org.eclipse.core.resources.linux.x86_64/build.properties b/resources/bundles/org.eclipse.core.resources.linux.x86_64/build.properties new file mode 100644 index 00000000000..34d2e4d2dad --- /dev/null +++ b/resources/bundles/org.eclipse.core.resources.linux.x86_64/build.properties @@ -0,0 +1,4 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + . diff --git a/resources/bundles/org.eclipse.core.resources.linux.x86_64/fragment.properties b/resources/bundles/org.eclipse.core.resources.linux.x86_64/fragment.properties new file mode 100644 index 00000000000..a9b86a73916 --- /dev/null +++ b/resources/bundles/org.eclipse.core.resources.linux.x86_64/fragment.properties @@ -0,0 +1,16 @@ +############################################################################### +# Copyright (c) 2023 Christoph Läubrich and others. +# +# This program and the accompanying materials +# are made available under the terms of the Eclipse Public License 2.0 +# which accompanies this distribution, and is available at +# https://www.eclipse.org/legal/epl-2.0/ +# +# SPDX-License-Identifier: EPL-2.0 +# +# Contributors: +# Christoph Läubrich - initial API and implementation +############################################################################### +providerName = Eclipse.org +linuxragmentName = Core Resource Management Linux Fragment +linuxMonitorFactoryName = Linux Auto-refresh monitor diff --git a/resources/bundles/org.eclipse.core.resources.linux.x86_64/fragment.xml b/resources/bundles/org.eclipse.core.resources.linux.x86_64/fragment.xml new file mode 100644 index 00000000000..ad51b91de58 --- /dev/null +++ b/resources/bundles/org.eclipse.core.resources.linux.x86_64/fragment.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/resources/bundles/org.eclipse.core.resources.linux.x86_64/src/org/eclipse/core/internal/resources/refresh/linux/LinuxRefreshProvider.java b/resources/bundles/org.eclipse.core.resources.linux.x86_64/src/org/eclipse/core/internal/resources/refresh/linux/LinuxRefreshProvider.java new file mode 100644 index 00000000000..8bedc206dfb --- /dev/null +++ b/resources/bundles/org.eclipse.core.resources.linux.x86_64/src/org/eclipse/core/internal/resources/refresh/linux/LinuxRefreshProvider.java @@ -0,0 +1,23 @@ +/******************************************************************************** + * Copyright (c) 2023 Christoph Läubrich and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Christoph Läubrich - initial API and implementation + ********************************************************************************/ +package org.eclipse.core.internal.resources.refresh.linux; + +import org.eclipse.core.resources.refresh.RefreshProvider; + +/** + * The default implementation simply do nothing what will result in fallback to + * the plain polling + */ +public class LinuxRefreshProvider extends RefreshProvider { + +} diff --git a/resources/bundles/org.eclipse.core.resources.linux.x86_64/src17/org/eclipse/core/internal/resources/refresh/linux/inotify/RuntimeHelper.java b/resources/bundles/org.eclipse.core.resources.linux.x86_64/src17/org/eclipse/core/internal/resources/refresh/linux/inotify/RuntimeHelper.java new file mode 100644 index 00000000000..fb37d843427 --- /dev/null +++ b/resources/bundles/org.eclipse.core.resources.linux.x86_64/src17/org/eclipse/core/internal/resources/refresh/linux/inotify/RuntimeHelper.java @@ -0,0 +1,218 @@ +package org.eclipse.core.internal.resources.refresh.linux.inotify; +// Generated by jextract + +import jdk.incubator.foreign.Addressable; +import jdk.incubator.foreign.CLinker; +import jdk.incubator.foreign.FunctionDescriptor; +import jdk.incubator.foreign.SymbolLookup; +import jdk.incubator.foreign.MemoryAddress; +import jdk.incubator.foreign.MemoryLayout; +import jdk.incubator.foreign.MemorySegment; +import jdk.incubator.foreign.ResourceScope; +import jdk.incubator.foreign.SegmentAllocator; +import java.lang.invoke.MethodHandle; +import java.lang.invoke.MethodHandles; +import java.lang.invoke.MethodType; +import java.io.File; +import java.nio.file.Path; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.Optional; +import java.util.stream.Stream; + +import static jdk.incubator.foreign.CLinker.*; + +final class RuntimeHelper { + private RuntimeHelper() {} + private final static CLinker LINKER = CLinker.getInstance(); + private final static ClassLoader LOADER = RuntimeHelper.class.getClassLoader(); + private final static MethodHandles.Lookup MH_LOOKUP = MethodHandles.lookup(); + + static SymbolLookup lookup() { + SymbolLookup loaderLookup = SymbolLookup.loaderLookup(); + SymbolLookup systemLookup = CLinker.systemLookup(); + return name -> loaderLookup.lookup(name).or(() -> systemLookup.lookup(name)); + } + + static T requireNonNull(T obj, String symbolName) { + if (obj == null) { + throw new UnsatisfiedLinkError("unresolved symbol: " + symbolName); + } + return obj; + } + + private final static SegmentAllocator THROWING_ALLOCATOR = (x, y) -> { throw new AssertionError("should not reach here"); }; + + static final MemorySegment lookupGlobalVariable(SymbolLookup LOOKUP, String name, MemoryLayout layout) { + return LOOKUP.lookup(name).map(s -> s.address().asSegment(layout.byteSize(), ResourceScope.newImplicitScope())).orElse(null); + } + + static final MethodHandle downcallHandle(SymbolLookup LOOKUP, String name, String desc, FunctionDescriptor fdesc, boolean variadic) { + return LOOKUP.lookup(name).map( + addr -> { + MethodType mt = MethodType.fromMethodDescriptorString(desc, LOADER); + return variadic ? + VarargsInvoker.make(addr, mt, fdesc) : + LINKER.downcallHandle(addr, mt, fdesc); + }).orElse(null); + } + + static final MethodHandle downcallHandle(String desc, FunctionDescriptor fdesc, boolean variadic) { + if (variadic) { + throw new AssertionError("Cannot get here!"); + } + MethodType mt = MethodType.fromMethodDescriptorString(desc, LOADER); + return LINKER.downcallHandle(mt, fdesc); + } + + static final MemoryAddress upcallStub(Class fi, Z z, FunctionDescriptor fdesc, String mtypeDesc) { + return upcallStub(fi, z, fdesc, mtypeDesc, ResourceScope.newImplicitScope()); + } + + static final MemoryAddress upcallStub(Class fi, Z z, FunctionDescriptor fdesc, String mtypeDesc, ResourceScope scope) { + try { + MethodHandle handle = MH_LOOKUP.findVirtual(fi, "apply", + MethodType.fromMethodDescriptorString(mtypeDesc, LOADER)); + handle = handle.bindTo(z); + return LINKER.upcallStub(handle, fdesc, scope); + } catch (Throwable ex) { + throw new AssertionError(ex); + } + } + + static MemorySegment asArray(MemoryAddress addr, MemoryLayout layout, int numElements, ResourceScope scope) { + return addr.asSegment(numElements * layout.byteSize(), scope); + } + + // Internals only below this point + + private static class VarargsInvoker { + private static final MethodHandle INVOKE_MH; + private final Addressable symbol; + private final MethodType varargs; + private final FunctionDescriptor function; + + private VarargsInvoker(Addressable symbol, MethodType type, FunctionDescriptor function) { + this.symbol = symbol; + this.varargs = type; + this.function = function; + } + + static { + try { + INVOKE_MH = MethodHandles.lookup().findVirtual(VarargsInvoker.class, "invoke", MethodType.methodType(Object.class, SegmentAllocator.class, Object[].class)); + } catch (ReflectiveOperationException e) { + throw new RuntimeException(e); + } + } + + static MethodHandle make(Addressable symbol, MethodType type, FunctionDescriptor function) { + VarargsInvoker invoker = new VarargsInvoker(symbol, type, function); + MethodHandle handle = INVOKE_MH.bindTo(invoker).asCollector(Object[].class, type.parameterCount()); + if (type.returnType().equals(MemorySegment.class)) { + type = type.insertParameterTypes(0, SegmentAllocator.class); + } else { + handle = MethodHandles.insertArguments(handle, 0, THROWING_ALLOCATOR); + } + return handle.asType(type); + } + + private Object invoke(SegmentAllocator allocator, Object[] args) throws Throwable { + // one trailing Object[] + int nNamedArgs = function.argumentLayouts().size(); + assert(args.length == nNamedArgs + 1); + // The last argument is the array of vararg collector + Object[] unnamedArgs = (Object[]) args[args.length - 1]; + + int argsCount = nNamedArgs + unnamedArgs.length; + Class[] argTypes = new Class[argsCount]; + MemoryLayout[] argLayouts = new MemoryLayout[nNamedArgs + unnamedArgs.length]; + + int pos = 0; + for (pos = 0; pos < nNamedArgs; pos++) { + argTypes[pos] = varargs.parameterType(pos); + argLayouts[pos] = function.argumentLayouts().get(pos); + } + + assert pos == nNamedArgs; + for (Object o: unnamedArgs) { + argTypes[pos] = normalize(o.getClass()); + argLayouts[pos] = variadicLayout(argTypes[pos]); + pos++; + } + assert pos == argsCount; + + MethodType mt = MethodType.methodType(varargs.returnType(), argTypes); + FunctionDescriptor f = (function.returnLayout().isEmpty()) ? + FunctionDescriptor.ofVoid(argLayouts) : + FunctionDescriptor.of(function.returnLayout().get(), argLayouts); + MethodHandle mh = LINKER.downcallHandle(symbol, allocator, mt, f); + // flatten argument list so that it can be passed to an asSpreader MH + Object[] allArgs = new Object[nNamedArgs + unnamedArgs.length]; + System.arraycopy(args, 0, allArgs, 0, nNamedArgs); + System.arraycopy(unnamedArgs, 0, allArgs, nNamedArgs, unnamedArgs.length); + + return mh.asSpreader(Object[].class, argsCount).invoke(allArgs); + } + + private static Class unboxIfNeeded(Class clazz) { + if (clazz == Boolean.class) { + return boolean.class; + } else if (clazz == Void.class) { + return void.class; + } else if (clazz == Byte.class) { + return byte.class; + } else if (clazz == Character.class) { + return char.class; + } else if (clazz == Short.class) { + return short.class; + } else if (clazz == Integer.class) { + return int.class; + } else if (clazz == Long.class) { + return long.class; + } else if (clazz == Float.class) { + return float.class; + } else if (clazz == Double.class) { + return double.class; + } else { + return clazz; + } + } + + private Class promote(Class c) { + if (c == byte.class || c == char.class || c == short.class || c == int.class) { + return long.class; + } else if (c == float.class) { + return double.class; + } else { + return c; + } + } + + private Class normalize(Class c) { + c = unboxIfNeeded(c); + if (c.isPrimitive()) { + return promote(c); + } + if (MemoryAddress.class.isAssignableFrom(c)) { + return MemoryAddress.class; + } + if (MemorySegment.class.isAssignableFrom(c)) { + return MemorySegment.class; + } + throw new IllegalArgumentException("Invalid type for ABI: " + c.getTypeName()); + } + + private MemoryLayout variadicLayout(Class c) { + if (c == long.class) { + return C_LONG_LONG; + } else if (c == double.class) { + return C_DOUBLE; + } else if (MemoryAddress.class.isAssignableFrom(c)) { + return C_POINTER; + } else { + throw new IllegalArgumentException("Unhandled variadic argument class: " + c); + } + } + } +} diff --git a/resources/bundles/org.eclipse.core.resources.linux.x86_64/src17/org/eclipse/core/internal/resources/refresh/linux/inotify/__fsid_t.java b/resources/bundles/org.eclipse.core.resources.linux.x86_64/src17/org/eclipse/core/internal/resources/refresh/linux/inotify/__fsid_t.java new file mode 100644 index 00000000000..2fb3111704f --- /dev/null +++ b/resources/bundles/org.eclipse.core.resources.linux.x86_64/src17/org/eclipse/core/internal/resources/refresh/linux/inotify/__fsid_t.java @@ -0,0 +1,33 @@ +// Generated by jextract + +package org.eclipse.core.internal.resources.refresh.linux.inotify; + +import java.lang.invoke.MethodHandle; +import java.lang.invoke.VarHandle; +import java.nio.ByteOrder; +import jdk.incubator.foreign.*; +import static jdk.incubator.foreign.CLinker.*; +public class __fsid_t { + + static final MemoryLayout $struct$LAYOUT = MemoryLayout.structLayout( + MemoryLayout.sequenceLayout(2, C_INT).withName("__val") + ); + public static MemoryLayout $LAYOUT() { + return __fsid_t.$struct$LAYOUT; + } + public static MemorySegment __val$slice(MemorySegment seg) { + return seg.asSlice(0, 8); + } + public static long sizeof() { return $LAYOUT().byteSize(); } + public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } + public static MemorySegment allocate(ResourceScope scope) { return allocate(SegmentAllocator.ofScope(scope)); } + public static MemorySegment allocateArray(int len, SegmentAllocator allocator) { + return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); + } + public static MemorySegment allocateArray(int len, ResourceScope scope) { + return allocateArray(len, SegmentAllocator.ofScope(scope)); + } + public static MemorySegment ofAddress(MemoryAddress addr, ResourceScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } +} + + diff --git a/resources/bundles/org.eclipse.core.resources.linux.x86_64/src17/org/eclipse/core/internal/resources/refresh/linux/inotify/constants$0.java b/resources/bundles/org.eclipse.core.resources.linux.x86_64/src17/org/eclipse/core/internal/resources/refresh/linux/inotify/constants$0.java new file mode 100644 index 00000000000..4de29cf36b9 --- /dev/null +++ b/resources/bundles/org.eclipse.core.resources.linux.x86_64/src17/org/eclipse/core/internal/resources/refresh/linux/inotify/constants$0.java @@ -0,0 +1,47 @@ +// Generated by jextract + +package org.eclipse.core.internal.resources.refresh.linux.inotify; + +import java.lang.invoke.MethodHandle; +import java.lang.invoke.VarHandle; +import java.nio.ByteOrder; +import jdk.incubator.foreign.*; +import static jdk.incubator.foreign.CLinker.*; +class constants$0 { + + static final FunctionDescriptor inotify_init$FUNC = FunctionDescriptor.of(C_INT); + static final MethodHandle inotify_init$MH = RuntimeHelper.downcallHandle( + inotify_h.LIBRARIES, "inotify_init", + "()I", + constants$0.inotify_init$FUNC, false + ); + static final FunctionDescriptor inotify_init1$FUNC = FunctionDescriptor.of(C_INT, + C_INT + ); + static final MethodHandle inotify_init1$MH = RuntimeHelper.downcallHandle( + inotify_h.LIBRARIES, "inotify_init1", + "(I)I", + constants$0.inotify_init1$FUNC, false + ); + static final FunctionDescriptor inotify_add_watch$FUNC = FunctionDescriptor.of(C_INT, + C_INT, + C_POINTER, + C_INT + ); + static final MethodHandle inotify_add_watch$MH = RuntimeHelper.downcallHandle( + inotify_h.LIBRARIES, "inotify_add_watch", + "(ILjdk/incubator/foreign/MemoryAddress;I)I", + constants$0.inotify_add_watch$FUNC, false + ); + static final FunctionDescriptor inotify_rm_watch$FUNC = FunctionDescriptor.of(C_INT, + C_INT, + C_INT + ); + static final MethodHandle inotify_rm_watch$MH = RuntimeHelper.downcallHandle( + inotify_h.LIBRARIES, "inotify_rm_watch", + "(II)I", + constants$0.inotify_rm_watch$FUNC, false + ); +} + + diff --git a/resources/bundles/org.eclipse.core.resources.linux.x86_64/src17/org/eclipse/core/internal/resources/refresh/linux/inotify/inotify_event.java b/resources/bundles/org.eclipse.core.resources.linux.x86_64/src17/org/eclipse/core/internal/resources/refresh/linux/inotify/inotify_event.java new file mode 100644 index 00000000000..17a75a15024 --- /dev/null +++ b/resources/bundles/org.eclipse.core.resources.linux.x86_64/src17/org/eclipse/core/internal/resources/refresh/linux/inotify/inotify_event.java @@ -0,0 +1,98 @@ +// Generated by jextract + +package org.eclipse.core.internal.resources.refresh.linux.inotify; + +import java.lang.invoke.MethodHandle; +import java.lang.invoke.VarHandle; +import java.nio.ByteOrder; +import jdk.incubator.foreign.*; +import static jdk.incubator.foreign.CLinker.*; +public class inotify_event { + + static final MemoryLayout $struct$LAYOUT = MemoryLayout.structLayout( + C_INT.withName("wd"), + C_INT.withName("mask"), + C_INT.withName("cookie"), + C_INT.withName("len"), + MemoryLayout.sequenceLayout(C_CHAR).withName("name") + ).withName("inotify_event"); + public static MemoryLayout $LAYOUT() { + return inotify_event.$struct$LAYOUT; + } + static final VarHandle wd$VH = $struct$LAYOUT.varHandle(int.class, MemoryLayout.PathElement.groupElement("wd")); + public static VarHandle wd$VH() { + return inotify_event.wd$VH; + } + public static int wd$get(MemorySegment seg) { + return (int)inotify_event.wd$VH.get(seg); + } + public static void wd$set( MemorySegment seg, int x) { + inotify_event.wd$VH.set(seg, x); + } + public static int wd$get(MemorySegment seg, long index) { + return (int)inotify_event.wd$VH.get(seg.asSlice(index*sizeof())); + } + public static void wd$set(MemorySegment seg, long index, int x) { + inotify_event.wd$VH.set(seg.asSlice(index*sizeof()), x); + } + static final VarHandle mask$VH = $struct$LAYOUT.varHandle(int.class, MemoryLayout.PathElement.groupElement("mask")); + public static VarHandle mask$VH() { + return inotify_event.mask$VH; + } + public static int mask$get(MemorySegment seg) { + return (int)inotify_event.mask$VH.get(seg); + } + public static void mask$set( MemorySegment seg, int x) { + inotify_event.mask$VH.set(seg, x); + } + public static int mask$get(MemorySegment seg, long index) { + return (int)inotify_event.mask$VH.get(seg.asSlice(index*sizeof())); + } + public static void mask$set(MemorySegment seg, long index, int x) { + inotify_event.mask$VH.set(seg.asSlice(index*sizeof()), x); + } + static final VarHandle cookie$VH = $struct$LAYOUT.varHandle(int.class, MemoryLayout.PathElement.groupElement("cookie")); + public static VarHandle cookie$VH() { + return inotify_event.cookie$VH; + } + public static int cookie$get(MemorySegment seg) { + return (int)inotify_event.cookie$VH.get(seg); + } + public static void cookie$set( MemorySegment seg, int x) { + inotify_event.cookie$VH.set(seg, x); + } + public static int cookie$get(MemorySegment seg, long index) { + return (int)inotify_event.cookie$VH.get(seg.asSlice(index*sizeof())); + } + public static void cookie$set(MemorySegment seg, long index, int x) { + inotify_event.cookie$VH.set(seg.asSlice(index*sizeof()), x); + } + static final VarHandle len$VH = $struct$LAYOUT.varHandle(int.class, MemoryLayout.PathElement.groupElement("len")); + public static VarHandle len$VH() { + return inotify_event.len$VH; + } + public static int len$get(MemorySegment seg) { + return (int)inotify_event.len$VH.get(seg); + } + public static void len$set( MemorySegment seg, int x) { + inotify_event.len$VH.set(seg, x); + } + public static int len$get(MemorySegment seg, long index) { + return (int)inotify_event.len$VH.get(seg.asSlice(index*sizeof())); + } + public static void len$set(MemorySegment seg, long index, int x) { + inotify_event.len$VH.set(seg.asSlice(index*sizeof()), x); + } + public static long sizeof() { return $LAYOUT().byteSize(); } + public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } + public static MemorySegment allocate(ResourceScope scope) { return allocate(SegmentAllocator.ofScope(scope)); } + public static MemorySegment allocateArray(int len, SegmentAllocator allocator) { + return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); + } + public static MemorySegment allocateArray(int len, ResourceScope scope) { + return allocateArray(len, SegmentAllocator.ofScope(scope)); + } + public static MemorySegment ofAddress(MemoryAddress addr, ResourceScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } +} + + diff --git a/resources/bundles/org.eclipse.core.resources.linux.x86_64/src17/org/eclipse/core/internal/resources/refresh/linux/inotify/inotify_h.java b/resources/bundles/org.eclipse.core.resources.linux.x86_64/src17/org/eclipse/core/internal/resources/refresh/linux/inotify/inotify_h.java new file mode 100644 index 00000000000..b91c4df8820 --- /dev/null +++ b/resources/bundles/org.eclipse.core.resources.linux.x86_64/src17/org/eclipse/core/internal/resources/refresh/linux/inotify/inotify_h.java @@ -0,0 +1,483 @@ +// Generated by jextract + +package org.eclipse.core.internal.resources.refresh.linux.inotify; + +import java.lang.invoke.MethodHandle; +import java.lang.invoke.VarHandle; +import java.nio.ByteOrder; +import jdk.incubator.foreign.*; +import static jdk.incubator.foreign.CLinker.*; +public class inotify_h { + + static { + } + + static final SymbolLookup LIBRARIES = RuntimeHelper.lookup(); /* package-private */ inotify_h() {} + public static int _INOTIFYTOOLS_INOTIFY_H() { + return (int)1L; + } + public static int SYS_INOTIFY_H_EXISTS_AND_WORKS() { + return (int)1L; + } + public static int _SYS_INOTIFY_H() { + return (int)1L; + } + public static int _STDINT_H() { + return (int)1L; + } + public static int _FEATURES_H() { + return (int)1L; + } + public static int _DEFAULT_SOURCE() { + return (int)1L; + } + public static int __USE_ISOC11() { + return (int)1L; + } + public static int __USE_ISOC99() { + return (int)1L; + } + public static int __USE_ISOC95() { + return (int)1L; + } + public static int __USE_POSIX_IMPLICITLY() { + return (int)1L; + } + public static int _POSIX_SOURCE() { + return (int)1L; + } + public static int __USE_POSIX() { + return (int)1L; + } + public static int __USE_POSIX2() { + return (int)1L; + } + public static int __USE_POSIX199309() { + return (int)1L; + } + public static int __USE_POSIX199506() { + return (int)1L; + } + public static int __USE_XOPEN2K() { + return (int)1L; + } + public static int __USE_XOPEN2K8() { + return (int)1L; + } + public static int _ATFILE_SOURCE() { + return (int)1L; + } + public static int __USE_MISC() { + return (int)1L; + } + public static int __USE_ATFILE() { + return (int)1L; + } + public static int __USE_FORTIFY_LEVEL() { + return (int)0L; + } + public static int __GLIBC_USE_DEPRECATED_GETS() { + return (int)0L; + } + public static int _STDC_PREDEF_H() { + return (int)1L; + } + public static int __STDC_IEC_559__() { + return (int)1L; + } + public static int __STDC_IEC_559_COMPLEX__() { + return (int)1L; + } + public static int __GNU_LIBRARY__() { + return (int)6L; + } + public static int __GLIBC__() { + return (int)2L; + } + public static int __GLIBC_MINOR__() { + return (int)28L; + } + public static int _SYS_CDEFS_H() { + return (int)1L; + } + public static int __glibc_c99_flexarr_available() { + return (int)1L; + } + public static int __WORDSIZE() { + return (int)64L; + } + public static int __WORDSIZE_TIME64_COMPAT32() { + return (int)1L; + } + public static int __SYSCALL_WORDSIZE() { + return (int)64L; + } + public static int __HAVE_GENERIC_SELECTION() { + return (int)1L; + } + public static int __GLIBC_USE_LIB_EXT2() { + return (int)0L; + } + public static int __GLIBC_USE_IEC_60559_BFP_EXT() { + return (int)0L; + } + public static int __GLIBC_USE_IEC_60559_FUNCS_EXT() { + return (int)0L; + } + public static int __GLIBC_USE_IEC_60559_TYPES_EXT() { + return (int)0L; + } + public static int _BITS_TYPES_H() { + return (int)1L; + } + public static int _BITS_TYPESIZES_H() { + return (int)1L; + } + public static int __OFF_T_MATCHES_OFF64_T() { + return (int)1L; + } + public static int __INO_T_MATCHES_INO64_T() { + return (int)1L; + } + public static int __RLIM_T_MATCHES_RLIM64_T() { + return (int)1L; + } + public static int __FD_SETSIZE() { + return (int)1024L; + } + public static int _BITS_WCHAR_H() { + return (int)1L; + } + public static int _BITS_STDINT_INTN_H() { + return (int)1L; + } + public static int _BITS_STDINT_UINTN_H() { + return (int)1L; + } + public static int IN_ACCESS() { + return (int)1L; + } + public static int IN_MODIFY() { + return (int)2L; + } + public static int IN_ATTRIB() { + return (int)4L; + } + public static int IN_CLOSE_WRITE() { + return (int)8L; + } + public static int IN_CLOSE_NOWRITE() { + return (int)16L; + } + public static int IN_OPEN() { + return (int)32L; + } + public static int IN_MOVED_FROM() { + return (int)64L; + } + public static int IN_MOVED_TO() { + return (int)128L; + } + public static int IN_CREATE() { + return (int)256L; + } + public static int IN_DELETE() { + return (int)512L; + } + public static int IN_DELETE_SELF() { + return (int)1024L; + } + public static int IN_MOVE_SELF() { + return (int)2048L; + } + public static int IN_UNMOUNT() { + return (int)8192L; + } + public static int IN_Q_OVERFLOW() { + return (int)16384L; + } + public static int IN_IGNORED() { + return (int)32768L; + } + public static int IN_ONLYDIR() { + return (int)16777216L; + } + public static int IN_DONT_FOLLOW() { + return (int)33554432L; + } + public static int IN_EXCL_UNLINK() { + return (int)67108864L; + } + public static int IN_MASK_ADD() { + return (int)536870912L; + } + public static int IN_ISDIR() { + return (int)1073741824L; + } + public static ValueLayout __int16_t = C_SHORT; + public static ValueLayout __int32_t = C_INT; + public static ValueLayout __int64_t = C_LONG; + public static ValueLayout __int_least16_t = C_SHORT; + public static ValueLayout __int_least32_t = C_INT; + public static ValueLayout __int_least64_t = C_LONG; + public static ValueLayout __quad_t = C_LONG; + public static ValueLayout __intmax_t = C_LONG; + public static ValueLayout __off_t = C_LONG; + public static ValueLayout __off64_t = C_LONG; + public static ValueLayout __pid_t = C_INT; + public static ValueLayout __clock_t = C_LONG; + public static ValueLayout __time_t = C_LONG; + public static ValueLayout __suseconds_t = C_LONG; + public static ValueLayout __daddr_t = C_INT; + public static ValueLayout __key_t = C_INT; + public static ValueLayout __clockid_t = C_INT; + public static ValueLayout __blksize_t = C_LONG; + public static ValueLayout __blkcnt_t = C_LONG; + public static ValueLayout __blkcnt64_t = C_LONG; + public static ValueLayout __fsword_t = C_LONG; + public static ValueLayout __ssize_t = C_LONG; + public static ValueLayout __syscall_slong_t = C_LONG; + public static ValueLayout __loff_t = C_LONG; + public static ValueLayout __intptr_t = C_LONG; + public static ValueLayout __sig_atomic_t = C_INT; + public static ValueLayout int16_t = C_SHORT; + public static ValueLayout int32_t = C_INT; + public static ValueLayout int64_t = C_LONG; + public static ValueLayout int_least16_t = C_SHORT; + public static ValueLayout int_least32_t = C_INT; + public static ValueLayout int_least64_t = C_LONG; + public static ValueLayout int_fast16_t = C_LONG; + public static ValueLayout int_fast32_t = C_LONG; + public static ValueLayout int_fast64_t = C_LONG; + public static ValueLayout intptr_t = C_LONG; + public static ValueLayout intmax_t = C_LONG; + public static int IN_CLOEXEC() { + return (int)524288L; + } + public static int IN_NONBLOCK() { + return (int)2048L; + } + public static MethodHandle inotify_init$MH() { + return RuntimeHelper.requireNonNull(constants$0.inotify_init$MH,"inotify_init"); + } + public static int inotify_init () { + var mh$ = RuntimeHelper.requireNonNull(constants$0.inotify_init$MH, "inotify_init"); + try { + return (int)mh$.invokeExact(); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + public static MethodHandle inotify_init1$MH() { + return RuntimeHelper.requireNonNull(constants$0.inotify_init1$MH,"inotify_init1"); + } + public static int inotify_init1 ( int __flags) { + var mh$ = RuntimeHelper.requireNonNull(constants$0.inotify_init1$MH, "inotify_init1"); + try { + return (int)mh$.invokeExact(__flags); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + public static MethodHandle inotify_add_watch$MH() { + return RuntimeHelper.requireNonNull(constants$0.inotify_add_watch$MH,"inotify_add_watch"); + } + public static int inotify_add_watch ( int __fd, Addressable __name, int __mask) { + var mh$ = RuntimeHelper.requireNonNull(constants$0.inotify_add_watch$MH, "inotify_add_watch"); + try { + return (int)mh$.invokeExact(__fd, __name.address(), __mask); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + public static MethodHandle inotify_rm_watch$MH() { + return RuntimeHelper.requireNonNull(constants$0.inotify_rm_watch$MH,"inotify_rm_watch"); + } + public static int inotify_rm_watch ( int __fd, int __wd) { + var mh$ = RuntimeHelper.requireNonNull(constants$0.inotify_rm_watch$MH, "inotify_rm_watch"); + try { + return (int)mh$.invokeExact(__fd, __wd); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + public static long _POSIX_C_SOURCE() { + return 200809L; + } + public static long __STDC_ISO_10646__() { + return 201706L; + } + public static int __WCHAR_MAX() { + return (int)2147483647L; + } + public static int __WCHAR_MIN() { + return (int)-2147483648L; + } + public static int INT8_MIN() { + return (int)-128L; + } + public static int INT16_MIN() { + return (int)-32768L; + } + public static int INT32_MIN() { + return (int)-2147483648L; + } + public static long INT64_MIN() { + return -9223372036854775808L; + } + public static int INT8_MAX() { + return (int)127L; + } + public static int INT16_MAX() { + return (int)32767L; + } + public static int INT32_MAX() { + return (int)2147483647L; + } + public static long INT64_MAX() { + return 9223372036854775807L; + } + public static int UINT8_MAX() { + return (int)255L; + } + public static int UINT16_MAX() { + return (int)65535L; + } + public static int UINT32_MAX() { + return (int)4294967295L; + } + public static long UINT64_MAX() { + return -1L; + } + public static int INT_LEAST8_MIN() { + return (int)-128L; + } + public static int INT_LEAST16_MIN() { + return (int)-32768L; + } + public static int INT_LEAST32_MIN() { + return (int)-2147483648L; + } + public static long INT_LEAST64_MIN() { + return -9223372036854775808L; + } + public static int INT_LEAST8_MAX() { + return (int)127L; + } + public static int INT_LEAST16_MAX() { + return (int)32767L; + } + public static int INT_LEAST32_MAX() { + return (int)2147483647L; + } + public static long INT_LEAST64_MAX() { + return 9223372036854775807L; + } + public static int UINT_LEAST8_MAX() { + return (int)255L; + } + public static int UINT_LEAST16_MAX() { + return (int)65535L; + } + public static int UINT_LEAST32_MAX() { + return (int)4294967295L; + } + public static long UINT_LEAST64_MAX() { + return -1L; + } + public static int INT_FAST8_MIN() { + return (int)-128L; + } + public static long INT_FAST16_MIN() { + return -9223372036854775808L; + } + public static long INT_FAST32_MIN() { + return -9223372036854775808L; + } + public static long INT_FAST64_MIN() { + return -9223372036854775808L; + } + public static int INT_FAST8_MAX() { + return (int)127L; + } + public static long INT_FAST16_MAX() { + return 9223372036854775807L; + } + public static long INT_FAST32_MAX() { + return 9223372036854775807L; + } + public static long INT_FAST64_MAX() { + return 9223372036854775807L; + } + public static int UINT_FAST8_MAX() { + return (int)255L; + } + public static long UINT_FAST16_MAX() { + return -1L; + } + public static long UINT_FAST32_MAX() { + return -1L; + } + public static long UINT_FAST64_MAX() { + return -1L; + } + public static long INTPTR_MIN() { + return -9223372036854775808L; + } + public static long INTPTR_MAX() { + return 9223372036854775807L; + } + public static long UINTPTR_MAX() { + return -1L; + } + public static long INTMAX_MIN() { + return -9223372036854775808L; + } + public static long INTMAX_MAX() { + return 9223372036854775807L; + } + public static long UINTMAX_MAX() { + return -1L; + } + public static long PTRDIFF_MIN() { + return -9223372036854775808L; + } + public static long PTRDIFF_MAX() { + return 9223372036854775807L; + } + public static int SIG_ATOMIC_MIN() { + return (int)-2147483648L; + } + public static int SIG_ATOMIC_MAX() { + return (int)2147483647L; + } + public static long SIZE_MAX() { + return -1L; + } + public static int WCHAR_MIN() { + return (int)-2147483648L; + } + public static int WCHAR_MAX() { + return (int)2147483647L; + } + public static int WINT_MIN() { + return (int)0L; + } + public static int WINT_MAX() { + return (int)4294967295L; + } + public static int IN_CLOSE() { + return (int)24L; + } + public static int IN_MOVE() { + return (int)192L; + } + public static int IN_ONESHOT() { + return (int)2147483648L; + } + public static int IN_ALL_EVENTS() { + return (int)4095L; + } +} + + diff --git a/resources/bundles/org.eclipse.core.resources.linux.x86_64/src19/org/eclipse/core/internal/resources/refresh/linux/inotify/Constants$root.java b/resources/bundles/org.eclipse.core.resources.linux.x86_64/src19/org/eclipse/core/internal/resources/refresh/linux/inotify/Constants$root.java new file mode 100644 index 00000000000..63700dc8ff5 --- /dev/null +++ b/resources/bundles/org.eclipse.core.resources.linux.x86_64/src19/org/eclipse/core/internal/resources/refresh/linux/inotify/Constants$root.java @@ -0,0 +1,23 @@ +// Generated by jextract + +package org.eclipse.core.internal.resources.refresh.linux.inotify; + +import java.lang.invoke.MethodHandle; +import java.lang.invoke.VarHandle; +import java.nio.ByteOrder; +import jdk.incubator.foreign.*; +import static jdk.incubator.foreign.ValueLayout.*; +public class Constants$root { + + static final OfBoolean C_BOOL$LAYOUT = JAVA_BOOLEAN; + static final OfByte C_CHAR$LAYOUT = JAVA_BYTE; + static final OfShort C_SHORT$LAYOUT = JAVA_SHORT.withBitAlignment(16); + static final OfInt C_INT$LAYOUT = JAVA_INT.withBitAlignment(32); + static final OfLong C_LONG$LAYOUT = JAVA_LONG.withBitAlignment(64); + static final OfLong C_LONG_LONG$LAYOUT = JAVA_LONG.withBitAlignment(64); + static final OfFloat C_FLOAT$LAYOUT = JAVA_FLOAT.withBitAlignment(32); + static final OfDouble C_DOUBLE$LAYOUT = JAVA_DOUBLE.withBitAlignment(64); + static final OfAddress C_POINTER$LAYOUT = ADDRESS.withBitAlignment(64); +} + + diff --git a/resources/bundles/org.eclipse.core.resources.linux.x86_64/src19/org/eclipse/core/internal/resources/refresh/linux/inotify/RuntimeHelper.java b/resources/bundles/org.eclipse.core.resources.linux.x86_64/src19/org/eclipse/core/internal/resources/refresh/linux/inotify/RuntimeHelper.java new file mode 100644 index 00000000000..14d5d54cdc8 --- /dev/null +++ b/resources/bundles/org.eclipse.core.resources.linux.x86_64/src19/org/eclipse/core/internal/resources/refresh/linux/inotify/RuntimeHelper.java @@ -0,0 +1,235 @@ +package org.eclipse.core.internal.resources.refresh.linux.inotify; +// Generated by jextract + +import jdk.incubator.foreign.Addressable; +import jdk.incubator.foreign.CLinker; +import jdk.incubator.foreign.FunctionDescriptor; +import jdk.incubator.foreign.GroupLayout; +import jdk.incubator.foreign.NativeSymbol; +import jdk.incubator.foreign.SymbolLookup; +import jdk.incubator.foreign.MemoryAddress; +import jdk.incubator.foreign.MemoryLayout; +import jdk.incubator.foreign.MemorySegment; +import jdk.incubator.foreign.ResourceScope; +import jdk.incubator.foreign.SegmentAllocator; +import jdk.incubator.foreign.ValueLayout; +import java.lang.invoke.MethodHandle; +import java.lang.invoke.MethodHandles; +import java.lang.invoke.MethodType; +import java.io.File; +import java.nio.file.Path; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.Optional; +import java.util.stream.Stream; + +import static jdk.incubator.foreign.CLinker.*; +import static jdk.incubator.foreign.ValueLayout.*; + +final class RuntimeHelper { + + private RuntimeHelper() {} + private final static CLinker LINKER = CLinker.systemCLinker(); + private final static ClassLoader LOADER = RuntimeHelper.class.getClassLoader(); + private final static MethodHandles.Lookup MH_LOOKUP = MethodHandles.lookup(); + private final static SymbolLookup SYMBOL_LOOKUP; + + final static SegmentAllocator CONSTANT_ALLOCATOR = + (size, align) -> MemorySegment.allocateNative(size, align, ResourceScope.newImplicitScope()); + + static { + + SymbolLookup loaderLookup = SymbolLookup.loaderLookup(); + SYMBOL_LOOKUP = name -> loaderLookup.lookup(name).or(() -> LINKER.lookup(name)); + } + + static T requireNonNull(T obj, String symbolName) { + if (obj == null) { + throw new UnsatisfiedLinkError("unresolved symbol: " + symbolName); + } + return obj; + } + + private final static SegmentAllocator THROWING_ALLOCATOR = (x, y) -> { throw new AssertionError("should not reach here"); }; + + static final MemorySegment lookupGlobalVariable(String name, MemoryLayout layout) { + return SYMBOL_LOOKUP.lookup(name).map(symbol -> MemorySegment.ofAddress(symbol.address(), layout.byteSize(), ResourceScope.newSharedScope())).orElse(null); + } + + static final MethodHandle downcallHandle(String name, FunctionDescriptor fdesc, boolean variadic) { + return SYMBOL_LOOKUP.lookup(name).map( + addr -> { + return variadic ? + VarargsInvoker.make(addr, fdesc) : + LINKER.downcallHandle(addr, fdesc); + }).orElse(null); + } + + static final MethodHandle downcallHandle(FunctionDescriptor fdesc, boolean variadic) { + if (variadic) { + throw new AssertionError("Cannot get here!"); + } + return LINKER.downcallHandle(fdesc); + } + + static final NativeSymbol upcallStub(Class fi, Z z, FunctionDescriptor fdesc, String mtypeDesc, ResourceScope scope) { + try { + MethodHandle handle = MH_LOOKUP.findVirtual(fi, "apply", + MethodType.fromMethodDescriptorString(mtypeDesc, LOADER)); + handle = handle.bindTo(z); + return LINKER.upcallStub(handle, fdesc, scope); + } catch (Throwable ex) { + throw new AssertionError(ex); + } + } + + static MemorySegment asArray(MemoryAddress addr, MemoryLayout layout, int numElements, ResourceScope scope) { + return MemorySegment.ofAddress(addr, numElements * layout.byteSize(), scope); + } + + // Internals only below this point + + private static class VarargsInvoker { + private static final MethodHandle INVOKE_MH; + private final NativeSymbol symbol; + private final FunctionDescriptor function; + + private VarargsInvoker(NativeSymbol symbol, FunctionDescriptor function) { + this.symbol = symbol; + this.function = function; + } + + static { + try { + INVOKE_MH = MethodHandles.lookup().findVirtual(VarargsInvoker.class, "invoke", MethodType.methodType(Object.class, SegmentAllocator.class, Object[].class)); + } catch (ReflectiveOperationException e) { + throw new RuntimeException(e); + } + } + + static MethodHandle make(NativeSymbol symbol, FunctionDescriptor function) { + VarargsInvoker invoker = new VarargsInvoker(symbol, function); + MethodHandle handle = INVOKE_MH.bindTo(invoker).asCollector(Object[].class, function.argumentLayouts().size() + 1); + MethodType mtype = MethodType.methodType(function.returnLayout().isPresent() ? carrier(function.returnLayout().get(), true) : void.class); + for (MemoryLayout layout : function.argumentLayouts()) { + mtype = mtype.appendParameterTypes(carrier(layout, false)); + } + mtype = mtype.appendParameterTypes(Object[].class); + if (mtype.returnType().equals(MemorySegment.class)) { + mtype = mtype.insertParameterTypes(0, SegmentAllocator.class); + } else { + handle = MethodHandles.insertArguments(handle, 0, THROWING_ALLOCATOR); + } + return handle.asType(mtype); + } + + static Class carrier(MemoryLayout layout, boolean ret) { + if (layout instanceof ValueLayout valueLayout) { + return (ret || valueLayout.carrier() != MemoryAddress.class) ? + valueLayout.carrier() : Addressable.class; + } else if (layout instanceof GroupLayout) { + return MemorySegment.class; + } else { + throw new AssertionError("Cannot get here!"); + } + } + + private Object invoke(SegmentAllocator allocator, Object[] args) throws Throwable { + // one trailing Object[] + int nNamedArgs = function.argumentLayouts().size(); + assert(args.length == nNamedArgs + 1); + // The last argument is the array of vararg collector + Object[] unnamedArgs = (Object[]) args[args.length - 1]; + + int argsCount = nNamedArgs + unnamedArgs.length; + Class[] argTypes = new Class[argsCount]; + MemoryLayout[] argLayouts = new MemoryLayout[nNamedArgs + unnamedArgs.length]; + + int pos = 0; + for (pos = 0; pos < nNamedArgs; pos++) { + argLayouts[pos] = function.argumentLayouts().get(pos); + } + + assert pos == nNamedArgs; + for (Object o: unnamedArgs) { + argLayouts[pos] = variadicLayout(normalize(o.getClass())); + pos++; + } + assert pos == argsCount; + + FunctionDescriptor f = (function.returnLayout().isEmpty()) ? + FunctionDescriptor.ofVoid(argLayouts) : + FunctionDescriptor.of(function.returnLayout().get(), argLayouts); + MethodHandle mh = LINKER.downcallHandle(symbol, f); + if (mh.type().returnType() == MemorySegment.class) { + mh = mh.bindTo(allocator); + } + // flatten argument list so that it can be passed to an asSpreader MH + Object[] allArgs = new Object[nNamedArgs + unnamedArgs.length]; + System.arraycopy(args, 0, allArgs, 0, nNamedArgs); + System.arraycopy(unnamedArgs, 0, allArgs, nNamedArgs, unnamedArgs.length); + + return mh.asSpreader(Object[].class, argsCount).invoke(allArgs); + } + + private static Class unboxIfNeeded(Class clazz) { + if (clazz == Boolean.class) { + return boolean.class; + } else if (clazz == Void.class) { + return void.class; + } else if (clazz == Byte.class) { + return byte.class; + } else if (clazz == Character.class) { + return char.class; + } else if (clazz == Short.class) { + return short.class; + } else if (clazz == Integer.class) { + return int.class; + } else if (clazz == Long.class) { + return long.class; + } else if (clazz == Float.class) { + return float.class; + } else if (clazz == Double.class) { + return double.class; + } else { + return clazz; + } + } + + private Class promote(Class c) { + if (c == byte.class || c == char.class || c == short.class || c == int.class) { + return long.class; + } else if (c == float.class) { + return double.class; + } else { + return c; + } + } + + private Class normalize(Class c) { + c = unboxIfNeeded(c); + if (c.isPrimitive()) { + return promote(c); + } + if (MemoryAddress.class.isAssignableFrom(c)) { + return MemoryAddress.class; + } + if (MemorySegment.class.isAssignableFrom(c)) { + return MemorySegment.class; + } + throw new IllegalArgumentException("Invalid type for ABI: " + c.getTypeName()); + } + + private MemoryLayout variadicLayout(Class c) { + if (c == long.class) { + return JAVA_LONG; + } else if (c == double.class) { + return JAVA_DOUBLE; + } else if (MemoryAddress.class.isAssignableFrom(c)) { + return ADDRESS; + } else { + throw new IllegalArgumentException("Unhandled variadic argument class: " + c); + } + } + } +} diff --git a/resources/bundles/org.eclipse.core.resources.linux.x86_64/src19/org/eclipse/core/internal/resources/refresh/linux/inotify/__fsid_t.java b/resources/bundles/org.eclipse.core.resources.linux.x86_64/src19/org/eclipse/core/internal/resources/refresh/linux/inotify/__fsid_t.java new file mode 100644 index 00000000000..25ed05e4bd4 --- /dev/null +++ b/resources/bundles/org.eclipse.core.resources.linux.x86_64/src19/org/eclipse/core/internal/resources/refresh/linux/inotify/__fsid_t.java @@ -0,0 +1,33 @@ +// Generated by jextract + +package org.eclipse.core.internal.resources.refresh.linux.inotify; + +import java.lang.invoke.MethodHandle; +import java.lang.invoke.VarHandle; +import java.nio.ByteOrder; +import jdk.incubator.foreign.*; +import static jdk.incubator.foreign.ValueLayout.*; +public class __fsid_t { + + static final GroupLayout $struct$LAYOUT = MemoryLayout.structLayout( + MemoryLayout.sequenceLayout(2, Constants$root.C_INT$LAYOUT).withName("__val") + ); + public static MemoryLayout $LAYOUT() { + return __fsid_t.$struct$LAYOUT; + } + public static MemorySegment __val$slice(MemorySegment seg) { + return seg.asSlice(0, 8); + } + public static long sizeof() { return $LAYOUT().byteSize(); } + public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } + public static MemorySegment allocateArray(int len, SegmentAllocator allocator) { + return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); + } + public static MemorySegment allocate(ResourceScope scope) { return allocate(SegmentAllocator.nativeAllocator(scope)); } + public static MemorySegment allocateArray(int len, ResourceScope scope) { + return allocateArray(len, SegmentAllocator.nativeAllocator(scope)); + } + public static MemorySegment ofAddress(MemoryAddress addr, ResourceScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } +} + + diff --git a/resources/bundles/org.eclipse.core.resources.linux.x86_64/src19/org/eclipse/core/internal/resources/refresh/linux/inotify/constants$0.java b/resources/bundles/org.eclipse.core.resources.linux.x86_64/src19/org/eclipse/core/internal/resources/refresh/linux/inotify/constants$0.java new file mode 100644 index 00000000000..3bea7479a6d --- /dev/null +++ b/resources/bundles/org.eclipse.core.resources.linux.x86_64/src19/org/eclipse/core/internal/resources/refresh/linux/inotify/constants$0.java @@ -0,0 +1,43 @@ +// Generated by jextract + +package org.eclipse.core.internal.resources.refresh.linux.inotify; + +import java.lang.invoke.MethodHandle; +import java.lang.invoke.VarHandle; +import java.nio.ByteOrder; +import jdk.incubator.foreign.*; +import static jdk.incubator.foreign.ValueLayout.*; +class constants$0 { + + static final FunctionDescriptor inotify_init$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT); + static final MethodHandle inotify_init$MH = RuntimeHelper.downcallHandle( + "inotify_init", + constants$0.inotify_init$FUNC, false + ); + static final FunctionDescriptor inotify_init1$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, + Constants$root.C_INT$LAYOUT + ); + static final MethodHandle inotify_init1$MH = RuntimeHelper.downcallHandle( + "inotify_init1", + constants$0.inotify_init1$FUNC, false + ); + static final FunctionDescriptor inotify_add_watch$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, + Constants$root.C_INT$LAYOUT, + Constants$root.C_POINTER$LAYOUT, + Constants$root.C_INT$LAYOUT + ); + static final MethodHandle inotify_add_watch$MH = RuntimeHelper.downcallHandle( + "inotify_add_watch", + constants$0.inotify_add_watch$FUNC, false + ); + static final FunctionDescriptor inotify_rm_watch$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, + Constants$root.C_INT$LAYOUT, + Constants$root.C_INT$LAYOUT + ); + static final MethodHandle inotify_rm_watch$MH = RuntimeHelper.downcallHandle( + "inotify_rm_watch", + constants$0.inotify_rm_watch$FUNC, false + ); +} + + diff --git a/resources/bundles/org.eclipse.core.resources.linux.x86_64/src19/org/eclipse/core/internal/resources/refresh/linux/inotify/inotify_event.java b/resources/bundles/org.eclipse.core.resources.linux.x86_64/src19/org/eclipse/core/internal/resources/refresh/linux/inotify/inotify_event.java new file mode 100644 index 00000000000..82435bca775 --- /dev/null +++ b/resources/bundles/org.eclipse.core.resources.linux.x86_64/src19/org/eclipse/core/internal/resources/refresh/linux/inotify/inotify_event.java @@ -0,0 +1,98 @@ +// Generated by jextract + +package org.eclipse.core.internal.resources.refresh.linux.inotify; + +import java.lang.invoke.MethodHandle; +import java.lang.invoke.VarHandle; +import java.nio.ByteOrder; +import jdk.incubator.foreign.*; +import static jdk.incubator.foreign.ValueLayout.*; +public class inotify_event { + + static final GroupLayout $struct$LAYOUT = MemoryLayout.structLayout( + Constants$root.C_INT$LAYOUT.withName("wd"), + Constants$root.C_INT$LAYOUT.withName("mask"), + Constants$root.C_INT$LAYOUT.withName("cookie"), + Constants$root.C_INT$LAYOUT.withName("len"), + MemoryLayout.sequenceLayout(Constants$root.C_CHAR$LAYOUT).withName("name") + ).withName("inotify_event"); + public static MemoryLayout $LAYOUT() { + return inotify_event.$struct$LAYOUT; + } + static final VarHandle wd$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("wd")); + public static VarHandle wd$VH() { + return inotify_event.wd$VH; + } + public static int wd$get(MemorySegment seg) { + return (int)inotify_event.wd$VH.get(seg); + } + public static void wd$set( MemorySegment seg, int x) { + inotify_event.wd$VH.set(seg, x); + } + public static int wd$get(MemorySegment seg, long index) { + return (int)inotify_event.wd$VH.get(seg.asSlice(index*sizeof())); + } + public static void wd$set(MemorySegment seg, long index, int x) { + inotify_event.wd$VH.set(seg.asSlice(index*sizeof()), x); + } + static final VarHandle mask$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("mask")); + public static VarHandle mask$VH() { + return inotify_event.mask$VH; + } + public static int mask$get(MemorySegment seg) { + return (int)inotify_event.mask$VH.get(seg); + } + public static void mask$set( MemorySegment seg, int x) { + inotify_event.mask$VH.set(seg, x); + } + public static int mask$get(MemorySegment seg, long index) { + return (int)inotify_event.mask$VH.get(seg.asSlice(index*sizeof())); + } + public static void mask$set(MemorySegment seg, long index, int x) { + inotify_event.mask$VH.set(seg.asSlice(index*sizeof()), x); + } + static final VarHandle cookie$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("cookie")); + public static VarHandle cookie$VH() { + return inotify_event.cookie$VH; + } + public static int cookie$get(MemorySegment seg) { + return (int)inotify_event.cookie$VH.get(seg); + } + public static void cookie$set( MemorySegment seg, int x) { + inotify_event.cookie$VH.set(seg, x); + } + public static int cookie$get(MemorySegment seg, long index) { + return (int)inotify_event.cookie$VH.get(seg.asSlice(index*sizeof())); + } + public static void cookie$set(MemorySegment seg, long index, int x) { + inotify_event.cookie$VH.set(seg.asSlice(index*sizeof()), x); + } + static final VarHandle len$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("len")); + public static VarHandle len$VH() { + return inotify_event.len$VH; + } + public static int len$get(MemorySegment seg) { + return (int)inotify_event.len$VH.get(seg); + } + public static void len$set( MemorySegment seg, int x) { + inotify_event.len$VH.set(seg, x); + } + public static int len$get(MemorySegment seg, long index) { + return (int)inotify_event.len$VH.get(seg.asSlice(index*sizeof())); + } + public static void len$set(MemorySegment seg, long index, int x) { + inotify_event.len$VH.set(seg.asSlice(index*sizeof()), x); + } + public static long sizeof() { return $LAYOUT().byteSize(); } + public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } + public static MemorySegment allocateArray(int len, SegmentAllocator allocator) { + return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); + } + public static MemorySegment allocate(ResourceScope scope) { return allocate(SegmentAllocator.nativeAllocator(scope)); } + public static MemorySegment allocateArray(int len, ResourceScope scope) { + return allocateArray(len, SegmentAllocator.nativeAllocator(scope)); + } + public static MemorySegment ofAddress(MemoryAddress addr, ResourceScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } +} + + diff --git a/resources/bundles/org.eclipse.core.resources.linux.x86_64/src19/org/eclipse/core/internal/resources/refresh/linux/inotify/inotify_h.java b/resources/bundles/org.eclipse.core.resources.linux.x86_64/src19/org/eclipse/core/internal/resources/refresh/linux/inotify/inotify_h.java new file mode 100644 index 00000000000..35795494800 --- /dev/null +++ b/resources/bundles/org.eclipse.core.resources.linux.x86_64/src19/org/eclipse/core/internal/resources/refresh/linux/inotify/inotify_h.java @@ -0,0 +1,490 @@ +// Generated by jextract + +package org.eclipse.core.internal.resources.refresh.linux.inotify; + +import java.lang.invoke.MethodHandle; +import java.lang.invoke.VarHandle; +import java.nio.ByteOrder; +import jdk.incubator.foreign.*; +import static jdk.incubator.foreign.ValueLayout.*; +public class inotify_h { + + /* package-private */ inotify_h() {} + public static OfByte C_CHAR = Constants$root.C_CHAR$LAYOUT; + public static OfShort C_SHORT = Constants$root.C_SHORT$LAYOUT; + public static OfInt C_INT = Constants$root.C_INT$LAYOUT; + public static OfLong C_LONG = Constants$root.C_LONG_LONG$LAYOUT; + public static OfLong C_LONG_LONG = Constants$root.C_LONG_LONG$LAYOUT; + public static OfFloat C_FLOAT = Constants$root.C_FLOAT$LAYOUT; + public static OfDouble C_DOUBLE = Constants$root.C_DOUBLE$LAYOUT; + public static OfAddress C_POINTER = Constants$root.C_POINTER$LAYOUT; + public static int _INOTIFYTOOLS_INOTIFY_H() { + return (int)1L; + } + public static int SYS_INOTIFY_H_EXISTS_AND_WORKS() { + return (int)1L; + } + public static int _SYS_INOTIFY_H() { + return (int)1L; + } + public static int _STDINT_H() { + return (int)1L; + } + public static int _FEATURES_H() { + return (int)1L; + } + public static int _DEFAULT_SOURCE() { + return (int)1L; + } + public static int __USE_ISOC11() { + return (int)1L; + } + public static int __USE_ISOC99() { + return (int)1L; + } + public static int __USE_ISOC95() { + return (int)1L; + } + public static int __USE_POSIX_IMPLICITLY() { + return (int)1L; + } + public static int _POSIX_SOURCE() { + return (int)1L; + } + public static int __USE_POSIX() { + return (int)1L; + } + public static int __USE_POSIX2() { + return (int)1L; + } + public static int __USE_POSIX199309() { + return (int)1L; + } + public static int __USE_POSIX199506() { + return (int)1L; + } + public static int __USE_XOPEN2K() { + return (int)1L; + } + public static int __USE_XOPEN2K8() { + return (int)1L; + } + public static int _ATFILE_SOURCE() { + return (int)1L; + } + public static int __USE_MISC() { + return (int)1L; + } + public static int __USE_ATFILE() { + return (int)1L; + } + public static int __USE_FORTIFY_LEVEL() { + return (int)0L; + } + public static int __GLIBC_USE_DEPRECATED_GETS() { + return (int)0L; + } + public static int _STDC_PREDEF_H() { + return (int)1L; + } + public static int __STDC_IEC_559__() { + return (int)1L; + } + public static int __STDC_IEC_559_COMPLEX__() { + return (int)1L; + } + public static int __GNU_LIBRARY__() { + return (int)6L; + } + public static int __GLIBC__() { + return (int)2L; + } + public static int __GLIBC_MINOR__() { + return (int)28L; + } + public static int _SYS_CDEFS_H() { + return (int)1L; + } + public static int __glibc_c99_flexarr_available() { + return (int)1L; + } + public static int __WORDSIZE() { + return (int)64L; + } + public static int __WORDSIZE_TIME64_COMPAT32() { + return (int)1L; + } + public static int __SYSCALL_WORDSIZE() { + return (int)64L; + } + public static int __HAVE_GENERIC_SELECTION() { + return (int)1L; + } + public static int __GLIBC_USE_LIB_EXT2() { + return (int)0L; + } + public static int __GLIBC_USE_IEC_60559_BFP_EXT() { + return (int)0L; + } + public static int __GLIBC_USE_IEC_60559_FUNCS_EXT() { + return (int)0L; + } + public static int __GLIBC_USE_IEC_60559_TYPES_EXT() { + return (int)0L; + } + public static int _BITS_TYPES_H() { + return (int)1L; + } + public static int _BITS_TYPESIZES_H() { + return (int)1L; + } + public static int __OFF_T_MATCHES_OFF64_T() { + return (int)1L; + } + public static int __INO_T_MATCHES_INO64_T() { + return (int)1L; + } + public static int __RLIM_T_MATCHES_RLIM64_T() { + return (int)1L; + } + public static int __FD_SETSIZE() { + return (int)1024L; + } + public static int _BITS_WCHAR_H() { + return (int)1L; + } + public static int _BITS_STDINT_INTN_H() { + return (int)1L; + } + public static int _BITS_STDINT_UINTN_H() { + return (int)1L; + } + public static int IN_ACCESS() { + return (int)1L; + } + public static int IN_MODIFY() { + return (int)2L; + } + public static int IN_ATTRIB() { + return (int)4L; + } + public static int IN_CLOSE_WRITE() { + return (int)8L; + } + public static int IN_CLOSE_NOWRITE() { + return (int)16L; + } + public static int IN_OPEN() { + return (int)32L; + } + public static int IN_MOVED_FROM() { + return (int)64L; + } + public static int IN_MOVED_TO() { + return (int)128L; + } + public static int IN_CREATE() { + return (int)256L; + } + public static int IN_DELETE() { + return (int)512L; + } + public static int IN_DELETE_SELF() { + return (int)1024L; + } + public static int IN_MOVE_SELF() { + return (int)2048L; + } + public static int IN_UNMOUNT() { + return (int)8192L; + } + public static int IN_Q_OVERFLOW() { + return (int)16384L; + } + public static int IN_IGNORED() { + return (int)32768L; + } + public static int IN_ONLYDIR() { + return (int)16777216L; + } + public static int IN_DONT_FOLLOW() { + return (int)33554432L; + } + public static int IN_EXCL_UNLINK() { + return (int)67108864L; + } + public static int IN_MASK_ADD() { + return (int)536870912L; + } + public static int IN_ISDIR() { + return (int)1073741824L; + } + public static OfShort __int16_t = Constants$root.C_SHORT$LAYOUT; + public static OfInt __int32_t = Constants$root.C_INT$LAYOUT; + public static OfLong __int64_t = Constants$root.C_LONG_LONG$LAYOUT; + public static OfShort __int_least16_t = Constants$root.C_SHORT$LAYOUT; + public static OfInt __int_least32_t = Constants$root.C_INT$LAYOUT; + public static OfLong __int_least64_t = Constants$root.C_LONG_LONG$LAYOUT; + public static OfLong __quad_t = Constants$root.C_LONG_LONG$LAYOUT; + public static OfLong __intmax_t = Constants$root.C_LONG_LONG$LAYOUT; + public static OfLong __off_t = Constants$root.C_LONG_LONG$LAYOUT; + public static OfLong __off64_t = Constants$root.C_LONG_LONG$LAYOUT; + public static OfInt __pid_t = Constants$root.C_INT$LAYOUT; + public static OfLong __clock_t = Constants$root.C_LONG_LONG$LAYOUT; + public static OfLong __time_t = Constants$root.C_LONG_LONG$LAYOUT; + public static OfLong __suseconds_t = Constants$root.C_LONG_LONG$LAYOUT; + public static OfInt __daddr_t = Constants$root.C_INT$LAYOUT; + public static OfInt __key_t = Constants$root.C_INT$LAYOUT; + public static OfInt __clockid_t = Constants$root.C_INT$LAYOUT; + public static OfAddress __timer_t = Constants$root.C_POINTER$LAYOUT; + public static OfLong __blksize_t = Constants$root.C_LONG_LONG$LAYOUT; + public static OfLong __blkcnt_t = Constants$root.C_LONG_LONG$LAYOUT; + public static OfLong __blkcnt64_t = Constants$root.C_LONG_LONG$LAYOUT; + public static OfLong __fsword_t = Constants$root.C_LONG_LONG$LAYOUT; + public static OfLong __ssize_t = Constants$root.C_LONG_LONG$LAYOUT; + public static OfLong __syscall_slong_t = Constants$root.C_LONG_LONG$LAYOUT; + public static OfLong __loff_t = Constants$root.C_LONG_LONG$LAYOUT; + public static OfAddress __caddr_t = Constants$root.C_POINTER$LAYOUT; + public static OfLong __intptr_t = Constants$root.C_LONG_LONG$LAYOUT; + public static OfInt __sig_atomic_t = Constants$root.C_INT$LAYOUT; + public static OfShort int16_t = Constants$root.C_SHORT$LAYOUT; + public static OfInt int32_t = Constants$root.C_INT$LAYOUT; + public static OfLong int64_t = Constants$root.C_LONG_LONG$LAYOUT; + public static OfShort int_least16_t = Constants$root.C_SHORT$LAYOUT; + public static OfInt int_least32_t = Constants$root.C_INT$LAYOUT; + public static OfLong int_least64_t = Constants$root.C_LONG_LONG$LAYOUT; + public static OfLong int_fast16_t = Constants$root.C_LONG_LONG$LAYOUT; + public static OfLong int_fast32_t = Constants$root.C_LONG_LONG$LAYOUT; + public static OfLong int_fast64_t = Constants$root.C_LONG_LONG$LAYOUT; + public static OfLong intptr_t = Constants$root.C_LONG_LONG$LAYOUT; + public static OfLong intmax_t = Constants$root.C_LONG_LONG$LAYOUT; + public static int IN_CLOEXEC() { + return (int)524288L; + } + public static int IN_NONBLOCK() { + return (int)2048L; + } + public static MethodHandle inotify_init$MH() { + return RuntimeHelper.requireNonNull(constants$0.inotify_init$MH,"inotify_init"); + } + public static int inotify_init () { + var mh$ = RuntimeHelper.requireNonNull(constants$0.inotify_init$MH, "inotify_init"); + try { + return (int)mh$.invokeExact(); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + public static MethodHandle inotify_init1$MH() { + return RuntimeHelper.requireNonNull(constants$0.inotify_init1$MH,"inotify_init1"); + } + public static int inotify_init1 ( int __flags) { + var mh$ = RuntimeHelper.requireNonNull(constants$0.inotify_init1$MH, "inotify_init1"); + try { + return (int)mh$.invokeExact(__flags); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + public static MethodHandle inotify_add_watch$MH() { + return RuntimeHelper.requireNonNull(constants$0.inotify_add_watch$MH,"inotify_add_watch"); + } + public static int inotify_add_watch ( int __fd, Addressable __name, int __mask) { + var mh$ = RuntimeHelper.requireNonNull(constants$0.inotify_add_watch$MH, "inotify_add_watch"); + try { + return (int)mh$.invokeExact(__fd, __name, __mask); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + public static MethodHandle inotify_rm_watch$MH() { + return RuntimeHelper.requireNonNull(constants$0.inotify_rm_watch$MH,"inotify_rm_watch"); + } + public static int inotify_rm_watch ( int __fd, int __wd) { + var mh$ = RuntimeHelper.requireNonNull(constants$0.inotify_rm_watch$MH, "inotify_rm_watch"); + try { + return (int)mh$.invokeExact(__fd, __wd); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + public static long _POSIX_C_SOURCE() { + return 200809L; + } + public static long __STDC_ISO_10646__() { + return 201706L; + } + public static int __WCHAR_MAX() { + return (int)2147483647L; + } + public static int __WCHAR_MIN() { + return (int)-2147483648L; + } + public static int INT8_MIN() { + return (int)-128L; + } + public static int INT16_MIN() { + return (int)-32768L; + } + public static int INT32_MIN() { + return (int)-2147483648L; + } + public static long INT64_MIN() { + return -9223372036854775808L; + } + public static int INT8_MAX() { + return (int)127L; + } + public static int INT16_MAX() { + return (int)32767L; + } + public static int INT32_MAX() { + return (int)2147483647L; + } + public static long INT64_MAX() { + return 9223372036854775807L; + } + public static int UINT8_MAX() { + return (int)255L; + } + public static int UINT16_MAX() { + return (int)65535L; + } + public static int UINT32_MAX() { + return (int)4294967295L; + } + public static long UINT64_MAX() { + return -1L; + } + public static int INT_LEAST8_MIN() { + return (int)-128L; + } + public static int INT_LEAST16_MIN() { + return (int)-32768L; + } + public static int INT_LEAST32_MIN() { + return (int)-2147483648L; + } + public static long INT_LEAST64_MIN() { + return -9223372036854775808L; + } + public static int INT_LEAST8_MAX() { + return (int)127L; + } + public static int INT_LEAST16_MAX() { + return (int)32767L; + } + public static int INT_LEAST32_MAX() { + return (int)2147483647L; + } + public static long INT_LEAST64_MAX() { + return 9223372036854775807L; + } + public static int UINT_LEAST8_MAX() { + return (int)255L; + } + public static int UINT_LEAST16_MAX() { + return (int)65535L; + } + public static int UINT_LEAST32_MAX() { + return (int)4294967295L; + } + public static long UINT_LEAST64_MAX() { + return -1L; + } + public static int INT_FAST8_MIN() { + return (int)-128L; + } + public static long INT_FAST16_MIN() { + return -9223372036854775808L; + } + public static long INT_FAST32_MIN() { + return -9223372036854775808L; + } + public static long INT_FAST64_MIN() { + return -9223372036854775808L; + } + public static int INT_FAST8_MAX() { + return (int)127L; + } + public static long INT_FAST16_MAX() { + return 9223372036854775807L; + } + public static long INT_FAST32_MAX() { + return 9223372036854775807L; + } + public static long INT_FAST64_MAX() { + return 9223372036854775807L; + } + public static int UINT_FAST8_MAX() { + return (int)255L; + } + public static long UINT_FAST16_MAX() { + return -1L; + } + public static long UINT_FAST32_MAX() { + return -1L; + } + public static long UINT_FAST64_MAX() { + return -1L; + } + public static long INTPTR_MIN() { + return -9223372036854775808L; + } + public static long INTPTR_MAX() { + return 9223372036854775807L; + } + public static long UINTPTR_MAX() { + return -1L; + } + public static long INTMAX_MIN() { + return -9223372036854775808L; + } + public static long INTMAX_MAX() { + return 9223372036854775807L; + } + public static long UINTMAX_MAX() { + return -1L; + } + public static long PTRDIFF_MIN() { + return -9223372036854775808L; + } + public static long PTRDIFF_MAX() { + return 9223372036854775807L; + } + public static int SIG_ATOMIC_MIN() { + return (int)-2147483648L; + } + public static int SIG_ATOMIC_MAX() { + return (int)2147483647L; + } + public static long SIZE_MAX() { + return -1L; + } + public static int WCHAR_MIN() { + return (int)-2147483648L; + } + public static int WCHAR_MAX() { + return (int)2147483647L; + } + public static int WINT_MIN() { + return (int)0L; + } + public static int WINT_MAX() { + return (int)4294967295L; + } + public static int IN_CLOSE() { + return (int)24L; + } + public static int IN_MOVE() { + return (int)192L; + } + public static int IN_ONESHOT() { + return (int)2147483648L; + } + public static int IN_ALL_EVENTS() { + return (int)4095L; + } +} + +