RFR: 8347408: Create an internal method handle adapter for system calls with errno [v7]

Jorn Vernee jvernee at openjdk.org
Wed Jan 15 17:49:37 UTC 2025


On Wed, 15 Jan 2025 15:51:49 GMT, Per Minborg <pminborg at openjdk.org> wrote:

> > So, as we foresee the adoption of the FFM API in the JDK internals, we will use such a mechanism for system calls like `fopen`, `socket`, and the like.
> > See #22307 for example.
> 
> Sorry I still don't see where you do the actual native call and read errno. Just to be clear you have to read errno/last-error immediately after the native call. You can't for example, return to Java see the call failed and then make a second native call to retrieve errno.

There is no separate native call to read errno. The read happens as part of the native call to a function that sets errno, before transitioning back to the java thread state. See: [`DowncallLinker::capture_state`](https://github.com/openjdk/jdk/blob/cfe70ebcb3a9fadceac5eccdc1f3353d0d74c235/src/hotspot/share/prims/downcallLinker.cpp#L36) and its uses.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/22391#issuecomment-2593577526


More information about the core-libs-dev mailing list