From 7ca5dc4232b9ac5ee5cd25c8b5b33a58904cd251 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Wed, 2 Mar 2016 11:52:38 -0600 Subject: For years the man pages have said to #include to get major/minor/makedev, but glibc has vowed to break existing programs (https://sourceware.org/ml/libc-alpha/2015-11/msg00253.html) and replace it with _another_ non-standard header (not in posix or lsb), so let's just add functions to lib/ that do the transform ourselves. --- lib/lib.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'lib/lib.c') diff --git a/lib/lib.c b/lib/lib.c index 43db2e37..1c1f2248 100644 --- a/lib/lib.c +++ b/lib/lib.c @@ -1043,3 +1043,18 @@ char *strnstr(char *line, char *str) return *s ? s : 0; } + +int dev_minor(int dev) +{ + return ((dev&0xfff00000)>>12)|(dev&0xff); +} + +int dev_major(int dev) +{ + return (dev&0xfff00)>>8; +} + +int dev_makedev(int major, int minor) +{ + return (minor&0xff)|((major&0xfff)<<8)|((minor&0xfff00)<<12); +} -- cgit v1.2.3