diff options
Diffstat (limited to 'server/file.h')
-rw-r--r-- | server/file.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/server/file.h b/server/file.h new file mode 100644 index 0000000..720cf9b --- /dev/null +++ b/server/file.h @@ -0,0 +1,28 @@ +/* + * server/file.h - Functions to work with files. + */ + + +/* + * Open a file and test it with stat. + * + * Returns: File descriptor on success or -1 on failure. + */ +int file_open(char *filename); + + +/* + * Store in @size the size in bytes of the file pointed to by @fd. + * + * Returns: 0 on success -1 on failure; + * + */ +int file_getsize(int fd, off_t *size); + + +/* + * Copy @size bytes of @fd, starting at @pos, into @buf. + * + * Returns: 0 on success -1 on failure. + */ +int file_read(int fd, void *buf, size_t size, off_t pos); |