diff options
Diffstat (limited to 'misc/subr.h')
| -rw-r--r-- | misc/subr.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/misc/subr.h b/misc/subr.h new file mode 100644 index 0000000..9467839 --- /dev/null +++ b/misc/subr.h @@ -0,0 +1,21 @@ +#ifndef BTPD_SUBR_H +#define BTPD_SUBR_H + +#define min(x, y) ((x) <= (y) ? (x) : (y)) + +int set_nonblocking(int fd); +int set_blocking(int fd); + +int mkdirs(char *path); + +int vopen(int *resfd, int flags, const char *fmt, ...); + +void set_bit(uint8_t *bits, unsigned long index); +int has_bit(uint8_t *bits, unsigned long index); +void clear_bit(uint8_t *bits, unsigned long index); + +int canon_path(const char *path, char **res); + +size_t round_to_page(size_t size); + +#endif |