OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 SANDBOX_IMPL_H__ | 5 #ifndef SANDBOX_IMPL_H__ |
6 #define SANDBOX_IMPL_H__ | 6 #define SANDBOX_IMPL_H__ |
7 | 7 |
8 #include <asm/ldt.h> | 8 #include <asm/ldt.h> |
9 #include <errno.h> | 9 #include <errno.h> |
10 #include <fcntl.h> | 10 #include <fcntl.h> |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 } | 261 } |
262 for (;;) { | 262 for (;;) { |
263 sys.exit_group(1); | 263 sys.exit_group(1); |
264 sys._exit(1); | 264 sys._exit(1); |
265 } | 265 } |
266 } | 266 } |
267 | 267 |
268 // Wrapper around "read()" that can deal with partial and interrupted reads | 268 // Wrapper around "read()" that can deal with partial and interrupted reads |
269 // and that does not modify the global errno variable. | 269 // and that does not modify the global errno variable. |
270 static ssize_t read(SysCalls& sys, int fd, void* buf, size_t len) { | 270 static ssize_t read(SysCalls& sys, int fd, void* buf, size_t len) { |
271 if (len < 0) { | 271 if (static_cast<ssize_t>(len) < 0) { |
272 sys.my_errno = EINVAL; | 272 sys.my_errno = EINVAL; |
273 return -1; | 273 return -1; |
274 } | 274 } |
275 size_t offset = 0; | 275 size_t offset = 0; |
276 while (offset < len) { | 276 while (offset < len) { |
277 ssize_t partial = | 277 ssize_t partial = |
278 NOINTR_SYS(sys.read(fd, reinterpret_cast<char*>(buf) + offset, | 278 NOINTR_SYS(sys.read(fd, reinterpret_cast<char*>(buf) + offset, |
279 len - offset)); | 279 len - offset)); |
280 if (partial < 0) { | 280 if (partial < 0) { |
281 return partial; | 281 return partial; |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
656 static ProtectedMap protectedMap_; | 656 static ProtectedMap protectedMap_; |
657 static std::vector<SecureMem::Args*> secureMemPool_; | 657 static std::vector<SecureMem::Args*> secureMemPool_; |
658 }; | 658 }; |
659 | 659 |
660 } // namespace | 660 } // namespace |
661 | 661 |
662 using playground::Sandbox; | 662 using playground::Sandbox; |
663 #endif // __cplusplus | 663 #endif // __cplusplus |
664 | 664 |
665 #endif // SANDBOX_IMPL_H__ | 665 #endif // SANDBOX_IMPL_H__ |
OLD | NEW |