Rework some of the RPC service bits and add boot support

This commit is contained in:
Simon Fels 2016-07-04 12:10:31 +02:00
commit 1879e634c5
39 changed files with 746 additions and 106 deletions

View file

@ -23,6 +23,9 @@
#include <unistd.h>
#include <errno.h>
#define LOG_TAG "Anbox"
#include <cutils/log.h>
namespace {
bool socket_error_is_transient(int error_code) {
return (error_code == EINTR);
@ -30,7 +33,6 @@ bool socket_error_is_transient(int error_code) {
}
namespace anbox {
namespace android {
LocalSocketConnection::LocalSocketConnection(const std::string &path) :
fd_(Fd::invalid) {
@ -52,12 +54,15 @@ LocalSocketConnection::~LocalSocketConnection() {
ssize_t LocalSocketConnection::read_all(std::uint8_t *buffer, const size_t &size) {
ssize_t bytes_read = ::recv(fd_, reinterpret_cast<void*>(buffer), size, 0);
ALOGI("Read %d bytes", bytes_read);
return bytes_read;
}
void LocalSocketConnection::send(char const* data, size_t length) {
size_t bytes_written{0};
ALOGI("Writing %d bytes", length);
while(bytes_written < length) {
ssize_t const result = ::send(fd_,
data + bytes_written,
@ -73,5 +78,4 @@ void LocalSocketConnection::send(char const* data, size_t length) {
bytes_written += result;
}
}
} // namespace android
} // namespace anbox