Major reorganization in prep for appserver merge
[akaros.git] / kern / include / frontend.h
1 #ifndef ROS_FRONTEND_H
2 #define ROS_FRONTEND_H
3
4 #include <ros/common.h>
5
6 #ifdef ROS_KERNEL
7
8 #include <env.h>
9 #include <process.h>
10
11 int32_t frontend_syscall_from_user(env_t* p, int32_t syscall_num, 
12                                    uint32_t arg0, uint32_t arg1, 
13                                    uint32_t arg2, uint32_t translate_args);
14
15 int32_t frontend_syscall(pid_t pid, int32_t syscall_num, 
16                          uint32_t arg0, uint32_t arg1, uint32_t arg2, 
17                          uint32_t arg3, int32_t* errno);
18
19 int user_frontend_syscall(struct proc* p, int n, int a0, 
20                           int a1, int a2, int a3);
21
22 int32_t frontend_nbputch(char ch);
23 int32_t frontend_nbgetch();
24
25 void* user_memdup(struct proc* p, const void* va, int len);
26 void* user_memdup_errno(struct proc* p, const void* va, int len);
27 void user_memdup_free(struct proc* p, void* va);
28 char* user_strdup(struct proc* p, const char* va0, int max);
29 char* user_strdup_errno(struct proc* p, const char* va, int max);
30 int memcpy_to_user_errno(struct proc* p, void* dst, const void* src, int len);
31 void* kmalloc_errno(int len);
32
33 error_t read_page(struct proc* p, int fd, physaddr_t pa, int pgoff);
34 error_t open_file(struct proc* p, const char* path, int oflag, int mode);
35 error_t close_file(struct proc* p, int fd);
36
37 #endif
38
39 #define APPSERVER_MAXPATH            1024
40
41 #define APPSERVER_SYSCALL_exit          1
42 #define APPSERVER_SYSCALL_read          3
43 #define APPSERVER_SYSCALL_write         4
44 #define APPSERVER_SYSCALL_open          5
45 #define APPSERVER_SYSCALL_close         6
46 #define APPSERVER_SYSCALL_link          9
47 #define APPSERVER_SYSCALL_unlink       10
48 #define APPSERVER_SYSCALL_chdir        12
49 #define APPSERVER_SYSCALL_chmod        15
50 #define APPSERVER_SYSCALL_brk          17
51 #define APPSERVER_SYSCALL_stat         18
52 #define APPSERVER_SYSCALL_lseek        19
53 #define APPSERVER_SYSCALL_fstat        28
54 #define APPSERVER_SYSCALL_utime        30
55 #define APPSERVER_SYSCALL_access       33
56 #define APPSERVER_SYSCALL_dup          41
57 #define APPSERVER_SYSCALL_umask        60
58 #define APPSERVER_SYSCALL_fcntl        62
59 #define APPSERVER_SYSCALL_lstat        88
60 #define APPSERVER_SYSCALL_tcgetattr    89
61 #define APPSERVER_SYSCALL_tcsetattr    90
62 #define APPSERVER_SYSCALL_closedir     91
63 #define APPSERVER_SYSCALL_rewinddir    92
64 #define APPSERVER_SYSCALL_readdir      93
65 #define APPSERVER_SYSCALL_opendir      94
66 #define APPSERVER_SYSCALL_dup2         95
67 #define APPSERVER_SYSCALL_proc_free    96
68 #define APPSERVER_SYSCALL_proc_init    97
69 #define APPSERVER_SYSCALL_time         98
70 #define APPSERVER_SYSCALL_pread       173
71 #define APPSERVER_SYSCALL_pwrite      174
72 #define APPSERVER_SYSCALL_getcwd      229
73
74 #endif /* !ROS_FRONTEND_H */