3 ms·
It does allow for unsafe pointer math, I have some examples here where I've ported io_uring to use native Java Foreign Memory API with no external headers/bindi
by gavinray 4y ago
It does allow for unsafe pointer math, I have some examples here where I've ported io_uring to use native Java Foreign Memory API with no external headers/bindings:
https://github.com/GavinRay97/panama-liburing/blob/6a80673e73cfcf773212ee068b808f2b9d628df6/lib/src/test/java/panama/liburing/LibraryTest.java#L65 https://github.com/GavinRay97/panama-liburing/blob/6a80673e7...
- lbhdc 4y agoIt seems like you are using the `MemoryAddress` object. The article says that api was removed in 20. I may be misunderstanding what you are doing though :) In Java 19, there was a notion named MemoryAddress used for “pointers to memory” and function addresses. In Java 20, MemorySegment::address returns a raw memory address in the form of a long rather than a MemoryAddress object.
- gavinray 4y agoSame difference, the "MemoryAddress" was a wrapper class around a long that pointed to the underlying address You can see that a bit further down below when ".toRawLongValue()" is called: long iovecs_ptr = fi.address().toRawLongValue() + file_info.sizeof(); liburing.io_uring_prep_readv(sqe_ptr, file_fd, MemoryAddress.ofLong(iovecs_ptr), blocks, 0); liburing.io_uring_sqe_set_data(sqe_ptr, fi.address()); int ret = liburing.io_uring_submit(ring_ptr);
- throwaway2037 4y agoThis is insanely cool. Thank you to share.