lwp_syscall.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*
  2. * File : lwp_syscall.h
  3. * This file is part of RT-Thread RTOS
  4. * COPYRIGHT (C) 2006 - 2018, RT-Thread Development Team
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License along
  17. * with this program; if not, write to the Free Software Foundation, Inc.,
  18. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  19. *
  20. * Change Logs:
  21. * Date Author Notes
  22. * 2006-03-18 Bernard the first version
  23. * 2006-04-25 Bernard add rt_hw_context_switch_interrupt declaration
  24. * 2006-09-24 Bernard add rt_hw_context_switch_to declaration
  25. * 2012-12-29 Bernard add rt_hw_exception_install declaration
  26. * 2017-10-17 Hichard add some micros
  27. */
  28. #ifndef __LWP_SYSCALL_H__
  29. #define __LWP_SYSCALL_H__
  30. #include <stdint.h>
  31. #include <rtthread.h>
  32. #include <dfs_posix.h>
  33. #include <sys/time.h>
  34. #include <sys/types.h>
  35. typedef long suseconds_t; /* microseconds (signed) */
  36. typedef long key_t; /* IPC key (for Sys V IPC) */
  37. typedef uint32_t id_t; /* may contain pid, uid or gid */
  38. /*
  39. * Process priority specifications to get/setpriority.
  40. */
  41. #define PRIO_MIN (-20)
  42. #define PRIO_MAX 20
  43. #define PRIO_PROCESS 0 /* only support lwp process */
  44. #define PRIO_PGRP 1
  45. #define PRIO_USER 2
  46. #define TIMEVAL_TO_TIMESPEC(tv, ts) { \
  47. (ts)->tv_sec = (tv)->tv_sec; \
  48. (ts)->tv_nsec = (tv)->tv_usec * 1000; \
  49. }
  50. #define TIMESPEC_TO_TIMEVAL(tv, ts) { \
  51. (tv)->tv_sec = (ts)->tv_sec; \
  52. (tv)->tv_usec = (ts)->tv_nsec / 1000; \
  53. }
  54. void sys_exit(int value);
  55. ssize_t sys_read(int fd, void *buf, size_t nbyte);
  56. ssize_t sys_write(int fd, const void *buf, size_t nbyte);
  57. off_t sys_lseek(int fd, off_t offset, int whence);
  58. int sys_open(const char *name, int mode, ...);
  59. int sys_close(int fd);
  60. int sys_nanosleep(const struct timespec *rqtp, struct timespec *rmtp);
  61. int sys_getpriority(int which, id_t who);
  62. int sys_setpriority(int which, id_t who, int prio);
  63. int sys_gettimeofday(struct timeval *tp, struct timezone *tzp);
  64. int sys_settimeofday(const struct timeval *tv, const struct timezone *tzp);
  65. int sys_msgget(key_t key, int msgflg);
  66. int sys_msgsend(int msqid, const void *msgp, size_t msgsz, int msgflg);
  67. int sys_msgrcv(int msqid, void *msgp, size_t msgsz, long msgtyp, int msgflg);
  68. int sys_log(const char* log, int size);
  69. #endif