⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 proctask.h

📁 T-kernel 的extension源代码
💻 H
字号:
/* *---------------------------------------------------------------------- *    T-Kernel / Standard Extension * *    Copyright (C) 2006 by Ken Sakamura. All rights reserved. *    T-Kernel / Standard Extension is distributed  *      under the T-License for T-Kernel / Standard Extension. *---------------------------------------------------------------------- * *    Version:   1.00.00 *    Released by T-Engine Forum(http://www.t-engine.org) at 2006/8/11. * *---------------------------------------------------------------------- *//* *	proctask.h (extension) * *	Process/task management */#ifndef	__EXTENSION_PROCTASK_H__#define	__EXTENSION_PROCTASK_H__#include <basic.h>#include <tk/typedef.h>#include "typedef.h"#include "system.h"#ifdef __cplusplusextern "C" {#endif#ifndef __message__typedef struct message	MESSAGE;	/* Defined in message.h */#define __message__#endif/* *	Process state */typedef	struct {	UW	state;		/* Process state 			*/	PRI	priority;	/* Priority of current process (0 - 255)	*/	ID	parpid;		/* Parent process ID		*/} P_STATE;/* *	Process user information */typedef	struct {	TC	usr_name[14];	/* User name (12 + 2 hidden characters)	*/	TC	grp_name1[14];	/* Group name 1 (12 + 2 hidden characters) */	TC	grp_name2[14];	/* Group name 2 (12 + 2 hidden characters) */	TC	grp_name3[14];	/* Group name 3 (12 + 2 hidden characters) */	TC	grp_name4[14];	/* Group name 4 (12 + 2 hidden characters) */	W	level;		/* User level (0 - 15)		*/	W	net_level;	/* Network user level (0 - 15) */} P_USER;/* *	Process statistical information */typedef struct {	UW	etime;		/* Total elapsed time (in seconds)		*/	UW	utime;		/* Total CPU time spent in process	*/	UW	stime;		/* Total CPU time spent in system	*/	W	tmem;		/* Total memory size necessary for execution	*/	W	wmem;		/* Actual memory size allocated now */	W	resv[11];	/* Reserved 				*/} P_INFO;/* *	Constants related to process operation */#define	TERM_NRM	0x0000		/* Forced termination of specified process only	*/#define TERM_ALL	0x0001		/* Forced termination including child process */#define P_ABS		0x0000		/* Absolute priority specification (>=0)	*/#define P_REL		0x0001		/* Relative priority specification		*/#define	P_TASK		0x0002		/* For tasks		*/#define P_DORMANT	0x1000		/* Dormant sate			*/#define P_WAIT		0x2000		/* Wait sate			*/#define P_READY 	0x4000		/* Executable state 		*/#define P_RUN		0x8000		/* Execution state		*//* * Termination notification message */typedef struct {	W	type;		/* Message type (MS_SYS2) */	W	size;		/* Message size */	W	kind;		/* Termination type (MS_ABORT,MS_EXIT,MS_TERM) */	ID	pid;		/* Process ID of terminated process */	W	code;		/* Termination code */} EXITMSG;/* * Various system messages (MS_SYS2) */typedef union {	struct {			/* Basic format of MS_SYS2 */		W	type;		/* Message type (MS_SYS2) */		W	size;		/* Message size */		W	kind;		/* By type*/		VW	info[1];	/* Information varying from type to type */	} base;	EXITMSG		exitmsg;	/* Termination notification (req_emg) */} MSG_SYS2;/* * prc_inf(): Type of information (item) */#define	PI_LINK		0x00010000	/* Link to program file */#define	PI_NTSK		0x00020000	/* Number of in-process tasks */#define	PI_TSKSTAT	0x00030000	/* State of each task */#define	PI_CREINF	0x00040000	/* Create process infomation */#define	PI_PROFIL	0x00100000	/* Profile information *//* * PI_TSKSTAT: Task state information */typedef struct {	ID	tskid;		/* Task ID */	UW	state;		/* Task state */	PRI	priority;	/* Priority of task */} P_TSKSTAT;/* Create process infomation */typedef struct {	PRI	pri;		/* priority  */	ATR	prcatr;		/* attribute */	VB	prchdr[1];	/* handler   */} P_CREINF;/* * PI_PROFIL: Profile information */typedef struct	{	UH	*buf;		/* Profile buffer */	UW	bufsiz;		/* Buffer byte size */	UW	offset;		/* PC offset */	UW	scale;		/* PC scaling */} P_PROFILINF;/* * Dynamic loading information */typedef struct {	VP	loadaddr;	/* Loading address */	UW	loadsize;	/* Load size */	FP	entry;		/* Entry address */	UW	info[3];	/* Model-dependent information */} P_DYNLDINF;#define TPA_RNG0	0x00000001	/**/#define TPA_RNG1	0x00000002	/**/#define TPA_RNG2	0x00000004	/**/#define TPA_RNG3	0x00000008	/**/#define TPA_SYS		TPA_RNG1	/**/#define TPA_USR		TPA_RNG3	/**/#define TPA_LINK	0x00000100	/**/#define TPA_SEIO	0x00000200	/**/#define TPA_PTR		0x00000400	/**/#define TMA_LINK	0x00001000	/**/#define TMA_SEIO	0x00002000	/**/#define TMA_PTR		0x00004000	/**/typedef struct {	ATR	prcatr;		/**/	VP	prchdr;		/**/	PRI	pri;		/**/} T_CPRC;typedef struct {	ATR	modatr;		/**/	VP	modhdr;		/**/} T_LMOD;typedef struct {	ATR	spgatr;		/**/	VP	spghdr;		/**/} T_LSPG;/* * Definitions for automatic generation of interface library (mkiflib) *//*** DEFINE_IFLIB[INCLUDE FILE]<extension/proctask.h>[PREFIX]PM***//* * Process task management system call *//* [BEGIN SYSCALLS] */IMPORT ER tkse_cre_prc2(LINK* lnk, PRI pri, MESSAGE *msg);/* RESERVE_NO */IMPORT void tkse_ext_prc(W exit_code);IMPORT ER tkse_ter_prc(ID pid, W abort_code, W opt);IMPORT ER tkse_chg_pri(ID pid, PRI new_pri, W opt);IMPORT ER tkse_dly_tsk(RELTIM dlytim);/* RESERVE_NO */IMPORT ER tkse_prc_sts(ID pid, P_STATE *buff, TC *path);/* RESERVE_NO *//* RESERVE_NO */IMPORT ER tkse_get_inf(ID pid, P_INFO *buff);IMPORT ER tkse_crs_tsk(void (*entry)(W), PRI pri, W arg);IMPORT void tkse_ext_tsk(void);IMPORT ER tkse_slp_tsk(TMO tmout);IMPORT ER tkse_wup_tsk(ID tskid);IMPORT ER tkse_get_tid(void);IMPORT ER tkse_cre_sysprc(LINK* lnk, PRI pri, MESSAGE *msg);IMPORT ER tkse_ter_tsk(ID tskid);IMPORT ER tkse_can_wup(ID tskid);IMPORT ER tkse_req_emg(ID pid, W t_mask);IMPORT ER tkse_prc_inf(ID pid, W item, VP buf, W len);IMPORT ER tkse_lod_mod2(LINK *lnk, P_DYNLDINF *info);IMPORT ER tkse_unl_mod(ID loadid);/* ORIGIN_NO 99 */IMPORT W KnlDebugFunc(W fn, VW p1, VW p2, VW p3);IMPORT ER tkse_wai_fflock( void );IMPORT ER tkse_wup_fflock( ID tid );/* ALIGN_NO 0x100 *//* System management system call */IMPORT ER tkse_get_ver(T_VER *version);IMPORT ER tkse_lod_spg2(LINK *lnk, TC *arg, VW info[N_SPG_INFO]);IMPORT ER tkse_unl_spg(ID progid );IMPORT ER tkse_cre_dbg(LINK *lnk, PRI pri, MESSAGE *msg);IMPORT ER tkse_set_dbg(ID pid, W mode);/* ALIGN_NO 0x10 */IMPORT ER tkse_cre_prc(T_CPRC *pk_cprc, MESSAGE *msg);IMPORT ER tkse_lod_mod(T_LMOD *pk_mod, P_DYNLDINF *info);IMPORT ER tkse_lod_spg(T_LSPG *pk_sysprg, TC *arg, VW info[N_SPG_INFO]);IMPORT ER tkse_cre_tsk(void (*entry)(W), PRI pri);IMPORT ER tkse_sta_tsk(ID id, W arg);#ifdef __cplusplus}#endif#endif /* __EXTENSION_PROCTASK_H__ */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -