[PATCH 1/2] linux_reboot.h: support 1-argument reboot() from alternative libc.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux