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

Per Minborg pminborg at openjdk.org
Wed Jan 15 15:55:36 UTC 2025


On Tue, 14 Jan 2025 12:29:11 GMT, David Holmes <dholmes 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.

I believe the segment handling works as it should now. The segment is now allocated from a platform-thread-local cache. This means we do not have to pin. On the other hand, we will not reuse segments in the unlikely event of a virtual thread unmount during the call.

Here is an example of such a system method handle: https://github.com/openjdk/jdk/pull/22307/files#diff-e5ba9b4d94ed42c635e449212e33bc65dc4a823e4187e197f7d39be516eee430R117

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

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


More information about the core-libs-dev mailing list