From c920ea363635ae03e3c3575271d9acbe29d63e6d Mon Sep 17 00:00:00 2001 From: Freya Murphy Date: Wed, 30 Apr 2025 10:50:37 -0400 Subject: inflate / deflate --- user/include/unistd.h | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'user/include') diff --git a/user/include/unistd.h b/user/include/unistd.h index f080917..cad3a81 100644 --- a/user/include/unistd.h +++ b/user/include/unistd.h @@ -16,6 +16,20 @@ typedef unsigned short pid_t; +enum { + S_SET = 0, + S_CUR = 1, + S_END = 2, +}; + +enum { + O_CREATE = 0x01, + O_RDONLY = 0x02, + O_WRONLY = 0x04, + O_APPEND = 0x08, + O_RDWR = O_RDONLY | O_WRONLY, +}; + /** * terminates the calling process and does not return. * @@ -65,7 +79,7 @@ extern void exec(const char *filename, char **args); * @param filename - the name of the file to open * @return the file descriptior of the open file or a negative error code. */ -extern int open(const char *filename); +extern int open(const char *filename, int flags); /** * closes a stream with the given file descriptior @@ -94,6 +108,16 @@ extern int read(int fd, void *buffer, size_t nbytes); */ extern int write(int fd, const void *buffer, size_t nbytes); +/** + * seek a file + * + * @param fd - file stream to seek + * @param off - offset to seek + * @param whence - whence to seek + * @return 0 on success, or an error code + */ +extern int seek(int fd, long int off, int whence); + /** * gets the pid of the calling process * -- cgit v1.2.3-freya