X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;ds=sidebyside;f=Kernel%2Finclude%2Fthreads.h;h=9ff7b629c72dda39bce063054bd5c78712031932;hb=a2495c6ea4f4cab16b5d339ae511428e92e89e73;hp=6a14546667ab089346061bb526a18048f7b47e63;hpb=f24c301371fbcb5ee42c5118f61f7304cb989746;p=tpg%2Facess2.git diff --git a/Kernel/include/threads.h b/Kernel/include/threads.h index 6a145466..9ff7b629 100644 --- a/Kernel/include/threads.h +++ b/Kernel/include/threads.h @@ -1,75 +1,12 @@ /* + * Acess2 Kernel */ #ifndef _THREADS_H_ #define _THREADS_H_ #include #include -#include - -typedef struct sMessage -{ - struct sMessage *Next; - Uint Source; - Uint Length; - Uint8 Data[]; -} tMsg; // sizeof = 12+ - -typedef struct sThread -{ - // --- threads.c's - // 0 - struct sThread *Next; //!< Next thread in list - tSpinlock IsLocked; //!< Thread's spinlock - volatile int Status; //!< Thread Status - int RetStatus; //!< Return Status - - // 16 - Uint TID; //!< Thread ID - Uint TGID; //!< Thread Group (Process) - Uint PTID; //!< Parent Thread ID - Uint UID, GID; //!< User and Group - char *ThreadName; //!< Name of thread - - // --- arch/proc.c's responsibility - // 40 - //! Kernel Stack Base - tVAddr KernelStack; - - // 44 (x86) - //! Memory Manager State - tMemoryState MemState; - - // 48 (x86) - //! State on task switch - tTaskState SavedState; - - // --- threads.c's - // 60 - int CurFaultNum; //!< Current fault number, 0: none - tVAddr FaultHandler; //!< Fault Handler - - tMsg * volatile Messages; //!< Message Queue - tMsg *LastMessage; //!< Last Message (speeds up insertion) - - int Quantum, Remaining; //!< Quantum Size and remaining timesteps - int NumTickets; //!< Priority - Chance of gaining CPU - - Uint Config[NUM_CFG_ENTRIES]; //!< Per-process configuration - - // --- proc.c's - volatile int bIsRunning; //!< Set if the thread is in use (used in MP) -} tThread; - - -enum { - THREAD_STAT_NULL, - THREAD_STAT_ACTIVE, - THREAD_STAT_SLEEPING, - THREAD_STAT_WAITING, - THREAD_STAT_ZOMBIE, - THREAD_STAT_DEAD -}; +//#include enum eFaultNumbers { @@ -83,10 +20,21 @@ enum eFaultNumbers #define GETMSG_IGNORE ((void*)-1) +typedef struct sThread tThread; + // === FUNCTIONS === -extern tThread *Proc_GetCurThread(void); -extern tThread *Threads_GetThread(Uint TID); -extern void Threads_Wake(tThread *Thread); -extern void Threads_AddActive(tThread *Thread); +extern void Threads_SetFaultHandler(Uint Handler); + +extern int Threads_SetUID(tUID ID); +extern int Threads_SetGID(tUID ID); +extern tTID Threads_WaitTID(int TID, int *Status); + + +extern int *Threads_GetMaxFD(void); +extern char **Threads_GetCWD(void); +extern char **Threads_GetChroot(void); + +extern int Proc_SendMessage(Uint Dest, int Length, void *Data); +extern int Proc_GetMessage(Uint *Source, void *Buffer); #endif