[components] Remove lwP from v3.1.0

This commit is contained in:
Bernard Xiong
2018-09-01 12:03:32 +08:00
parent 52761fb9c8
commit ab1a220eae
21 changed files with 4 additions and 3636 deletions
-7
View File
@@ -1,7 +0,0 @@
config RT_USING_LWP
bool "Using light-weight process"
select RT_USING_DFS
depends on ARCH_ARM_CORTEX_M
default n
help
The lwP is a light weight process running in user mode.
-20
View File
@@ -1,20 +0,0 @@
Import('rtconfig')
from building import *
cwd = GetCurrentDir()
src = []
CPPPATH = []
support_arch = {"arm": ["cortex-m3", "cortex-m4", "cortex-m7"]}
platform_file = {'armcc': 'rvds.S', 'gcc': 'gcc.S', 'iar': 'iar.S'}
if rtconfig.PLATFORM in platform_file.keys(): # support platforms
if rtconfig.ARCH in support_arch.keys() and rtconfig.CPU in support_arch[rtconfig.ARCH]:
# arch/arm/cortex-m7/lwp_gcc.S
asm_path = 'arch/' + rtconfig.ARCH + '/' + rtconfig.CPU + '/*_' + platform_file[rtconfig.PLATFORM]
src = Glob('*.c') + Glob(asm_path)
CPPPATH = [cwd]
group = DefineGroup('lwP', src, depend = ['RT_USING_LWP'], CPPPATH = CPPPATH)
Return('group')
-176
View File
@@ -1,176 +0,0 @@
/*
* File : lwp_gcc.c
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006 - 2018, RT-Thread Development Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Change Logs:
* Date Author Notes
*/
.cpu cortex-m3
.syntax unified
.thumb
.text
/*
* void* lwp_get_sys_api(rt_uint32_t number);
*/
.global lwp_get_sys_api
.global lwp_get_kernel_sp
.global lwp_set_kernel_sp
/*
* void lwp_user_entry(u32 R0_text_addr, u32 R1_data_addr);
*/
.global lwp_user_entry
.type lwp_user_entry, % function
lwp_user_entry:
PUSH {R0 - R1} /* push text&data addr. */
MOV R0, SP /* v1 = SP */
BL lwp_set_kernel_sp /* lwp_set_kernel_sp(v1) */
POP {R0 - R1} /* pop app address to R1. */
/* set CPU to user-thread mode. */
MRS R2, CONTROL
ORR R2, R2, #0x03 /* use PSP, user-thread mode. */
MSR CONTROL, R2
/* set data address. */
MOV R9, R1
/* run app, only Thumb-mode. */
ORR R0, R0, #0x01
BX R0
/*
* void SVC_Handler(void);
*/
.global SVC_Handler
.type SVC_Handler, % function
SVC_Handler:
PUSH {LR}
/* get user SP. */
TST LR, #0x4
ITE EQ
MRSEQ R1, MSP
MRSNE R1, PSP
PUSH {R1} /* push app SP. */
MOV R2, R1
STMFD R2!, {R4 - R11} /* push app R4-R11 to app stack , and R1 not change. */
/* get SVC number. */
LDR R0, [R1, #24] /* get the app LR. */
LDRB R0, [R0, #-2] /* get the SVC No. from instruction. */
/* get kernel system API */
BL lwp_get_sys_api
/* if(api == NULL) return; */
CMP R0, #0
POPEQ {R1}
POPEQ {LR}
BXEQ LR
/* push api */
PUSH {R0}
/* get kernel SP to R0. */
BL lwp_get_kernel_sp
POP {R2} /* pop api to R2. */
POP {R1} /* pop app SP to R1. */
/* copy R1(app SP) to R0(server SP). */
LDMFD R1, {R4 - R11} /* pop exception_stack_frame to r4 - r11 register */
STMFD R0!, {R4 - R11} /* push exception_stack_frame to server SP. */
POP {LR}
PUSH {LR}
/* save app SP. */
PUSH {R0 - R3}
SUB R0, R1, #0x20 /* keep {R4 - R11} */
BL lwp_set_kernel_sp
POP {R0 - R3}
/* set to thread-privilege mode. */
MRS R3, CONTROL
BIC R3, R3, #0x01
ORR R3, R3, #0x02
MSR CONTROL, R3
/* call api. */
LDR R3, = svc_exit
STR R3, [R0, #20] /* update LR */
STR R2, [R0, #24] /* update api to PC */
MSR PSP, R0 /* update stack pointer */
POP {LR} /* 0xFFFFFFED */
ORR LR, LR, #0x10
BX LR
/*
* void svc_exit(void);
*/
.global svc_exit
.type svc_exit, % function
svc_exit:
/* get user SP. */
PUSH {R0} /* push result to SP. */
BL lwp_get_kernel_sp
LDMFD R0!, {R4 - R11} /* pop app {R4 - R11} */
ADD R0, R0, #16 /* skip R0-R3 */
LDMFD R0!, {R12, LR}
LDMFD R0!, {R1} /* pop PC to R1 */
LDMFD R0!, {R2} /* pop PSR to R2 */
/* align to 2 words */
ADD R0, R0, #0x07
BIC R0, R0, #0x07
PUSH {R0} /* push user-SP to SP */
/* save server SP. */
ADD R0, SP, #0x08 /* [user-SP, result] */
PUSH {R1 - R2, LR}
BL lwp_set_kernel_sp
POP {R1 - R2, LR}
POP {R3} /* pop user-SP to R3 */
POP {R0} /* restore API result. */
MSR APSR, R2 /* restore PSR */
MSR PSP, R3 /* restore app stack pointer */
/* restore to PSP & thread-unprivilege mode. */
MRS R2, CONTROL
ORR R2, R2, #0x03
MSR CONTROL, R2
/* return to lwp. */
ORR R1, R1, #0x01 /* only Thumb-mode. */
BX R1 /* return to user app. */
-176
View File
@@ -1,176 +0,0 @@
;/*
; * File : lwp_iar.S
; * This file is part of RT-Thread RTOS
; * COPYRIGHT (C) 2006 - 2018, RT-Thread Development Team
; *
; * This program is free software; you can redistribute it and/or modify
; * it under the terms of the GNU General Public License as published by
; * the Free Software Foundation; either version 2 of the License, or
; * (at your option) any later version.
; *
; * This program is distributed in the hope that it will be useful,
; * but WITHOUT ANY WARRANTY; without even the implied warranty of
; * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; * GNU General Public License for more details.
; *
; * You should have received a copy of the GNU General Public License along
; * with this program; if not, write to the Free Software Foundation, Inc.,
; * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
; *
; * Change Logs:
; * Date Author Notes
; */
SECTION .text:CODE(2)
THUMB
REQUIRE8
PRESERVE8
;/*
; * void* lwp_get_sys_api(rt_uint32_t number);
; */
IMPORT lwp_get_sys_api
IMPORT lwp_get_kernel_sp
IMPORT lwp_set_kernel_sp
;/*
; * void lwp_user_entry(u32 R0_text_addr, u32 R1_data_addr);
; */
EXPORT lwp_user_entry
lwp_user_entry:
PUSH {R0-R1} ; push text&data addr.
MOV R0, SP ; v1 = SP
BL lwp_set_kernel_sp ; lwp_set_kernel_sp(v1)
POP {R0-R1} ; pop app address to R1.
; set CPU to user-thread mode.
MRS R2, CONTROL
ORR R2, R2, #0x03 ; use PSP, user-thread mode.
MSR CONTROL, R2
; set data address.
MOV R9, R1
; run app, only Thumb-mode.
ORR R0, R0, #0x01
BX R0
;/*
; * void SVC_Handler(void);
; */
EXPORT SVC_Handler
SVC_Handler:
PUSH {LR}
; get user SP.
TST LR, #0x4
ITE EQ
MRSEQ R1, MSP
MRSNE R1, PSP
PUSH {R1} ; push app SP.
MOV R2, R1
STMFD R2!, {R4 - R11} ; push app R4-R11 to app stack , and R1 not change.
; get SVC number.
LDR R0, [R1, #24] ; get the app LR.
LDRB R0, [R0, #-2] ; get the SVC No. from instruction.
; get kernel system API
BL lwp_get_sys_api
; if(api == NULL) return;
CMP R0, #0
ITTT EQ
POPEQ {R1}
POPEQ {LR}
BXEQ LR
; push api
PUSH {R0}
; get kernel SP to R0.
BL lwp_get_kernel_sp
POP {R2} ; pop api to R2.
POP {R1} ; pop app SP to R1.
; copy R1(app SP) to R0(server SP).
LDMFD R1, {R4 - R11} ; pop exception_stack_frame to r4 - r11 register
STMFD R0!, {R4 - R11} ; push exception_stack_frame to server SP.
POP {LR}
PUSH {LR}
; save app SP.
PUSH {R0 - R3}
SUB R0, R1, #0x20 ; keep {R4 - R11}
BL lwp_set_kernel_sp
POP {R0 - R3}
; set to thread-privilege mode.
MRS R3, CONTROL
BIC R3, R3, #0x01
ORR R3, R3, #0x02
MSR CONTROL, R3
; call api.
LDR R3, =svc_exit
STR R3, [R0, #20] ; update LR
STR R2, [R0, #24] ; update api to PC
MSR PSP, R0 ; update stack pointer
POP {LR} ; 0xFFFFFFED
ORR LR, LR, #0x10
BX LR
;/*
; * void svc_exit(void);
; */
EXPORT svc_exit
svc_exit:
; get user SP.
PUSH {R0} ; push result to SP.
BL lwp_get_kernel_sp
LDMFD R0!, {R4 - R11} ; pop app {R4 - R11}
ADD R0, R0, #16 ; skip R0-R3
LDMFD R0!, {R12, LR} ;
LDMFD R0!, {R1} ; pop PC to R1
LDMFD R0!, {R2} ; pop PSR to R2
; align to 2 words
ADD R0, R0, #0x07
BIC R0, R0, #0x07
PUSH {R0} ; push user-SP to SP
; save server SP.
ADD R0, SP, #0x08 ; [user-SP, result]
PUSH {R1 - R2, LR}
BL lwp_set_kernel_sp
POP {R1 - R2, LR}
POP {R3} ; pop user-SP to R3
POP {R0} ; restore API result.
MSR APSR, R2 ; restore PSR
MSR PSP, R3 ; restore app stack pointer
; restore to PSP & thread-unprivilege mode.
MRS R2, CONTROL
ORR R2, R2, #0x03
MSR CONTROL, R2
; return to lwp.
ORR R1, R1, #0x01 ; only Thumb-mode.
BX R1 ; return to user app.
END
@@ -1,184 +0,0 @@
;/*
; * File : lwp_rvds.S
; * This file is part of RT-Thread RTOS
; * COPYRIGHT (C) 2006 - 2018, RT-Thread Development Team
; *
; * This program is free software; you can redistribute it and/or modify
; * it under the terms of the GNU General Public License as published by
; * the Free Software Foundation; either version 2 of the License, or
; * (at your option) any later version.
; *
; * This program is distributed in the hope that it will be useful,
; * but WITHOUT ANY WARRANTY; without even the implied warranty of
; * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; * GNU General Public License for more details.
; *
; * You should have received a copy of the GNU General Public License along
; * with this program; if not, write to the Free Software Foundation, Inc.,
; * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
; *
; * Change Logs:
; * Date Author Notes
; */
AREA |.text|, CODE, READONLY, ALIGN=2
THUMB
REQUIRE8
PRESERVE8
;/*
; * void* lwp_get_sys_api(rt_uint32_t number);
; */
IMPORT lwp_get_sys_api
IMPORT lwp_get_kernel_sp
IMPORT lwp_set_kernel_sp
;/*
; * void lwp_user_entry(args, text, data);
; */
lwp_user_entry PROC
EXPORT lwp_user_entry
PUSH {R0-R3} ; push text&data addr.
MOV R0, SP ; v1 = SP
BL lwp_set_kernel_sp ; lwp_set_kernel_sp(v1)
; set CPU to user-thread mode.
MRS R2, CONTROL
ORR R2, R2, #0x03 ; use PSP, user-thread mode.
MSR CONTROL, R2
POP {R0-R3} ; pop app address to R1.
; set data address.
MOV R9, R2
; run app, only Thumb-mode.
ORR R1, R1, #0x01
BX R1
; never reach here!
ENDP
;/*
; * void SVC_Handler(void);
; */
SVC_Handler PROC
EXPORT SVC_Handler
PUSH {LR}
; get user SP.
TST LR, #0x4
ITE EQ
MRSEQ R1, MSP
MRSNE R1, PSP
PUSH {R1} ; push app SP.
MOV R2, R1
STMFD R2!, {R4 - R11} ; push app R4-R11 to app stack , and R1 not change.
; get SVC number.
LDR R0, [R1, #24] ; get the app LR.
LDRB R0, [R0, #-2] ; get the SVC No. from instruction.
; get kernel system API
BL lwp_get_sys_api
; if(api == NULL) return;
CMP R0, #0
POPEQ {R1}
POPEQ {LR}
BXEQ LR
; push api
PUSH {R0}
; get kernel SP to R0.
BL lwp_get_kernel_sp
POP {R2} ; pop api to R2.
POP {R1} ; pop app SP to R1.
; copy R1(app SP) to R0(server SP).
LDMFD R1, {R4 - R11} ; pop exception_stack_frame to r4 - r11 register
STMFD R0!, {R4 - R11} ; push exception_stack_frame to server SP.
POP {LR}
PUSH {LR}
; save app SP.
PUSH {R0 - R3}
SUB R0, R1, #0x20 ; keep {R4 - R11}
BL lwp_set_kernel_sp
POP {R0 - R3}
; set to thread-privilege mode.
MRS R3, CONTROL
BIC R3, R3, #0x01
ORR R3, R3, #0x02
MSR CONTROL, R3
; call api.
LDR R3, =svc_exit
STR R3, [R0, #20] ; update LR
STR R2, [R0, #24] ; update api to PC
MSR PSP, R0 ; update stack pointer
POP {LR} ; 0xFFFFFFED
ORR LR, LR, #0x10
BX LR
ENDP
;/*
; * void svc_exit(void);
; */
svc_exit PROC
EXPORT svc_exit
; get user SP.
PUSH {R0} ; push result to SP.
BL lwp_get_kernel_sp
LDMFD R0!, {R4 - R11} ; pop app {R4 - R11}
ADD R0, R0, #16 ; skip R0-R3
LDMFD R0!, {R12, LR} ;
LDMFD R0!, {R1} ; pop PC to R1
LDMFD R0!, {R2} ; pop PSR to R2
; align to 2 words
ADD R0, R0, #0x07
BIC R0, R0, #0x07
PUSH {R0} ; push user-SP to SP
; save server SP.
ADD R0, SP, #0x08 ; [user-SP, result]
PUSH {R1 - R2, LR}
BL lwp_set_kernel_sp
POP {R1 - R2, LR}
POP {R3} ; pop user-SP to R3
POP {R0} ; restore API result.
MSR APSR, R2 ; restore PSR
MSR PSP, R3 ; restore app stack pointer
; restore to PSP & thread-unprivilege mode.
MRS R2, CONTROL
ORR R2, R2, #0x03
MSR CONTROL, R2
; return to lwp.
ORR R1, R1, #0x01 ; only Thumb-mode.
BX R1 ; return to user app.
ENDP
ALIGN
END
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
-84
View File
@@ -1,84 +0,0 @@
/*
* File : lwp.h
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006 - 2018, RT-Thread Development Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Change Logs:
* Date Author Notes
*/
#ifndef __LWP_H__
#define __LWP_H__
#define LWP_MAGIC 0x5A
#define LWP_TYPE_FIX_ADDR 0x01
#define LWP_TYPE_DYN_ADDR 0x02
#define LWP_ARG_MAX 8
#include <stdint.h>
#include <rtthread.h>
#include <dfs.h>
#include <lwp_memheap.h>
struct rt_lwp
{
uint8_t lwp_type;
uint8_t heap_cnt;
uint8_t reserv[2];
rt_list_t hlist; /**< headp list */
uint8_t *text_entry;
uint32_t text_size;
uint8_t *data;
uint32_t data_size;
uint32_t *kernel_sp; /**< kernel stack point */
struct dfs_fdtable fdt;
void *args;
};
struct lwp_header
{
uint8_t magic;
uint8_t compress_encrypt_algo;
uint16_t reserved;
uint32_t crc32;
};
struct lwp_chunk
{
uint32_t total_len;
char name[4];
uint32_t data_len;
uint32_t data_len_space;
};
extern struct rt_lwp *rt_lwp_self(void);
extern void rt_lwp_mem_init(struct rt_lwp *lwp);
extern void rt_lwp_mem_deinit(struct rt_lwp *lwp);
extern void *rt_lwp_mem_malloc(rt_uint32_t size);
extern void rt_lwp_mem_free(void *addr);
extern void *rt_lwp_mem_realloc(void *rmem, rt_size_t newsize);
#endif
File diff suppressed because it is too large Load Diff
-34
View File
@@ -1,34 +0,0 @@
/*
* File : lwp_mem.h
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006 - 2018, RT-Thread Development Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Change Logs:
* Date Author Notes
*/
#ifndef __LWP_MEM_H__
#define __LWP_MEM_H__
extern void rt_lwp_mem_init(struct rt_lwp *lwp);
extern void rt_lwp_mem_deinit(struct rt_lwp *lwp);
extern void *rt_lwp_mem_malloc(rt_uint32_t size);
extern void rt_lwp_mem_free(void *addr);
extern void *rt_lwp_mem_realloc(void *rmem, rt_size_t newsize);
#endif
File diff suppressed because it is too large Load Diff
-74
View File
@@ -1,74 +0,0 @@
/*
* File : lwp_memheap.h
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006 - 2018, RT-Thread Development Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Change Logs:
* Date Author Notes
*/
#ifndef __LWP_MEMHEAP_H__
#define __LWP_MEMHEAP_H__
#include <stdint.h>
#include <rtthread.h>
/**
* memory item on the heap
*/
struct rt_lwp_memheap_item
{
rt_uint32_t magic; /**< magic number for memheap */
struct rt_lwp_memheap *pool_ptr; /**< point of pool */
struct rt_lwp_memheap_item *next; /**< next memheap item */
struct rt_lwp_memheap_item *prev; /**< prev memheap item */
struct rt_lwp_memheap_item *next_free; /**< next free memheap item */
struct rt_lwp_memheap_item *prev_free; /**< prev free memheap item */
};
/**
* Base structure of memory heap object
*/
struct rt_lwp_memheap
{
struct rt_object parent; /**< inherit from rt_object */
void *start_addr; /**< pool start address and size */
rt_uint32_t pool_size; /**< pool size */
rt_uint32_t available_size; /**< available size */
rt_uint32_t max_used_size; /**< maximum allocated size */
struct rt_lwp_memheap_item *block_list; /**< used block list */
struct rt_lwp_memheap_item *free_list; /**< free block list */
struct rt_lwp_memheap_item free_header; /**< free block list header */
struct rt_semaphore lock; /**< semaphore lock */
rt_list_t mlist;
};
extern rt_err_t rt_lwp_memheap_init(struct rt_lwp_memheap *memheap, const char *name, void *start_addr, rt_uint32_t size);
extern void *rt_lwp_memheap_alloc(struct rt_lwp_memheap *heap, rt_uint32_t size);
extern void rt_lwp_memheap_free(void *ptr);
extern void *rt_lwp_memheap_realloc(struct rt_lwp_memheap *heap, void *ptr, rt_size_t newsize);
extern rt_bool_t rt_lwp_memheap_is_empty(struct rt_lwp_memheap *memheap);
extern rt_bool_t rt_lwp_memheap_unavailable_size_get(void);
#endif
File diff suppressed because it is too large Load Diff
-78
View File
@@ -1,78 +0,0 @@
/*
* File : lwp_syscall.h
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006 - 2018, RT-Thread Development Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Change Logs:
* Date Author Notes
* 2006-03-18 Bernard the first version
* 2006-04-25 Bernard add rt_hw_context_switch_interrupt declaration
* 2006-09-24 Bernard add rt_hw_context_switch_to declaration
* 2012-12-29 Bernard add rt_hw_exception_install declaration
* 2017-10-17 Hichard add some micros
*/
#ifndef __LWP_SYSCALL_H__
#define __LWP_SYSCALL_H__
#include <stdint.h>
#include <rtthread.h>
#include <dfs_posix.h>
#include <sys/time.h>
#include <sys/types.h>
typedef long suseconds_t; /* microseconds (signed) */
typedef long key_t; /* IPC key (for Sys V IPC) */
typedef uint32_t id_t; /* may contain pid, uid or gid */
/*
* Process priority specifications to get/setpriority.
*/
#define PRIO_MIN (-20)
#define PRIO_MAX 20
#define PRIO_PROCESS 0 /* only support lwp process */
#define PRIO_PGRP 1
#define PRIO_USER 2
#define TIMEVAL_TO_TIMESPEC(tv, ts) { \
(ts)->tv_sec = (tv)->tv_sec; \
(ts)->tv_nsec = (tv)->tv_usec * 1000; \
}
#define TIMESPEC_TO_TIMEVAL(tv, ts) { \
(tv)->tv_sec = (ts)->tv_sec; \
(tv)->tv_usec = (ts)->tv_nsec / 1000; \
}
void sys_exit(int value);
ssize_t sys_read(int fd, void *buf, size_t nbyte);
ssize_t sys_write(int fd, const void *buf, size_t nbyte);
off_t sys_lseek(int fd, off_t offset, int whence);
int sys_open(const char *name, int mode, ...);
int sys_close(int fd);
int sys_nanosleep(const struct timespec *rqtp, struct timespec *rmtp);
int sys_getpriority(int which, id_t who);
int sys_setpriority(int which, id_t who, int prio);
int sys_gettimeofday(struct timeval *tp, struct timezone *tzp);
int sys_settimeofday(const struct timeval *tv, const struct timezone *tzp);
int sys_msgget(key_t key, int msgflg);
int sys_msgsend(int msqid, const void *msgp, size_t msgsz, int msgflg);
int sys_msgrcv(int msqid, void *msgp, size_t msgsz, long msgtyp, int msgflg);
int sys_log(const char* log, int size);
#endif