/vm/os-unix.hpp

http://github.com/abeaumont/factor · C++ Header · 53 lines · 39 code · 14 blank · 0 comment · 0 complexity · 9e99c4f4ad189b5061073015bc0c21e6 MD5 · raw file

  1. #include <unistd.h>
  2. #include <sys/param.h>
  3. #include <dirent.h>
  4. #include <sys/mman.h>
  5. #include <sys/types.h>
  6. #include <sys/stat.h>
  7. #include <unistd.h>
  8. #include <sys/time.h>
  9. #include <dlfcn.h>
  10. #include <signal.h>
  11. #include <pthread.h>
  12. #include <sched.h>
  13. #include "atomic-gcc.hpp"
  14. namespace factor
  15. {
  16. typedef char vm_char;
  17. typedef char symbol_char;
  18. #define STRING_LITERAL(string) string
  19. #define SSCANF sscanf
  20. #define STRCMP strcmp
  21. #define STRNCMP strncmp
  22. #define STRDUP strdup
  23. #define SNPRINTF snprintf
  24. #define FTELL ftello
  25. #define FSEEK fseeko
  26. #define OPEN_READ(path) fopen(path,"rb")
  27. #define OPEN_WRITE(path) fopen(path,"wb")
  28. #define print_native_string(string) print_string(string)
  29. typedef pthread_t THREADHANDLE;
  30. THREADHANDLE start_thread(void *(*start_routine)(void *),void *args);
  31. inline static THREADHANDLE thread_id() { return pthread_self(); }
  32. u64 nano_count();
  33. void sleep_nanos(u64 nsec);
  34. void move_file(const vm_char *path1, const vm_char *path2);
  35. static inline void breakpoint()
  36. {
  37. __builtin_trap();
  38. }
  39. }