-
Notifications
You must be signed in to change notification settings - Fork 10
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
Windows support for the sidecar #305
Conversation
spawn working on windows
…atadog into sidecar-windows
Signed-off-by: Bob Weinand <bob.weinand@datadoghq.com>
Signed-off-by: Bob Weinand <bob.weinand@datadoghq.com>
Signed-off-by: Bob Weinand <bob.weinand@datadoghq.com>
Signed-off-by: Bob Weinand <bob.weinand@datadoghq.com>
…sidecar-windows
b122789
to
3161803
Compare
Signed-off-by: Bob Weinand <bob.weinand@datadoghq.com>
3161803
to
01b8877
Compare
Signed-off-by: Bob Weinand <bob.weinand@datadoghq.com>
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.
Overall LGTM
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.
Looks good overall. Only nits.
impl ShmHandle { | ||
pub fn new(size: usize) -> anyhow::Result<ShmHandle> { | ||
// If one uses null_mut() for the name, DuplicateHandle will emit a very confusing "The system cannot find the file specified. (os error 2)". | ||
// It seems like DuplicateHandle requires a name to re-open the FileMapping within another process. Oh well. Let's generate an unique one. |
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.
Very long lines.
|
||
impl NamedShmHandle { | ||
fn format_name(path: &CString) -> CString { | ||
// Global\ namespace is reserved for Session ID 0. We cannot rely on our PHP process having permissions to write to Global\. |
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.
Using Global\
twice in this comment (and it's long).
sidecar/src/setup/windows.rs
Outdated
}; | ||
|
||
let socket_path = self.socket_path.clone(); | ||
// Have a ProcessHandle::Getter() so that we don't immediately block in case the sidecar is still starting up, but only the first time we want to submit shared memory |
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.
More long comments
sidecar/src/setup/windows.rs
Outdated
Ok(Channel::from_client_handle_and_pid( | ||
unsafe { OwnedHandle::from_raw_handle(pipe) }, | ||
ProcessHandle::Getter(Box::new(move || { | ||
// Await the shared memory handle which will contain the pid of the sidecar - it may not be immediately available during startup |
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 here as well
use super::ChannelMetadata; | ||
|
||
#[derive(Debug)] | ||
#[pin_project(project = NamedPipeProject)] |
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.
I think it would be good to add some comments and/or links to docs explaining projections and structural pinning for ppl unfamiliar with the code base and Rust.
Signed-off-by: Bob Weinand <bob.weinand@datadoghq.com>
…dows Signed-off-by: Bob Weinand <bob.weinand@datadoghq.com>
4c83149
to
31e79b3
Compare
d3f73c8
to
84411b3
Compare
84411b3
to
e707176
Compare
…C` helper **What does this PR do?** This PR introduces a new `DDOG_CHARSLICE_C_BARE` helper, as well as undoes the change to `DDOG_CHARSLICE_C` from https://github.com/DataDog/libdatadog/pull/305/files#diff-5c00b9c49c81bf0d0a754e0bcc6e0add4fe849bf0ea4a4d1ebfac8f698150f0b There are now two helpers: `DDOG_CHARSLICE_C` that includes the `(ddog_CharSlice)` cast and `DDOG_CHARSLICE_C_BARE` which doesn't. **Motivation:** In a nutshell @bwoebi explained to me that on Windows there's times where you need to use `(ddog_CharSlice) {.ptr = ..., .len = ...}` and others where you need to use `{.ptr = ..., .len = ...}` and cannot include the cast. Thus in #305 we tweaked the helper to never have `(ddog_CharSlice)`, with the intention of using `(ddog_CharSlice) DDOG_CHARSLICE_C(...)` some times, and `DDOG_CHARSLICE_C(...)` the other times. But... this had the downside of making some of our Ruby Profiler code really ugly, as we'd need to move from `DDOG_CHARSLICE_C` to `(CharSlice) DDOG_CHARSLICE_C` in a lot of cases. Thus, this PR introduces one helper for each variant, so that we always have a nice user-friendly option for each case, and avoid needing to sprinkle casts. **Additional Notes:** Arghhh C/C++ you always manage to be weird and annoying. **How to test the change?** I've tested this change by compiling the Ruby profiler to use this branch of libdatadog, and validating that it compiles successfully on Linux.
…C` helper **What does this PR do?** This PR introduces a new `DDOG_CHARSLICE_C_BARE` helper, as well as undoes the change to `DDOG_CHARSLICE_C` from https://github.com/DataDog/libdatadog/pull/305/files#diff-5c00b9c49c81bf0d0a754e0bcc6e0add4fe849bf0ea4a4d1ebfac8f698150f0b There are now two helpers: `DDOG_CHARSLICE_C` that includes the `(ddog_CharSlice)` cast and `DDOG_CHARSLICE_C_BARE` which doesn't. **Motivation:** In a nutshell @bwoebi explained to me that on Windows there's times where you need to use `(ddog_CharSlice) {.ptr = ..., .len = ...}` and others where you need to use `{.ptr = ..., .len = ...}` and cannot include the cast. Thus in #305 we tweaked the helper to never have `(ddog_CharSlice)`, with the intention of using `(ddog_CharSlice) DDOG_CHARSLICE_C(...)` some times, and `DDOG_CHARSLICE_C(...)` the other times. But... this had the downside of making some of our Ruby Profiler code really ugly, as we'd need to move from `DDOG_CHARSLICE_C` to `(CharSlice) DDOG_CHARSLICE_C` in a lot of cases. Thus, this PR introduces one helper for each variant, so that we always have a nice user-friendly option for each case, and avoid needing to sprinkle casts. **Additional Notes:** Arghhh C/C++ you always manage to be weird and annoying. **How to test the change?** I've tested this change by compiling the Ruby profiler to use this branch of libdatadog, and validating that it compiles successfully on Linux.
Adds NamedPipes and spawning of the sidecar process for windows support.