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

Unified Diff: libraries/nacl-mounts/base/KernelProxy.h

Issue 10392070: Socket subsystem implementation (Closed) Base URL: http://naclports.googlecode.com/svn/trunk/src/
Patch Set: Created 8 years, 7 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: libraries/nacl-mounts/base/KernelProxy.h
===================================================================
--- libraries/nacl-mounts/base/KernelProxy.h (revision 594)
+++ libraries/nacl-mounts/base/KernelProxy.h (working copy)
@@ -8,6 +8,7 @@
#include <errno.h>
#ifdef __GLIBC__
+#include <netdb.h>
#include <poll.h>
#endif
#include <pthread.h>
@@ -18,6 +19,8 @@
#include <string>
#include "../base/Mount.h"
#include "../base/MountManager.h"
+#include "../base/PthreadHelpers.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,36 @@
#endif
MountManager *mm() { return &mm_; }
+ int AddFileStream(FileStream* stream);
+ int AddFileStream(FileStream* stream, int fd);
+ void RemoveFileStream(int fd);
+
+ int IsReady(int nfds, fd_set* fds, bool (FileStream::*is_ready)(),
+ bool apply);
+ Cond& cond() { return cond_; }
+ Mutex& mutex() { return mutex_; }
private:
struct FileDescriptor {
// An index in open_files_ table
int handle;
};
+ // used for select() signals
+ Cond cond_;
+ Mutex mutex_;
Evgeniy Stepanov 2012/05/28 14:55:12 Rename to smth like select_cond_ & select_lock_. A
vissi 2012/05/28 15:20:21 Done.
+
struct FileHandle {
Mount *mount;
+ FileStream* stream;
ino_t node;
off_t offset;
int flags;
int use_count;
pthread_mutex_t lock;
};
+ FileHandle* GetFileHandle(int fd);
+ BaseSocketSubSystem* ss;
Path cwd_;
int max_path_len_;
MountManager mm_;
@@ -152,7 +173,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();

Powered by Google App Engine
This is Rietveld 408576698