unixcompat.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. #ifndef MC_UNIXCOMPAT_H
  11. #define MC_UNIXCOMPAT_H
  12. #include <sys/types.h> /* BSD */
  13. #if MAJOR_IN_MKDEV
  14. #include <sys/mkdev.h>
  15. #elif MAJOR_IN_SYSMACROS
  16. #include <sys/sysmacros.h>
  17. #endif
  18. #if defined(_AIX)
  19. #include <time.h> /* AIX for tm */
  20. #endif
  21. /*** typedefs(not structures) and defined constants **********************************************/
  22. #ifndef major
  23. #warning major() is undefined. Device numbers will not be shown correctly.
  24. #define major(devnum) (((devnum) >> 8) & 0xff)
  25. #endif
  26. #ifndef minor
  27. #warning minor() is undefined. Device numbers will not be shown correctly.
  28. #define minor(devnum) (((devnum) & 0xff))
  29. #endif
  30. #ifndef makedev
  31. #warning makedev() is undefined. Device numbers will not be shown correctly.
  32. #define makedev(major,minor) ((((major) & 0xff) << 8) | ((minor) & 0xff))
  33. #endif
  34. /*** enums ***************************************************************************************/
  35. /*** structures declarations (and typedefs of structures)*****************************************/
  36. /*** global variables defined in .c file *********************************************************/
  37. /*** declarations of public functions ************************************************************/
  38. /*** inline functions ****************************************************************************/
  39. #endif