Change copyright year to 2013.
[paraslash.git] / fd.h
1 /*
2 * Copyright (C) 2006-2013 Andre Noll <maan@systemlinux.org>
3 *
4 * Licensed under the GPL v2. For licencing details see COPYING.
5 */
6
7 /** \file fd.h exported symbols from fd.c */
8
9 int write_all(int fd, const char *buf, size_t len);
10 __printf_2_3 int write_va_buffer(int fd, const char *fmt, ...);
11 int file_exists(const char *);
12 int para_select(int n, fd_set *readfds, fd_set *writefds,
13 struct timeval *timeout_tv);
14 __must_check int mark_fd_nonblocking(int fd);
15 __must_check int mark_fd_blocking(int fd);
16 void para_fd_set(int fd, fd_set *fds, int *max_fileno);
17 __must_check int para_fgets(char *line, int size, FILE *f);
18 int para_mmap(size_t length, int prot, int flags, int fd, off_t offset,
19 void *map);
20 int para_open(const char *path, int flags, mode_t mode);
21 int para_mkdir(const char *path, mode_t mode);
22 int para_chdir(const char *path);
23 int mmap_full_file(const char *filename, int open_mode, void **map,
24 size_t *size, int *fd_ptr);
25 int para_munmap(void *start, size_t length);
26 int write_ok(int fd);
27 void valid_fd_012(void);
28 int readv_nonblock(int fd, struct iovec *iov, int iovcnt, fd_set *rfds,
29 size_t *num_bytes);
30 int read_nonblock(int fd, void *buf, size_t sz, fd_set *rfds, size_t *num_bytes);
31 int read_pattern(int fd, const char *pattern, size_t bufsize, fd_set *rfds);
32 int xwrite(int fd, const char *buf, size_t len);
33 int xwritev(int fd, struct iovec *iov, int iovcnt);
34 int for_each_file_in_dir(const char *dirname,
35 int (*func)(const char *, void *), void *private_data);
36 /**
37 * Write a \p NULL-terminated buffer.
38 *
39 * \param fd The file descriptor.
40 * \param buf The null-terminated buffer to be send.
41 *
42 * This is equivalent to write_all(fd, buf, strlen(buf)).
43 *
44 * \return Standard.
45 */
46 _static_inline_ int write_buffer(int fd, const char *buf)
47 {
48 return write_all(fd, buf, strlen(buf));
49 }