Skip to content
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

darwin: Fix build #23

Merged
merged 4 commits into from
Jun 14, 2019
Merged

darwin: Fix build #23

merged 4 commits into from
Jun 14, 2019

Conversation

kirelagin
Copy link
Contributor

@kirelagin kirelagin commented Jun 12, 2019

Part of #13.

This fixes the build on macOS (and, hopefully, does not break it on Linux).

The thing is still extremely far from being usable on macOS, as it relies on the linux-ptrace package, which (as its name implies :) is very Linux specific.


This change is Reviewable

The `unix` package detects whether the platform supports SIGPOLL and
export related names only if it does. We reuse the configuration
constant from the `unix` package to add SIGPOLL to our signal map
conditionally.

This is needed, for example, for macOS (Darwin).
This is needed on macOS (Darwin).
The `data` parameter of the `ptrace` function on Linux is `void *`,
while on other platforms it is an `int`, which resulted in a warning.
@kirelagin
Copy link
Contributor Author

(I should probably add that I actually did not test this change on Linux and, in particular, I am not sure that the CPP thing actually works as expected and adds SIGPOLL to the map on Linux.)

@qrilka
Copy link
Collaborator

qrilka commented Jun 12, 2019

@kirelagin I didn't look into the code but your branch looks ok on Linux, on my desktop Gentoo stack test finishing with

27 examples, 0 failures, 4 pending                                                                                                      
hatrace-0.1.0.0: Test suite hatrace-test passed
Completed 2 action(s).

@nh2
Copy link
Owner

nh2 commented Jun 13, 2019

I can confirm this fixes the compilation on Darwin. InvalidArgment in the tests, need to do that next :)

@kirelagin
Copy link
Contributor Author

The problem is that linux-ptrace uses Linux-specific ptrace functionality and it makes calls with magic constants, rather than by including an OS header file, so it doesn’t fail to compile on other platforms, when it actually should. I am not even sure that all required functionality is supported on darwin, although I haven’t looked at what calls it makes and why in detail yet. My feeling is that the next step is creating darwin-ptrace and making it API-compatible.

@nh2
Copy link
Owner

nh2 commented Jun 13, 2019

Perhaps we should also just make our own ptrace module as part of hatrace, build that from scratch via header file constants, and when we're done and it works well, we can offer it back up to linux-ptrace.

@nh2 nh2 merged commit 69b027b into nh2:master Jun 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants