29 static FILE *_send, *_recv;
33 static ssize_t readn(
int fd,
void *buf,
size_t count)
37 while (total < count) {
38 ssize_t n = read(fd, (
char *)buf + total, count - total);
50 static ssize_t writen(
int fd,
const void *buf,
size_t count)
54 while (total < count) {
55 ssize_t n = write(fd, (
const char *)buf + total, count - total);
92 return fwrite(buf, 1, size, _send) == size;
94 return writen(fileno(_send), buf, size) == size;
96 return write(fileno(_send), buf, size) == size;
103 #ifdef USE_BUFFERED_IO 106 return fread(buf, 1, size, _recv) == size;
108 return readn(fileno(_recv), buf, size) == size;
110 return read(fileno(_recv), buf, size) == size;
int db__recv(void *buf, size_t size)
void db__set_protocol_fds(FILE *send, FILE *recv)
?
int db__send(const void *buf, size_t size)
?