mirror of
https://github.com/9fans/plan9port.git
synced 2025-01-15 11:20:03 +00:00
33 lines
376 B
C
33 lines
376 B
C
|
#include <u.h>
|
||
|
#include <libc.h>
|
||
|
#include "9proc.h"
|
||
|
|
||
|
static Lock privlock;
|
||
|
static ulong privmap;
|
||
|
|
||
|
int
|
||
|
privalloc(void)
|
||
|
{
|
||
|
int i;
|
||
|
|
||
|
lock(&privlock);
|
||
|
for(i=0; i<NPRIV; i++)
|
||
|
if((privmap&(1<<i)) == 0){
|
||
|
privmap |= (1<<i);
|
||
|
unlock(&privlock);
|
||
|
return i;
|
||
|
}
|
||
|
unlock(&privlock);
|
||
|
return -1;
|
||
|
}
|
||
|
|
||
|
void**
|
||
|
privmem(int i)
|
||
|
{
|
||
|
Uproc *up;
|
||
|
|
||
|
up = _p9uproc();
|
||
|
return &up->priv[i];
|
||
|
}
|
||
|
|