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