lwp_syscall.h 2.0 KB

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