aboutsummaryrefslogtreecommitdiff
path: root/pk/file.h
diff options
context:
space:
mode:
authorAndrew Waterman <waterman@s141.Millennium.Berkeley.EDU>2010-08-18 18:24:55 -0700
committerAndrew Waterman <waterman@s141.Millennium.Berkeley.EDU>2010-08-18 18:24:55 -0700
commit29cc0dc9854c66f12bd65e12516f68ccd9a741da (patch)
tree23bd8147007d3d0fbb005f578f395e71f7d7d18d /pk/file.h
parente97220c9bf519b8e0f0b131a4f868331c4d526fb (diff)
downloadpk-29cc0dc9854c66f12bd65e12516f68ccd9a741da.zip
pk-29cc0dc9854c66f12bd65e12516f68ccd9a741da.tar.gz
pk-29cc0dc9854c66f12bd65e12516f68ccd9a741da.tar.bz2
[pk,fesvr] improved proxykernel build system
Now uses a modified MCPPBS. Add --host=riscv to configure path. Front-end server now just searches PATH for riscv-pk, so just install the pk to somewhere in your path.
Diffstat (limited to 'pk/file.h')
-rw-r--r--pk/file.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/pk/file.h b/pk/file.h
new file mode 100644
index 0000000..95bf02c
--- /dev/null
+++ b/pk/file.h
@@ -0,0 +1,30 @@
+#ifndef _FILE_H
+#define _FILE_H
+
+#include <sys/stat.h>
+#include <machine/syscall.h>
+#include "atomic.h"
+
+typedef struct file
+{
+ int kfd; // file descriptor on the appserver side
+ atomic_t refcnt;
+} file_t;
+
+extern file_t *stdin, *stdout, *stderr;
+
+file_t* file_get(int fd);
+sysret_t file_open(const char* fn, size_t len, int flags, int mode);
+int file_dup(file_t*);
+
+sysret_t file_write(file_t* f, const void* buf, size_t n);
+sysret_t file_read(file_t* f, void* buf, size_t n);
+sysret_t file_stat(file_t* f, struct stat* s);
+sysret_t file_lseek(file_t* f, size_t ptr, int dir);
+int fd_close(int fd);
+
+void file_init();
+
+#define cons_write(buf,sz) file_write(stdout,buf,sz)
+
+#endif