Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(51)

Unified Diff: native_client_sdk/src/libraries/nacl_io/kernel_object.h

Issue 23005005: [NaCl SDK] nacl_io: Add initial implementations of kill and signal (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: native_client_sdk/src/libraries/nacl_io/kernel_object.h
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 036ff64e666f87d517268eb4b30222170c4f1233..83a41a0e64148af520b96eda8989e375e7a3f99f 100644
--- a/native_client_sdk/src/libraries/nacl_io/kernel_object.h
+++ b/native_client_sdk/src/libraries/nacl_io/kernel_object.h
@@ -12,6 +12,7 @@
#include <vector>
#include "nacl_io/error.h"
+#include "nacl_io/event_emitter.h"
#include "nacl_io/kernel_handle.h"
#include "nacl_io/mount.h"
#include "nacl_io/mount_node.h"
@@ -26,7 +27,7 @@ namespace nacl_io {
// All Kernel locks are private to ensure the lock order.
//
// All calls are assumed to be a relative path.
-class KernelObject {
+class KernelObject : public EventEmitter {
public:
typedef std::vector<ScopedKernelHandle> HandleMap_t;
typedef std::map<std::string, ScopedMount> MountMap_t;
@@ -75,6 +76,16 @@ class KernelObject {
// Returns parts of the absolute path for the given relative path
Path GetAbsParts(const std::string& path);
+ // From EventEmitter. The KernelObject emitters events in order
+ // to inturrupt anything waiting in select()/poll() when kill()
+ // is called. It has no readable or wriable state and also no
+ // meaningful type.
+ uint32_t GetEventStatus() { return 0; }
+ int GetType() {
+ // For lack of a better type, report socket to signify it can be in an
+ // used to signal.
+ return S_IFSOCK;
+ }
private:
std::string cwd_;
std::vector<int> free_fds_;
@@ -93,6 +104,9 @@ private:
DISALLOW_COPY_AND_ASSIGN(KernelObject);
};
+typedef sdk_util::ScopedRef<KernelObject> ScopedKernelObject;
+
+
} // namespace nacl_io
#endif // LIBRARIES_NACL_IO_KERNEL_OBJECT_H_

Powered by Google App Engine
This is Rietveld 408576698