diff options
author | Freya Murphy <freya@freyacat.org> | 2025-04-30 10:50:37 -0400 |
---|---|---|
committer | Freya Murphy <freya@freyacat.org> | 2025-04-30 11:25:35 -0400 |
commit | c920ea363635ae03e3c3575271d9acbe29d63e6d (patch) | |
tree | 50b8c0ca17f3973713fd0d9acb9d904e9f8fd1bb /user/include/unistd.h | |
parent | make malloc work (diff) | |
download | comus-c920ea363635ae03e3c3575271d9acbe29d63e6d.tar.gz comus-c920ea363635ae03e3c3575271d9acbe29d63e6d.tar.bz2 comus-c920ea363635ae03e3c3575271d9acbe29d63e6d.zip |
inflate / deflate
Diffstat (limited to 'user/include/unistd.h')
-rw-r--r-- | user/include/unistd.h | 26 |
1 files changed, 25 insertions, 1 deletions
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 @@ -95,6 +109,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 * * @return the pid of this process |