rust-mobile / ndk

Rust bindings to the Android NDK
Apache License 2.0
1.11k stars 110 forks source link

ndk: Add bindings for `ASharedMemory` #427

Closed MarijnS95 closed 10 months ago

MarijnS95 commented 1 year ago

ASharedMemory allows allocating shared memory as a file descriptor that can be mmaped or shared to other processes via parcels or Unix domain sockets.

Its Java counterpart is android.os.SharedMemory from which (when available as a JNI jobject) an owned file descriptor clone can be created to access the memory object in native code.

Common Rust traits such as FromRawFd are provided so that a SharedMemory object can also be created from a received file descriptor.