summaryrefslogtreecommitdiffstats
path: root/server/file.h
blob: 720cf9be167daf2bd41251506f4b9b6c0816f9a7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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);