VFS: mounts KFS, shell functions
[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 <vfs.h>
10 #include <process.h>
11
12 // Default APPSERVER_ETH_TYPE if not defined externally
13 #ifndef APPSERVER_ETH_TYPE
14 #define APPSERVER_ETH_TYPE 0x8888
15 #endif
16
17 void frontend_proc_init(struct proc* p);
18 void frontend_proc_free(struct proc* p);
19
20 int32_t frontend_syscall(pid_t pid, int32_t syscall_num, 
21                          uint32_t arg0, uint32_t arg1, uint32_t arg2, 
22                          uint32_t arg3, int32_t* errno);
23
24 int frontend_syscall_errno(struct proc* p, int n, int a0, 
25                            int a1, int a2, int a3);
26
27 void* user_memdup(struct proc* p, const void* va, int len);
28 void* user_memdup_errno(struct proc* p, const void* va, int len);
29 void user_memdup_free(struct proc* p, void* va);
30 char* user_strdup(struct proc* p, const char* va0, int max);
31 char* user_strdup_errno(struct proc* p, const char* va, int max);
32 int memcpy_to_user_errno(struct proc* p, void* dst, const void* src, int len);
33 void* kmalloc_errno(int len);
34
35 void file_init(void);
36 error_t file_read_page(struct file* f, physaddr_t pa, size_t pgoff);
37 struct file* file_open(const char* path, int oflag, int mode);
38 struct file* file_open_from_fd(struct proc* p, int fd);
39 void file_incref(struct file* f);
40 void file_decref(struct file* f);
41
42 #endif
43
44 #define APPSERVER_MAXPATH            1024
45
46 #define APPSERVER_SYSCALL_exit          1
47 #define APPSERVER_SYSCALL_read          3
48 #define APPSERVER_SYSCALL_write         4
49 #define APPSERVER_SYSCALL_open          5
50 #define APPSERVER_SYSCALL_close         6
51 #define APPSERVER_SYSCALL_link          9
52 #define APPSERVER_SYSCALL_unlink       10
53 #define APPSERVER_SYSCALL_chdir        12
54 #define APPSERVER_SYSCALL_chmod        15
55 #define APPSERVER_SYSCALL_brk          17
56 #define APPSERVER_SYSCALL_stat         18
57 #define APPSERVER_SYSCALL_lseek        19
58 #define APPSERVER_SYSCALL_fstat        28
59 #define APPSERVER_SYSCALL_utime        30
60 #define APPSERVER_SYSCALL_access       33
61 #define APPSERVER_SYSCALL_dup          41
62 #define APPSERVER_SYSCALL_umask        60
63 #define APPSERVER_SYSCALL_fcntl        62
64 #define APPSERVER_SYSCALL_kdup         87
65 #define APPSERVER_SYSCALL_lstat        88
66 #define APPSERVER_SYSCALL_tcgetattr    89
67 #define APPSERVER_SYSCALL_tcsetattr    90
68 #define APPSERVER_SYSCALL_closedir     91
69 #define APPSERVER_SYSCALL_rewinddir    92
70 #define APPSERVER_SYSCALL_readdir      93
71 #define APPSERVER_SYSCALL_opendir      94
72 #define APPSERVER_SYSCALL_dup2         95
73 #define APPSERVER_SYSCALL_proc_free    96
74 #define APPSERVER_SYSCALL_proc_init    97
75 #define APPSERVER_SYSCALL_time         98
76 #define APPSERVER_SYSCALL_pread       173
77 #define APPSERVER_SYSCALL_pwrite      174
78 #define APPSERVER_SYSCALL_getcwd      229
79
80 #endif /* !ROS_FRONTEND_H */