Skip to content

Conversation

@jacmet
Copy link

@jacmet jacmet commented Sep 1, 2025

vsyslog() is not in POSIX, so only exposed by <syslog.h> on musl and uclibc-ng if we define _DEFAULT_SOURCE.

https://git.musl-libc.org/cgit/musl/tree/include/syslog.h#n64 https://cgit.uclibc-ng.org/cgi/cgit/uclibc-ng.git/tree/include/sys/syslog.h#n200

While we are at it, drop the glibc-implementation-specific __USE_MISC define in src/util.c to get rid of a double definition:

src/util.c:3: warning: "__USE_MISC" redefined
    3 | #define __USE_MISC
      |
In file included from /usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33,
                 from /usr/include/stdio.h:27,
                 from src/util.c:2:
/usr/include/features.h:395: note: this is the location of the previous definition
  395 | # define __USE_MISC     1

On glibc (and uClibc-ng) the internal __USE_MISC symbol gets defined if _DEFAULT_SOURCE is:

https://github.com/bminor/glibc/blob/master/include/features.h#L417-L419

vsyslog() is not in POSIX, so only exposed by <syslog.h> on musl and
uclibc-ng if we define _DEFAULT_SOURCE.

https://git.musl-libc.org/cgit/musl/tree/include/syslog.h#n64
https://cgit.uclibc-ng.org/cgi/cgit/uclibc-ng.git/tree/include/sys/syslog.h#n200

While we are at it, drop the glibc-implementation-specific __USE_MISC define
in src/util.c to get rid of a double definition:

src/util.c:3: warning: "__USE_MISC" redefined
    3 | #define __USE_MISC
      |
In file included from /usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33,
                 from /usr/include/stdio.h:27,
                 from src/util.c:2:
/usr/include/features.h:395: note: this is the location of the previous definition
  395 | # define __USE_MISC     1

On glibc (and uClibc-ng) the internal __USE_MISC symbol gets defined if
_DEFAULT_SOURCE is:

https://github.com/bminor/glibc/blob/master/include/features.h#L417-L419

Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
@paralin
Copy link

paralin commented Sep 1, 2025

+1 fixes issues with the build in buildroot against uclibc/musl

@gaul gaul merged commit 25c2a09 into linux-on-mac:master Sep 1, 2025
@gaul
Copy link
Member

gaul commented Sep 1, 2025

Thank you for your contribution @jacmet!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants