std.*.ptrace: support more platforms and features more correctly #25225
+128
−11
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resolves #24982
First commit fixes a bug introduced by myself in #24921 by adding a missing
@enumFromInt
to thestd.posix.ptrace
.darwin
prong. Also theelse
prong didn't really make sense there and wouldn't compile anyway as it was so I added explicit ptrace support for BSDs and compile errors for everything else.Sources:
https://man7.org/linux/man-pages/man2/ptrace.2.html
https://man.dragonflybsd.org/?command=ptrace§ion=2
https://man.freebsd.org/cgi/man.cgi?query=ptrace
https://man.netbsd.org/ptrace.2
https://man.openbsd.org/ptrace.2
https://github.com/SerenityOS/serenity/blob/502caef9a40bccc7459f9835f2174a601106299a/Userland/Libraries/LibC/sys/ptrace.h
https://docs.oracle.com/cd/E36784_01/html/E36874/ptrace-3c.html
https://smartos.org/man/3C/ptrace
(specifically the part about ptrace not being a real syscall + only existing on 32-bit systems)
Second commit adds some more ptrace-related constants to
std.os.linux
.Source: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/uapi/linux/ptrace.h?h=v6.17-rc5