From: "Anthony G. Basile" <blueness(a)gentoo.org>
man feature_test_macros(7) specifies that _BSD_SOURCE and _SVID_SOURCE have
been deprecated in favor of _DEFAULT_SOURCE since libc 2.20. Specifying
either of the former is now equivalent to specifying just the latter. We add
this macro to conform to this standard, but do not add the compiler warning
to maintain full backwards compatibility with earlier version of glibc and
uclibc.
Signed-off-by: Anthony G. Basile <blueness(a)gentoo.org>
---
include/features.h | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/include/features.h b/include/features.h
index f9820791b..362b811fd 100644
--- a/include/features.h
+++ b/include/features.h
@@ -40,6 +40,7 @@
_SVID_SOURCE ISO C, POSIX, and SVID things.
_ATFILE_SOURCE Additional *at interfaces.
_GNU_SOURCE All of the above, plus GNU extensions.
+ _DEFAULT_SOURCE Equivalent to defining _BSD_SOURCE and _SVID_SOURCE.
_REENTRANT Select additionally reentrant object.
_THREAD_SAFE Same as _REENTRANT, often used by other systems.
_FORTIFY_SOURCE If set to numeric value > 0 additional security
@@ -140,6 +141,19 @@
# define __GNUC_PREREQ(maj, min) 0
#endif
+/* _DEFAULT_SOURCE is equivalent to defining _BSD_SOURCE and _SVID_SOURCE
+ * and vice versa. */
+#ifdef _DEFAULT_SOURCE
+# undef _BSD_SOURCE
+# define _BSD_SOURCE 1
+# undef _SVID_SOURCE
+# define _SVID_SOURCE 1
+#endif
+
+#if defined _BSD_SOURCE || defined _SVID_SOURCE
+# undef _DEFAULT_SOURCE
+# define _DEFAULT_SOURCE 1
+#endif
/* If _BSD_SOURCE was defined by the user, favor BSD over POSIX. */
#if defined _BSD_SOURCE && \
--
2.13.0
From: "Anthony G. Basile" <blueness(a)gentoo.org>
This syncs up <sys/reboot.h> with the GNU C library, see their
commit 1a09dc56. These constants are needed by init systems like
openrc.
Signed-off-by: Anthony G. Basile <blueness(a)gentoo.org>
---
include/sys/reboot.h | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/include/sys/reboot.h b/include/sys/reboot.h
index bc685aebb..fafd2fb0c 100644
--- a/include/sys/reboot.h
+++ b/include/sys/reboot.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2017 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -38,6 +38,12 @@
/* Stop system and switch power off if possible. */
#define RB_POWER_OFF 0x4321fedc
+/* Suspend system using software suspend. */
+#define RB_SW_SUSPEND 0xd000fce2
+
+/* Reboot system into new kernel. */
+#define RB_KEXEC 0x45584543
+
__BEGIN_DECLS
/* Reboot or halt the system. */
--
2.13.0
This syncs up <sys/reboot.h> with the GNU C library, see their
commit 1a09dc56. These constants are needed by init systems like
openrc.
Signed-off-by: Anthony G. Basile <blueness(a)gentoo.org>
---
include/sys/reboot.h | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/include/sys/reboot.h b/include/sys/reboot.h
index bc685aebb..fafd2fb0c 100644
--- a/include/sys/reboot.h
+++ b/include/sys/reboot.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2017 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -38,6 +38,12 @@
/* Stop system and switch power off if possible. */
#define RB_POWER_OFF 0x4321fedc
+/* Suspend system using software suspend. */
+#define RB_SW_SUSPEND 0xd000fce2
+
+/* Reboot system into new kernel. */
+#define RB_KEXEC 0x45584543
+
__BEGIN_DECLS
/* Reboot or halt the system. */
--
2.13.0
This syncs up <sys/reboot.h> with the GNU C library, see their
commit 1a09dc56. These constants are needed by init systems like
openrc.
Signed-off-by: Anthony G. Basile <blueness(a)gentoo.org>
---
include/sys/reboot.h | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/include/sys/reboot.h b/include/sys/reboot.h
index bc685aebb..fafd2fb0c 100644
--- a/include/sys/reboot.h
+++ b/include/sys/reboot.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2017 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -38,6 +38,12 @@
/* Stop system and switch power off if possible. */
#define RB_POWER_OFF 0x4321fedc
+/* Suspend system using software suspend. */
+#define RB_SW_SUSPEND 0xd000fce2
+
+/* Reboot system into new kernel. */
+#define RB_KEXEC 0x45584543
+
__BEGIN_DECLS
/* Reboot or halt the system. */
--
2.13.0
Current uClibc-ng version incorrectly calculates clockid
in pthread_getcpuclockid (at least for modern kernels). The simplest test
program
#include <time.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
int main()
{
clockid_t clk;
struct timespec ts;
const int err = pthread_getcpuclockid(pthread_self(), &clk);
if (err != 0) {
errno = err;
perror("pthread_getcpuclockid");
return EXIT_FAILURE;
}
if (clock_gettime(clk, &ts) == -1) {
perror("clock_gettime");
return EXIT_FAILURE;
}
printf("Thread time is %lu.%06lu.\n",
ts.tv_sec,
ts.tv_nsec / 1000);
return EXIT_SUCCESS;
}
fails with
clock_gettime: Invalid argument
Tested on Linux 3.4 / MIPS built with GCC 5.4.0.
Other implementations, for example musl, use a simple calculation
https://git.musl-libc.org/cgit/musl/tree/src/thread/pthread_getcpuclockid.c
Looks strange, but the official glibc repository
https://sourceware.org/git/?p=glibc.git;a=blob_plain;f=nptl/pthread_getcpuc…
has the same implementation as in uClibc-ng.
This fork
https://github.com/lattera/glibc/blob/master/nptl/sysdeps/unix/sysv/linux/p…
use more accurate approach relying on __NR_clock_getres (defined in the
kernel since 2.6.24) with MAKE_THREAD_CPUCLOCK macro copied from the kernel
(
http://lxr.free-electrons.com/source/include/linux/posix-timers.h?v=2.6.24#…,
Linux
4.10 has the same one).
I propose an intermediate solution: use MAKE_THREAD_CPUCLOCK like
computation of clockid when __NR_clock_getres defined and do a fallback to
an older implementation when not.
Hello,
Since a few days, we are seeing build failures of the radvd package in
Buildroot:
http://autobuild.buildroot.net/?reason=radvd-2.12
The build failure is:
/home/buildroot/autobuild/run/instance-2/output/host/usr/arc-buildroot-linux-uclibc/sysroot/usr/include/linux/if_arp.h:121:8: error: redefinition of 'struct arpreq_old'
struct arpreq_old {
^~~~~~~~~~
In file included from includes.h:90:0,
from recv.c:17:
/home/buildroot/autobuild/run/instance-2/output/host/usr/arc-buildroot-linux-uclibc/sysroot/usr/include/net/if_arp.h:147:8: note: originally defined here
struct arpreq_old
^~~~~~~~~~
[...]
The build failures happens with uClibc-ng toolchains in combination
with Linux 4.11 kernel headers, so it seems to be a new thing caused by
Linux 4.11 headers. However the kernel Git history doesn't show any
change on this header file between 4.10 and 4.11.
Any idea?
Thanks,
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com