summary refs log tree commit diff
path: root/misc/subr.h
blob: 946783908eb962f2a4b50e6ea8f3d7a9a198e6ee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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