Chromium Code Reviews| Index: libraries/nacl-mounts/base/KernelProxy.h |
| =================================================================== |
| --- libraries/nacl-mounts/base/KernelProxy.h (revision 583) |
| +++ libraries/nacl-mounts/base/KernelProxy.h (working copy) |
| @@ -12,12 +12,15 @@ |
| #endif |
| #include <pthread.h> |
| #ifdef __GLIBC__ |
| +#include <netdb.h> |
| #include <sys/epoll.h> |
| #endif |
| #include <sys/stat.h> |
| #include <string> |
| +#include "../base/FileHandle.h" |
| #include "../base/Mount.h" |
| #include "../base/MountManager.h" |
| +#include "../net/BaseSocketSubSystem.h" |
| #include "../util/Path.h" |
| #include "../util/SimpleAutoLock.h" |
| #include "../util/SlotAllocator.h" |
| @@ -33,12 +36,14 @@ |
| // Obtain the singleton instance of the kernel proxy. If no instance |
| // has been instantiated, one will be instantiated and returned. |
| static KernelProxy *KPInstance(); |
| + void SetSocketSubSystem(BaseSocketSubSystem* bss); |
| // System calls handled by KernelProxy (not mount-specific) |
| int chdir(const std::string& path); |
| bool getcwd(std::string *buf, size_t size); |
| bool getwd(std::string *buf); |
| int dup(int oldfd); |
| + int dup2(int oldfd, int newfd); |
| // System calls that take a path as an argument: |
| // The kernel proxy will look for the Node associated to the path. To |
| @@ -109,6 +114,7 @@ |
| const struct timeval *timeout, void* sigmask); |
| int getpeername(int sockfd, struct sockaddr *addr, socklen_t *addrlen); |
| int getsockname(int sockfd, struct sockaddr *addr, socklen_t *addrlen); |
| + struct hostent* gethostbyname(const char* name); |
| int getsockopt(int sockfd, int level, int optname, void *optval, |
| socklen_t* optlen); |
| int setsockopt(int sockfd, int level, int optname, const void *optval, |
| @@ -128,21 +134,21 @@ |
| #endif |
| MountManager *mm() { return &mm_; } |
| + ino_t CreateSocket(); |
| + int AddFileStream(FileStream* stream); |
| + int AddFileStream(FileStream* stream, int fd); |
| + FileHandle* GetFileHandle(int fd); |
| + void RemoveFileStream(int fd); |
| + |
| + int IsReady(int nfds, fd_set* fds, bool (FileStream::*is_ready)(), |
| + bool apply); |
| private: |
| struct FileDescriptor { |
| // An index in open_files_ table |
| int handle; |
| }; |
| - struct FileHandle { |
|
Evgeniy Stepanov
2012/05/25 12:05:57
move this back into KernelProxy
vissi
2012/05/25 13:07:09
Done.
|
| - Mount *mount; |
| - ino_t node; |
| - off_t offset; |
| - int flags; |
| - int use_count; |
| - pthread_mutex_t lock; |
| - }; |
| - |
| + BaseSocketSubSystem* ss; |
| Path cwd_; |
| int max_path_len_; |
| MountManager mm_; |
| @@ -152,7 +158,6 @@ |
| SlotAllocator<FileDescriptor> fds_; |
| SlotAllocator<FileHandle> open_files_; |
| - FileHandle *GetFileHandle(int fd); |
| int OpenHandle(Mount *mount, const std::string& path, int oflag, mode_t mode); |
| KernelProxy(); |