blob: 42e3f49c3237f0c3b0437c43fc9ef4d192bd66bb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
#include "unistd.h"
#include "string.h"
#include <Kernel/Syscall.h>
extern "C" {
uid_t getuid()
{
return Syscall::invoke(Syscall::PosixGetuid);
}
uid_t getgid()
{
return Syscall::invoke(Syscall::PosixGetgid);
}
uid_t getpid()
{
return Syscall::invoke(Syscall::PosixGetpid);
}
int open(const char* path)
{
size_t length = strlen(path);
return Syscall::invoke(Syscall::PosixOpen, (dword)path, (dword)length);
}
ssize_t read(int fd, void* buf, size_t count)
{
return Syscall::invoke(Syscall::PosixRead, (dword)fd, (dword)buf, (dword)count);
}
int close(int fd)
{
return Syscall::invoke(Syscall::PosixClose, fd);
}
pid_t waitpid(pid_t waitee)
{
return Syscall::invoke(Syscall::PosixWaitpid, waitee);
}
int lstat(const char* path, stat* statbuf)
{
return Syscall::invoke(Syscall::PosixLstat, (dword)path, (dword)statbuf);
}
}
|