Skip to content

add signal and raise bindings for windows #1176

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

Merged
merged 4 commits into from
Dec 18, 2018

Conversation

xmclark
Copy link
Contributor

@xmclark xmclark commented Dec 15, 2018

This PR adds signal and raise bindings for windows.

I don't know these functions or linux very well, so I leaned on other overrides of signal in the linux bindings, and the cppreference page for adding the bindings.

I added some constants that were shown on the microsoft signal page and used the default values I found spelunking through my own copy of signal.h that came along with visual studio.

The automated tests pass and my toy apps use the signal and raise as expected. Let me know if there is anything else I need to do, or any extra tests to write.

EDIT:
currently working on getting a nice isolated msys2 environment I can use to dev against.

  • msys2 env setup and building

@rust-highfive
Copy link

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @alexcrichton (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@xmclark xmclark changed the title add signal and raise bindings for windows WIP - add signal and raise bindings for windows Dec 15, 2018
separate for gnu and msvc


scope resolve c_int

these types are not allowed, and more scope resolution


use size_t
@xmclark xmclark force-pushed the add-signal-and-raise-windows branch from 1ddf826 to 313483b Compare December 17, 2018 00:26
@xmclark
Copy link
Contributor Author

xmclark commented Dec 17, 2018

Hello @alexcrichton! I'm having a little trouble getting stable-x86_64-pc-windows-gnu to build Appveyor build.

I can't explain why the gnu compiler is failing. The pointer arithmetic seems valid.

I think I could also use a sanity check. Make sure everything looks right. I have never contributed to an FFI library before.

@alexcrichton
Copy link
Member

Oh I think this is largely just a bug in our testing, you'll need to edit libc-test/build.rs to update the skip_signedness function to include this typedef as well. It's a typedef to a function pointer type so it doesn't have a signedness

@alexcrichton
Copy link
Member

@bors: r+

@bors
Copy link
Contributor

bors commented Dec 18, 2018

📋 Looks like this PR is still in progress, ignoring approval.

Hint: Remove WIP from this PR's title when it is ready for review.

@xmclark xmclark force-pushed the add-signal-and-raise-windows branch from 4f67390 to 4c32b9f Compare December 18, 2018 01:57
@xmclark xmclark changed the title WIP - add signal and raise bindings for windows add signal and raise bindings for windows Dec 18, 2018
@xmclark
Copy link
Contributor Author

xmclark commented Dec 18, 2018

I believe this is ready for review.

I've added the signedness exception for mingw.

Both windows targets have different names for the signalhandler_t type. I added the an alias for both targets.

@xmclark xmclark force-pushed the add-signal-and-raise-windows branch from 5cb9c53 to af19934 Compare December 18, 2018 03:32
@alexcrichton
Copy link
Member

@bors: r+

@bors
Copy link
Contributor

bors commented Dec 18, 2018

📌 Commit af19934 has been approved by alexcrichton

@bors
Copy link
Contributor

bors commented Dec 18, 2018

⌛ Testing commit af19934 with merge 027d483...

bors added a commit that referenced this pull request Dec 18, 2018
…chton

add signal and raise bindings for windows

This PR adds `signal` and `raise` bindings for windows.

I don't know these functions or linux very well, so I leaned on other overrides of signal in the linux bindings, and the [cppreference page](https://en.cppreference.com/w/cpp/header/csignal) for adding the bindings.

I added some constants that were shown on the [microsoft signal page](https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/signal?view=vs-2017) and used the default values I found spelunking through my own copy of `signal.h` that came along with visual studio.

The automated tests pass and my toy apps use the `signal` and `raise` as expected. Let me know if there is anything else I need to do, or any extra tests to write.

EDIT:
currently working on getting a nice isolated msys2 environment I can use to dev against.
- [x] msys2 env setup and building
@bors
Copy link
Contributor

bors commented Dec 18, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: alexcrichton
Pushing 027d483 to master...

@bors bors merged commit af19934 into rust-lang:master Dec 18, 2018
@xmclark xmclark deleted the add-signal-and-raise-windows branch December 23, 2018 21:02
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.

4 participants