xref: /nrf52832-nimble/rt-thread/components/lwp/lwp_syscall.h (revision 104654410c56c573564690304ae786df310c91fc)
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  * 2018-12-10     Jesven       fix complie error in iar and keil
9  */
10 
11 #ifndef __LWP_SYSCALL_H__
12 #define __LWP_SYSCALL_H__
13 
14 #include <stdint.h>
15 #include <rtthread.h>
16 #include <dfs_posix.h>
17 #include <sys/time.h>
18 #include <sys/types.h>
19 
20 typedef long suseconds_t;       /* microseconds (signed) */
21 typedef uint32_t id_t;          /* may contain pid, uid or gid */
22 
23 /*
24  * Process priority specifications to get/setpriority.
25  */
26 #define	PRIO_MIN	    (-20)
27 #define	PRIO_MAX	    20
28 
29 #define	PRIO_PROCESS	0       /* only support lwp process */
30 #define	PRIO_PGRP	    1
31 #define	PRIO_USER	    2
32 
33 #ifndef TIMEVAL_TO_TIMESPEC
34 #define TIMEVAL_TO_TIMESPEC(tv, ts) {                   \
35     (ts)->tv_sec = (tv)->tv_sec;                        \
36     (ts)->tv_nsec = (tv)->tv_usec * 1000;               \
37 }
38 #endif
39 
40 #ifndef TIMESPEC_TO_TIMEVAL
41 #define TIMESPEC_TO_TIMEVAL(tv, ts) {                   \
42     (tv)->tv_sec = (ts)->tv_sec;                        \
43     (tv)->tv_usec = (ts)->tv_nsec / 1000;               \
44 }
45 #endif
46 
47 void sys_exit(int value);
48 ssize_t sys_read(int fd, void *buf, size_t nbyte);
49 ssize_t sys_write(int fd, const void *buf, size_t nbyte);
50 off_t sys_lseek(int fd, off_t offset, int whence);
51 int sys_open(const char *name, int mode, ...);
52 int sys_close(int fd);
53 int sys_nanosleep(const struct timespec *rqtp, struct timespec *rmtp);
54 int sys_getpriority(int which, id_t who);
55 int sys_setpriority(int which, id_t who, int prio);
56 int sys_gettimeofday(struct timeval *tp, struct timezone *tzp);
57 int sys_settimeofday(const struct timeval *tv, const struct timezone *tzp);
58 int sys_msgget(key_t key, int msgflg);
59 int sys_msgsend(int msqid, const void *msgp, size_t msgsz, int msgflg);
60 int sys_msgrcv(int msqid, void *msgp, size_t msgsz, long msgtyp, int msgflg);
61 
62 int sys_log(const char* log, int size);
63 
64 #endif
65