Original patch as attached on the bugreport
[midnight-commander.git] / src / unixcompat.h
blobb4d0305692e72b7efc903b6d0a55463af0a285ce
1 #ifndef MC_UNIXCOMPAT_H
2 #define MC_UNIXCOMPAT_H
4 /* This header file collects differences between the various Unix
5 * variants that are supported by the Midnight Commander and provides
6 * replacement routines if they are not natively available.
7 */
9 /* The major/minor macros are not specified in SUSv3, so we can only hope
10 * they are provided by the operating system or emulate it.
13 #include <sys/types.h> /* BSD */
14 #ifdef HAVE_SYS_MKDEV_H
15 # include <sys/mkdev.h> /* Solaris 9 */
16 #endif
17 #if defined(_AIX) && defined(HAVE_SYS_SYSMACROS_H)
18 # include <sys/sysmacros.h> /* AIX */
19 #endif
21 #ifndef major
22 # warning major() is undefined. Device numbers will not be shown correctly.
23 # define major(devnum) (((devnum) >> 8) & 0xff)
24 #endif
25 #ifndef minor
26 # warning minor() is undefined. Device numbers will not be shown correctly.
27 # define minor(devnum) (((devnum) & 0xff))
28 #endif
29 #ifndef makedev
30 # warning makedev() is undefined. Device numbers will not be shown correctly.
31 # define makedev(major,minor) ((((major) & 0xff) << 8) | ((minor) & 0xff))
32 #endif
34 #endif