1 /** \file unixcompat.h 2 * \brief Header: collects differences between the various Unix 3 * 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 * The major/minor macros are not specified in SUSv3, so we can only hope 8 * they are provided by the operating system or emulate it. 9 */ 10 11 #ifndef MC_UNIXCOMPAT_H 12 #define MC_UNIXCOMPAT_H 13 14 #include <sys/types.h> /* BSD */ 15 16 #ifdef MAJOR_IN_MKDEV 17 #include <sys/mkdev.h> 18 #elif defined MAJOR_IN_SYSMACROS 19 #include <sys/sysmacros.h> 20 #endif 21 22 #include <unistd.h> 23 24 /*** typedefs(not structures) and defined constants **********************************************/ 25 26 #ifndef major 27 #warning major() is undefined. Device numbers will not be shown correctly. 28 #define major(devnum) (((devnum) >> 8) & 0xff) 29 #endif 30 31 #ifndef minor 32 #warning minor() is undefined. Device numbers will not be shown correctly. 33 #define minor(devnum) (((devnum) & 0xff)) 34 #endif 35 36 #ifndef makedev 37 #warning makedev() is undefined. Device numbers will not be shown correctly. 38 #define makedev(major,minor) ((((major) & 0xff) << 8) | ((minor) & 0xff)) 39 #endif 40 41 #ifndef STDIN_FILENO 42 #define STDIN_FILENO 0 43 #endif 44 45 #ifndef STDOUT_FILENO 46 #define STDOUT_FILENO 1 47 #endif 48 49 #ifndef STDERR_FILENO 50 #define STDERR_FILENO 2 51 #endif 52 53 /*** enums ***************************************************************************************/ 54 55 /*** structures declarations (and typedefs of structures)*****************************************/ 56 57 /*** global variables defined in .c file *********************************************************/ 58 59 /*** declarations of public functions ************************************************************/ 60 61 /*** inline functions ****************************************************************************/ 62 63 #endif