X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Kernel%2Fthreads.c;h=075350dd6c2d426697665b310f574d62d70eadc8;hb=ca05044548d5c1de87c030d625a305731a6cc665;hp=3515fe0930fb76291e181ffafdf4b135f5073688;hpb=47e9dfd89189fc6b150bd6b20229cb047c7e0858;p=tpg%2Facess2.git diff --git a/Kernel/threads.c b/Kernel/threads.c index 3515fe09..075350dd 100644 --- a/Kernel/threads.c +++ b/Kernel/threads.c @@ -3,7 +3,7 @@ * threads.c * - Common Thread Control */ -#include +#include #include #include @@ -41,8 +41,10 @@ void Threads_Wake(tThread *Thread); void Threads_AddActive(tThread *Thread); int Threads_GetPID(); int Threads_GetTID(); - int Threads_GetUID(); - int Threads_GetGID(); +tUID Threads_GetUID(); + int Threads_SetUID(Uint *Errno, tUID ID); +tGID Threads_GetGID(); + int Threads_SetGID(Uint *Errno, tUID ID); void Threads_Dump(); // === GLOBALS === @@ -608,23 +610,47 @@ void Threads_SendSignal(int TID, int Num) #endif // --- Process Structure Access Functions --- -int Threads_GetPID() +tPID Threads_GetPID() { return Proc_GetCurThread()->TGID; } -int Threads_GetTID() +tTID Threads_GetTID() { return Proc_GetCurThread()->TID; } -int Threads_GetUID() +tUID Threads_GetUID() { return Proc_GetCurThread()->UID; } -int Threads_GetGID() +tGID Threads_GetGID() { return Proc_GetCurThread()->GID; } +int Threads_SetUID(Uint *Errno, tUID ID) +{ + tThread *t = Proc_GetCurThread(); + if( t->UID != 0 ) { + *Errno = -EACCES; + return -1; + } + Log("Threads_SetUID - Setting User ID to %i", ID); + t->UID = ID; + return 0; +} + +int Threads_SetGID(Uint *Errno, tGID ID) +{ + tThread *t = Proc_GetCurThread(); + if( t->UID != 0 ) { + *Errno = -EACCES; + return -1; + } + Log("Threads_SetGID - Setting Group ID to %i", ID); + t->GID = ID; + return 0; +} + /** * \fn void Threads_Dump() * \brief Dums a list of currently running threads