FreeBSD complains about SIGWINCH

Bug #1824791 reported by Paul "LeoNerd" Evans
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
libtickit
New
Undecided
Unassigned

Bug Description

(From Alien::libtickit)

http://www.cpantesters.org/cpan/report/b9e0f6ce-5d6b-11e9-b4c4-54171f24ea8f

src/evloop-default.c:50:13: error: use of undeclared identifier 'SIGWINCH'
  sigaction(SIGWINCH, &(struct sigaction){ .sa_handler = sigwinch }, NULL);
            ^
src/evloop-default.c:64:13: error: use of undeclared identifier 'SIGWINCH'
  sigaction(SIGWINCH, &(struct sigaction){ .sa_handler = SIG_DFL }, NULL);
            ^
2 errors generated.

Revision history for this message
Paul "LeoNerd" Evans (leonerd) wrote :

Once upon a time we had

https://rt.cpan.org/Ticket/Display.html?id=114309

which sortof fixed itself, and I didn't really get to the bottom of the problem. It may be related to the _BSD_SOURCE or __BSD_VISIBLE macros, but I don't really want to just blindly fiddle with them "until it works". I'd prefer some input from a FreeBSD aware person to advise what is correct.

Revision history for this message
Tomasz Konojacki (xenu536) wrote :

The issue still exists, both on FreeBSD and on DragonFly BSD.

On both of those operating systems, the only right way is to not define anything. As opposed to glibc, they use feature macros only to *hide* things. By default, everything is visible in their headers.

For reference (both dragonfly and freebsd use *exactly* the same logic):

sys/cdefs.h (where _BSD_VISIBLE is defined): https://gitweb.dragonflybsd.org/dragonfly.git/blob/725e0fd894bdd515bdc7411d9d266a83e09c40ae:/sys/sys/cdefs.h#l594

sys/signal.h (SIGWINCH): https://gitweb.dragonflybsd.org/dragonfly.git/blob/725e0fd894bdd515bdc7411d9d266a83e09c40ae:/sys/sys/signal.h#l110

As you can see, SIGWINCH depends on _BSD_VISIBLE, and _BSD_VISIBLE is defined only when _POSIX_C_SOURCE, _POSIX_SOURCE, _ANSI_SOURCE, _C99_SOURCE and _C11_SOURCE are *not* defined.

IMO, the issue should be fixed by wrapping visibility macro defines with "#ifdef __GLIBC__", see the attached patch. I have tested it on FreeBSD and DragonFly BSD. I'm also 90% sure it will work on OpenBSD and NetBSD, I didn't test it, but I have read their headers.

If it breaks other platfoms (MacOS? musl?), you can simply amend those ifdefs basing on the incoming bugreports.

Revision history for this message
Paul "LeoNerd" Evans (leonerd) wrote :

Thanks. Applied as -r695

Also fixed up a few other occurrences of `_XOPEN_SOURCE` in some other files as -r696

Try that.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.