summaryrefslogtreecommitdiff
path: root/portability/sys
diff options
context:
space:
mode:
authorAriadne Conill <ariadne@dereferenced.org>2021-12-27 15:24:29 -0600
committerTimo Teräs <timo.teras@iki.fi>2021-12-29 20:14:41 +0200
commitdd1908f2fc20b4cfe2c15c55fafaa5fadfb599dc (patch)
tree0b069889738892b0b9502391408610ffcb2c1ff8 /portability/sys
parent837d2fd915739e50bffb2c5f5c35d422b7fe8ac8 (diff)
downloadapk-tools-dd1908f2fc20b4cfe2c15c55fafaa5fadfb599dc.tar.gz
apk-tools-dd1908f2fc20b4cfe2c15c55fafaa5fadfb599dc.tar.bz2
apk-tools-dd1908f2fc20b4cfe2c15c55fafaa5fadfb599dc.tar.xz
apk-tools-dd1908f2fc20b4cfe2c15c55fafaa5fadfb599dc.zip
portability: add sys/sysmacros.h wrapper for makedev/major/minor
Diffstat (limited to 'portability/sys')
-rw-r--r--portability/sys/sysmacros.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/portability/sys/sysmacros.h b/portability/sys/sysmacros.h
new file mode 100644
index 0000000..863972e
--- /dev/null
+++ b/portability/sys/sysmacros.h
@@ -0,0 +1,9 @@
+#ifdef __linux__
+# include_next <sys/sysmacros.h>
+#else
+# include <stdint.h>
+# include <sys/types.h>
+# define major(x) ((int32_t)(((u_int32_t)(x) >> 24) & 0xff))
+# define minor(x) ((int32_t)((x) & 0xffffff))
+# define makedev(x, y) ((dev_t)(((x) << 24) | (y)))
+#endif