aboutsummaryrefslogtreecommitdiff
path: root/pk/file.h
diff options
context:
space:
mode:
authorAndrew Waterman <waterman@s141.Millennium.Berkeley.EDU>2011-06-19 20:47:29 -0700
committerAndrew Waterman <waterman@s141.Millennium.Berkeley.EDU>2011-06-19 20:47:29 -0700
commit0edaecc54329048eb91ad6a45338265ef1a4569c (patch)
treeb0695be27ac3b1e14aa944c4820683fcd8adefca /pk/file.h
parente63e4fbe8794c68e1ad846a36e33cba62e801b34 (diff)
downloadpk-0edaecc54329048eb91ad6a45338265ef1a4569c.zip
pk-0edaecc54329048eb91ad6a45338265ef1a4569c.tar.gz
pk-0edaecc54329048eb91ad6a45338265ef1a4569c.tar.bz2
temporary undoing of renaming
Diffstat (limited to 'pk/file.h')
-rw-r--r--pk/file.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/pk/file.h b/pk/file.h
new file mode 100644
index 0000000..55637a3
--- /dev/null
+++ b/pk/file.h
@@ -0,0 +1,31 @@
+#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);
+void file_decref(file_t*);
+int file_dup(file_t*);
+
+sysret_t file_pwrite(file_t* f, const char* buf, size_t n, off_t off);
+sysret_t file_pread(file_t* f, char* buf, size_t n, off_t off);
+sysret_t file_write(file_t* f, const char* buf, size_t n);
+sysret_t file_read(file_t* f, char* 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();
+
+#endif