《操作系统》的实验代码。
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
1.2 KiB

12 years ago
  1. #ifndef __USER_LIBS_ULIB_H__
  2. #define __USER_LIBS_ULIB_H__
  3. #include <defs.h>
  4. void __warn(const char *file, int line, const char *fmt, ...);
  5. void __noreturn __panic(const char *file, int line, const char *fmt, ...);
  6. #define warn(...) \
  7. __warn(__FILE__, __LINE__, __VA_ARGS__)
  8. #define panic(...) \
  9. __panic(__FILE__, __LINE__, __VA_ARGS__)
  10. #define assert(x) \
  11. do { \
  12. if (!(x)) { \
  13. panic("assertion failed: %s", #x); \
  14. } \
  15. } while (0)
  16. // static_assert(x) will generate a compile-time error if 'x' is false.
  17. #define static_assert(x) \
  18. switch (x) { case 0: case (x): ; }
  19. void __noreturn exit(int error_code);
  20. int fork(void);
  21. int wait(void);
  22. int waitpid(int pid, int *store);
  23. void yield(void);
  24. int kill(int pid);
  25. int getpid(void);
  26. void print_pgdir(void);
  27. unsigned int gettime_msec(void);
  28. void lab6_set_priority(uint32_t priority);
  29. int sleep(unsigned int time);
  30. #endif /* !__USER_LIBS_ULIB_H__ */