-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ndk: Add bindings for ASharedMemory
#427
Conversation
# Only for use in documentation and doc-tests | ||
libc = "0.2" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before merging this - if folks find this a good idea at all - I'd like to go over existing documentation and replace their mentions of e.g. mmap
and other flags with libc
intradoc links.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Appears this is not true at all. dev-dependencies
applies to (doc!) tests, but not to documentation itself.
I can add it behind the docsrs
cfg then... :(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note too that many of these constants - except the PROT_
ones, are (accidentally?) included in the ndk-sys
ffi bindings...
But better to reference public/obvious ones from libc
unless there's a "kernel header" target?
ndk/src/shared_memory.rs
Outdated
/// `sendmsg` and `SCM_RIGHTS`. See `sendmsg(3)` and `cmsg(3)` man pages for more information. | ||
/// | ||
/// If you intend to share this file descriptor with a child process after calling `exec(3)`, | ||
/// note that you will need to use `fcntl(2)` with `FD_SETFD` to clear the `FD_CLOEXEC` flag |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And through the magic of intradoc links I learned that FD_SETFD
must be a typo in the AOSP documentation; it is F_SETFD
:)
150824b
to
fa2f4dd
Compare
fa2f4dd
to
e40e3aa
Compare
e40e3aa
to
6e79235
Compare
`ASharedMemory` allows allocating shared memory as a file descriptor that can be `mmap`ed 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.
6e79235
to
9de6d69
Compare
ASharedMemory
allows allocating shared memory as a file descriptor that can bemmap
ed or shared to other processes via parcels or Unix domain sockets.Its Java counterpart is
android.os.SharedMemory
from which (when available as a JNIjobject
) 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 aSharedMemory
object can also be created from a received file descriptor.