| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef LIBRARIES_NACL_IO_KERNEL_PROXY_H_ | 5 #ifndef LIBRARIES_NACL_IO_KERNEL_PROXY_H_ |
| 6 #define LIBRARIES_NACL_IO_KERNEL_PROXY_H_ | 6 #define LIBRARIES_NACL_IO_KERNEL_PROXY_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "nacl_io/host_resolver.h" | 11 #include "nacl_io/host_resolver.h" |
| 12 #include "nacl_io/kernel_object.h" | 12 #include "nacl_io/kernel_object.h" |
| 13 #include "nacl_io/mount_factory.h" | 13 #include "nacl_io/mount_factory.h" |
| 14 #include "nacl_io/mount_socket.h" | 14 #include "nacl_io/mount_socket.h" |
| 15 #include "nacl_io/ossignal.h" | 15 #include "nacl_io/ossignal.h" |
| 16 #include "nacl_io/ossocket.h" | 16 #include "nacl_io/ossocket.h" |
| 17 #include "nacl_io/ostypes.h" | 17 #include "nacl_io/ostypes.h" |
| 18 #include "nacl_io/osutime.h" | 18 #include "nacl_io/osutime.h" |
| 19 | 19 |
| 20 struct timeval; | 20 struct timeval; |
| 21 | 21 |
| 22 namespace nacl_io { | 22 namespace nacl_io { |
| 23 | 23 |
| 24 class PepperInterface; | 24 class PepperInterface; |
| 25 class SignalEmitter; |
| 26 |
| 27 typedef sdk_util::ScopedRef<SignalEmitter> ScopedSignalEmitter; |
| 25 | 28 |
| 26 // KernelProxy provide one-to-one mapping for libc kernel calls. Calls to the | 29 // KernelProxy provide one-to-one mapping for libc kernel calls. Calls to the |
| 27 // proxy will result in IO access to the provided Mount and MountNode objects. | 30 // proxy will result in IO access to the provided Mount and MountNode objects. |
| 28 // | 31 // |
| 29 // NOTE: The KernelProxy does not directly take any kernel locks, all locking | 32 // NOTE: The KernelProxy does not directly take any kernel locks, all locking |
| 30 // is done by the parent class KernelObject. Instead, KernelProxy is | 33 // is done by the parent class KernelObject. Instead, KernelProxy is |
| 31 // responsible for taking the locks of the KernelHandle, and MountNode objects. | 34 // responsible for taking the locks of the KernelHandle, and MountNode objects. |
| 32 // For this reason, a KernelObject call should not be done while holding | 35 // For this reason, a KernelObject call should not be done while holding |
| 33 // a handle or node lock. In addition, to ensure locking order, | 36 // a handle or node lock. In addition, to ensure locking order, |
| 34 // a KernelHandle lock must never be taken after taking the associated | 37 // a KernelHandle lock must never be taken after taking the associated |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 virtual int socket(int domain, int type, int protocol); | 179 virtual int socket(int domain, int type, int protocol); |
| 177 virtual int socketpair(int domain, int type, int protocol, int* sv); | 180 virtual int socketpair(int domain, int type, int protocol, int* sv); |
| 178 #endif // PROVIDES_SOCKET_API | 181 #endif // PROVIDES_SOCKET_API |
| 179 | 182 |
| 180 protected: | 183 protected: |
| 181 MountFactoryMap_t factories_; | 184 MountFactoryMap_t factories_; |
| 182 sdk_util::ScopedRef<MountSocket> socket_mount_; | 185 sdk_util::ScopedRef<MountSocket> socket_mount_; |
| 183 int dev_; | 186 int dev_; |
| 184 PepperInterface* ppapi_; | 187 PepperInterface* ppapi_; |
| 185 static KernelProxy *s_instance_; | 188 static KernelProxy *s_instance_; |
| 189 sighandler_t sigwinch_handler_; |
| 186 #ifdef PROVIDES_SOCKET_API | 190 #ifdef PROVIDES_SOCKET_API |
| 187 HostResolver host_resolver_; | 191 HostResolver host_resolver_; |
| 188 #endif | 192 #endif |
| 189 | 193 |
| 190 #ifdef PROVIDES_SOCKET_API | 194 #ifdef PROVIDES_SOCKET_API |
| 191 virtual int AcquireSocketHandle(int fd, ScopedKernelHandle* handle); | 195 virtual int AcquireSocketHandle(int fd, ScopedKernelHandle* handle); |
| 192 #endif | 196 #endif |
| 193 | 197 |
| 198 ScopedSignalEmitter signal_emitter_; |
| 194 DISALLOW_COPY_AND_ASSIGN(KernelProxy); | 199 DISALLOW_COPY_AND_ASSIGN(KernelProxy); |
| 195 }; | 200 }; |
| 196 | 201 |
| 197 } // namespace nacl_io | 202 } // namespace nacl_io |
| 198 | 203 |
| 199 #endif // LIBRARIES_NACL_IO_KERNEL_PROXY_H_ | 204 #endif // LIBRARIES_NACL_IO_KERNEL_PROXY_H_ |
| OLD | NEW |