Summary: | #include <signal.h> doesn't make ucontext_t available | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | Base System | Reporter: | Ting-Wei Lan <lantw44> | ||||||
Component: | standards | Assignee: | freebsd-standards (Nobody) <standards> | ||||||
Status: | Closed FIXED | ||||||||
Severity: | Affects Only Me | CC: | avos, kib | ||||||
Priority: | --- | Keywords: | patch | ||||||
Version: | 10.2-STABLE | ||||||||
Hardware: | Any | ||||||||
OS: | Any | ||||||||
Attachments: |
|
Description
Ting-Wei Lan
2016-02-10 14:35:09 UTC
Created attachment 166831 [details]
A fix
Split struct __ucontext into sys/_ucontext.h and use the header both in sys/ucontext.h and signal.h.
(In reply to Konstantin Belousov from comment #1) Please try the attached patch, it is for HEAD, but might be applicable for stable/10. I am somewhat sceptical that the patch could be included into 10.3 due to the stage of the releng process. 'make buildworld' fails: ===> usr.bin/xlint/llib (all) lint -cghapbx -Cposix <freebsd_source>/usr.bin/xlint/llib/llib-lposix llib-lposix: warning: unknown warning option '-Wtraditional' [-Wunknown-warning-option] 1 warning generated. ... _ucontext.h(44): syntax error [249] _ucontext.h(47): syntax error [249] ... *** Error code 1 Stop. make[5]: stopped in <freebsd_source>/usr.bin/xlint/llib Created attachment 166868 [details]
Updated fix
Yes, there were issues with lint libs and with some architectures.
Replaced patch should be in better shape, but I did not run make universe with it yet. x86 arches built.
The new patch works on 10.3 after manually resolving rejected hunks. A commit references this bug: Author: kib Date: Fri Feb 12 07:38:20 UTC 2016 New revision: 295561 URL: https://svnweb.freebsd.org/changeset/base/295561 Log: POSIX states that #include <signal.h> shall make both mcontext_t and ucontext_t available. Our code even has XXX comment about this. Add a bit of compliance by moving struct __ucontext definition into sys/_ucontext.h and including it into signal.h and sys/ucontext.h. Several machine/ucontext.h headers were changed to use namespace-safe types (like uint64_t->__uint64_t) to not depend on sys/types.h. struct __stack_t from sys/signal.h is made always visible in private namespace to satisfy sys/_ucontext.h requirements. Apparently mips _types.h pollutes global namespace with f_register_t type definition. This commit does not try to fix the issue. PR: 207079 Reported and tested by: Ting-Wei Lan <lantw44@gmail.com> Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Changes: head/include/signal.h head/sys/mips/include/ucontext.h head/sys/powerpc/include/ucontext.h head/sys/sparc64/include/ucontext.h head/sys/sys/_ucontext.h head/sys/sys/signal.h head/sys/sys/ucontext.h head/sys/x86/include/ucontext.h Looks like the issue was resolved ~3 years ago and both ucontext_t and mcontext_t are defined in <signal.h> on 11-STABLE / 12-STABLE / 13-CURRENT branches, so the PR can be closed now. |