X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Kernel%2Fthreads.c;h=890f32d7cff5eb60ffa3a97c418144234c2d701b;hb=56b770130dc830c6a9dccb6c50e6442a8bdb0b6c;hp=90eb740e49829d63bbc54ce81205856c674f92ba;hpb=1ada116600acdd35f86f0cdaad2cc0339d61e533;p=tpg%2Facess2.git diff --git a/Kernel/threads.c b/Kernel/threads.c index 90eb740e..890f32d7 100644 --- a/Kernel/threads.c +++ b/Kernel/threads.c @@ -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 === @@ -616,14 +618,40 @@ int Threads_GetTID() { return Proc_GetCurThread()->TID; } -int Threads_GetUID() +tUID Threads_GetUID() { - return Proc_GetCurThread()->UID; + tThread *t = Proc_GetCurThread(); + int ret = t->UID; + Log("Threads_GetUID: TID %i, return %i", t->TID, ret); + return ret; +} +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_GetGID() + +tGID Threads_GetGID() { return Proc_GetCurThread()->GID; } +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()