file_utils: add lxc_send_nointr()

parent e3233f26
...@@ -106,6 +106,17 @@ again: ...@@ -106,6 +106,17 @@ again:
return ret; return ret;
} }
ssize_t lxc_send_nointr(int sockfd, void *buf, size_t len, int flags)
{
ssize_t ret;
again:
ret = send(sockfd, buf, len, flags);
if (ret < 0 && errno == EINTR)
goto again;
return ret;
}
ssize_t lxc_read_nointr(int fd, void *buf, size_t count) ssize_t lxc_read_nointr(int fd, void *buf, size_t count)
{ {
ssize_t ret; ssize_t ret;
......
...@@ -37,6 +37,7 @@ extern int lxc_read_from_file(const char *filename, void *buf, size_t count); ...@@ -37,6 +37,7 @@ extern int lxc_read_from_file(const char *filename, void *buf, size_t count);
/* send and receive buffers completely */ /* send and receive buffers completely */
extern ssize_t lxc_write_nointr(int fd, const void *buf, size_t count); extern ssize_t lxc_write_nointr(int fd, const void *buf, size_t count);
extern ssize_t lxc_send_nointr(int sockfd, void *buf, size_t len, int flags);
extern ssize_t lxc_read_nointr(int fd, void *buf, size_t count); extern ssize_t lxc_read_nointr(int fd, void *buf, size_t count);
extern ssize_t lxc_read_nointr_expect(int fd, void *buf, size_t count, extern ssize_t lxc_read_nointr_expect(int fd, void *buf, size_t count,
const void *expected_buf); const void *expected_buf);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment