lwp_syscall.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. * Copyright (c) 2006-2018, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2006-03-18 Bernard the first version
  9. * 2006-04-25 Bernard add rt_hw_context_switch_interrupt declaration
  10. * 2006-09-24 Bernard add rt_hw_context_switch_to declaration
  11. * 2012-12-29 Bernard add rt_hw_exception_install declaration
  12. * 2017-10-17 Hichard add some micros
  13. * 2018-12-10 Jesven fix complie error in iar and keil
  14. */
  15. #ifndef __LWP_SYSCALL_H__
  16. #define __LWP_SYSCALL_H__
  17. #include <stdint.h>
  18. #include <rtthread.h>
  19. #include <dfs_posix.h>
  20. #include <sys/time.h>
  21. #include <sys/types.h>
  22. typedef long suseconds_t; /* microseconds (signed) */
  23. typedef uint32_t id_t; /* may contain pid, uid or gid */
  24. /*
  25. * Process priority specifications to get/setpriority.
  26. */
  27. #define PRIO_MIN (-20)
  28. #define PRIO_MAX 20
  29. #define PRIO_PROCESS 0 /* only support lwp process */
  30. #define PRIO_PGRP 1
  31. #define PRIO_USER 2
  32. #define TIMEVAL_TO_TIMESPEC(tv, ts) { \
  33. (ts)->tv_sec = (tv)->tv_sec; \
  34. (ts)->tv_nsec = (tv)->tv_usec * 1000; \
  35. }
  36. #define TIMESPEC_TO_TIMEVAL(tv, ts) { \
  37. (tv)->tv_sec = (ts)->tv_sec; \
  38. (tv)->tv_usec = (ts)->tv_nsec / 1000; \
  39. }
  40. void sys_exit(int value);
  41. ssize_t sys_read(int fd, void *buf, size_t nbyte);
  42. ssize_t sys_write(int fd, const void *buf, size_t nbyte);
  43. off_t sys_lseek(int fd, off_t offset, int whence);
  44. int sys_open(const char *name, int mode, ...);
  45. int sys_close(int fd);
  46. int sys_nanosleep(const struct timespec *rqtp, struct timespec *rmtp);
  47. int sys_getpriority(int which, id_t who);
  48. int sys_setpriority(int which, id_t who, int prio);
  49. int sys_gettimeofday(struct timeval *tp, struct timezone *tzp);
  50. int sys_settimeofday(const struct timeval *tv, const struct timezone *tzp);
  51. int sys_msgget(key_t key, int msgflg);
  52. int sys_msgsend(int msqid, const void *msgp, size_t msgsz, int msgflg);
  53. int sys_msgrcv(int msqid, void *msgp, size_t msgsz, long msgtyp, int msgflg);
  54. int sys_log(const char* log, int size);
  55. #endif