ell/signal.h: use sigset_t instead of internal libc implementation
PATCH 1/1 ell/signal.h: use sigset_t instead of internal libc implementation
Fixes compilation on musl libc which doesn't show up the internal implementation.
Error message:
CC ell/main.lo
In file included from ell/main.c:35:ell/signal.h:39:40: error: unknown type name '__sigset_t'
struct l_signal *l_signal_create(const __sigset_t *mask,
^~~~~~~~~~ --- ell/signal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
ell/signal.h +1 -1
@@ -36,7 +36,7 @@ typedef void (*l_signal_notify_cb_t) (struct l_signal *signal, uint32_t signo, void *user_data);typedef void (*l_signal_destroy_cb_t ) (void *user_data); -struct l_signal *l_signal_create (const __sigset_t *mask, +struct l_signal *l_signal_create (const sigset_t *mask,l_signal_notify_cb_t callback,void *user_data,l_signal_destroy_cb_t destroy);void l_signal_remove (struct l_signal *signal);
Signature · 1 line
2.19.1
Hi Maxwell,
Quoted 1 line · On Nov 1, 2018, at 10:27, maxice8 <[email protected]> wrote:
Please use full name in author information.
Quoted 10 lines
Fixes compilation on musl libc which doesn't show up the internal implementation.
Error message:
CC ell/main.lo
In file included fromell/main.c:35:ell/signal.h:39:40: error: unknown type name '__sigset_t' structl_signal*l_signal_create(const__sigset_t*mask,^~~~~~~~~~
I tried to make this work with -std=c99 and I am kinda lost on what the right approach here is. Define _USE_POSIX or what is the recommendation?
Regards
Marcel
Othman
Hi Marcel,
Sorry about the duplicate e-mail. I neglected to reply to all earlier.
Quoted 10 lines · Marcel Holtmann
Quoted 8 lines · On Nov 1, 2018, at 10:27, maxice8 <[email protected]> wrote:
Error message:
CC ell/main.lo
In file included fromell/main.c:35:ell/signal.h:39:40: error: unknown type name '__sigset_t' structl_signal*l_signal_create(const__sigset_t*mask,^~~~~~~~~~I tried to make this work with -std=c99 and I am kinda lost on what the right approach here is. Define
_USE_POSIXor what is the recommendation?
Ideally ELL's public API should not depend on the definition of a feature test macro, but if one is going to be defined I'd avoid __USE_POSIX since it's a glibc implementation detail. I'd go with _DEFAULT_SOURCE, which I think is specific to glibc, or one of the standard _POSIX_SOURCE, _POSIX_C_SOURCE (>= 1), or _XOPEN_SOURCE. Relevant feature test macro documentation:
http://man7.org/linux/man-pages/man7/feature_test_macros.7.html
http://pubs.opengroup.org/onlinepubs/007904975/functions/xsh_chap02_02.html
https://www.gnu.org/software/libc/manual/html_node/Feature-Test-Macros.html
BTW, this problem isn't specific to -std=c99 builds. It occurs with -std=c11 and -ansi, too.
HTH,
-Ossama