-
Notifications
You must be signed in to change notification settings - Fork 717
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
The value of SIGCHLD is changed through binding in Linux docker container on MacOS #2979
Comments
my best bet is that bindgen is being fed different system headers than the C compiler you're using to compile I cannot reproduce it on my system: $ cat input.h
#include <unistd.h>
#include <signal.h>
#ifndef MY_LIB_H
#define MY_LIB_H
int get_sigchld();
#endif
$ bindgen input.h | grep "SIGCHLD"
pub const SIGCHLD: u32 = 17;
$ bindgen --version
bindgen 0.65.1 If I clone and
|
Actually I found that 20 is the value of SIGCHLD on MacOS. But AFAIK, applications running in Docker container are not able to access header files on the host OS directly (unless some mappings are setup on purpose). So I'm really confused. |
There are libraries that already let you do signal handling in a portable manner so you don't have to deal with such issues. If you want the same API exposed by |
Sorry for the late reply and thank you for your advice! I'll use these API instead. But still I spent some debugging it, and I think I've found the bug. It seems that bindgen cannot handle #define SIGCHLD 20 then redefined in #undef SIGCHLD
#define SIGCHLD 17 And bindgen takes the first definition into account. |
Looks like a duplicate of that one then -- thanks for getting to the bottom of it! |
Scenario: I'm currently developing my application in a docker container on MacOS. I wish to use
kill
and other related apis in Rust. Therefore I need to port those signal constants from C header to Rust. However I found that the value ofSIGCHLD
, which should be 17, is changed to 20.The bindgen version is
0.65.1
.About the container (generate by Docker Desktop's dev container):
Here's a mininal error reproduction (repo):
Performing
cargo run
gives the following output:The text was updated successfully, but these errors were encountered: