portability: add sys/sysmacros.h wrapper for makedev/major/minor

cute-signatures
Ariadne Conill 2021-12-27 15:24:29 -06:00 committed by Timo Teräs
parent 837d2fd915
commit dd1908f2fc
1 changed files with 9 additions and 0 deletions

View File

@ -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