-
Notifications
You must be signed in to change notification settings - Fork 58
[DO NOT MERGE] Remove Mono.Unix dependency
#222
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
Conversation
Mono.Unix dependency
ab0204a to
da222f4
Compare
da222f4 to
2892d63
Compare
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.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| public ulong st_dev; // Device | ||
| public ulong st_ino; // File serial number (inode) | ||
| public uint st_mode; // File mode | ||
| public uint st_nlink; // Link count | ||
| public uint st_uid; // User ID of the file's owner |
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.
Fix Linux stat struct size for P/Invoke
On 64‑bit Linux (e.g., ubuntu-latest runners) the native struct stat layout uses 64‑bit st_nlink/st_blksize with a total size of 144 bytes (/usr/include/x86_64-linux-gnu/bits/struct_stat.h), but StatStructLinux declares those fields as 32‑bit and omits the trailing padding, making the managed struct only 128 bytes. The P/Invoke call to stat() therefore writes past the allocated buffer, which can corrupt the stack or return garbage whenever TryStat runs (OriginDetection calls it during startup). The struct definition needs to match the platform layout (e.g., 64‑bit fields or use stat64) to avoid undefined behavior.
Useful? React with 👍 / 👎.
Mono.Unix dependencyMono.Unix dependency
|
Closing in favor of #223 |
Summary
This PR removes the
Mono.Unixpackage dependency that was added in #211. This removes the only external dependency. Furthermore,Mono.Unixnuget package versions are all considered pre-releases (semver), which blocks many users from usingdogstatsd-csharp-client.Changes
Mono.UnixdependencyNativeMethods.cswith direct P/Invoke tolibcstat()functionIFileSystem.TryStat()to use the new implementation instead ofMono.Unix.Native.Syscall.stat()UnixEndPoint.csfor UDS support (originally from Mono.Unix, was removed in [AGTMETRICS-347]Add cgroup origin detection #211)latestto enable modern syntax like file-scoped namespaces and nullable reference typesTesting
No user-facing behavior changes aside from removing the
Mono.Unixdependency.