summaryrefslogtreecommitdiffstats
path: root/native_client_sdk
diff options
context:
space:
mode:
authorsbc@chromium.org <sbc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-30 22:39:40 +0000
committersbc@chromium.org <sbc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-30 22:39:40 +0000
commite5c3668e3a528c5b0684dd1b34c4908e836950ff (patch)
tree06b692bce4e6faddf4360c966727c8fe8e8f891c /native_client_sdk
parentf39c6f2dc2643ec53ae0188cbc67155a8a5bf654 (diff)
downloadchromium_src-e5c3668e3a528c5b0684dd1b34c4908e836950ff.zip
chromium_src-e5c3668e3a528c5b0684dd1b34c4908e836950ff.tar.gz
chromium_src-e5c3668e3a528c5b0684dd1b34c4908e836950ff.tar.bz2
[NaCl SDK] nacl_io: Run clang-format over nacl_io sources.
This change contains most of the changes that clang-format wanted to make to nacl_io. I left out a few that we not obviously better, mostly related to complex PPAPI macros. R=binji@chromium.org, binji BUG= Review URL: https://codereview.chromium.org/303223007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@273918 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'native_client_sdk')
-rw-r--r--native_client_sdk/src/libraries/nacl_io/devfs/dev_fs.cc31
-rw-r--r--native_client_sdk/src/libraries/nacl_io/devfs/jspipe_event_emitter.cc52
-rw-r--r--native_client_sdk/src/libraries/nacl_io/devfs/jspipe_event_emitter.h8
-rw-r--r--native_client_sdk/src/libraries/nacl_io/devfs/jspipe_node.cc8
-rw-r--r--native_client_sdk/src/libraries/nacl_io/devfs/jspipe_node.h4
-rw-r--r--native_client_sdk/src/libraries/nacl_io/devfs/tty_node.cc6
-rw-r--r--native_client_sdk/src/libraries/nacl_io/dir_node.cc4
-rw-r--r--native_client_sdk/src/libraries/nacl_io/event_emitter.cc3
-rw-r--r--native_client_sdk/src/libraries/nacl_io/event_emitter.h2
-rw-r--r--native_client_sdk/src/libraries/nacl_io/event_listener.cc10
-rw-r--r--native_client_sdk/src/libraries/nacl_io/event_listener.h5
-rw-r--r--native_client_sdk/src/libraries/nacl_io/fifo_char.cc5
-rw-r--r--native_client_sdk/src/libraries/nacl_io/fifo_char.h2
-rw-r--r--native_client_sdk/src/libraries/nacl_io/filesystem.cc9
-rw-r--r--native_client_sdk/src/libraries/nacl_io/fuse.h38
-rw-r--r--native_client_sdk/src/libraries/nacl_io/fusefs/fuse_fs.cc12
-rw-r--r--native_client_sdk/src/libraries/nacl_io/fusefs/fuse_fs_factory.cc3
-rw-r--r--native_client_sdk/src/libraries/nacl_io/host_resolver.cc17
-rw-r--r--native_client_sdk/src/libraries/nacl_io/host_resolver.h12
-rw-r--r--native_client_sdk/src/libraries/nacl_io/html5fs/html5_fs.cc18
-rw-r--r--native_client_sdk/src/libraries/nacl_io/html5fs/html5_fs_node.cc15
-rw-r--r--native_client_sdk/src/libraries/nacl_io/httpfs/http_fs.cc6
-rw-r--r--native_client_sdk/src/libraries/nacl_io/httpfs/http_fs_node.cc15
-rw-r--r--native_client_sdk/src/libraries/nacl_io/include/sys/mount.h9
-rw-r--r--native_client_sdk/src/libraries/nacl_io/include/sys/poll.h2
-rw-r--r--native_client_sdk/src/libraries/nacl_io/include/sys/termios.h15
-rw-r--r--native_client_sdk/src/libraries/nacl_io/include/sys/utsname.h2
-rw-r--r--native_client_sdk/src/libraries/nacl_io/ioctl.h1
-rw-r--r--native_client_sdk/src/libraries/nacl_io/kernel_handle.cc14
-rw-r--r--native_client_sdk/src/libraries/nacl_io/kernel_handle.h1
-rw-r--r--native_client_sdk/src/libraries/nacl_io/kernel_intercept.cc91
-rw-r--r--native_client_sdk/src/libraries/nacl_io/kernel_intercept.h65
-rw-r--r--native_client_sdk/src/libraries/nacl_io/kernel_object.cc12
-rw-r--r--native_client_sdk/src/libraries/nacl_io/kernel_object.h10
-rw-r--r--native_client_sdk/src/libraries/nacl_io/kernel_proxy.h59
-rw-r--r--native_client_sdk/src/libraries/nacl_io/kernel_wrap.h27
-rw-r--r--native_client_sdk/src/libraries/nacl_io/kernel_wrap_bionic.cc120
-rw-r--r--native_client_sdk/src/libraries/nacl_io/kernel_wrap_dummy.cc14
-rw-r--r--native_client_sdk/src/libraries/nacl_io/kernel_wrap_glibc.cc167
-rw-r--r--native_client_sdk/src/libraries/nacl_io/kernel_wrap_newlib.cc91
-rw-r--r--native_client_sdk/src/libraries/nacl_io/kernel_wrap_real.h14
-rw-r--r--native_client_sdk/src/libraries/nacl_io/memfs/mem_fs.cc3
-rw-r--r--native_client_sdk/src/libraries/nacl_io/memfs/mem_fs_node.cc3
-rw-r--r--native_client_sdk/src/libraries/nacl_io/nacl_io.cc6
-rw-r--r--native_client_sdk/src/libraries/nacl_io/node.cc71
-rw-r--r--native_client_sdk/src/libraries/nacl_io/ostermios.h5
-rw-r--r--native_client_sdk/src/libraries/nacl_io/ostime.h7
-rw-r--r--native_client_sdk/src/libraries/nacl_io/passthroughfs/passthrough_fs.cc6
-rw-r--r--native_client_sdk/src/libraries/nacl_io/path.cc43
-rw-r--r--native_client_sdk/src/libraries/nacl_io/path.h3
-rw-r--r--native_client_sdk/src/libraries/nacl_io/pepper/all_interfaces.h1
-rw-r--r--native_client_sdk/src/libraries/nacl_io/pepper_interface.cc6
-rw-r--r--native_client_sdk/src/libraries/nacl_io/pepper_interface.h5
-rw-r--r--native_client_sdk/src/libraries/nacl_io/pepper_interface_delegate.cc3
-rw-r--r--native_client_sdk/src/libraries/nacl_io/pepper_interface_delegate.h6
-rw-r--r--native_client_sdk/src/libraries/nacl_io/pepper_interface_dummy.h2
-rw-r--r--native_client_sdk/src/libraries/nacl_io/pipe/pipe_event_emitter.cc3
-rw-r--r--native_client_sdk/src/libraries/nacl_io/real_pepper_interface.cc7
-rw-r--r--native_client_sdk/src/libraries/nacl_io/real_pepper_interface.h6
-rw-r--r--native_client_sdk/src/libraries/nacl_io/socket/fifo_packet.cc15
-rw-r--r--native_client_sdk/src/libraries/nacl_io/socket/packet.cc3
-rw-r--r--native_client_sdk/src/libraries/nacl_io/socket/socket_node.cc8
-rw-r--r--native_client_sdk/src/libraries/nacl_io/socket/tcp_event_emitter.cc7
-rw-r--r--native_client_sdk/src/libraries/nacl_io/socket/tcp_node.cc4
-rw-r--r--native_client_sdk/src/libraries/nacl_io/socket/udp_node.cc4
-rw-r--r--native_client_sdk/src/libraries/nacl_io/stream/stream_event_emitter.cc3
-rw-r--r--native_client_sdk/src/libraries/nacl_io/stream/stream_fs.cc24
-rw-r--r--native_client_sdk/src/libraries/nacl_io/stream/stream_node.cc17
-rw-r--r--native_client_sdk/src/libraries/nacl_io/syscalls/inet_ntop.cc9
69 files changed, 770 insertions, 509 deletions
diff --git a/native_client_sdk/src/libraries/nacl_io/devfs/dev_fs.cc b/native_client_sdk/src/libraries/nacl_io/devfs/dev_fs.cc
index a88021d..9b50c90 100644
--- a/native_client_sdk/src/libraries/nacl_io/devfs/dev_fs.cc
+++ b/native_client_sdk/src/libraries/nacl_io/devfs/dev_fs.cc
@@ -159,7 +159,9 @@ Error RealNode::Write(const HandleAttr& attr,
return 0;
}
-Error RealNode::GetStat(struct stat* stat) { return _real_fstat(fd_, stat); }
+Error RealNode::GetStat(struct stat* stat) {
+ return _real_fstat(fd_, stat);
+}
Error NullNode::Read(const HandleAttr& attr,
void* buf,
@@ -178,7 +180,8 @@ Error NullNode::Write(const HandleAttr& attr,
}
ConsoleNode::ConsoleNode(Filesystem* filesystem, PP_LogLevel level)
- : CharNode(filesystem), level_(level) {}
+ : CharNode(filesystem), level_(level) {
+}
Error ConsoleNode::Write(const HandleAttr& attr,
const void* buf,
@@ -317,15 +320,25 @@ Error DevFs::Open(const Path& path, int open_flags, ScopedNode* out_node) {
return error;
}
-Error DevFs::Unlink(const Path& path) { return EPERM; }
+Error DevFs::Unlink(const Path& path) {
+ return EPERM;
+}
-Error DevFs::Mkdir(const Path& path, int permissions) { return EPERM; }
+Error DevFs::Mkdir(const Path& path, int permissions) {
+ return EPERM;
+}
-Error DevFs::Rmdir(const Path& path) { return EPERM; }
+Error DevFs::Rmdir(const Path& path) {
+ return EPERM;
+}
-Error DevFs::Remove(const Path& path) { return EPERM; }
+Error DevFs::Remove(const Path& path) {
+ return EPERM;
+}
-Error DevFs::Rename(const Path& path, const Path& newpath) { return EPERM; }
+Error DevFs::Rename(const Path& path, const Path& newpath) {
+ return EPERM;
+}
Error DevFs::CreateFsNode(Filesystem* other_fs) {
int dev = other_fs->dev();
@@ -342,8 +355,8 @@ Error DevFs::DestroyFsNode(Filesystem* other_fs) {
return fs_dir_->RemoveChild(path);
}
-
-DevFs::DevFs() {}
+DevFs::DevFs() {
+}
#define INITIALIZE_DEV_NODE(path, klass) \
new_node = ScopedNode(new klass(this)); \
diff --git a/native_client_sdk/src/libraries/nacl_io/devfs/jspipe_event_emitter.cc b/native_client_sdk/src/libraries/nacl_io/devfs/jspipe_event_emitter.cc
index cc39414..bff2c7b 100644
--- a/native_client_sdk/src/libraries/nacl_io/devfs/jspipe_event_emitter.cc
+++ b/native_client_sdk/src/libraries/nacl_io/devfs/jspipe_event_emitter.cc
@@ -11,16 +11,16 @@
#include <algorithm>
#define TRACE(format, ...) \
- LOG_TRACE("jspipe[%s]: " format, name_.c_str(), ##__VA_ARGS__)
+ LOG_TRACE("jspipe[%s]: " format, name_.c_str(), ##__VA_ARGS__)
#define ERROR(format, ...) \
- LOG_ERROR("jspipe[%s]: " format, name_.c_str(), ##__VA_ARGS__)
+ LOG_ERROR("jspipe[%s]: " format, name_.c_str(), ##__VA_ARGS__)
#include "nacl_io/log.h"
#include "nacl_io/osinttypes.h"
#include "nacl_io/pepper_interface.h"
namespace {
-const size_t kMaxPostMessageSize = 64*1024;
+const size_t kMaxPostMessageSize = 64 * 1024;
const char* kDictKeyPipe = "pipe";
const char* kDictKeyOperation = "operation";
const char* kDictKeyPayload = "payload";
@@ -31,23 +31,23 @@ const char* kOperationNameWrite = "write";
namespace nacl_io {
JSPipeEventEmitter::JSPipeEventEmitter(PepperInterface* ppapi, size_t size)
- : input_fifo_(size),
- post_message_buffer_size_(size),
- bytes_sent_(0),
- bytes_acked_(0),
- bytes_read_(0),
- ppapi_(ppapi),
- messaging_iface_(NULL),
- var_iface_(NULL),
- array_iface_(NULL),
- buffer_iface_(NULL),
- dict_iface_(NULL),
- pipe_name_var_(PP_MakeUndefined()),
- pipe_key_(PP_MakeUndefined()),
- operation_key_(PP_MakeUndefined()),
- payload_key_(PP_MakeUndefined()),
- write_var_(PP_MakeUndefined()),
- ack_var_(PP_MakeUndefined()) {
+ : input_fifo_(size),
+ post_message_buffer_size_(size),
+ bytes_sent_(0),
+ bytes_acked_(0),
+ bytes_read_(0),
+ ppapi_(ppapi),
+ messaging_iface_(NULL),
+ var_iface_(NULL),
+ array_iface_(NULL),
+ buffer_iface_(NULL),
+ dict_iface_(NULL),
+ pipe_name_var_(PP_MakeUndefined()),
+ pipe_key_(PP_MakeUndefined()),
+ operation_key_(PP_MakeUndefined()),
+ payload_key_(PP_MakeUndefined()),
+ write_var_(PP_MakeUndefined()),
+ ack_var_(PP_MakeUndefined()) {
UpdateStatus_Locked();
if (ppapi == NULL) {
TRACE("missing PPAPI provider");
@@ -111,7 +111,7 @@ Error JSPipeEventEmitter::Read_Locked(char* data, size_t len, int* out_bytes) {
}
Error JSPipeEventEmitter::SendWriteMessage(const void* buf, size_t count) {
- TRACE("SendWriteMessage [%"PRIuS"] total=%"PRIuS, count, bytes_sent_);
+ TRACE("SendWriteMessage [%" PRIuS "] total=%" PRIuS, count, bytes_sent_);
if (!var_iface_ || !buffer_iface_)
return EIO;
@@ -143,8 +143,7 @@ Error JSPipeEventEmitter::SetName(const char* name) {
return 0;
}
-Error JSPipeEventEmitter::SendMessageToJS(PP_Var operation,
- PP_Var payload) {
+Error JSPipeEventEmitter::SendMessageToJS(PP_Var operation, PP_Var payload) {
if (!ppapi_ || !messaging_iface_ || !var_iface_ || !dict_iface_)
return EIO;
@@ -165,7 +164,7 @@ Error JSPipeEventEmitter::SendMessageToJS(PP_Var operation,
}
Error JSPipeEventEmitter::SendAckMessage(size_t byte_count) {
- TRACE("SendAckMessage %"PRIuS, byte_count);
+ TRACE("SendAckMessage %" PRIuS, byte_count);
PP_Var payload;
payload.type = PP_VARTYPE_INT32;
payload.value.as_int = (int32_t)byte_count;
@@ -181,7 +180,7 @@ size_t JSPipeEventEmitter::HandleJSWrite(const char* data, size_t len) {
void JSPipeEventEmitter::HandleJSAck(size_t byte_count) {
if (byte_count > bytes_sent_) {
- ERROR("HandleAck unexpected byte count: %"PRIuS, byte_count);
+ ERROR("HandleAck unexpected byte count: %" PRIuS, byte_count);
return;
}
@@ -281,7 +280,8 @@ Error JSPipeEventEmitter::HandleJSMessage(struct PP_Var message) {
return err;
}
-Error JSPipeEventEmitter::Write_Locked(const char* data, size_t len,
+Error JSPipeEventEmitter::Write_Locked(const char* data,
+ size_t len,
int* out_bytes) {
if (GetOSpace() == 0) {
*out_bytes = 0;
diff --git a/native_client_sdk/src/libraries/nacl_io/devfs/jspipe_event_emitter.h b/native_client_sdk/src/libraries/nacl_io/devfs/jspipe_event_emitter.h
index 3935699..7dc7398 100644
--- a/native_client_sdk/src/libraries/nacl_io/devfs/jspipe_event_emitter.h
+++ b/native_client_sdk/src/libraries/nacl_io/devfs/jspipe_event_emitter.h
@@ -38,8 +38,12 @@ class JSPipeEventEmitter : public EventEmitter {
Error Read_Locked(char* data, size_t len, int* out_bytes);
Error Write_Locked(const char* data, size_t len, int* out_bytes);
- size_t GetOSpace() { return post_message_buffer_size_ - BytesOutstanding(); };
- size_t GetISpace() { return input_fifo_.WriteAvailable(); };
+ size_t GetOSpace() {
+ return post_message_buffer_size_ - BytesOutstanding();
+ };
+ size_t GetISpace() {
+ return input_fifo_.WriteAvailable();
+ };
Error SetName(const char* name);
Error HandleJSMessage(PP_Var message);
diff --git a/native_client_sdk/src/libraries/nacl_io/devfs/jspipe_node.cc b/native_client_sdk/src/libraries/nacl_io/devfs/jspipe_node.cc
index 5e457f33..1cb6268 100644
--- a/native_client_sdk/src/libraries/nacl_io/devfs/jspipe_node.cc
+++ b/native_client_sdk/src/libraries/nacl_io/devfs/jspipe_node.cc
@@ -17,15 +17,15 @@
#define ERROR(format, ...) LOG_TRACE("jspipe: " format, ##__VA_ARGS__)
namespace {
-const size_t kPostMessageBufferSize = 512*1024;
+const size_t kPostMessageBufferSize = 512 * 1024;
}
namespace nacl_io {
JSPipeNode::JSPipeNode(Filesystem* filesystem)
- : Node(filesystem),
- pipe_(new JSPipeEventEmitter(filesystem_->ppapi(), kPostMessageBufferSize))
-{
+ : Node(filesystem),
+ pipe_(new JSPipeEventEmitter(filesystem_->ppapi(),
+ kPostMessageBufferSize)) {
}
JSPipeEventEmitter* JSPipeNode::GetEventEmitter() {
diff --git a/native_client_sdk/src/libraries/nacl_io/devfs/jspipe_node.h b/native_client_sdk/src/libraries/nacl_io/devfs/jspipe_node.h
index e770b0fa..c1bd820 100644
--- a/native_client_sdk/src/libraries/nacl_io/devfs/jspipe_node.h
+++ b/native_client_sdk/src/libraries/nacl_io/devfs/jspipe_node.h
@@ -44,7 +44,9 @@ class JSPipeNode : public Node {
public:
explicit JSPipeNode(Filesystem* filesystem);
- virtual void Destroy() { LOG_TRACE("JSPipeNode: Destroy"); };
+ virtual void Destroy() {
+ LOG_TRACE("JSPipeNode: Destroy");
+ }
virtual JSPipeEventEmitter* GetEventEmitter();
diff --git a/native_client_sdk/src/libraries/nacl_io/devfs/tty_node.cc b/native_client_sdk/src/libraries/nacl_io/devfs/tty_node.cc
index e3f57ed..211451f 100644
--- a/native_client_sdk/src/libraries/nacl_io/devfs/tty_node.cc
+++ b/native_client_sdk/src/libraries/nacl_io/devfs/tty_node.cc
@@ -21,7 +21,7 @@
#include "nacl_io/pepper_interface.h"
#include "sdk_util/auto_lock.h"
-#define CHECK_LFLAG(TERMIOS, FLAG) (TERMIOS.c_lflag & FLAG)
+#define CHECK_LFLAG(TERMIOS, FLAG) (TERMIOS.c_lflag& FLAG)
#define IS_ECHO CHECK_LFLAG(termios_, ECHO)
#define IS_ECHOE CHECK_LFLAG(termios_, ECHOE)
@@ -76,7 +76,9 @@ void TtyNode::InitTermios() {
termios_.c_cc[VEOL2] = 0;
}
-EventEmitter* TtyNode::GetEventEmitter() { return emitter_.get(); }
+EventEmitter* TtyNode::GetEventEmitter() {
+ return emitter_.get();
+}
Error TtyNode::Write(const HandleAttr& attr,
const void* buf,
diff --git a/native_client_sdk/src/libraries/nacl_io/dir_node.cc b/native_client_sdk/src/libraries/nacl_io/dir_node.cc
index d5edcea..0486198 100644
--- a/native_client_sdk/src/libraries/nacl_io/dir_node.cc
+++ b/native_client_sdk/src/libraries/nacl_io/dir_node.cc
@@ -43,7 +43,9 @@ Error DirNode::Read(const HandleAttr& attr,
return EISDIR;
}
-Error DirNode::FTruncate(off_t size) { return EISDIR; }
+Error DirNode::FTruncate(off_t size) {
+ return EISDIR;
+}
Error DirNode::Write(const HandleAttr& attr,
const void* buf,
diff --git a/native_client_sdk/src/libraries/nacl_io/event_emitter.cc b/native_client_sdk/src/libraries/nacl_io/event_emitter.cc
index a135971..2e620bc 100644
--- a/native_client_sdk/src/libraries/nacl_io/event_emitter.cc
+++ b/native_client_sdk/src/libraries/nacl_io/event_emitter.cc
@@ -18,7 +18,8 @@ bool operator<(const ScopedEventEmitter& src_a,
return src_a.get() < src_b.get();
}
-EventEmitter::EventEmitter() : event_status_(0) {}
+EventEmitter::EventEmitter() : event_status_(0) {
+}
void EventEmitter::RegisterListener(EventListener* listener, uint32_t events) {
AUTO_LOCK(emitter_lock_);
diff --git a/native_client_sdk/src/libraries/nacl_io/event_emitter.h b/native_client_sdk/src/libraries/nacl_io/event_emitter.h
index d6d7a32..07d0262f 100644
--- a/native_client_sdk/src/libraries/nacl_io/event_emitter.h
+++ b/native_client_sdk/src/libraries/nacl_io/event_emitter.h
@@ -23,7 +23,6 @@ namespace nacl_io {
class EventEmitter;
class EventListener;
-
typedef sdk_util::ScopedRef<EventEmitter> ScopedEventEmitter;
typedef std::map<EventListener*, uint32_t> EventListenerMap_t;
@@ -78,5 +77,4 @@ class EventEmitter : public sdk_util::RefObject {
} // namespace nacl_io
-
#endif // LIBRARIES_NACL_IO_EVENT_EMITTER_H_
diff --git a/native_client_sdk/src/libraries/nacl_io/event_listener.cc b/native_client_sdk/src/libraries/nacl_io/event_listener.cc
index c034147..773b1df 100644
--- a/native_client_sdk/src/libraries/nacl_io/event_listener.cc
+++ b/native_client_sdk/src/libraries/nacl_io/event_listener.cc
@@ -55,7 +55,7 @@ EventListener::~EventListener() {
static void AbsoluteFromDeltaMS(struct timespec* timeout, int ms_timeout) {
if (ms_timeout >= 0) {
uint64_t usec = usec_since_epoch();
- usec += ((int64_t) ms_timeout * 1000);
+ usec += ((int64_t)ms_timeout * 1000);
timeout->tv_nsec = (usec % 1000000) * 1000;
timeout->tv_sec = (usec / 1000000);
@@ -65,7 +65,6 @@ static void AbsoluteFromDeltaMS(struct timespec* timeout, int ms_timeout) {
}
}
-
EventListenerLock::EventListenerLock(EventEmitter* emitter)
: EventListener(),
emitter_(emitter),
@@ -77,8 +76,7 @@ EventListenerLock::~EventListenerLock() {
delete lock_;
}
-void EventListenerLock::ReceiveEvents(EventEmitter* emitter,
- uint32_t events) {
+void EventListenerLock::ReceiveEvents(EventEmitter* emitter, uint32_t events) {
// We are using the emitter's mutex, which is already locked.
pthread_cond_signal(&signal_cond_);
}
@@ -113,8 +111,7 @@ Error EventListenerLock::WaitOnEvent(uint32_t events, int ms_timeout) {
return 0;
}
-void EventListenerPoll::ReceiveEvents(EventEmitter* emitter,
- uint32_t events) {
+void EventListenerPoll::ReceiveEvents(EventEmitter* emitter, uint32_t events) {
AUTO_LOCK(signal_lock_);
emitters_[emitter]->events |= events;
signaled_++;
@@ -124,7 +121,6 @@ void EventListenerPoll::ReceiveEvents(EventEmitter* emitter,
Error EventListenerPoll::WaitOnAny(EventRequest* requests,
size_t cnt,
int ms_timeout) {
-
signaled_ = 0;
// Build a map of request emitters to request data before
diff --git a/native_client_sdk/src/libraries/nacl_io/event_listener.h b/native_client_sdk/src/libraries/nacl_io/event_listener.h
index 4b9647a..679f4ff 100644
--- a/native_client_sdk/src/libraries/nacl_io/event_listener.h
+++ b/native_client_sdk/src/libraries/nacl_io/event_listener.h
@@ -78,7 +78,6 @@ struct EventRequest {
uint32_t events;
};
-
class EventListener;
class EventListenerGroup;
class EventListenerSingle;
@@ -104,7 +103,6 @@ class EventListener {
DISALLOW_COPY_AND_ASSIGN(EventListener);
};
-
// EventListenerLock
//
// On construction, references and locks the emitter. WaitOnEvent will
@@ -130,14 +128,13 @@ class EventListenerLock : public EventListener {
// EINTR if the wait was interrupted.
Error WaitOnEvent(uint32_t events, int ms_max);
-private:
+ private:
EventEmitter* emitter_;
sdk_util::AutoLock* lock_;
uint32_t events_;
DISALLOW_COPY_AND_ASSIGN(EventListenerLock);
};
-
class EventListenerPoll : public EventListener {
public:
EventListenerPoll() : EventListener(), signaled_(0) {}
diff --git a/native_client_sdk/src/libraries/nacl_io/fifo_char.cc b/native_client_sdk/src/libraries/nacl_io/fifo_char.cc
index ba886cf..5624555 100644
--- a/native_client_sdk/src/libraries/nacl_io/fifo_char.cc
+++ b/native_client_sdk/src/libraries/nacl_io/fifo_char.cc
@@ -12,10 +12,7 @@
namespace nacl_io {
FIFOChar::FIFOChar(size_t size)
- : buffer_(NULL),
- size_(size),
- avail_(0),
- tail_(0) {
+ : buffer_(NULL), size_(size), avail_(0), tail_(0) {
if (size)
buffer_ = new char[size];
}
diff --git a/native_client_sdk/src/libraries/nacl_io/fifo_char.h b/native_client_sdk/src/libraries/nacl_io/fifo_char.h
index 2f43db6..27cec2f 100644
--- a/native_client_sdk/src/libraries/nacl_io/fifo_char.h
+++ b/native_client_sdk/src/libraries/nacl_io/fifo_char.h
@@ -40,7 +40,7 @@ class FIFOChar : public FIFOInterface {
// written.
size_t Write(const void* buf, size_t len);
-private:
+ private:
char* buffer_;
size_t size_; // Size of the FIFO
size_t avail_; // How much data is currently available
diff --git a/native_client_sdk/src/libraries/nacl_io/filesystem.cc b/native_client_sdk/src/libraries/nacl_io/filesystem.cc
index 7a2b1a0..b823ab6 100644
--- a/native_client_sdk/src/libraries/nacl_io/filesystem.cc
+++ b/native_client_sdk/src/libraries/nacl_io/filesystem.cc
@@ -21,9 +21,11 @@
namespace nacl_io {
-Filesystem::Filesystem() : dev_(0) {}
+Filesystem::Filesystem() : dev_(0) {
+}
-Filesystem::~Filesystem() {}
+Filesystem::~Filesystem() {
+}
Error Filesystem::Init(const FsInitArgs& args) {
dev_ = args.dev;
@@ -31,7 +33,8 @@ Error Filesystem::Init(const FsInitArgs& args) {
return 0;
}
-void Filesystem::Destroy() {}
+void Filesystem::Destroy() {
+}
Error Filesystem::OpenResource(const Path& path, ScopedNode* out_node) {
out_node->reset(NULL);
diff --git a/native_client_sdk/src/libraries/nacl_io/fuse.h b/native_client_sdk/src/libraries/nacl_io/fuse.h
index feb90cd..314291c 100644
--- a/native_client_sdk/src/libraries/nacl_io/fuse.h
+++ b/native_client_sdk/src/libraries/nacl_io/fuse.h
@@ -119,7 +119,10 @@ struct fuse_operations {
// Called by read(). Note that FUSE specifies that all reads will fill the
// entire requested buffer. If this function returns less than that, the
// remainder of the buffer is zeroed.
- int (*read)(const char* path, char* buf, size_t count, off_t,
+ int (*read)(const char* path,
+ char* buf,
+ size_t count,
+ off_t,
struct fuse_file_info*);
// Called by getdents(), which is called by the more standard function
// readdir().
@@ -167,7 +170,10 @@ struct fuse_operations {
// return 0;
// }
//
- int (*readdir)(const char* path, void* buf, fuse_fill_dir_t filldir, off_t,
+ int (*readdir)(const char* path,
+ void* buf,
+ fuse_fill_dir_t filldir,
+ off_t,
struct fuse_file_info*);
// Called when the last reference to this node is released. This is only
// called for regular files. For directories, fuse_operations.releasedir is
@@ -187,7 +193,10 @@ struct fuse_operations {
int (*unlink)(const char* path);
// Called by write(). Note that FUSE specifies that a write should always
// return the full count, unless an error occurs.
- int (*write)(const char* path, const char* buf, size_t count, off_t,
+ int (*write)(const char* path,
+ const char* buf,
+ size_t count,
+ off_t,
struct fuse_file_info*);
// The following functions are not currently called by the nacl_io
@@ -200,22 +209,33 @@ struct fuse_operations {
int (*flush)(const char*, struct fuse_file_info*);
int (*fsyncdir)(const char*, int, struct fuse_file_info*);
int (*getxattr)(const char*, const char*, char*, size_t);
- int (*ioctl)(const char*, int cmd, void* arg, struct fuse_file_info*,
- unsigned int flags, void* data);
+ int (*ioctl)(const char*,
+ int cmd,
+ void* arg,
+ struct fuse_file_info*,
+ unsigned int flags,
+ void* data);
int (*link)(const char*, const char*);
int (*listxattr)(const char*, char*, size_t);
int (*lock)(const char*, struct fuse_file_info*, int cmd, struct flock*);
- int (*poll)(const char*, struct fuse_file_info*, struct fuse_pollhandle* ph,
+ int (*poll)(const char*,
+ struct fuse_file_info*,
+ struct fuse_pollhandle* ph,
unsigned* reventsp);
- int (*read_buf)(const char*, struct fuse_bufvec** bufp, size_t size,
- off_t off, struct fuse_file_info*);
+ int (*read_buf)(const char*,
+ struct fuse_bufvec** bufp,
+ size_t size,
+ off_t off,
+ struct fuse_file_info*);
int (*readlink)(const char*, char*, size_t);
int (*removexattr)(const char*, const char*);
int (*setxattr)(const char*, const char*, const char*, size_t, int);
int (*statfs)(const char*, struct statvfs*);
int (*symlink)(const char*, const char*);
int (*utimens)(const char*, const struct timespec tv[2]);
- int (*write_buf)(const char*, struct fuse_bufvec* buf, off_t off,
+ int (*write_buf)(const char*,
+ struct fuse_bufvec* buf,
+ off_t off,
struct fuse_file_info*);
};
diff --git a/native_client_sdk/src/libraries/nacl_io/fusefs/fuse_fs.cc b/native_client_sdk/src/libraries/nacl_io/fusefs/fuse_fs.cc
index 5eaf8e1..34e7064 100644
--- a/native_client_sdk/src/libraries/nacl_io/fusefs/fuse_fs.cc
+++ b/native_client_sdk/src/libraries/nacl_io/fusefs/fuse_fs.cc
@@ -29,7 +29,8 @@ struct FillDirInfo {
} // namespace
-FuseFs::FuseFs() : fuse_ops_(NULL), fuse_user_data_(NULL) {}
+FuseFs::FuseFs() : fuse_ops_(NULL), fuse_user_data_(NULL) {
+}
Error FuseFs::Init(const FsInitArgs& args) {
Error error = Filesystem::Init(args);
@@ -204,7 +205,8 @@ FuseFsNode::FuseFsNode(Filesystem* filesystem,
struct fuse_operations* fuse_ops,
struct fuse_file_info& info,
const std::string& path)
- : Node(filesystem), fuse_ops_(fuse_ops), info_(info), path_(path) {}
+ : Node(filesystem), fuse_ops_(fuse_ops), info_(info), path_(path) {
+}
bool FuseFsNode::CanOpen(int open_flags) {
struct stat statbuf;
@@ -271,7 +273,8 @@ FileFuseFsNode::FileFuseFsNode(Filesystem* filesystem,
struct fuse_operations* fuse_ops,
struct fuse_file_info& info,
const std::string& path)
- : FuseFsNode(filesystem, fuse_ops, info, path) {}
+ : FuseFsNode(filesystem, fuse_ops, info, path) {
+}
void FileFuseFsNode::Destroy() {
if (!fuse_ops_->release)
@@ -347,7 +350,8 @@ DirFuseFsNode::DirFuseFsNode(Filesystem* filesystem,
struct fuse_operations* fuse_ops,
struct fuse_file_info& info,
const std::string& path)
- : FuseFsNode(filesystem, fuse_ops, info, path) {}
+ : FuseFsNode(filesystem, fuse_ops, info, path) {
+}
void DirFuseFsNode::Destroy() {
if (!fuse_ops_->releasedir)
diff --git a/native_client_sdk/src/libraries/nacl_io/fusefs/fuse_fs_factory.cc b/native_client_sdk/src/libraries/nacl_io/fusefs/fuse_fs_factory.cc
index c61afc9..c148b1b 100644
--- a/native_client_sdk/src/libraries/nacl_io/fusefs/fuse_fs_factory.cc
+++ b/native_client_sdk/src/libraries/nacl_io/fusefs/fuse_fs_factory.cc
@@ -8,7 +8,8 @@
namespace nacl_io {
-FuseFsFactory::FuseFsFactory(fuse_operations* fuse_ops) : fuse_ops_(fuse_ops) {}
+FuseFsFactory::FuseFsFactory(fuse_operations* fuse_ops) : fuse_ops_(fuse_ops) {
+}
Error FuseFsFactory::CreateFilesystem(const FsInitArgs& args,
ScopedFilesystem* out_fs) {
diff --git a/native_client_sdk/src/libraries/nacl_io/host_resolver.cc b/native_client_sdk/src/libraries/nacl_io/host_resolver.cc
index 0ff582c..b8100a7 100644
--- a/native_client_sdk/src/libraries/nacl_io/host_resolver.cc
+++ b/native_client_sdk/src/libraries/nacl_io/host_resolver.cc
@@ -58,8 +58,7 @@ void CreateAddrInfo(const addrinfo* hints,
break;
}
case AF_INET: {
- sockaddr_in* in =
- static_cast<sockaddr_in*>(malloc(sizeof(sockaddr_in)));
+ sockaddr_in* in = static_cast<sockaddr_in*>(malloc(sizeof(sockaddr_in)));
*in = *(sockaddr_in*)addr;
ai->ai_family = AF_INET;
ai->ai_addr = reinterpret_cast<sockaddr*>(in);
@@ -206,7 +205,7 @@ struct hostent* HostResolver::gethostbyname(const char* name) {
return &hostent_;
}
-void HostResolver::freeaddrinfo(struct addrinfo *res) {
+void HostResolver::freeaddrinfo(struct addrinfo* res) {
while (res) {
struct addrinfo* cur = res;
res = res->ai_next;
@@ -216,7 +215,8 @@ void HostResolver::freeaddrinfo(struct addrinfo *res) {
}
}
-int HostResolver::getaddrinfo(const char* node, const char* service,
+int HostResolver::getaddrinfo(const char* node,
+ const char* service,
const struct addrinfo* hints_in,
struct addrinfo** result) {
*result = NULL;
@@ -343,7 +343,7 @@ int HostResolver::getaddrinfo(const char* node, const char* service,
// TODO(sbc): investigate this issue with PPAPI team.
if (len > 0) {
// Copy and NULL-terminate the UTF8 string var.
- canon_name = static_cast<char*>(malloc(len+1));
+ canon_name = static_cast<char*>(malloc(len + 1));
strncpy(canon_name, tmp, len);
canon_name[len] = '\0';
}
@@ -381,8 +381,7 @@ int HostResolver::getaddrinfo(const char* node, const char* service,
assert(false);
break;
}
- memcpy(&addr_in6.sin6_addr.s6_addr, pp_addr.addr,
- sizeof(in6_addr));
+ memcpy(&addr_in6.sin6_addr.s6_addr, pp_addr.addr, sizeof(in6_addr));
sockaddr = (struct sockaddr*)&addr_in6;
break;
}
@@ -409,13 +408,13 @@ void HostResolver::hostent_cleanup() {
free(hostent_.h_name);
}
if (NULL != hostent_.h_aliases) {
- for (int i = 0; NULL != hostent_.h_aliases[i]; i++) {
+ for (int i = 0; NULL != hostent_.h_aliases[i]; i++) {
free(hostent_.h_aliases[i]);
}
free(hostent_.h_aliases);
}
if (NULL != hostent_.h_addr_list) {
- for (int i = 0; NULL != hostent_.h_addr_list[i]; i++) {
+ for (int i = 0; NULL != hostent_.h_addr_list[i]; i++) {
free(hostent_.h_addr_list[i]);
}
free(hostent_.h_addr_list);
diff --git a/native_client_sdk/src/libraries/nacl_io/host_resolver.h b/native_client_sdk/src/libraries/nacl_io/host_resolver.h
index dc37b96..2647e29 100644
--- a/native_client_sdk/src/libraries/nacl_io/host_resolver.h
+++ b/native_client_sdk/src/libraries/nacl_io/host_resolver.h
@@ -20,17 +20,19 @@ class HostResolver {
void Init(PepperInterface* ppapi);
- void freeaddrinfo(struct addrinfo *res);
- int getaddrinfo(const char *node, const char *service,
- const struct addrinfo *hints,
- struct addrinfo **res);
+ void freeaddrinfo(struct addrinfo* res);
+ int getaddrinfo(const char* node,
+ const char* service,
+ const struct addrinfo* hints,
+ struct addrinfo** res);
struct hostent* gethostbyname(const char* name);
+
private:
void hostent_initialize();
void hostent_cleanup();
struct hostent hostent_;
- PepperInterface *ppapi_;
+ PepperInterface* ppapi_;
sdk_util::SimpleLock gethostbyname_lock_;
};
diff --git a/native_client_sdk/src/libraries/nacl_io/html5fs/html5_fs.cc b/native_client_sdk/src/libraries/nacl_io/html5fs/html5_fs.cc
index 99be95f..19fca59 100644
--- a/native_client_sdk/src/libraries/nacl_io/html5fs/html5_fs.cc
+++ b/native_client_sdk/src/libraries/nacl_io/html5fs/html5_fs.cc
@@ -55,7 +55,9 @@ Error Html5Fs::Open(const Path& path, int open_flags, ScopedNode* out_node) {
return 0;
}
-Error Html5Fs::Unlink(const Path& path) { return Remove(path); }
+Error Html5Fs::Unlink(const Path& path) {
+ return Remove(path);
+}
Error Html5Fs::Mkdir(const Path& path, int permissions) {
Error error = BlockUntilFilesystemOpen();
@@ -82,7 +84,9 @@ Error Html5Fs::Mkdir(const Path& path, int permissions) {
return 0;
}
-Error Html5Fs::Rmdir(const Path& path) { return Remove(path); }
+Error Html5Fs::Rmdir(const Path& path) {
+ return Remove(path);
+}
Error Html5Fs::Remove(const Path& path) {
Error error = BlockUntilFilesystemOpen();
@@ -123,9 +127,10 @@ Error Html5Fs::Rename(const Path& path, const Path& newpath) {
if (!new_fileref_resource.pp_resource())
return ENOENT;
- int32_t result = ppapi()->GetFileRefInterface()->Rename(
- fileref_resource.pp_resource(), new_fileref_resource.pp_resource(),
- PP_BlockUntilComplete());
+ int32_t result =
+ ppapi()->GetFileRefInterface()->Rename(fileref_resource.pp_resource(),
+ new_fileref_resource.pp_resource(),
+ PP_BlockUntilComplete());
if (result != PP_OK)
return PPErrorToErrno(result);
@@ -135,7 +140,8 @@ Error Html5Fs::Rename(const Path& path, const Path& newpath) {
Html5Fs::Html5Fs()
: filesystem_resource_(0),
filesystem_open_has_result_(false),
- filesystem_open_error_(0) {}
+ filesystem_open_error_(0) {
+}
Error Html5Fs::Init(const FsInitArgs& args) {
Error error = Filesystem::Init(args);
diff --git a/native_client_sdk/src/libraries/nacl_io/html5fs/html5_fs_node.cc b/native_client_sdk/src/libraries/nacl_io/html5fs/html5_fs_node.cc
index 1f0e843..92877bb 100644
--- a/native_client_sdk/src/libraries/nacl_io/html5fs/html5_fs_node.cc
+++ b/native_client_sdk/src/libraries/nacl_io/html5fs/html5_fs_node.cc
@@ -227,7 +227,9 @@ Error Html5FsNode::Write(const HandleAttr& attr,
return 0;
}
-int Html5FsNode::GetType() { return fileio_resource_ ? S_IFREG : S_IFDIR; }
+int Html5FsNode::GetType() {
+ return fileio_resource_ ? S_IFREG : S_IFDIR;
+}
Error Html5FsNode::GetSize(off_t* out_size) {
*out_size = 0;
@@ -247,14 +249,19 @@ Error Html5FsNode::GetSize(off_t* out_size) {
return 0;
}
-bool Html5FsNode::IsaDir() { return !fileio_resource_; }
+bool Html5FsNode::IsaDir() {
+ return !fileio_resource_;
+}
-bool Html5FsNode::IsaFile() { return fileio_resource_; }
+bool Html5FsNode::IsaFile() {
+ return fileio_resource_;
+}
Html5FsNode::Html5FsNode(Filesystem* filesystem, PP_Resource fileref_resource)
: Node(filesystem),
fileref_resource_(fileref_resource),
- fileio_resource_(0) {}
+ fileio_resource_(0) {
+}
Error Html5FsNode::Init(int open_flags) {
Error error = Node::Init(open_flags);
diff --git a/native_client_sdk/src/libraries/nacl_io/httpfs/http_fs.cc b/native_client_sdk/src/libraries/nacl_io/httpfs/http_fs.cc
index ee5e5f3..cb2a6f6 100644
--- a/native_client_sdk/src/libraries/nacl_io/httpfs/http_fs.cc
+++ b/native_client_sdk/src/libraries/nacl_io/httpfs/http_fs.cc
@@ -200,7 +200,8 @@ HttpFs::HttpFs()
: allow_cors_(false),
allow_credentials_(false),
cache_stat_(true),
- cache_content_(true) {}
+ cache_content_(true) {
+}
Error HttpFs::Init(const FsInitArgs& args) {
Error error = Filesystem::Init(args);
@@ -248,7 +249,8 @@ Error HttpFs::Init(const FsInitArgs& args) {
return 0;
}
-void HttpFs::Destroy() {}
+void HttpFs::Destroy() {
+}
Error HttpFs::FindOrCreateDir(const Path& path, ScopedNode* out_node) {
out_node->reset(NULL);
diff --git a/native_client_sdk/src/libraries/nacl_io/httpfs/http_fs_node.cc b/native_client_sdk/src/libraries/nacl_io/httpfs/http_fs_node.cc
index 6a4815b..394252e 100644
--- a/native_client_sdk/src/libraries/nacl_io/httpfs/http_fs_node.cc
+++ b/native_client_sdk/src/libraries/nacl_io/httpfs/http_fs_node.cc
@@ -152,7 +152,9 @@ void HttpFsNode::SetCachedSize(off_t size) {
stat_.st_size = size;
}
-Error HttpFsNode::FSync() { return EACCES; }
+Error HttpFsNode::FSync() {
+ return EACCES;
+}
Error HttpFsNode::GetDents(size_t offs,
struct dirent* pdir,
@@ -187,7 +189,9 @@ Error HttpFsNode::Read(const HandleAttr& attr,
return DownloadPartial(attr, buf, count, out_bytes);
}
-Error HttpFsNode::FTruncate(off_t size) { return EACCES; }
+Error HttpFsNode::FTruncate(off_t size) {
+ return EACCES;
+}
Error HttpFsNode::Write(const HandleAttr& attr,
const void* buf,
@@ -219,9 +223,12 @@ HttpFsNode::HttpFsNode(Filesystem* filesystem,
: Node(filesystem),
url_(url),
cache_content_(cache_content),
- has_cached_size_(false) {}
+ has_cached_size_(false) {
+}
-void HttpFsNode::SetMode(int mode) { stat_.st_mode = mode; }
+void HttpFsNode::SetMode(int mode) {
+ stat_.st_mode = mode;
+}
Error HttpFsNode::GetStat_Locked(struct stat* stat) {
// Assume we need to 'HEAD' if we do not know the size, otherwise, assume
diff --git a/native_client_sdk/src/libraries/nacl_io/include/sys/mount.h b/native_client_sdk/src/libraries/nacl_io/include/sys/mount.h
index dde0ab3..722f01a 100644
--- a/native_client_sdk/src/libraries/nacl_io/include/sys/mount.h
+++ b/native_client_sdk/src/libraries/nacl_io/include/sys/mount.h
@@ -9,10 +9,13 @@
__BEGIN_DECLS
-int mount(const char* source, const char* target, const char* filesystemtype,
- unsigned long mountflags, const void *data);
+int mount(const char* source,
+ const char* target,
+ const char* filesystemtype,
+ unsigned long mountflags,
+ const void* data);
-int umount(const char *target);
+int umount(const char* target);
__END_DECLS
diff --git a/native_client_sdk/src/libraries/nacl_io/include/sys/poll.h b/native_client_sdk/src/libraries/nacl_io/include/sys/poll.h
index 1784344..d09eb59 100644
--- a/native_client_sdk/src/libraries/nacl_io/include/sys/poll.h
+++ b/native_client_sdk/src/libraries/nacl_io/include/sys/poll.h
@@ -31,7 +31,7 @@ struct pollfd {
uint16_t revents;
};
-int poll(struct pollfd *__fds, nfds_t __nfds, int __timeout);
+int poll(struct pollfd* __fds, nfds_t __nfds, int __timeout);
EXTERN_C_END
diff --git a/native_client_sdk/src/libraries/nacl_io/include/sys/termios.h b/native_client_sdk/src/libraries/nacl_io/include/sys/termios.h
index 7a4af07..ca16c10 100644
--- a/native_client_sdk/src/libraries/nacl_io/include/sys/termios.h
+++ b/native_client_sdk/src/libraries/nacl_io/include/sys/termios.h
@@ -120,23 +120,22 @@ struct termios {
speed_t c_ospeed;
};
-
#include <sys/cdefs.h>
__BEGIN_DECLS
-speed_t cfgetispeed(const struct termios *termios_p);
-speed_t cfgetospeed(const struct termios *termios_p);
-int cfsetispeed(struct termios *termios_p, speed_t speed);
-int cfsetospeed(struct termios *termios_p, speed_t speed);
-int cfsetspeed(struct termios *termios_p, speed_t speed);
+speed_t cfgetispeed(const struct termios* termios_p);
+speed_t cfgetospeed(const struct termios* termios_p);
+int cfsetispeed(struct termios* termios_p, speed_t speed);
+int cfsetospeed(struct termios* termios_p, speed_t speed);
+int cfsetspeed(struct termios* termios_p, speed_t speed);
int tcdrain(int fd);
int tcflow(int fd, int action);
int tcflush(int fd, int queue_selector);
-int tcgetattr(int fd, struct termios *termios_p);
+int tcgetattr(int fd, struct termios* termios_p);
int tcsendbreak(int fd, int duration);
-int tcsetattr(int fd, int optional_actions, const struct termios *termios_p);
+int tcsetattr(int fd, int optional_actions, const struct termios* termios_p);
__END_DECLS
diff --git a/native_client_sdk/src/libraries/nacl_io/include/sys/utsname.h b/native_client_sdk/src/libraries/nacl_io/include/sys/utsname.h
index 2292915..3eff529 100644
--- a/native_client_sdk/src/libraries/nacl_io/include/sys/utsname.h
+++ b/native_client_sdk/src/libraries/nacl_io/include/sys/utsname.h
@@ -19,7 +19,7 @@ struct utsname {
__BEGIN_DECLS
-int uname(struct utsname *buf);
+int uname(struct utsname* buf);
__END_DECLS
diff --git a/native_client_sdk/src/libraries/nacl_io/ioctl.h b/native_client_sdk/src/libraries/nacl_io/ioctl.h
index 15cc467..6bce290 100644
--- a/native_client_sdk/src/libraries/nacl_io/ioctl.h
+++ b/native_client_sdk/src/libraries/nacl_io/ioctl.h
@@ -56,7 +56,6 @@ struct tioc_nacl_input_string {
const char* buffer;
};
-
typedef ssize_t (*tioc_nacl_output_handler_t)(const char* buf,
size_t count,
void* user_data);
diff --git a/native_client_sdk/src/libraries/nacl_io/kernel_handle.cc b/native_client_sdk/src/libraries/nacl_io/kernel_handle.cc
index 9ad4605..29c4890 100644
--- a/native_client_sdk/src/libraries/nacl_io/kernel_handle.cc
+++ b/native_client_sdk/src/libraries/nacl_io/kernel_handle.cc
@@ -17,10 +17,12 @@
namespace nacl_io {
// It is only legal to construct a handle while the kernel lock is held.
-KernelHandle::KernelHandle() : filesystem_(NULL), node_(NULL) {}
+KernelHandle::KernelHandle() : filesystem_(NULL), node_(NULL) {
+}
KernelHandle::KernelHandle(const ScopedFilesystem& fs, const ScopedNode& node)
- : filesystem_(fs), node_(node) {}
+ : filesystem_(fs), node_(node) {
+}
KernelHandle::~KernelHandle() {
// Force release order for cases where filesystem_ is not ref'd by mounting.
@@ -153,7 +155,8 @@ Error KernelHandle::VFcntl(int request, int* result, va_list args) {
return ENOSYS;
}
-Error KernelHandle::Accept(PP_Resource* new_sock, struct sockaddr* addr,
+Error KernelHandle::Accept(PP_Resource* new_sock,
+ struct sockaddr* addr,
socklen_t* len) {
SocketNode* sock = socket_node();
if (!sock)
@@ -200,10 +203,7 @@ Error KernelHandle::RecvFrom(void* buf,
out_len);
}
-Error KernelHandle::Send(const void* buf,
- size_t len,
- int flags,
- int* out_len) {
+Error KernelHandle::Send(const void* buf, size_t len, int flags, int* out_len) {
SocketNode* sock = socket_node();
if (!sock)
return ENOTSOCK;
diff --git a/native_client_sdk/src/libraries/nacl_io/kernel_handle.h b/native_client_sdk/src/libraries/nacl_io/kernel_handle.h
index d385eb3..e586c5d 100644
--- a/native_client_sdk/src/libraries/nacl_io/kernel_handle.h
+++ b/native_client_sdk/src/libraries/nacl_io/kernel_handle.h
@@ -40,7 +40,6 @@ struct HandleAttr {
// KernelHandle can only be referenced when the KernelProxy lock is held.
class KernelHandle : public sdk_util::RefObject {
public:
-
KernelHandle();
KernelHandle(const ScopedFilesystem& fs, const ScopedNode& node);
~KernelHandle();
diff --git a/native_client_sdk/src/libraries/nacl_io/kernel_intercept.cc b/native_client_sdk/src/libraries/nacl_io/kernel_intercept.cc
index 3b7490b..aa66e19 100644
--- a/native_client_sdk/src/libraries/nacl_io/kernel_intercept.cc
+++ b/native_client_sdk/src/libraries/nacl_io/kernel_intercept.cc
@@ -54,8 +54,8 @@ int ki_init(void* kp) {
}
int ki_init_ppapi(void* kp,
- PP_Instance instance,
- PPB_GetInterface get_browser_interface) {
+ PP_Instance instance,
+ PPB_GetInterface get_browser_interface) {
assert(!s_state.kp);
if (s_state.kp != NULL)
return 1;
@@ -163,7 +163,7 @@ int ki_dup2(int oldfd, int newfd) {
return s_state.kp->dup2(oldfd, newfd);
}
-int ki_chmod(const char *path, mode_t mode) {
+int ki_chmod(const char* path, mode_t mode) {
ON_NOSYS_RETURN(-1);
return s_state.kp->chmod(path, mode);
}
@@ -178,33 +178,36 @@ int ki_fchmod(int fd, mode_t mode) {
return s_state.kp->fchmod(fd, mode);
}
-int ki_stat(const char *path, struct stat *buf) {
+int ki_stat(const char* path, struct stat* buf) {
ON_NOSYS_RETURN(-1);
return s_state.kp->stat(path, buf);
}
-int ki_mkdir(const char *path, mode_t mode) {
+int ki_mkdir(const char* path, mode_t mode) {
ON_NOSYS_RETURN(-1);
return s_state.kp->mkdir(path, mode);
}
-int ki_rmdir(const char *path) {
+int ki_rmdir(const char* path) {
ON_NOSYS_RETURN(-1);
return s_state.kp->rmdir(path);
}
-int ki_mount(const char *source, const char *target, const char *filesystemtype,
- unsigned long mountflags, const void *data) {
+int ki_mount(const char* source,
+ const char* target,
+ const char* filesystemtype,
+ unsigned long mountflags,
+ const void* data) {
ON_NOSYS_RETURN(-1);
return s_state.kp->mount(source, target, filesystemtype, mountflags, data);
}
-int ki_umount(const char *path) {
+int ki_umount(const char* path) {
ON_NOSYS_RETURN(-1);
return s_state.kp->umount(path);
}
-int ki_open(const char *path, int oflag) {
+int ki_open(const char* path, int oflag) {
ON_NOSYS_RETURN(-1);
return s_state.kp->open(path, oflag);
}
@@ -214,22 +217,22 @@ int ki_pipe(int pipefds[2]) {
return s_state.kp->pipe(pipefds);
}
-ssize_t ki_read(int fd, void *buf, size_t nbyte) {
+ssize_t ki_read(int fd, void* buf, size_t nbyte) {
ON_NOSYS_RETURN(-1);
return s_state.kp->read(fd, buf, nbyte);
}
-ssize_t ki_write(int fd, const void *buf, size_t nbyte) {
+ssize_t ki_write(int fd, const void* buf, size_t nbyte) {
ON_NOSYS_RETURN(-1);
return s_state.kp->write(fd, buf, nbyte);
}
-int ki_fstat(int fd, struct stat *buf){
+int ki_fstat(int fd, struct stat* buf) {
ON_NOSYS_RETURN(-1);
return s_state.kp->fstat(fd, buf);
}
-int ki_getdents(int fd, void *buf, unsigned int count) {
+int ki_getdents(int fd, void* buf, unsigned int count) {
ON_NOSYS_RETURN(-1);
return s_state.kp->getdents(fd, buf, count);
}
@@ -304,17 +307,21 @@ int ki_access(const char* path, int amode) {
return s_state.kp->access(path, amode);
}
-int ki_readlink(const char *path, char *buf, size_t count) {
+int ki_readlink(const char* path, char* buf, size_t count) {
ON_NOSYS_RETURN(-1);
return s_state.kp->readlink(path, buf, count);
}
-int ki_utimes(const char *path, const struct timeval times[2]) {
+int ki_utimes(const char* path, const struct timeval times[2]) {
ON_NOSYS_RETURN(-1);
return s_state.kp->utimes(path, times);
}
-void* ki_mmap(void* addr, size_t length, int prot, int flags, int fd,
+void* ki_mmap(void* addr,
+ size_t length,
+ int prot,
+ int flags,
+ int fd,
off_t offset) {
ON_NOSYS_RETURN(MAP_FAILED);
return s_state.kp->mmap(addr, length, prot, flags, fd, offset);
@@ -326,7 +333,8 @@ int ki_munmap(void* addr, size_t length) {
}
int ki_open_resource(const char* file) {
- ON_NOSYS_RETURN(-1); return s_state.kp->open_resource(file);
+ ON_NOSYS_RETURN(-1);
+ return s_state.kp->open_resource(file);
}
int ki_fcntl(int d, int request, va_list args) {
@@ -359,12 +367,15 @@ int ki_utime(const char* filename, const struct utimbuf* times) {
return s_state.kp->utime(filename, times);
}
-int ki_poll(struct pollfd *fds, nfds_t nfds, int timeout) {
+int ki_poll(struct pollfd* fds, nfds_t nfds, int timeout) {
return s_state.kp->poll(fds, nfds, timeout);
}
-int ki_select(int nfds, fd_set* readfds, fd_set* writefds,
- fd_set* exceptfds, struct timeval* timeout) {
+int ki_select(int nfds,
+ fd_set* readfds,
+ fd_set* writefds,
+ fd_set* exceptfds,
+ struct timeval* timeout) {
return s_state.kp->select(nfds, readfds, writefds, exceptfds, timeout);
}
@@ -378,8 +389,9 @@ int ki_tcgetattr(int fd, struct termios* termios_p) {
return s_state.kp->tcgetattr(fd, termios_p);
}
-int ki_tcsetattr(int fd, int optional_actions,
- const struct termios *termios_p) {
+int ki_tcsetattr(int fd,
+ int optional_actions,
+ const struct termios* termios_p) {
ON_NOSYS_RETURN(-1);
return s_state.kp->tcsetattr(fd, optional_actions, termios_p);
}
@@ -394,7 +406,8 @@ int ki_killpg(pid_t pid, int sig) {
return -1;
}
-int ki_sigaction(int signum, const struct sigaction* action,
+int ki_sigaction(int signum,
+ const struct sigaction* action,
struct sigaction* oaction) {
ON_NOSYS_RETURN(-1);
return s_state.kp->sigaction(signum, action, oaction);
@@ -455,14 +468,15 @@ struct hostent* ki_gethostbyname(const char* name) {
return s_state.kp->gethostbyname(name);
}
-int ki_getaddrinfo(const char *node, const char *service,
- const struct addrinfo *hints,
- struct addrinfo **res) {
+int ki_getaddrinfo(const char* node,
+ const char* service,
+ const struct addrinfo* hints,
+ struct addrinfo** res) {
ON_NOSYS_RETURN(EAI_SYSTEM);
return s_state.kp->getaddrinfo(node, service, hints, res);
}
-void ki_freeaddrinfo(struct addrinfo *res) {
+void ki_freeaddrinfo(struct addrinfo* res) {
s_state.kp->freeaddrinfo(res);
}
@@ -491,8 +505,12 @@ ssize_t ki_recv(int fd, void* buf, size_t len, int flags) {
return s_state.kp->recv(fd, buf, len, flags);
}
-ssize_t ki_recvfrom(int fd, void* buf, size_t len, int flags,
- struct sockaddr* addr, socklen_t* addrlen) {
+ssize_t ki_recvfrom(int fd,
+ void* buf,
+ size_t len,
+ int flags,
+ struct sockaddr* addr,
+ socklen_t* addrlen) {
ON_NOSYS_RETURN(-1);
return s_state.kp->recvfrom(fd, buf, len, flags, addr, addrlen);
}
@@ -507,8 +525,12 @@ ssize_t ki_send(int fd, const void* buf, size_t len, int flags) {
return s_state.kp->send(fd, buf, len, flags);
}
-ssize_t ki_sendto(int fd, const void* buf, size_t len, int flags,
- const struct sockaddr* addr, socklen_t addrlen) {
+ssize_t ki_sendto(int fd,
+ const void* buf,
+ size_t len,
+ int flags,
+ const struct sockaddr* addr,
+ socklen_t addrlen) {
ON_NOSYS_RETURN(-1);
return s_state.kp->sendto(fd, buf, len, flags, addr, addrlen);
}
@@ -518,7 +540,10 @@ ssize_t ki_sendmsg(int fd, const struct msghdr* msg, int flags) {
return s_state.kp->sendmsg(fd, msg, flags);
}
-int ki_setsockopt(int fd, int lvl, int optname, const void* optval,
+int ki_setsockopt(int fd,
+ int lvl,
+ int optname,
+ const void* optval,
socklen_t len) {
ON_NOSYS_RETURN(-1);
return s_state.kp->setsockopt(fd, lvl, optname, optval, len);
diff --git a/native_client_sdk/src/libraries/nacl_io/kernel_intercept.h b/native_client_sdk/src/libraries/nacl_io/kernel_intercept.h
index 65d269b..e75deb5 100644
--- a/native_client_sdk/src/libraries/nacl_io/kernel_intercept.h
+++ b/native_client_sdk/src/libraries/nacl_io/kernel_intercept.h
@@ -52,7 +52,6 @@ int ki_init_ppapi(void* kernel_proxy,
PP_Instance instance,
PPB_GetInterface get_browser_interface);
-
/*
* ki_init_interface() is a variant of ki_init() that can be called with
* a PepperInterface object.
@@ -78,14 +77,17 @@ int ki_fchmod(int fd, mode_t mode);
int ki_stat(const char* path, struct stat* buf);
int ki_mkdir(const char* path, mode_t mode);
int ki_rmdir(const char* path);
-int ki_mount(const char* source, const char* target, const char* filesystemtype,
- unsigned long mountflags, const void *data);
+int ki_mount(const char* source,
+ const char* target,
+ const char* filesystemtype,
+ unsigned long mountflags,
+ const void* data);
int ki_umount(const char* path);
int ki_open(const char* path, int oflag);
int ki_pipe(int pipefds[2]);
ssize_t ki_read(int fd, void* buf, size_t nbyte);
ssize_t ki_write(int fd, const void* buf, size_t nbyte);
-int ki_fstat(int fd, struct stat *buf);
+int ki_fstat(int fd, struct stat* buf);
int ki_getdents(int fd, void* buf, unsigned int count);
int ki_fsync(int fd);
int ki_fdatasync(int fd);
@@ -101,9 +103,13 @@ int ki_link(const char* oldpath, const char* newpath);
int ki_rename(const char* oldpath, const char* newpath);
int ki_symlink(const char* oldpath, const char* newpath);
int ki_access(const char* path, int amode);
-int ki_readlink(const char *path, char *buf, size_t count);
-int ki_utimes(const char *path, const struct timeval times[2]);
-void* ki_mmap(void* addr, size_t length, int prot, int flags, int fd,
+int ki_readlink(const char* path, char* buf, size_t count);
+int ki_utimes(const char* path, const struct timeval times[2]);
+void* ki_mmap(void* addr,
+ size_t length,
+ int prot,
+ int flags,
+ int fd,
off_t offset);
int ki_munmap(void* addr, size_t length);
int ki_open_resource(const char* file);
@@ -114,17 +120,20 @@ int ki_fchown(int fd, uid_t owner, gid_t group);
int ki_lchown(const char* path, uid_t owner, gid_t group);
int ki_utime(const char* filename, const struct utimbuf* times);
-int ki_poll(struct pollfd *fds, nfds_t nfds, int timeout);
-int ki_select(int nfds, fd_set* readfds, fd_set* writefds,
- fd_set* exceptfds, struct timeval* timeout);
+int ki_poll(struct pollfd* fds, nfds_t nfds, int timeout);
+int ki_select(int nfds,
+ fd_set* readfds,
+ fd_set* writefds,
+ fd_set* exceptfds,
+ struct timeval* timeout);
int ki_tcflush(int fd, int queue_selector);
int ki_tcgetattr(int fd, struct termios* termios_p);
-int ki_tcsetattr(int fd, int optional_actions,
- const struct termios *termios_p);
+int ki_tcsetattr(int fd, int optional_actions, const struct termios* termios_p);
int ki_kill(pid_t pid, int sig);
int ki_killpg(pid_t pid, int sig);
-int ki_sigaction(int signum, const struct sigaction* action,
+int ki_sigaction(int signum,
+ const struct sigaction* action,
struct sigaction* oaction);
int ki_sigpause(int sigmask);
int ki_sigpending(sigset_t* set);
@@ -137,24 +146,36 @@ sighandler_t ki_sigset(int signum, sighandler_t handler);
int ki_accept(int fd, struct sockaddr* addr, socklen_t* len);
int ki_bind(int fd, const struct sockaddr* addr, socklen_t len);
int ki_connect(int fd, const struct sockaddr* addr, socklen_t len);
-void ki_freeaddrinfo(struct addrinfo *res);
-int ki_getaddrinfo(const char *node, const char *service,
- const struct addrinfo *hints,
- struct addrinfo **res);
+void ki_freeaddrinfo(struct addrinfo* res);
+int ki_getaddrinfo(const char* node,
+ const char* service,
+ const struct addrinfo* hints,
+ struct addrinfo** res);
struct hostent* ki_gethostbyname(const char* name);
int ki_getpeername(int fd, struct sockaddr* addr, socklen_t* len);
int ki_getsockname(int fd, struct sockaddr* addr, socklen_t* len);
int ki_getsockopt(int fd, int lvl, int optname, void* optval, socklen_t* len);
int ki_listen(int fd, int backlog);
ssize_t ki_recv(int fd, void* buf, size_t len, int flags);
-ssize_t ki_recvfrom(int fd, void* buf, size_t len, int flags,
- struct sockaddr* addr, socklen_t* addrlen);
+ssize_t ki_recvfrom(int fd,
+ void* buf,
+ size_t len,
+ int flags,
+ struct sockaddr* addr,
+ socklen_t* addrlen);
ssize_t ki_recvmsg(int fd, struct msghdr* msg, int flags);
ssize_t ki_send(int fd, const void* buf, size_t len, int flags);
-ssize_t ki_sendto(int fd, const void* buf, size_t len, int flags,
- const struct sockaddr* addr, socklen_t addrlen);
+ssize_t ki_sendto(int fd,
+ const void* buf,
+ size_t len,
+ int flags,
+ const struct sockaddr* addr,
+ socklen_t addrlen);
ssize_t ki_sendmsg(int fd, const struct msghdr* msg, int flags);
-int ki_setsockopt(int fd, int lvl, int optname, const void* optval,
+int ki_setsockopt(int fd,
+ int lvl,
+ int optname,
+ const void* optval,
socklen_t len);
int ki_shutdown(int fd, int how);
int ki_socket(int domain, int type, int protocol);
diff --git a/native_client_sdk/src/libraries/nacl_io/kernel_object.cc b/native_client_sdk/src/libraries/nacl_io/kernel_object.cc
index 8b64ca1..81e5729 100644
--- a/native_client_sdk/src/libraries/nacl_io/kernel_object.cc
+++ b/native_client_sdk/src/libraries/nacl_io/kernel_object.cc
@@ -24,7 +24,9 @@
namespace nacl_io {
-KernelObject::KernelObject() { cwd_ = "/"; }
+KernelObject::KernelObject() {
+ cwd_ = "/";
+}
KernelObject::~KernelObject() {};
@@ -183,8 +185,9 @@ Error KernelObject::AcquireHandle(int fd, ScopedKernelHandle* out_handle) {
return 0;
}
-Error KernelObject::AcquireHandleAndPath(int fd, ScopedKernelHandle* out_handle,
- std::string* out_path){
+Error KernelObject::AcquireHandleAndPath(int fd,
+ ScopedKernelHandle* out_handle,
+ std::string* out_path) {
out_handle->reset(NULL);
AUTO_LOCK(handle_lock_);
@@ -223,7 +226,8 @@ int KernelObject::AllocateFD(const ScopedKernelHandle& handle,
return id;
}
-void KernelObject::FreeAndReassignFD(int fd, const ScopedKernelHandle& handle,
+void KernelObject::FreeAndReassignFD(int fd,
+ const ScopedKernelHandle& handle,
const std::string& path) {
if (NULL == handle) {
FreeFD(fd);
diff --git a/native_client_sdk/src/libraries/nacl_io/kernel_object.h b/native_client_sdk/src/libraries/nacl_io/kernel_object.h
index cab977b..5563cf3 100644
--- a/native_client_sdk/src/libraries/nacl_io/kernel_object.h
+++ b/native_client_sdk/src/libraries/nacl_io/kernel_object.h
@@ -33,7 +33,7 @@ class KernelObject {
Descriptor_t() : flags(0) {}
explicit Descriptor_t(const ScopedKernelHandle& h,
const std::string& open_path)
- : handle(h), flags(0), path(open_path) {}
+ : handle(h), flags(0), path(open_path) {}
ScopedKernelHandle handle;
int flags;
@@ -74,17 +74,19 @@ class KernelObject {
// Convert from FD to KernelHandle, and acquire the handle.
// Assumes |out_handle| is non-NULL.
Error AcquireHandle(int fd, ScopedKernelHandle* out_handle);
- Error AcquireHandleAndPath(int fd, ScopedKernelHandle *out_handle,
+ Error AcquireHandleAndPath(int fd,
+ ScopedKernelHandle* out_handle,
std::string* out_path);
// Allocate a new fd and assign the handle to it, while
// ref counting the handle and associated filesystem.
// Assumes |handle| is non-NULL;
int AllocateFD(const ScopedKernelHandle& handle,
- const std::string& path=std::string());
+ const std::string& path = std::string());
// Assumes |handle| is non-NULL;
- void FreeAndReassignFD(int fd, const ScopedKernelHandle& handle,
+ void FreeAndReassignFD(int fd,
+ const ScopedKernelHandle& handle,
const std::string& path);
void FreeFD(int fd);
diff --git a/native_client_sdk/src/libraries/nacl_io/kernel_proxy.h b/native_client_sdk/src/libraries/nacl_io/kernel_proxy.h
index 22c9a61..a758cdf 100644
--- a/native_client_sdk/src/libraries/nacl_io/kernel_proxy.h
+++ b/native_client_sdk/src/libraries/nacl_io/kernel_proxy.h
@@ -76,12 +76,12 @@ class KernelProxy : protected KernelObject {
virtual int chdir(const char* path);
virtual char* getcwd(char* buf, size_t size);
virtual char* getwd(char* buf);
- virtual int mount(const char *source,
- const char *target,
- const char *filesystemtype,
+ virtual int mount(const char* source,
+ const char* target,
+ const char* filesystemtype,
unsigned long mountflags,
- const void *data);
- virtual int umount(const char *path);
+ const void* data);
+ virtual int umount(const char* path);
// Stub system calls that don't do anything (yet), handled by KernelProxy.
virtual int chown(const char* path, uid_t owner, gid_t group);
@@ -94,22 +94,22 @@ class KernelProxy : protected KernelObject {
// calls the corresponding filesystem's GetNode() method. The corresponding
// method will be called. If the node cannot be found, errno is set and -1 is
// returned.
- virtual int chmod(const char *path, mode_t mode);
- virtual int mkdir(const char *path, mode_t mode);
- virtual int rmdir(const char *path);
- virtual int stat(const char *path, struct stat *buf);
+ virtual int chmod(const char* path, mode_t mode);
+ virtual int mkdir(const char* path, mode_t mode);
+ virtual int rmdir(const char* path);
+ virtual int stat(const char* path, struct stat* buf);
// System calls that take a file descriptor as an argument:
// The kernel proxy will determine to which filesystem the file
// descriptor's corresponding file handle belongs. The
// associated filesystem's function will be called.
- virtual ssize_t read(int fd, void *buf, size_t nbyte);
- virtual ssize_t write(int fd, const void *buf, size_t nbyte);
+ virtual ssize_t read(int fd, void* buf, size_t nbyte);
+ virtual ssize_t write(int fd, const void* buf, size_t nbyte);
virtual int fchmod(int fd, int prot);
virtual int fcntl(int fd, int request, va_list args);
- virtual int fstat(int fd, struct stat *buf);
- virtual int getdents(int fd, void *buf, unsigned int count);
+ virtual int fstat(int fd, struct stat* buf);
+ virtual int getdents(int fd, void* buf, unsigned int count);
virtual int fchdir(int fd);
virtual int ftruncate(int fd, off_t length);
virtual int fsync(int fd);
@@ -132,8 +132,8 @@ class KernelProxy : protected KernelObject {
virtual int rename(const char* path, const char* newpath);
// access() uses the Filesystem's Stat().
virtual int access(const char* path, int amode);
- virtual int readlink(const char *path, char *buf, size_t count);
- virtual int utimes(const char *filename, const struct timeval times[2]);
+ virtual int readlink(const char* path, char* buf, size_t count);
+ virtual int utimes(const char* filename, const struct timeval times[2]);
virtual int link(const char* oldpath, const char* newpath);
virtual int symlink(const char* oldpath, const char* newpath);
@@ -147,26 +147,32 @@ class KernelProxy : protected KernelObject {
virtual int munmap(void* addr, size_t length);
virtual int tcflush(int fd, int queue_selector);
virtual int tcgetattr(int fd, struct termios* termios_p);
- virtual int tcsetattr(int fd, int optional_actions,
- const struct termios *termios_p);
+ virtual int tcsetattr(int fd,
+ int optional_actions,
+ const struct termios* termios_p);
virtual int kill(pid_t pid, int sig);
- virtual int sigaction(int signum, const struct sigaction* action,
+ virtual int sigaction(int signum,
+ const struct sigaction* action,
struct sigaction* oaction);
#ifdef PROVIDES_SOCKET_API
- virtual int select(int nfds, fd_set* readfds, fd_set* writefds,
- fd_set* exceptfds, struct timeval* timeout);
+ virtual int select(int nfds,
+ fd_set* readfds,
+ fd_set* writefds,
+ fd_set* exceptfds,
+ struct timeval* timeout);
- virtual int poll(struct pollfd *fds, nfds_t nfds, int timeout);
+ virtual int poll(struct pollfd* fds, nfds_t nfds, int timeout);
// Socket support functions
virtual int accept(int fd, struct sockaddr* addr, socklen_t* len);
virtual int bind(int fd, const struct sockaddr* addr, socklen_t len);
virtual int connect(int fd, const struct sockaddr* addr, socklen_t len);
virtual struct hostent* gethostbyname(const char* name);
- virtual void freeaddrinfo(struct addrinfo *res);
- virtual int getaddrinfo(const char* node, const char* service,
+ virtual void freeaddrinfo(struct addrinfo* res);
+ virtual int getaddrinfo(const char* node,
+ const char* service,
const struct addrinfo* hints,
struct addrinfo** res);
virtual int getpeername(int fd, struct sockaddr* addr, socklen_t* len);
@@ -177,10 +183,7 @@ class KernelProxy : protected KernelObject {
void* optval,
socklen_t* len);
virtual int listen(int fd, int backlog);
- virtual ssize_t recv(int fd,
- void* buf,
- size_t len,
- int flags);
+ virtual ssize_t recv(int fd, void* buf, size_t len, int flags);
virtual ssize_t recvfrom(int fd,
void* buf,
size_t len,
@@ -223,7 +226,7 @@ class KernelProxy : protected KernelObject {
sdk_util::ScopedRef<DevFs> dev_fs_;
int dev_;
PepperInterface* ppapi_;
- static KernelProxy *s_instance_;
+ static KernelProxy* s_instance_;
struct sigaction sigwinch_handler_;
nacl_io_exit_handler_t exit_handler_;
void* exit_handler_user_data_;
diff --git a/native_client_sdk/src/libraries/nacl_io/kernel_wrap.h b/native_client_sdk/src/libraries/nacl_io/kernel_wrap.h
index d290da2..bcc4a87 100644
--- a/native_client_sdk/src/libraries/nacl_io/kernel_wrap.h
+++ b/native_client_sdk/src/libraries/nacl_io/kernel_wrap.h
@@ -30,12 +30,12 @@
// macros are used in the wrappers to check that the ki_ function actually
// set errno and to its value.
#define RTN_ERRNO_IF(cond) \
- if (cond) { \
- assert(errno != 0); \
- return errno; \
+ if (cond) { \
+ assert(errno != 0); \
+ return errno; \
}
-#define ERRNO_RTN(cond) \
+#define ERRNO_RTN(cond) \
RTN_ERRNO_IF(cond < 0); \
return 0;
@@ -130,15 +130,22 @@ int getsockname(int fd, struct sockaddr* addr, socklen_t* len);
int getsockopt(int fd, int lvl, int optname, void* optval, socklen_t* len);
int listen(int fd, int backlog);
ssize_t recv(int fd, void* buf, size_t len, int flags);
-ssize_t recvfrom(int fd, void* buf, size_t len, int flags,
- struct sockaddr* addr, socklen_t* addrlen);
+ssize_t recvfrom(int fd,
+ void* buf,
+ size_t len,
+ int flags,
+ struct sockaddr* addr,
+ socklen_t* addrlen);
ssize_t recvmsg(int fd, struct msghdr* msg, int flags);
ssize_t send(int fd, const void* buf, size_t len, int flags);
-ssize_t sendto(int fd, const void* buf, size_t len, int flags,
- const struct sockaddr* addr, socklen_t addrlen);
+ssize_t sendto(int fd,
+ const void* buf,
+ size_t len,
+ int flags,
+ const struct sockaddr* addr,
+ socklen_t addrlen);
ssize_t sendmsg(int fd, const struct msghdr* msg, int flags);
-int setsockopt(int fd, int lvl, int optname, const void* optval,
- socklen_t len);
+int setsockopt(int fd, int lvl, int optname, const void* optval, socklen_t len);
int shutdown(int fd, int how);
int socket(int domain, int type, int protocol);
int socketpair(int domain, int type, int protocl, int* sv);
diff --git a/native_client_sdk/src/libraries/nacl_io/kernel_wrap_bionic.cc b/native_client_sdk/src/libraries/nacl_io/kernel_wrap_bionic.cc
index 07da820..2754beb 100644
--- a/native_client_sdk/src/libraries/nacl_io/kernel_wrap_bionic.cc
+++ b/native_client_sdk/src/libraries/nacl_io/kernel_wrap_bionic.cc
@@ -50,7 +50,7 @@ void nacl_stat_to_stat(const nacl_abi_stat* nacl_buf, struct stat* buf) {
buf->st_uid = nacl_buf->nacl_abi_st_uid;
buf->st_gid = nacl_buf->nacl_abi_st_gid;
buf->st_rdev = nacl_buf->nacl_abi_st_rdev;
- buf->st_size = nacl_buf->nacl_abi_st_size ;
+ buf->st_size = nacl_buf->nacl_abi_st_size;
buf->st_blksize = nacl_buf->nacl_abi_st_blksize;
buf->st_blocks = nacl_buf->nacl_abi_st_blocks;
buf->st_atime = nacl_buf->nacl_abi_st_atime;
@@ -102,49 +102,45 @@ EXTERN_C_BEGIN
#define WRAP(name) __nacl_irt_##name##_wrap
// Declare REAL function pointer.
-#define DECLARE_REAL_PTR(name) \
- typeof(__nacl_irt_##name) REAL(name);
+#define DECLARE_REAL_PTR(name) typeof(__nacl_irt_##name) REAL(name);
// Assign the REAL function pointer.
-#define ASSIGN_REAL_PTR(name) \
- REAL(name) = __nacl_irt_##name;
+#define ASSIGN_REAL_PTR(name) REAL(name) = __nacl_irt_##name;
// Switch IRT's pointer to the REAL pointer
-#define USE_REAL(name) \
- __nacl_irt_##name = (typeof(__nacl_irt_##name)) REAL(name)
+#define USE_REAL(name) __nacl_irt_##name = (typeof(__nacl_irt_##name))REAL(name)
// Switch IRT's pointer to the WRAP function
-#define USE_WRAP(name) \
- __nacl_irt_##name = (typeof(__nacl_irt_##name)) WRAP(name)
+#define USE_WRAP(name) __nacl_irt_##name = (typeof(__nacl_irt_##name))WRAP(name)
#define EXPAND_SYMBOL_LIST_OPERATION(OP) \
- OP(chdir); \
- OP(close); \
- OP(dup); \
- OP(dup2); \
- OP(exit); \
- OP(fchdir); \
- OP(fchmod); \
- OP(fdatasync); \
- OP(fstat); \
- OP(fsync); \
- OP(getcwd); \
- OP(getdents); \
- OP(isatty); \
- OP(lstat); \
- OP(mkdir); \
- OP(mmap); \
- OP(munmap); \
- OP(open); \
- OP(open_resource); \
- OP(poll); \
- OP(read); \
- OP(readlink); \
- OP(rmdir); \
- OP(seek); \
- OP(stat); \
- OP(truncate); \
- OP(write); \
+ OP(chdir); \
+ OP(close); \
+ OP(dup); \
+ OP(dup2); \
+ OP(exit); \
+ OP(fchdir); \
+ OP(fchmod); \
+ OP(fdatasync); \
+ OP(fstat); \
+ OP(fsync); \
+ OP(getcwd); \
+ OP(getdents); \
+ OP(isatty); \
+ OP(lstat); \
+ OP(mkdir); \
+ OP(mmap); \
+ OP(munmap); \
+ OP(open); \
+ OP(open_resource); \
+ OP(poll); \
+ OP(read); \
+ OP(readlink); \
+ OP(rmdir); \
+ OP(seek); \
+ OP(stat); \
+ OP(truncate); \
+ OP(write);
EXPAND_SYMBOL_LIST_OPERATION(DECLARE_REAL_PTR);
@@ -181,7 +177,7 @@ int WRAP(fdatasync)(int fd) NOTHROW {
ERRNO_RTN(ki_fdatasync(fd));
}
-int WRAP(fstat)(int fd, struct nacl_abi_stat *nacl_buf) {
+int WRAP(fstat)(int fd, struct nacl_abi_stat* nacl_buf) {
struct stat buf;
memset(&buf, 0, sizeof(struct stat));
int res = ki_fstat(fd, &buf);
@@ -199,7 +195,7 @@ int WRAP(getcwd)(char* buf, size_t size) {
return 0;
}
-int WRAP(getdents)(int fd, dirent* nacl_buf, size_t nacl_count, size_t *nread) {
+int WRAP(getdents)(int fd, dirent* nacl_buf, size_t nacl_count, size_t* nread) {
int nacl_offset = 0;
// "buf" contains dirent(s); "nacl_buf" contains nacl_abi_dirent(s).
// nacl_abi_dirent(s) are smaller than dirent(s), so nacl_count bytes buffer
@@ -234,7 +230,7 @@ int WRAP(isatty)(int fd, int* result) {
return 0;
}
-int WRAP(lstat)(const char *path, struct nacl_abi_stat* nacl_buf) {
+int WRAP(lstat)(const char* path, struct nacl_abi_stat* nacl_buf) {
struct stat buf;
memset(&buf, 0, sizeof(struct stat));
int res = ki_lstat(path, &buf);
@@ -247,7 +243,11 @@ int WRAP(mkdir)(const char* pathname, mode_t mode) {
ERRNO_RTN(ki_mkdir(pathname, mode));
}
-int WRAP(mmap)(void** addr, size_t length, int prot, int flags, int fd,
+int WRAP(mmap)(void** addr,
+ size_t length,
+ int prot,
+ int flags,
+ int fd,
int64_t offset) {
if (flags & MAP_ANONYMOUS)
return REAL(mmap)(addr, length, prot, flags, fd, offset);
@@ -274,13 +274,12 @@ int WRAP(open_resource)(const char* file, int* fd) {
ERRNO_RTN(*fd);
}
-int WRAP(poll)(struct pollfd *fds, nfds_t nfds, int timeout, int* count) {
+int WRAP(poll)(struct pollfd* fds, nfds_t nfds, int timeout, int* count) {
*count = ki_poll(fds, nfds, timeout);
ERRNO_RTN(*count);
-
}
-int WRAP(read)(int fd, void *buf, size_t count, size_t *nread) {
+int WRAP(read)(int fd, void* buf, size_t count, size_t* nread) {
ssize_t signed_nread = ki_read(fd, buf, count);
*nread = static_cast<size_t>(signed_nread);
ERRNO_RTN(signed_nread);
@@ -301,13 +300,17 @@ int WRAP(seek)(int fd, off64_t offset, int whence, int64_t* new_offset) {
ERRNO_RTN(*new_offset);
}
-int WRAP(select)(int nfds, fd_set* readfds, fd_set* writefds,
- fd_set* exceptfds, struct timeval* timeout, int* count) {
+int WRAP(select)(int nfds,
+ fd_set* readfds,
+ fd_set* writefds,
+ fd_set* exceptfds,
+ struct timeval* timeout,
+ int* count) {
*count = ki_select(nfds, readfds, writefds, exceptfds, timeout);
ERRNO_RTN(*count);
}
-int WRAP(stat)(const char *pathname, struct nacl_abi_stat *nacl_buf) {
+int WRAP(stat)(const char* pathname, struct nacl_abi_stat* nacl_buf) {
struct stat buf;
memset(&buf, 0, sizeof(struct stat));
int res = ki_stat(pathname, &buf);
@@ -316,7 +319,7 @@ int WRAP(stat)(const char *pathname, struct nacl_abi_stat *nacl_buf) {
return 0;
}
-int WRAP(truncate)(const char *name, int64_t len) {
+int WRAP(truncate)(const char* name, int64_t len) {
ERRNO_RTN(ki_truncate(name, len));
}
@@ -335,7 +338,7 @@ static void assign_real_pointers() {
}
#define CHECK_REAL(func) \
- if (!REAL(func)) \
+ if (!REAL(func)) \
assign_real_pointers();
// "real" functions, i.e. the unwrapped original functions.
@@ -368,7 +371,7 @@ int _real_fstat(int fd, struct stat* buf) {
struct nacl_abi_stat st;
CHECK_REAL(fstat);
- int err = REAL(fstat)(fd, (struct stat*) &st);
+ int err = REAL(fstat)(fd, (struct stat*)&st);
if (err) {
errno = err;
return -1;
@@ -401,8 +404,8 @@ int _real_getdents(int fd, void* buf, size_t count, size_t* nread) {
d->d_ino = nacl_d->nacl_abi_d_ino;
d->d_off = nacl_d->nacl_abi_d_off;
d->d_reclen = nacl_d->nacl_abi_d_reclen + d_name_shift;
- size_t d_name_len = nacl_d->nacl_abi_d_reclen -
- offsetof(nacl_abi_dirent, nacl_abi_d_name);
+ size_t d_name_len =
+ nacl_d->nacl_abi_d_reclen - offsetof(nacl_abi_dirent, nacl_abi_d_name);
memcpy(d->d_name, nacl_d->nacl_abi_d_name, d_name_len);
offset += d->d_reclen;
@@ -430,7 +433,7 @@ int _real_lstat(const char* path, struct stat* buf) {
struct nacl_abi_stat st;
CHECK_REAL(fstat);
- int err = REAL(lstat)(path, (struct stat*) &st);
+ int err = REAL(lstat)(path, (struct stat*)&st);
if (err) {
errno = err;
return -1;
@@ -440,13 +443,16 @@ int _real_lstat(const char* path, struct stat* buf) {
return 0;
}
-
int _real_mkdir(const char* pathname, mode_t mode) {
CHECK_REAL(mkdir);
return REAL(mkdir)(pathname, mode);
}
-int _real_mmap(void** addr, size_t length, int prot, int flags, int fd,
+int _real_mmap(void** addr,
+ size_t length,
+ int prot,
+ int flags,
+ int fd,
int64_t offset) {
CHECK_REAL(mmap);
return REAL(mmap)(addr, length, prot, flags, fd, offset);
@@ -467,12 +473,12 @@ int _real_open_resource(const char* file, int* fd) {
return REAL(open_resource)(file, fd);
}
-int _real_read(int fd, void *buf, size_t count, size_t *nread) {
+int _real_read(int fd, void* buf, size_t count, size_t* nread) {
CHECK_REAL(read);
return REAL(read)(fd, buf, count, nread);
}
-int _real_readlink(const char *path, char* buf, size_t count, size_t* nread) {
+int _real_readlink(const char* path, char* buf, size_t count, size_t* nread) {
CHECK_REAL(readlink);
return REAL(readlink)(path, buf, count, nread);
}
@@ -487,7 +493,7 @@ int _real_truncate(const char* pathname, int64_t len) {
return REAL(truncate)(pathname, len);
}
-int _real_write(int fd, const void *buf, size_t count, size_t *nwrote) {
+int _real_write(int fd, const void* buf, size_t count, size_t* nwrote) {
CHECK_REAL(write);
return REAL(write)(fd, buf, count, nwrote);
}
diff --git a/native_client_sdk/src/libraries/nacl_io/kernel_wrap_dummy.cc b/native_client_sdk/src/libraries/nacl_io/kernel_wrap_dummy.cc
index ab5d199..807d8d7 100644
--- a/native_client_sdk/src/libraries/nacl_io/kernel_wrap_dummy.cc
+++ b/native_client_sdk/src/libraries/nacl_io/kernel_wrap_dummy.cc
@@ -19,11 +19,11 @@ int _real_close(int fd) {
return ENOSYS;
}
-int _real_fstat(int fd, struct stat *buf) {
+int _real_fstat(int fd, struct stat* buf) {
return 0;
}
-int _real_getdents(int fd, void* nacl_buf, size_t nacl_count, size_t *nread) {
+int _real_getdents(int fd, void* nacl_buf, size_t nacl_count, size_t* nread) {
return ENOSYS;
}
@@ -35,7 +35,11 @@ int _real_mkdir(const char* pathname, mode_t mode) {
return ENOSYS;
}
-int _real_mmap(void** addr, size_t length, int prot, int flags, int fd,
+int _real_mmap(void** addr,
+ size_t length,
+ int prot,
+ int flags,
+ int fd,
off_t offset) {
return ENOSYS;
}
@@ -52,7 +56,7 @@ int _real_open_resource(const char* file, int* fd) {
return ENOSYS;
}
-int _real_read(int fd, void *buf, size_t count, size_t *nread) {
+int _real_read(int fd, void* buf, size_t count, size_t* nread) {
*nread = count;
return 0;
}
@@ -61,7 +65,7 @@ int _real_rmdir(const char* pathname) {
return ENOSYS;
}
-int _real_write(int fd, const void *buf, size_t count, size_t *nwrote) {
+int _real_write(int fd, const void* buf, size_t count, size_t* nwrote) {
int rtn = write(fd, buf, count);
if (rtn < 0)
return -1;
diff --git a/native_client_sdk/src/libraries/nacl_io/kernel_wrap_glibc.cc b/native_client_sdk/src/libraries/nacl_io/kernel_wrap_glibc.cc
index 990b823..5e43c6c 100644
--- a/native_client_sdk/src/libraries/nacl_io/kernel_wrap_glibc.cc
+++ b/native_client_sdk/src/libraries/nacl_io/kernel_wrap_glibc.cc
@@ -26,7 +26,6 @@
#include "nacl_io/log.h"
#include "nacl_io/osmman.h"
-
namespace {
void stat_to_nacl_stat(const struct stat* buf, nacl_abi_stat* nacl_buf) {
@@ -55,7 +54,7 @@ void nacl_stat_to_stat(const nacl_abi_stat* nacl_buf, struct stat* buf) {
buf->st_uid = nacl_buf->nacl_abi_st_uid;
buf->st_gid = nacl_buf->nacl_abi_st_gid;
buf->st_rdev = nacl_buf->nacl_abi_st_rdev;
- buf->st_size = nacl_buf->nacl_abi_st_size ;
+ buf->st_size = nacl_buf->nacl_abi_st_size;
buf->st_blksize = nacl_buf->nacl_abi_st_blksize;
buf->st_blocks = nacl_buf->nacl_abi_st_blocks;
buf->st_atime = nacl_buf->nacl_abi_st_atime;
@@ -107,60 +106,57 @@ EXTERN_C_BEGIN
#define WRAP(name) __nacl_irt_##name##_wrap
// Declare REAL function pointer.
-#define DECLARE_REAL_PTR(name) \
- typeof(__nacl_irt_##name) REAL(name);
+#define DECLARE_REAL_PTR(name) typeof(__nacl_irt_##name) REAL(name);
// Assign the REAL function pointer.
-#define ASSIGN_REAL_PTR(name) \
+#define ASSIGN_REAL_PTR(name) \
assert(__nacl_irt_##name != NULL); \
REAL(name) = __nacl_irt_##name;
// Switch IRT's pointer to the REAL pointer
-#define USE_REAL(name) \
- __nacl_irt_##name = (typeof(__nacl_irt_##name)) REAL(name)
+#define USE_REAL(name) __nacl_irt_##name = (typeof(__nacl_irt_##name))REAL(name)
// Switch IRT's pointer to the WRAP function
-#define USE_WRAP(name) \
- __nacl_irt_##name = (typeof(__nacl_irt_##name)) WRAP(name)
+#define USE_WRAP(name) __nacl_irt_##name = (typeof(__nacl_irt_##name))WRAP(name)
#define EXPAND_SYMBOL_LIST_OPERATION(OP) \
- OP(chdir); \
- OP(close); \
- OP(dup); \
- OP(dup2); \
- OP(exit); \
- OP(fstat); \
- OP(getcwd); \
- OP(getdents); \
- OP(mkdir); \
- OP(open); \
- OP(poll);\
- OP(read); \
- OP(rmdir); \
- OP(seek); \
- OP(stat); \
- OP(select); \
- OP(write); \
- OP(mmap); \
- OP(munmap); \
- OP(open_resource); \
- \
- OP(socket); \
- OP(accept); \
- OP(bind); \
- OP(listen); \
- OP(connect); \
- OP(send); \
- OP(sendmsg); \
- OP(sendto); \
- OP(recv); \
- OP(recvmsg); \
- OP(recvfrom); \
- OP(getpeername); \
- OP(getsockname); \
- OP(getsockopt); \
- OP(setsockopt); \
- OP(socketpair); \
+ OP(chdir); \
+ OP(close); \
+ OP(dup); \
+ OP(dup2); \
+ OP(exit); \
+ OP(fstat); \
+ OP(getcwd); \
+ OP(getdents); \
+ OP(mkdir); \
+ OP(open); \
+ OP(poll); \
+ OP(read); \
+ OP(rmdir); \
+ OP(seek); \
+ OP(stat); \
+ OP(select); \
+ OP(write); \
+ OP(mmap); \
+ OP(munmap); \
+ OP(open_resource); \
+ \
+ OP(socket); \
+ OP(accept); \
+ OP(bind); \
+ OP(listen); \
+ OP(connect); \
+ OP(send); \
+ OP(sendmsg); \
+ OP(sendto); \
+ OP(recv); \
+ OP(recvmsg); \
+ OP(recvfrom); \
+ OP(getpeername); \
+ OP(getsockname); \
+ OP(getsockopt); \
+ OP(setsockopt); \
+ OP(socketpair); \
OP(shutdown);
// TODO(bradnelson): Add these as well.
@@ -199,7 +195,7 @@ void WRAP(exit)(int status) {
ki_exit(status);
}
-int WRAP(fstat)(int fd, struct nacl_abi_stat *nacl_buf) {
+int WRAP(fstat)(int fd, struct nacl_abi_stat* nacl_buf) {
struct stat buf;
memset(&buf, 0, sizeof(struct stat));
int res = ki_fstat(fd, &buf);
@@ -213,7 +209,7 @@ int WRAP(getcwd)(char* buf, size_t size) {
return 0;
}
-int WRAP(getdents)(int fd, dirent* nacl_buf, size_t nacl_count, size_t *nread) {
+int WRAP(getdents)(int fd, dirent* nacl_buf, size_t nacl_count, size_t* nread) {
int nacl_offset = 0;
// "buf" contains dirent(s); "nacl_buf" contains nacl_abi_dirent(s).
// nacl_abi_dirent(s) are smaller than dirent(s), so nacl_count bytes buffer
@@ -247,7 +243,11 @@ int WRAP(mkdir)(const char* pathname, mode_t mode) {
return 0;
}
-int WRAP(mmap)(void** addr, size_t length, int prot, int flags, int fd,
+int WRAP(mmap)(void** addr,
+ size_t length,
+ int prot,
+ int flags,
+ int fd,
off_t offset) {
if (flags & MAP_ANONYMOUS)
return REAL(mmap)(addr, length, prot, flags, fd, offset);
@@ -276,13 +276,13 @@ int WRAP(open_resource)(const char* file, int* fd) {
return 0;
}
-int WRAP(poll)(struct pollfd *fds, nfds_t nfds, int timeout, int* count) {
+int WRAP(poll)(struct pollfd* fds, nfds_t nfds, int timeout, int* count) {
*count = ki_poll(fds, nfds, timeout);
RTN_ERRNO_IF(*count < 0);
return 0;
}
-int WRAP(read)(int fd, void *buf, size_t count, size_t *nread) {
+int WRAP(read)(int fd, void* buf, size_t count, size_t* nread) {
ssize_t signed_nread = ki_read(fd, buf, count);
*nread = static_cast<size_t>(signed_nread);
RTN_ERRNO_IF(signed_nread < 0);
@@ -300,14 +300,18 @@ int WRAP(seek)(int fd, off_t offset, int whence, off_t* new_offset) {
return 0;
}
-int WRAP(select)(int nfds, fd_set* readfds, fd_set* writefds,
- fd_set* exceptfds, struct timeval* timeout, int* count) {
+int WRAP(select)(int nfds,
+ fd_set* readfds,
+ fd_set* writefds,
+ fd_set* exceptfds,
+ struct timeval* timeout,
+ int* count) {
*count = ki_select(nfds, readfds, writefds, exceptfds, timeout);
RTN_ERRNO_IF(*count < 0);
return 0;
}
-int WRAP(stat)(const char *pathname, struct nacl_abi_stat *nacl_buf) {
+int WRAP(stat)(const char* pathname, struct nacl_abi_stat* nacl_buf) {
struct stat buf;
memset(&buf, 0, sizeof(struct stat));
int res = ki_stat(pathname, &buf);
@@ -323,8 +327,10 @@ int WRAP(write)(int fd, const void* buf, size_t count, size_t* nwrote) {
return 0;
}
-int WRAP(accept)(int sockfd, struct sockaddr* addr,
- socklen_t* addrlen, int *sd) {
+int WRAP(accept)(int sockfd,
+ struct sockaddr* addr,
+ socklen_t* addrlen,
+ int* sd) {
*sd = ki_accept(sockfd, addr, addrlen);
RTN_ERRNO_IF(*sd < 0);
return 0;
@@ -350,13 +356,19 @@ int WRAP(getsockname)(int sockfd, struct sockaddr* addr, socklen_t* addrlen) {
return 0;
}
-int WRAP(getsockopt)(int sockfd, int level, int optname, void* optval,
+int WRAP(getsockopt)(int sockfd,
+ int level,
+ int optname,
+ void* optval,
socklen_t* optlen) {
RTN_ERRNO_IF(ki_getsockopt(sockfd, level, optname, optval, optlen) < 0);
return 0;
}
-int WRAP(setsockopt)(int sockfd, int level, int optname, const void* optval,
+int WRAP(setsockopt)(int sockfd,
+ int level,
+ int optname,
+ const void* optval,
socklen_t optlen) {
RTN_ERRNO_IF(ki_setsockopt(sockfd, level, optname, optval, optlen) < 0);
return 0;
@@ -374,15 +386,20 @@ int WRAP(recv)(int sockfd, void* buf, size_t len, int flags, int* count) {
return 0;
}
-int WRAP(recvfrom)(int sockfd, void* buf, size_t len, int flags,
- struct sockaddr* addr, socklen_t* addrlen, int* count) {
+int WRAP(recvfrom)(int sockfd,
+ void* buf,
+ size_t len,
+ int flags,
+ struct sockaddr* addr,
+ socklen_t* addrlen,
+ int* count) {
ssize_t signed_nread = ki_recvfrom(sockfd, buf, len, flags, addr, addrlen);
*count = static_cast<int>(signed_nread);
RTN_ERRNO_IF(signed_nread < 0);
return 0;
}
-int WRAP(recvmsg)(int sockfd, struct msghdr* msg, int flags, int *count) {
+int WRAP(recvmsg)(int sockfd, struct msghdr* msg, int flags, int* count) {
ssize_t signed_nread = ki_recvmsg(sockfd, msg, flags);
*count = static_cast<int>(signed_nread);
RTN_ERRNO_IF(signed_nread < 0);
@@ -397,8 +414,12 @@ ssize_t WRAP(send)(int sockfd, const void* buf, size_t len, int flags,
return 0;
}
-ssize_t WRAP(sendto)(int sockfd, const void* buf, size_t len, int flags,
- const struct sockaddr* addr, socklen_t addrlen,
+ssize_t WRAP(sendto)(int sockfd,
+ const void* buf,
+ size_t len,
+ int flags,
+ const struct sockaddr* addr,
+ socklen_t addrlen,
int* count) {
ssize_t signed_nread = ki_sendto(sockfd, buf, len, flags, addr, addrlen);
*count = static_cast<int>(signed_nread);
@@ -406,7 +427,9 @@ ssize_t WRAP(sendto)(int sockfd, const void* buf, size_t len, int flags,
return 0;
}
-ssize_t WRAP(sendmsg)(int sockfd, const struct msghdr* msg, int flags,
+ssize_t WRAP(sendmsg)(int sockfd,
+ const struct msghdr* msg,
+ int flags,
int* count) {
ssize_t signed_nread = ki_sendmsg(sockfd, msg, flags);
*count = static_cast<int>(signed_nread);
@@ -439,7 +462,7 @@ static void assign_real_pointers() {
}
#define CHECK_REAL(func) \
- if (!REAL(func)) \
+ if (!REAL(func)) \
assign_real_pointers();
// "real" functions, i.e. the unwrapped original functions.
@@ -485,8 +508,8 @@ int _real_getdents(int fd, void* buf, size_t count, size_t* nread) {
d->d_ino = nacl_d->nacl_abi_d_ino;
d->d_off = nacl_d->nacl_abi_d_off;
d->d_reclen = nacl_d->nacl_abi_d_reclen + d_name_shift;
- size_t d_name_len = nacl_d->nacl_abi_d_reclen -
- offsetof(nacl_abi_dirent, nacl_abi_d_name);
+ size_t d_name_len =
+ nacl_d->nacl_abi_d_reclen - offsetof(nacl_abi_dirent, nacl_abi_d_name);
memcpy(d->d_name, nacl_d->nacl_abi_d_name, d_name_len);
offset += d->d_reclen;
@@ -507,7 +530,11 @@ int _real_mkdir(const char* pathname, mode_t mode) {
return REAL(mkdir)(pathname, mode);
}
-int _real_mmap(void** addr, size_t length, int prot, int flags, int fd,
+int _real_mmap(void** addr,
+ size_t length,
+ int prot,
+ int flags,
+ int fd,
off_t offset) {
CHECK_REAL(mmap);
return REAL(mmap)(addr, length, prot, flags, fd, offset);
@@ -528,7 +555,7 @@ int _real_open_resource(const char* file, int* fd) {
return REAL(open_resource)(file, fd);
}
-int _real_read(int fd, void *buf, size_t count, size_t *nread) {
+int _real_read(int fd, void* buf, size_t count, size_t* nread) {
CHECK_REAL(read);
return REAL(read)(fd, buf, count, nread);
}
@@ -538,7 +565,7 @@ int _real_rmdir(const char* pathname) {
return REAL(rmdir)(pathname);
}
-int _real_write(int fd, const void *buf, size_t count, size_t *nwrote) {
+int _real_write(int fd, const void* buf, size_t count, size_t* nwrote) {
CHECK_REAL(write);
return REAL(write)(fd, buf, count, nwrote);
}
diff --git a/native_client_sdk/src/libraries/nacl_io/kernel_wrap_newlib.cc b/native_client_sdk/src/libraries/nacl_io/kernel_wrap_newlib.cc
index d126d46..af3ecca 100644
--- a/native_client_sdk/src/libraries/nacl_io/kernel_wrap_newlib.cc
+++ b/native_client_sdk/src/libraries/nacl_io/kernel_wrap_newlib.cc
@@ -35,16 +35,15 @@ EXTERN_C_BEGIN
typeof(__libnacl_irt_##group.name) REAL(name);
// Assign the REAL function pointer.
-#define ASSIGN_REAL_PTR(group, name) \
- REAL(name) = __libnacl_irt_##group.name;
+#define ASSIGN_REAL_PTR(group, name) REAL(name) = __libnacl_irt_##group.name;
// Switch IRT's pointer to the REAL pointer
#define USE_REAL(group, name) \
- __libnacl_irt_##group.name = (typeof(REAL(name))) REAL(name); \
+ __libnacl_irt_##group.name = (typeof(REAL(name)))REAL(name);
// Switch the IRT's pointer to the WRAP function
#define USE_WRAP(group, name) \
- __libnacl_irt_##group.name = (typeof(REAL(name))) WRAP(name); \
+ __libnacl_irt_##group.name = (typeof(REAL(name)))WRAP(name);
extern void __libnacl_irt_dev_filename_init(void);
@@ -56,38 +55,38 @@ extern struct nacl_irt_memory __libnacl_irt_memory;
// Create function pointers to the REAL implementation
#define EXPAND_SYMBOL_LIST_OPERATION(OP) \
- OP(basic, exit); \
- OP(fdio, close); \
- OP(fdio, dup); \
- OP(fdio, dup2); \
- OP(fdio, read); \
- OP(fdio, write); \
- OP(fdio, seek); \
- OP(fdio, fstat); \
- OP(fdio, getdents); \
- OP(dev_fdio, fchdir); \
- OP(dev_fdio, fchmod); \
- OP(dev_fdio, fsync); \
- OP(dev_fdio, fdatasync); \
- OP(dev_fdio, ftruncate); \
- OP(dev_fdio, isatty); \
- OP(dev_filename, open); \
- OP(dev_filename, stat); \
- OP(dev_filename, mkdir); \
- OP(dev_filename, rmdir); \
- OP(dev_filename, chdir); \
- OP(dev_filename, getcwd); \
- OP(dev_filename, unlink); \
- OP(dev_filename, truncate); \
- OP(dev_filename, lstat); \
- OP(dev_filename, link); \
- OP(dev_filename, rename); \
- OP(dev_filename, symlink); \
- OP(dev_filename, chmod); \
- OP(dev_filename, access); \
- OP(dev_filename, readlink); \
- OP(dev_filename, utimes); \
- OP(memory, mmap); \
+ OP(basic, exit); \
+ OP(fdio, close); \
+ OP(fdio, dup); \
+ OP(fdio, dup2); \
+ OP(fdio, read); \
+ OP(fdio, write); \
+ OP(fdio, seek); \
+ OP(fdio, fstat); \
+ OP(fdio, getdents); \
+ OP(dev_fdio, fchdir); \
+ OP(dev_fdio, fchmod); \
+ OP(dev_fdio, fsync); \
+ OP(dev_fdio, fdatasync); \
+ OP(dev_fdio, ftruncate); \
+ OP(dev_fdio, isatty); \
+ OP(dev_filename, open); \
+ OP(dev_filename, stat); \
+ OP(dev_filename, mkdir); \
+ OP(dev_filename, rmdir); \
+ OP(dev_filename, chdir); \
+ OP(dev_filename, getcwd); \
+ OP(dev_filename, unlink); \
+ OP(dev_filename, truncate); \
+ OP(dev_filename, lstat); \
+ OP(dev_filename, link); \
+ OP(dev_filename, rename); \
+ OP(dev_filename, symlink); \
+ OP(dev_filename, chmod); \
+ OP(dev_filename, access); \
+ OP(dev_filename, readlink); \
+ OP(dev_filename, utimes); \
+ OP(memory, mmap); \
OP(memory, munmap);
EXPAND_SYMBOL_LIST_OPERATION(DECLARE_REAL_PTR);
@@ -164,7 +163,11 @@ int WRAP(isatty)(int fd, int* result) {
return 0;
}
-int WRAP(mmap)(void** addr, size_t length, int prot, int flags, int fd,
+int WRAP(mmap)(void** addr,
+ size_t length,
+ int prot,
+ int flags,
+ int fd,
off_t offset) {
if (flags & MAP_ANONYMOUS)
return REAL(mmap)(addr, length, prot, flags, fd, offset);
@@ -240,8 +243,10 @@ int WRAP(access)(const char* pathname, int amode) {
ERRNO_RTN(ki_access(pathname, amode));
}
-int WRAP(readlink)(const char* pathname, char *buf,
- size_t count, size_t *nread) {
+int WRAP(readlink)(const char* pathname,
+ char* buf,
+ size_t count,
+ size_t* nread) {
int rtn = ki_readlink(pathname, buf, count);
RTN_ERRNO_IF(rtn < 0);
*nread = rtn;
@@ -262,7 +267,7 @@ static void assign_real_pointers() {
}
#define CHECK_REAL(func) \
- if (!REAL(func)) \
+ if (!REAL(func)) \
assign_real_pointers();
// "real" functions, i.e. the unwrapped original functions.
@@ -301,7 +306,11 @@ int _real_mkdir(const char* pathname, mode_t mode) {
return ENOSYS;
}
-int _real_mmap(void** addr, size_t length, int prot, int flags, int fd,
+int _real_mmap(void** addr,
+ size_t length,
+ int prot,
+ int flags,
+ int fd,
off_t offset) {
CHECK_REAL(mmap);
return REAL(mmap)(addr, length, prot, flags, fd, offset);
diff --git a/native_client_sdk/src/libraries/nacl_io/kernel_wrap_real.h b/native_client_sdk/src/libraries/nacl_io/kernel_wrap_real.h
index 68e3345..77ccc4a 100644
--- a/native_client_sdk/src/libraries/nacl_io/kernel_wrap_real.h
+++ b/native_client_sdk/src/libraries/nacl_io/kernel_wrap_real.h
@@ -14,19 +14,23 @@ EXTERN_C_BEGIN
/* NOTE: We do not use off_t because it may be 32 or 64 bit */
int _real_close(int fd);
void _real_exit(int status);
-int _real_fstat(int fd, struct stat *buf);
-int _real_getdents(int fd, void* nacl_buf, size_t nacl_count, size_t *nread);
+int _real_fstat(int fd, struct stat* buf);
+int _real_getdents(int fd, void* nacl_buf, size_t nacl_count, size_t* nread);
int _real_isatty(int fd, int* result);
int _real_lseek(int fd, int64_t offset, int whence, int64_t* new_offset);
int _real_mkdir(const char* pathname, mode_t mode);
-int _real_mmap(void** addr, size_t length, int prot, int flags, int fd,
+int _real_mmap(void** addr,
+ size_t length,
+ int prot,
+ int flags,
+ int fd,
int64_t offset);
int _real_munmap(void* addr, size_t length);
int _real_open(const char* pathname, int oflag, mode_t cmode, int* newfd);
int _real_open_resource(const char* file, int* fd);
-int _real_read(int fd, void *buf, size_t count, size_t *nread);
+int _real_read(int fd, void* buf, size_t count, size_t* nread);
int _real_rmdir(const char* pathname);
-int _real_write(int fd, const void *buf, size_t count, size_t *nwrote);
+int _real_write(int fd, const void* buf, size_t count, size_t* nwrote);
EXTERN_C_END
diff --git a/native_client_sdk/src/libraries/nacl_io/memfs/mem_fs.cc b/native_client_sdk/src/libraries/nacl_io/memfs/mem_fs.cc
index d090a86..d29602d 100644
--- a/native_client_sdk/src/libraries/nacl_io/memfs/mem_fs.cc
+++ b/native_client_sdk/src/libraries/nacl_io/memfs/mem_fs.cc
@@ -21,7 +21,8 @@
namespace nacl_io {
-MemFs::MemFs() : root_(NULL) {}
+MemFs::MemFs() : root_(NULL) {
+}
Error MemFs::Init(const FsInitArgs& args) {
Error error = Filesystem::Init(args);
diff --git a/native_client_sdk/src/libraries/nacl_io/memfs/mem_fs_node.cc b/native_client_sdk/src/libraries/nacl_io/memfs/mem_fs_node.cc
index 3782013..1e41591 100644
--- a/native_client_sdk/src/libraries/nacl_io/memfs/mem_fs_node.cc
+++ b/native_client_sdk/src/libraries/nacl_io/memfs/mem_fs_node.cc
@@ -27,7 +27,8 @@ MemFsNode::MemFsNode(Filesystem* filesystem) : Node(filesystem) {
SetType(S_IFREG);
}
-MemFsNode::~MemFsNode() {}
+MemFsNode::~MemFsNode() {
+}
Error MemFsNode::Read(const HandleAttr& attr,
void* buf,
diff --git a/native_client_sdk/src/libraries/nacl_io/nacl_io.cc b/native_client_sdk/src/libraries/nacl_io/nacl_io.cc
index ee61e9d..635ce9c 100644
--- a/native_client_sdk/src/libraries/nacl_io/nacl_io.cc
+++ b/native_client_sdk/src/libraries/nacl_io/nacl_io.cc
@@ -12,12 +12,10 @@ void nacl_io_init() {
ki_init(NULL);
}
-void nacl_io_init_ppapi(PP_Instance instance,
- PPB_GetInterface get_interface) {
+void nacl_io_init_ppapi(PP_Instance instance, PPB_GetInterface get_interface) {
ki_init_ppapi(NULL, instance, get_interface);
}
-
int nacl_io_register_fs_type(const char* fs_type, fuse_operations* fuse_ops) {
return ki_get_proxy()->RegisterFsType(fs_type, fuse_ops);
}
@@ -27,6 +25,6 @@ int nacl_io_unregister_fs_type(const char* fs_type) {
}
int nacl_io_register_exit_handler(nacl_io_exit_handler_t exit_handler,
- void* user_data) {
+ void* user_data) {
return ki_get_proxy()->RegisterExitHandler(exit_handler, user_data);
}
diff --git a/native_client_sdk/src/libraries/nacl_io/node.cc b/native_client_sdk/src/libraries/nacl_io/node.cc
index fc30867..2024e97 100644
--- a/native_client_sdk/src/libraries/nacl_io/node.cc
+++ b/native_client_sdk/src/libraries/nacl_io/node.cc
@@ -39,9 +39,12 @@ Node::Node(Filesystem* filesystem) : filesystem_(filesystem) {
stat_.st_ino = 1;
}
-Node::~Node() {}
+Node::~Node() {
+}
-Error Node::Init(int open_flags) { return 0; }
+Error Node::Init(int open_flags) {
+ return 0;
+}
void Node::Destroy() {
if (filesystem_) {
@@ -49,7 +52,9 @@ void Node::Destroy() {
}
}
-EventEmitter* Node::GetEventEmitter() { return NULL; }
+EventEmitter* Node::GetEventEmitter() {
+ return NULL;
+}
uint32_t Node::GetEventStatus() {
if (GetEventEmitter())
@@ -71,9 +76,13 @@ bool Node::CanOpen(int open_flags) {
return false;
}
-Error Node::FSync() { return 0; }
+Error Node::FSync() {
+ return 0;
+}
-Error Node::FTruncate(off_t length) { return EINVAL; }
+Error Node::FTruncate(off_t length) {
+ return EINVAL;
+}
Error Node::GetDents(size_t offs,
struct dirent* pdir,
@@ -97,7 +106,9 @@ Error Node::Ioctl(int request, ...) {
return rtn;
}
-Error Node::VIoctl(int request, va_list args) { return EINVAL; }
+Error Node::VIoctl(int request, va_list args) {
+ return EINVAL;
+}
Error Node::Read(const HandleAttr& attr,
void* buf,
@@ -153,24 +164,34 @@ Error Node::MMap(void* addr,
return 0;
}
-Error Node::Tcflush(int queue_selector) { return EINVAL; }
+Error Node::Tcflush(int queue_selector) {
+ return EINVAL;
+}
-Error Node::Tcgetattr(struct termios* termios_p) { return EINVAL; }
+Error Node::Tcgetattr(struct termios* termios_p) {
+ return EINVAL;
+}
Error Node::Tcsetattr(int optional_actions, const struct termios* termios_p) {
return EINVAL;
}
-int Node::GetLinks() { return stat_.st_nlink; }
+int Node::GetLinks() {
+ return stat_.st_nlink;
+}
-int Node::GetMode() { return stat_.st_mode & ~S_IFMT; }
+int Node::GetMode() {
+ return stat_.st_mode & ~S_IFMT;
+}
Error Node::GetSize(off_t* out_size) {
*out_size = stat_.st_size;
return 0;
}
-int Node::GetType() { return stat_.st_mode & S_IFMT; }
+int Node::GetType() {
+ return stat_.st_mode & S_IFMT;
+}
void Node::SetType(int type) {
assert((type & ~S_IFMT) == 0);
@@ -178,11 +199,17 @@ void Node::SetType(int type) {
stat_.st_mode |= type;
}
-bool Node::IsaDir() { return (stat_.st_mode & S_IFDIR) != 0; }
+bool Node::IsaDir() {
+ return (stat_.st_mode & S_IFDIR) != 0;
+}
-bool Node::IsaFile() { return (stat_.st_mode & S_IFREG) != 0; }
+bool Node::IsaFile() {
+ return (stat_.st_mode & S_IFREG) != 0;
+}
-bool Node::IsaSock() { return (stat_.st_mode & S_IFSOCK) != 0; }
+bool Node::IsaSock() {
+ return (stat_.st_mode & S_IFSOCK) != 0;
+}
Error Node::Isatty() {
return ENOTTY;
@@ -192,17 +219,25 @@ Error Node::AddChild(const std::string& name, const ScopedNode& node) {
return ENOTDIR;
}
-Error Node::RemoveChild(const std::string& name) { return ENOTDIR; }
+Error Node::RemoveChild(const std::string& name) {
+ return ENOTDIR;
+}
Error Node::FindChild(const std::string& name, ScopedNode* out_node) {
out_node->reset(NULL);
return ENOTDIR;
}
-int Node::ChildCount() { return 0; }
+int Node::ChildCount() {
+ return 0;
+}
-void Node::Link() { stat_.st_nlink++; }
+void Node::Link() {
+ stat_.st_nlink++;
+}
-void Node::Unlink() { stat_.st_nlink--; }
+void Node::Unlink() {
+ stat_.st_nlink--;
+}
} // namespace nacl_io
diff --git a/native_client_sdk/src/libraries/nacl_io/ostermios.h b/native_client_sdk/src/libraries/nacl_io/ostermios.h
index a03b8a7..f0fc5f6 100644
--- a/native_client_sdk/src/libraries/nacl_io/ostermios.h
+++ b/native_client_sdk/src/libraries/nacl_io/ostermios.h
@@ -25,11 +25,10 @@ struct termios {
speed_t c_ospeed;
};
-
EXTERN_C_BEGIN
-int tcgetattr(int fd,struct termios *termios_p);
-int tcsetattr(int fd,int optional_actions,const struct termios *termios_p);
+int tcgetattr(int fd, struct termios* termios_p);
+int tcsetattr(int fd, int optional_actions, const struct termios* termios_p);
EXTERN_C_END
diff --git a/native_client_sdk/src/libraries/nacl_io/ostime.h b/native_client_sdk/src/libraries/nacl_io/ostime.h
index a3a92a4..d3b52a5 100644
--- a/native_client_sdk/src/libraries/nacl_io/ostime.h
+++ b/native_client_sdk/src/libraries/nacl_io/ostime.h
@@ -10,11 +10,11 @@
#include <pthread.h>
#ifndef CLOCK_REALTIME
-#define CLOCK_REALTIME (clockid_t) 1
+#define CLOCK_REALTIME (clockid_t)1
#endif
-int clock_gettime(clockid_t clock_id, struct timespec *tp);
-int clock_settime(clockid_t clock_id, const struct timespec *tp);
+int clock_gettime(clockid_t clock_id, struct timespec* tp);
+int clock_settime(clockid_t clock_id, const struct timespec* tp);
#else
@@ -23,4 +23,3 @@ int clock_settime(clockid_t clock_id, const struct timespec *tp);
#endif
#endif // LIBRARIES_NACL_IO_OSUNISTD_H_
-
diff --git a/native_client_sdk/src/libraries/nacl_io/passthroughfs/passthrough_fs.cc b/native_client_sdk/src/libraries/nacl_io/passthroughfs/passthrough_fs.cc
index 8b3bcab..52c5f96 100644
--- a/native_client_sdk/src/libraries/nacl_io/passthroughfs/passthrough_fs.cc
+++ b/native_client_sdk/src/libraries/nacl_io/passthroughfs/passthrough_fs.cc
@@ -122,13 +122,15 @@ class PassthroughFsNode : public Node {
int real_fd_;
};
-PassthroughFs::PassthroughFs() {}
+PassthroughFs::PassthroughFs() {
+}
Error PassthroughFs::Init(const FsInitArgs& args) {
return Filesystem::Init(args);
}
-void PassthroughFs::Destroy() {}
+void PassthroughFs::Destroy() {
+}
Error PassthroughFs::Access(const Path& path, int a_mode) {
// There is no underlying 'access' syscall in NaCl. It just returns ENOSYS.
diff --git a/native_client_sdk/src/libraries/nacl_io/path.cc b/native_client_sdk/src/libraries/nacl_io/path.cc
index 4989d51..0a64a15 100644
--- a/native_client_sdk/src/libraries/nacl_io/path.cc
+++ b/native_client_sdk/src/libraries/nacl_io/path.cc
@@ -12,7 +12,8 @@
namespace nacl_io {
-Path::Path() {}
+Path::Path() {
+}
Path::Path(const Path& path) {
paths_ = path.paths_;
@@ -22,7 +23,8 @@ Path::Path(const std::string& path) {
Set(path);
}
-Path::~Path() {}
+Path::~Path() {
+}
bool Path::IsAbsolute() const {
return !paths_.empty() && paths_[0] == "/";
@@ -45,7 +47,8 @@ Path& Path::Append(const std::string& path) {
for (size_t index = 0; index < paths.size(); index++) {
// Skip ROOT
- if (paths_.size() && index == 0 && paths[0] == "/") continue;
+ if (paths_.size() && index == 0 && paths[0] == "/")
+ continue;
paths_.push_back(paths[index]);
}
@@ -58,7 +61,8 @@ Path& Path::Prepend(const std::string& path) {
for (size_t index = 0; index < paths_.size(); index++) {
// Skip ROOT
- if (index == 0 && paths_[0] == "/") continue;
+ if (index == 0 && paths_[0] == "/")
+ continue;
paths.push_back(paths[index]);
}
paths_ = Normalize(paths);
@@ -74,12 +78,14 @@ Path& Path::Set(const std::string& path) {
Path Path::Parent() const {
Path out;
out.paths_ = paths_;
- if (out.paths_.size()) out.paths_.pop_back();
+ if (out.paths_.size())
+ out.paths_.pop_back();
return out;
}
std::string Path::Basename() const {
- if (paths_.size()) return paths_.back();
+ if (paths_.size())
+ return paths_.back();
return std::string();
}
@@ -100,14 +106,16 @@ StringArray_t Path::Normalize(const StringArray_t& paths) {
StringArray_t path_out;
for (size_t index = 0; index < paths.size(); index++) {
- const std::string &curr = paths[index];
+ const std::string& curr = paths[index];
// Check if '/' was used excessively in the path.
// For example, in cd Desktop/////
- if (curr == "/" && index != 0) continue;
+ if (curr == "/" && index != 0)
+ continue;
// Check for '.' in the path and remove it
- if (curr == ".") continue;
+ if (curr == ".")
+ continue;
// Check for '..'
if (curr == "..") {
@@ -137,7 +145,8 @@ StringArray_t Path::Normalize(const StringArray_t& paths) {
}
// If the path was valid, but now it's empty, return self
- if (path_out.size() == 0) path_out.push_back(".");
+ if (path_out.size() == 0)
+ path_out.push_back(".");
return path_out;
}
@@ -152,7 +161,8 @@ std::string Path::Range(const StringArray_t& paths, size_t start, size_t end) {
std::string out_path;
size_t index = start;
- if (end > paths.size()) end = paths.size();
+ if (end > paths.size())
+ end = paths.size();
// If this is an absolute path, paths[0] == "/". In this case, we don't want
// to add an additional / separator.
@@ -182,20 +192,21 @@ StringArray_t Path::Split(const std::string& path) {
// Copy path_split to components, removing empty path segments.
for (StringArray_t::const_iterator it = path_split.begin();
- it != path_split.end(); ++it) {
- if (!it->empty()) components.push_back(*it);
+ it != path_split.end();
+ ++it) {
+ if (!it->empty())
+ components.push_back(*it);
}
return components;
}
-Path& Path::operator =(const Path& p) {
+Path& Path::operator=(const Path& p) {
paths_ = p.paths_;
return *this;
}
-Path& Path::operator =(const std::string& p) {
+Path& Path::operator=(const std::string& p) {
return Set(p);
}
} // namespace nacl_io
-
diff --git a/native_client_sdk/src/libraries/nacl_io/path.h b/native_client_sdk/src/libraries/nacl_io/path.h
index 4b39daf..ce9b6bc 100644
--- a/native_client_sdk/src/libraries/nacl_io/path.h
+++ b/native_client_sdk/src/libraries/nacl_io/path.h
@@ -53,7 +53,8 @@ class Path {
// Collapse the string list removing extraneous '.', '..' path components
static StringArray_t Normalize(const StringArray_t& paths);
static std::string Join(const StringArray_t& paths);
- static std::string Range(const StringArray_t& paths, size_t start,
+ static std::string Range(const StringArray_t& paths,
+ size_t start,
size_t end);
static StringArray_t Split(const std::string& paths);
// Operator versions
diff --git a/native_client_sdk/src/libraries/nacl_io/pepper/all_interfaces.h b/native_client_sdk/src/libraries/nacl_io/pepper/all_interfaces.h
index 2ff3bbc..0fa645d 100644
--- a/native_client_sdk/src/libraries/nacl_io/pepper/all_interfaces.h
+++ b/native_client_sdk/src/libraries/nacl_io/pepper/all_interfaces.h
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-
/* Given an interface like this:
*
* struct PPB_Frob_1_1 {
diff --git a/native_client_sdk/src/libraries/nacl_io/pepper_interface.cc b/native_client_sdk/src/libraries/nacl_io/pepper_interface.cc
index 46591a5..8788737 100644
--- a/native_client_sdk/src/libraries/nacl_io/pepper_interface.cc
+++ b/native_client_sdk/src/libraries/nacl_io/pepper_interface.cc
@@ -17,10 +17,12 @@ void PepperInterface::ReleaseResource(PP_Resource resource) {
}
ScopedResource::ScopedResource(PepperInterface* ppapi)
- : ppapi_(ppapi), resource_(0) {}
+ : ppapi_(ppapi), resource_(0) {
+}
ScopedResource::ScopedResource(PepperInterface* ppapi, PP_Resource resource)
- : ppapi_(ppapi), resource_(resource) {}
+ : ppapi_(ppapi), resource_(resource) {
+}
ScopedResource::~ScopedResource() {
if (resource_)
diff --git a/native_client_sdk/src/libraries/nacl_io/pepper_interface.h b/native_client_sdk/src/libraries/nacl_io/pepper_interface.h
index c896431..27cf6be 100644
--- a/native_client_sdk/src/libraries/nacl_io/pepper_interface.h
+++ b/native_client_sdk/src/libraries/nacl_io/pepper_interface.h
@@ -61,13 +61,12 @@ namespace nacl_io {
// 2. Add the necessary pepper header to the top of this file.
// 3. Compile and cross your fingers!
-
// Forward declare interface classes.
#include "nacl_io/pepper/undef_macros.h"
#include "nacl_io/pepper/define_empty_macros.h"
#undef BEGIN_INTERFACE
#define BEGIN_INTERFACE(BaseClass, PPInterface, InterfaceString) \
- class BaseClass;
+ class BaseClass;
#include "nacl_io/pepper/all_interfaces.h"
int PPErrorToErrno(int32_t err);
@@ -92,7 +91,7 @@ class PepperInterface {
#include "nacl_io/pepper/define_empty_macros.h"
#undef BEGIN_INTERFACE
#define BEGIN_INTERFACE(BaseClass, PPInterface, InterfaceString) \
- virtual BaseClass* Get##BaseClass() = 0;
+ virtual BaseClass* Get##BaseClass() = 0;
#include "nacl_io/pepper/all_interfaces.h"
};
diff --git a/native_client_sdk/src/libraries/nacl_io/pepper_interface_delegate.cc b/native_client_sdk/src/libraries/nacl_io/pepper_interface_delegate.cc
index 384737e..29b922b 100644
--- a/native_client_sdk/src/libraries/nacl_io/pepper_interface_delegate.cc
+++ b/native_client_sdk/src/libraries/nacl_io/pepper_interface_delegate.cc
@@ -16,7 +16,8 @@ PepperInterfaceDelegate::PepperInterfaceDelegate(PP_Instance instance)
#include "nacl_io/pepper/all_interfaces.h"
}
-PepperInterfaceDelegate::~PepperInterfaceDelegate() {}
+PepperInterfaceDelegate::~PepperInterfaceDelegate() {
+}
PP_Instance PepperInterfaceDelegate::GetInstance() {
return instance_;
diff --git a/native_client_sdk/src/libraries/nacl_io/pepper_interface_delegate.h b/native_client_sdk/src/libraries/nacl_io/pepper_interface_delegate.h
index d6945a4..b9914c4 100644
--- a/native_client_sdk/src/libraries/nacl_io/pepper_interface_delegate.h
+++ b/native_client_sdk/src/libraries/nacl_io/pepper_interface_delegate.h
@@ -50,7 +50,7 @@ class PepperInterfaceDelegate : public PepperInterface {
#include "nacl_io/pepper/define_empty_macros.h"
#undef BEGIN_INTERFACE
#define BEGIN_INTERFACE(BaseClass, PPInterface, InterfaceString) \
- virtual BaseClass* Get##BaseClass();
+ virtual BaseClass* Get##BaseClass();
#include "nacl_io/pepper/all_interfaces.h"
// Interface delegate setters.
@@ -63,7 +63,7 @@ class PepperInterfaceDelegate : public PepperInterface {
#include "nacl_io/pepper/define_empty_macros.h"
#undef BEGIN_INTERFACE
#define BEGIN_INTERFACE(BaseClass, PPInterface, InterfaceString) \
- void Set##BaseClass##Delegate(BaseClass* delegate);
+ void Set##BaseClass##Delegate(BaseClass* delegate);
#include "nacl_io/pepper/all_interfaces.h"
private:
@@ -73,7 +73,7 @@ class PepperInterfaceDelegate : public PepperInterface {
#include "nacl_io/pepper/define_empty_macros.h"
#undef BEGIN_INTERFACE
#define BEGIN_INTERFACE(BaseClass, PPInterface, InterfaceString) \
- BaseClass* BaseClass##delegate_;
+ BaseClass* BaseClass##delegate_;
#include "nacl_io/pepper/all_interfaces.h"
};
diff --git a/native_client_sdk/src/libraries/nacl_io/pepper_interface_dummy.h b/native_client_sdk/src/libraries/nacl_io/pepper_interface_dummy.h
index 5c2271e..acb1906 100644
--- a/native_client_sdk/src/libraries/nacl_io/pepper_interface_dummy.h
+++ b/native_client_sdk/src/libraries/nacl_io/pepper_interface_dummy.h
@@ -34,7 +34,7 @@ class PepperInterfaceDummy : public PepperInterface {
#include "nacl_io/pepper/define_empty_macros.h"
#undef BEGIN_INTERFACE
#define BEGIN_INTERFACE(BaseClass, PPInterface, InterfaceString) \
- virtual BaseClass* Get##BaseClass() { return NULL; }
+ virtual BaseClass* Get##BaseClass() { return NULL; }
#include "nacl_io/pepper/all_interfaces.h"
};
diff --git a/native_client_sdk/src/libraries/nacl_io/pipe/pipe_event_emitter.cc b/native_client_sdk/src/libraries/nacl_io/pipe/pipe_event_emitter.cc
index b5c19e2..738a84b 100644
--- a/native_client_sdk/src/libraries/nacl_io/pipe/pipe_event_emitter.cc
+++ b/native_client_sdk/src/libraries/nacl_io/pipe/pipe_event_emitter.cc
@@ -20,7 +20,8 @@ Error PipeEventEmitter::Read_Locked(char* data, size_t len, int* out_bytes) {
return 0;
}
-Error PipeEventEmitter::Write_Locked(const char* data, size_t len,
+Error PipeEventEmitter::Write_Locked(const char* data,
+ size_t len,
int* out_bytes) {
*out_bytes = fifo_.Write(data, len);
diff --git a/native_client_sdk/src/libraries/nacl_io/real_pepper_interface.cc b/native_client_sdk/src/libraries/nacl_io/real_pepper_interface.cc
index 946cdd4..b7a6e4e 100644
--- a/native_client_sdk/src/libraries/nacl_io/real_pepper_interface.cc
+++ b/native_client_sdk/src/libraries/nacl_io/real_pepper_interface.cc
@@ -102,10 +102,9 @@ PP_Instance RealPepperInterface::GetInstance() {
#include "nacl_io/pepper/define_empty_macros.h"
#undef BEGIN_INTERFACE
#define BEGIN_INTERFACE(BaseClass, PPInterface, InterfaceString) \
- BaseClass* RealPepperInterface::Get##BaseClass() { \
- return BaseClass##interface_; \
- }
+ BaseClass* RealPepperInterface::Get##BaseClass() { \
+ return BaseClass##interface_; \
+ }
#include "nacl_io/pepper/all_interfaces.h"
} // namespace nacl_io
-
diff --git a/native_client_sdk/src/libraries/nacl_io/real_pepper_interface.h b/native_client_sdk/src/libraries/nacl_io/real_pepper_interface.h
index c6b0a18..d2c8a2f 100644
--- a/native_client_sdk/src/libraries/nacl_io/real_pepper_interface.h
+++ b/native_client_sdk/src/libraries/nacl_io/real_pepper_interface.h
@@ -17,7 +17,7 @@ namespace nacl_io {
#include "nacl_io/pepper/define_empty_macros.h"
#undef BEGIN_INTERFACE
#define BEGIN_INTERFACE(BaseClass, PPInterface, InterfaceString) \
- class Real##BaseClass;
+ class Real##BaseClass;
#include "nacl_io/pepper/all_interfaces.h"
class RealPepperInterface : public PepperInterface {
@@ -32,7 +32,7 @@ class RealPepperInterface : public PepperInterface {
#include "nacl_io/pepper/define_empty_macros.h"
#undef BEGIN_INTERFACE
#define BEGIN_INTERFACE(BaseClass, PPInterface, InterfaceString) \
- virtual BaseClass* Get##BaseClass();
+ virtual BaseClass* Get##BaseClass();
#include "nacl_io/pepper/all_interfaces.h"
private:
@@ -43,7 +43,7 @@ class RealPepperInterface : public PepperInterface {
#include "nacl_io/pepper/define_empty_macros.h"
#undef BEGIN_INTERFACE
#define BEGIN_INTERFACE(BaseClass, PPInterface, InterfaceString) \
- Real##BaseClass* BaseClass##interface_;
+ Real##BaseClass* BaseClass##interface_;
#include "nacl_io/pepper/all_interfaces.h"
};
diff --git a/native_client_sdk/src/libraries/nacl_io/socket/fifo_packet.cc b/native_client_sdk/src/libraries/nacl_io/socket/fifo_packet.cc
index 6e0fe14..3e5c330 100644
--- a/native_client_sdk/src/libraries/nacl_io/socket/fifo_packet.cc
+++ b/native_client_sdk/src/libraries/nacl_io/socket/fifo_packet.cc
@@ -13,21 +13,26 @@
namespace nacl_io {
-FIFOPacket::FIFOPacket(size_t size) : max_bytes_(size), cur_bytes_(0) {}
+FIFOPacket::FIFOPacket(size_t size) : max_bytes_(size), cur_bytes_(0) {
+}
FIFOPacket::~FIFOPacket() {
while (!IsEmpty())
delete ReadPacket();
}
-bool FIFOPacket::IsEmpty() { return packets_.empty(); }
+bool FIFOPacket::IsEmpty() {
+ return packets_.empty();
+}
bool FIFOPacket::Resize(size_t len) {
max_bytes_ = len;
return true;
}
-size_t FIFOPacket::ReadAvailable() { return cur_bytes_; }
+size_t FIFOPacket::ReadAvailable() {
+ return cur_bytes_;
+}
size_t FIFOPacket::WriteAvailable() {
if (cur_bytes_ > max_bytes_)
@@ -36,7 +41,9 @@ size_t FIFOPacket::WriteAvailable() {
return max_bytes_ - cur_bytes_;
}
-bool FIFOPacket::IsFull() { return cur_bytes_ >= max_bytes_; }
+bool FIFOPacket::IsFull() {
+ return cur_bytes_ >= max_bytes_;
+}
Packet* FIFOPacket::PeekPacket() {
if (packets_.empty())
diff --git a/native_client_sdk/src/libraries/nacl_io/socket/packet.cc b/native_client_sdk/src/libraries/nacl_io/socket/packet.cc
index c3545b0..f437d09 100644
--- a/native_client_sdk/src/libraries/nacl_io/socket/packet.cc
+++ b/native_client_sdk/src/libraries/nacl_io/socket/packet.cc
@@ -11,7 +11,8 @@
namespace nacl_io {
Packet::Packet(PepperInterface* ppapi)
- : ppapi_(ppapi), addr_(0), buffer_(NULL), len_(0) {}
+ : ppapi_(ppapi), addr_(0), buffer_(NULL), len_(0) {
+}
Packet::~Packet() {
if ((NULL != ppapi_) && addr_)
diff --git a/native_client_sdk/src/libraries/nacl_io/socket/socket_node.cc b/native_client_sdk/src/libraries/nacl_io/socket/socket_node.cc
index 98de7f6..8313455 100644
--- a/native_client_sdk/src/libraries/nacl_io/socket/socket_node.cc
+++ b/native_client_sdk/src/libraries/nacl_io/socket/socket_node.cc
@@ -215,7 +215,9 @@ Error SocketNode::Connect(const HandleAttr& attr,
return EOPNOTSUPP;
}
-Error SocketNode::Listen(int backlog) { return EOPNOTSUPP; }
+Error SocketNode::Listen(int backlog) {
+ return EOPNOTSUPP;
+}
Error SocketNode::GetSockOpt(int lvl,
int optname,
@@ -442,7 +444,9 @@ void SocketNode::SetError_Locked(int pp_error_num) {
last_errno_ = PPErrorToErrno(pp_error_num);
}
-Error SocketNode::Shutdown(int how) { return EOPNOTSUPP; }
+Error SocketNode::Shutdown(int how) {
+ return EOPNOTSUPP;
+}
Error SocketNode::GetPeerName(struct sockaddr* addr, socklen_t* len) {
if (NULL == addr || NULL == len)
diff --git a/native_client_sdk/src/libraries/nacl_io/socket/tcp_event_emitter.cc b/native_client_sdk/src/libraries/nacl_io/socket/tcp_event_emitter.cc
index 13e1134..ee0faa8 100644
--- a/native_client_sdk/src/libraries/nacl_io/socket/tcp_event_emitter.cc
+++ b/native_client_sdk/src/libraries/nacl_io/socket/tcp_event_emitter.cc
@@ -18,7 +18,8 @@ TcpEventEmitter::TcpEventEmitter(size_t rsize, size_t wsize)
out_fifo_(wsize),
error_(false),
listening_(false),
- accepted_socket_(0) {}
+ accepted_socket_(0) {
+}
uint32_t TcpEventEmitter::ReadIn_Locked(char* data, uint32_t len) {
uint32_t count = in_fifo_.Read(data, len);
@@ -72,7 +73,9 @@ void TcpEventEmitter::ConnectDone_Locked() {
UpdateStatus_Locked();
}
-bool TcpEventEmitter::GetError_Locked() { return error_; }
+bool TcpEventEmitter::GetError_Locked() {
+ return error_;
+}
void TcpEventEmitter::SetError_Locked() {
error_ = true;
diff --git a/native_client_sdk/src/libraries/nacl_io/socket/tcp_node.cc b/native_client_sdk/src/libraries/nacl_io/socket/tcp_node.cc
index 06e45e6..28915aa 100644
--- a/native_client_sdk/src/libraries/nacl_io/socket/tcp_node.cc
+++ b/native_client_sdk/src/libraries/nacl_io/socket/tcp_node.cc
@@ -307,7 +307,9 @@ Error TcpNode::Init(int open_flags) {
return 0;
}
-EventEmitter* TcpNode::GetEventEmitter() { return emitter_.get(); }
+EventEmitter* TcpNode::GetEventEmitter() {
+ return emitter_.get();
+}
void TcpNode::SetError_Locked(int pp_error_num) {
SocketNode::SetError_Locked(pp_error_num);
diff --git a/native_client_sdk/src/libraries/nacl_io/socket/udp_node.cc b/native_client_sdk/src/libraries/nacl_io/socket/udp_node.cc
index 807529d..582286d 100644
--- a/native_client_sdk/src/libraries/nacl_io/socket/udp_node.cc
+++ b/native_client_sdk/src/libraries/nacl_io/socket/udp_node.cc
@@ -160,7 +160,9 @@ void UdpNode::Destroy() {
SocketNode::Destroy();
}
-UdpEventEmitter* UdpNode::GetEventEmitter() { return emitter_.get(); }
+UdpEventEmitter* UdpNode::GetEventEmitter() {
+ return emitter_.get();
+}
Error UdpNode::Init(int open_flags) {
Error err = SocketNode::Init(open_flags);
diff --git a/native_client_sdk/src/libraries/nacl_io/stream/stream_event_emitter.cc b/native_client_sdk/src/libraries/nacl_io/stream/stream_event_emitter.cc
index c05a173..b81dd8f 100644
--- a/native_client_sdk/src/libraries/nacl_io/stream/stream_event_emitter.cc
+++ b/native_client_sdk/src/libraries/nacl_io/stream/stream_event_emitter.cc
@@ -13,7 +13,8 @@
namespace nacl_io {
-StreamEventEmitter::StreamEventEmitter() : stream_(NULL) {}
+StreamEventEmitter::StreamEventEmitter() : stream_(NULL) {
+}
void StreamEventEmitter::AttachStream(StreamNode* stream) {
AUTO_LOCK(GetLock());
diff --git a/native_client_sdk/src/libraries/nacl_io/stream/stream_fs.cc b/native_client_sdk/src/libraries/nacl_io/stream/stream_fs.cc
index bbc465a..8f5ef61 100644
--- a/native_client_sdk/src/libraries/nacl_io/stream/stream_fs.cc
+++ b/native_client_sdk/src/libraries/nacl_io/stream/stream_fs.cc
@@ -84,20 +84,32 @@ StreamFs::~StreamFs() {
pthread_cond_destroy(&message_cond_);
}
-Error StreamFs::Access(const Path& path, int a_mode) { return EACCES; }
+Error StreamFs::Access(const Path& path, int a_mode) {
+ return EACCES;
+}
Error StreamFs::Open(const Path& path, int o_flags, ScopedNode* out_node) {
return EACCES;
}
-Error StreamFs::Unlink(const Path& path) { return EACCES; }
+Error StreamFs::Unlink(const Path& path) {
+ return EACCES;
+}
-Error StreamFs::Mkdir(const Path& path, int permissions) { return EACCES; }
+Error StreamFs::Mkdir(const Path& path, int permissions) {
+ return EACCES;
+}
-Error StreamFs::Rmdir(const Path& path) { return EACCES; }
+Error StreamFs::Rmdir(const Path& path) {
+ return EACCES;
+}
-Error StreamFs::Remove(const Path& path) { return EACCES; }
+Error StreamFs::Remove(const Path& path) {
+ return EACCES;
+}
-Error StreamFs::Rename(const Path& path, const Path& newpath) { return EACCES; }
+Error StreamFs::Rename(const Path& path, const Path& newpath) {
+ return EACCES;
+}
} // namespace nacl_io
diff --git a/native_client_sdk/src/libraries/nacl_io/stream/stream_node.cc b/native_client_sdk/src/libraries/nacl_io/stream/stream_node.cc
index 87d4536..2b3a206 100644
--- a/native_client_sdk/src/libraries/nacl_io/stream/stream_node.cc
+++ b/native_client_sdk/src/libraries/nacl_io/stream/stream_node.cc
@@ -16,7 +16,8 @@
namespace nacl_io {
StreamNode::StreamNode(Filesystem* fs)
- : Node(fs), read_timeout_(-1), write_timeout_(-1), stream_state_flags_(0) {}
+ : Node(fs), read_timeout_(-1), write_timeout_(-1), stream_state_flags_(0) {
+}
Error StreamNode::Init(int open_flags) {
Node::Init(open_flags);
@@ -34,15 +35,21 @@ void StreamNode::ClearStreamFlags(uint32_t bits) {
sdk_util::AtomicAndFetch(&stream_state_flags_, ~bits);
}
-uint32_t StreamNode::GetStreamFlags() { return stream_state_flags_; }
+uint32_t StreamNode::GetStreamFlags() {
+ return stream_state_flags_;
+}
bool StreamNode::TestStreamFlags(uint32_t bits) {
return (stream_state_flags_ & bits) == bits;
}
-void StreamNode::QueueInput() {}
-void StreamNode::QueueOutput() {}
+void StreamNode::QueueInput() {
+}
+void StreamNode::QueueOutput() {
+}
-StreamFs* StreamNode::stream() { return static_cast<StreamFs*>(filesystem_); }
+StreamFs* StreamNode::stream() {
+ return static_cast<StreamFs*>(filesystem_);
+}
} // namespace nacl_io
diff --git a/native_client_sdk/src/libraries/nacl_io/syscalls/inet_ntop.cc b/native_client_sdk/src/libraries/nacl_io/syscalls/inet_ntop.cc
index 5ee66d1..4eaf0ef 100644
--- a/native_client_sdk/src/libraries/nacl_io/syscalls/inet_ntop.cc
+++ b/native_client_sdk/src/libraries/nacl_io/syscalls/inet_ntop.cc
@@ -43,10 +43,10 @@ const char* inet_ntop(int af, const void* src, char* dst, socklen_t size) {
for (int i = 0; i < 8; i++) {
host_tuples[i] = ntohs(tuples[i]);
if (host_tuples[i] == 0) {
- if (zero_run_start == -1)
- zero_run_start = i;
+ if (zero_run_start == -1)
+ zero_run_start = i;
} else if (zero_run_start != -1 && zero_run_end == -1) {
- zero_run_end = i;
+ zero_run_end = i;
}
}
@@ -64,13 +64,12 @@ const char* inet_ntop(int af, const void* src, char* dst, socklen_t size) {
if (zero_run_start == 0 &&
(zero_run_end == 6 ||
(zero_run_end == 5 && host_tuples[zero_run_end] == 0xffff))) {
-
if (zero_run_end == 5) {
strcpy(dst, "::ffff:");
} else {
strcpy(dst, "::");
}
- inet_ntop(AF_INET, host_tuples+6, dst+strlen(dst), INET_ADDRSTRLEN);
+ inet_ntop(AF_INET, host_tuples + 6, dst + strlen(dst), INET_ADDRSTRLEN);
} else {
std::stringstream output;
for (int i = 0; i < 8; i++) {