summaryrefslogtreecommitdiffstats
path: root/src/server/sendfile.h
blob: e4cc5b7044543d84762539db6c3263da3d120ce2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#ifndef SENDFILE_H_
#define SENDFILE_H_

#include <stdbool.h>
#include <stddef.h>
#include <sys/types.h>

/**
 * Platform-agnostic wrapper around sendfile, with retry logic.
 * @param fd file to read from
 * @param sock socket to write to
 * @param foffset offset in file to start reading from
 * @param bytes number of bytes to read/send
 * @return true on success
 */
bool sendfile_all(int fd, int sock, off_t foffset, size_t bytes);

#endif