Util-Linux package development
 help / color / mirror / Atom feed
* [PATCH 1/2] linux_reboot.h: support 1-argument reboot() from alternative libc.
@ 2015-11-17  8:54 Casper Ti. Vector
  2015-11-17  9:05 ` [PATCH 2/2] linux_reboot.h: remove code that is unused anyway Casper Ti. Vector
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Casper Ti. Vector @ 2015-11-17  8:54 UTC (permalink / raw)
  To: util-linux

Original code assumes 1-argument reboot() is only provided by glibc 2.x
and later; but as far as the patch author knows, at least the following
alternative C libraries for linux also provide the 1-argument variant:

* uclibc: all public releases.
* dietlibc: 0.7.2 and all later releases; reboot() was not provided in
            0.7.1 and earlier versions.
* musl: all public releases.
* klibc: all public releases.
* bionic: all public releases.

... which should already cover most use cases.
---
 include/linux_reboot.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/linux_reboot.h b/include/linux_reboot.h
index 9cebc67..7ba4bca 100644
--- a/include/linux_reboot.h
+++ b/include/linux_reboot.h
@@ -39,12 +39,12 @@
 #ifdef USE_LIBC
 
 /* libc version */
-#if defined __GLIBC__ && __GLIBC__ >= 2
-#  include <sys/reboot.h>
-#  define REBOOT(cmd) reboot(cmd)
-#else
+#if defined __GLIBC__ && __GLIBC__ < 2
 extern int reboot(int, int, int);
 #  define REBOOT(cmd) reboot(LINUX_REBOOT_MAGIC1,LINUX_REBOOT_MAGIC2,(cmd))
+#else
+#  include <sys/reboot.h>
+#  define REBOOT(cmd) reboot(cmd)
 #endif
 static inline int my_reboot(int cmd) {
 	return REBOOT(cmd);
-- 
2.6.3


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-11-19 11:38 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-17  8:54 [PATCH 1/2] linux_reboot.h: support 1-argument reboot() from alternative libc Casper Ti. Vector
2015-11-17  9:05 ` [PATCH 2/2] linux_reboot.h: remove code that is unused anyway Casper Ti. Vector
2015-11-17 21:04 ` [PATCH 1/2] linux_reboot.h: support 1-argument reboot() from alternative libc Christoph Hellwig
2015-11-18 12:59 ` Karel Zak
2015-11-19  2:52 ` [PATCH v2 1/2] ctrlaltdel: use reboot() provided by libc, assuming it is 1-adic Casper Ti. Vector
2015-11-19 11:12   ` Karel Zak
2015-11-19 11:38     ` Casper Ti. Vector
2015-11-19  2:56 ` [PATCH v2 2/2] Remove now useless linux_reboot.h Casper Ti. Vector

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox