-
Notifications
You must be signed in to change notification settings - Fork 85
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
libs: add flatipc implementation #576
Conversation
flatipc is a new method for doing IPC. This is a zero-copy approach where structs are given `repr(C)` implementations that are well-defined and work across process boundaries. If the same struct or enum is used in two processes that has the same layout, then data can be freely passed between the two processes without incurring a serialization or deserialization penalty, provided the following hold: 1. The buffer must be page-aligned and be a multiple of the page size 2. The item must be `#[repr(C)]` 3. There must be no pointers or references of any kind If these three things hold, then the object is safe to sling across the process boundary. This crate adds the ability to annotate structs with `#[derive(flatipc::Ipc)]` to provide them with this functionality. When doing so, objects gain the `.into_ipc()` call that turns them into something that can be sent across process boundaries. The resulting object has `.lend()`, `.lend_mut()`, `.try_lend()`, and `.try_lend_mut()` as functions. Signed-off-by: Sean Cross <[email protected]>
is it easy for you to run |
Signed-off-by: Sean Cross <[email protected]>
Sure. I initially ran that, and got a lot of changes. I backed those out and ran |
Signed-off-by: Sean Cross <[email protected]>
Super-weird. The patch still doesn't match up to the formatting. What version of Rust are you using? |
My nightly version is |
same here. Why would the results of cargo fmt differ? Is your |
These are required as this goes across the IPC boundary. Signed-off-by: Sean Cross <[email protected]>
The errors are all in files that I didn't touch. Did they get missed in an earlier reformat? I get the same diff when I run
Did you want me to reformat everything? |
The latest strange... |
Really strange. I pull down your branch and check the formatting locally and it passes. Maybe it's something wrong with the CI runner. |
Well, if you're good with the patch, we can go ahead and merge it and see what happens. I can't see why the CI is breaking, but, your patches are formatted correctly when I check it locally. |
It's not formatted for me -- I get the same errors as the CI runner:
|
I've crated #577 that should make the check happy once I rebase on top of that change. |
Weird, I tried running the command on windows and I get a clean format. My tree is up to date with main as well. I wonder what's up.... |
I think I'm using a later version of nightly than what you're using...
I wonder if they broke things in your nightly and reverted it? |
My rustfmt is I believe this is what's happened:
So the root cause is relying on a set of formatting rules that are still in flux, and they changed. |
OK, we'll fix formatting in a separate patch then. We definitely don't need to surf the latest edition when it comes to formatting, so, we can go to style_edition "2021 and make things more stable. And also I definitely don't want to do a huge format pull in the middle of a big rebase for xous_ipc, that'll be really painful because I've changed a lot of dependencies to remove xous_ipc, so let's just absorb the patch with broken CI results if you think you're done with the substance of the patch. Kind of irritating that Rust doesn't allow some of the more basic shit like width of code to be stabilized, and just subjects everyone to tyranny if they don't go with the One True Way for formatting. |
flatipc is a new method for doing IPC. This is a zero-copy approach where structs are given
repr(C)
implementations that are well-defined and work across process boundaries.If the same struct or enum is used in two processes that has the same layout, then data can be freely passed between the two processes without incurring a serialization or deserialization penalty, provided the following hold:
#[repr(C)]
If these three things hold, then the object is safe to sling across the process boundary.
This crate adds the ability to annotate structs with
#[derive(flatipc::Ipc)]
to provide them with this functionality. When doing so, objects gain the.into_ipc()
call that turns them into something that can be sent across process boundaries.The resulting object has
.lend()
,.lend_mut()
,.try_lend()
, and.try_lend_mut()
as functions.