-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
profile-handler: prefer documented sigev_notify_thread_id in sigevent #1250
Conversation
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here with What to do if you already signed the CLAIndividual signers
Corporate signers
ℹ️ Googlers: Go here for more info. |
@googlebot I signed it! |
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
Thanks for patch. glibc actually has sigev_notify_thread_id macro, but in linux/signal.h include. Notably musl doesn't seem to have this header. So perhaps we detect presence of linux/signal.h include it and use sigev_notify_thread_id for glibc too. |
Also BSD does support this macro too, using your existing include. So very nice. https://www.freebsd.org/cgi/man.cgi?query=sigevent&sektion=3&apropos=0 |
On 2021-02-12 22:29:20-0800, "Aliaksey Kandratsenka (aka Aliaksei Kandratsenka)" ***@***.***> wrote:
Thanks for patch. glibc actually has sigev_notify_thread_id macro,
but in linux/signal.h include. Notably musl doesn't seem to have
this header. So perhaps we detect presence of linux/signal.h include
it and use sigev_notify_thread_id for glibc too.
Sorry for being ignorance.
But, what is your preference in this case:
- rewrite this patch entirely: detect if linux/signal.h exists and
include linux/signal.h and use sigev_notify_thread_id
unconditionally
- Write another patch on top of this patch?
|
sigevent(7) is documented to have sigev_notify_thread_id as its member. In glibc system, it's a macro expanded to the legacy _sigev_un._tid, _sigev_un._tid is obviously an internal implementation detail as signaled by its underscore prefix. And this macro was hidden inside linux/signal.h in older version of glibc. On Linux that use musl libc, sigev_notify_thread_id is also a macro, but it's expanded to __sev_fields.sigev_notify_thread_id Let's use the documented member by include linux/signal.h if exists.
Hm, turns out linux/signal.h is basically unusable. It defines things that are conflicting with libc types (seeing this in both glibc and musl too). I've updated kernel bug at https://bugzilla.kernel.org/show_bug.cgi?id=200081 I think I'll take your change with minimal fix on top to unbreak it for glibc systems (since configure rightfully detects that linux/signal .h is broken and we end up with compile error trying to use that macro that is not defined anywhere). Your first change was most right one given that kernel headers bug. |
Filed glibc bug as well: https://sourceware.org/bugzilla/show_bug.cgi?id=27417 |
sigevent(7) is documented to have sigev_notify_thread_id as its member. In glibc system, it's a macro expanded to the legacy _sigev_un._tid, _sigev_un._tid is obviously an internal implementation detail as signaled by its underscore prefix. And this macro was hidden inside linux/signal.h in older version of glibc. On Linux that use musl libc, sigev_notify_thread_id is also a macro, but it's expanded to __sev_fields.sigev_notify_thread_id [alkondratenko@gmail.com: amputated broken linux/signal.h dependency] [alkondratenko@gmail.com: see #1250] Signed-off-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Merged. Thanks a lot for the patch! Indeed musl compilation was borked without it. As noted above, I've amended your change. Making clear notice about this in commit message. Hope this is okay (I left authorship on you, but hopefully blames on bug(s) in this change I accepted on me). |
Thanks. |
sigevent(7) is documented to have sigev_notify_thread_id as its member. In glibc system, it's a macro expanded to the legacy _sigev_un._tid, _sigev_un._tid is obviously an internal implementation detail as signaled by its underscore prefix. And this macro was hidden inside linux/signal.h in older version of glibc. On Linux that use musl libc, sigev_notify_thread_id is also a macro, but it's expanded to __sev_fields.sigev_notify_thread_id [alkondratenko@gmail.com: amputated broken linux/signal.h dependency] [alkondratenko@gmail.com: see gperftools/gperftools#1250] Signed-off-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
sigevent(7) is documented to have sigev_notify_thread_id as its member.
In glibc system, it's a macro expanded to the legacy _sigev_un._tid,
_sigev_un._tid is obviously an internal implementation detail as
signaled by its underscore prefix.
On Linux that use musl libc, sigev_notify_thread_id is also a macro, but
it's expanded to __sev_fields.sigev_notify_thread_id
Let's use the documented member if exists with a fallback to the
undocumented member instead.