getpid: use tos
This commit is contained in:
parent
8434f98cdd
commit
23fcac090c
1 changed files with 2 additions and 10 deletions
|
@ -1,17 +1,9 @@
|
||||||
#include <u.h>
|
#include <u.h>
|
||||||
#include <libc.h>
|
#include <libc.h>
|
||||||
|
#include <tos.h>
|
||||||
|
|
||||||
int
|
int
|
||||||
getpid(void)
|
getpid(void)
|
||||||
{
|
{
|
||||||
char b[20];
|
return _tos->pid;
|
||||||
int f;
|
|
||||||
|
|
||||||
memset(b, 0, sizeof(b));
|
|
||||||
f = open("#c/pid", 0);
|
|
||||||
if(f >= 0) {
|
|
||||||
read(f, b, sizeof(b));
|
|
||||||
close(f);
|
|
||||||
}
|
|
||||||
return atol(b);
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue