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 70ffb2f54a13e80900067f0b1845e8348be2f591..152e61c8c7e144676ee83771721b7519e56de088 100644 |
--- a/native_client_sdk/src/libraries/nacl_io/kernel_object.h |
+++ b/native_client_sdk/src/libraries/nacl_io/kernel_object.h |
@@ -37,6 +37,7 @@ class KernelObject { |
int flags; |
}; |
typedef std::vector<Descriptor_t> HandleMap_t; |
+ typedef std::map<int, std::string> FdPathMap_t; |
Sam Clegg
2014/01/07 23:56:39
Actually, why not just add at std::string to Descr
|
typedef std::map<std::string, ScopedFilesystem> FsMap_t; |
KernelObject(); |
@@ -65,20 +66,26 @@ class KernelObject { |
// Get FD-specific flags (currently only FD_CLOEXEC is supported). |
Error GetFDFlags(int fd, int* out_flags); |
+ // Get path at which FD was opened, if available. |
+ std::string GetFDPath(int fd); |
// Set FD-specific flags (currently only FD_CLOEXEC is supported). |
Error SetFDFlags(int fd, int flags); |
// 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, |
+ std::string& 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); |
+ int AllocateFD(const ScopedKernelHandle& handle, |
+ 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); |
// Returns or sets CWD |
@@ -92,6 +99,7 @@ class KernelObject { |
std::string cwd_; |
std::vector<int> free_fds_; |
HandleMap_t handle_map_; |
+ FdPathMap_t fd_paths_; |
FsMap_t filesystems_; |
// Lock to protect free_fds_ and handle_map_. |