compat.h 708 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #ifndef __COMPAT_H__
  2. #define __COMPAT_H__
  3. #ifdef WIN32
  4. #include <time.h>
  5. #include <pthread.h>
  6. #include <windows.h>
  7. static inline void nanosleep(struct timespec *rgtp, void *__unused)
  8. {
  9. Sleep(rgtp->tv_nsec / 1000000);
  10. }
  11. static inline void sleep(unsigned int secs)
  12. {
  13. Sleep(secs * 1000);
  14. }
  15. enum {
  16. PRIO_PROCESS = 0,
  17. };
  18. static inline int setpriority(int which, int who, int prio)
  19. {
  20. /* FIXME - actually do something */
  21. return 0;
  22. }
  23. typedef unsigned long int ulong;
  24. typedef unsigned short int ushort;
  25. typedef unsigned int uint;
  26. #ifndef __SUSECONDS_T_TYPE
  27. typedef long suseconds_t;
  28. #endif
  29. #define PTH(thr) ((thr)->pth.p)
  30. #else
  31. #define PTH(thr) ((thr)->pth)
  32. #endif /* WIN32 */
  33. #endif /* __COMPAT_H__ */