| 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 #include "nacl_io/kernel_object.h" | 5 #include "nacl_io/kernel_object.h" |
| 6 | 6 |
| 7 #include <assert.h> | 7 #include <assert.h> |
| 8 #include <errno.h> | 8 #include <errno.h> |
| 9 #include <fcntl.h> | 9 #include <fcntl.h> |
| 10 #include <pthread.h> | 10 #include <pthread.h> |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 error = (*out_fs)->Open(rel_parts, oflags, out_node); | 112 error = (*out_fs)->Open(rel_parts, oflags, out_node); |
| 113 if (error) | 113 if (error) |
| 114 return error; | 114 return error; |
| 115 | 115 |
| 116 return 0; | 116 return 0; |
| 117 } | 117 } |
| 118 | 118 |
| 119 Path KernelObject::GetAbsParts(const std::string& path) { | 119 Path KernelObject::GetAbsParts(const std::string& path) { |
| 120 AUTO_LOCK(cwd_lock_); | 120 AUTO_LOCK(cwd_lock_); |
| 121 | 121 |
| 122 Path abs_parts(cwd_); | 122 Path abs_parts; |
| 123 if (path[0] == '/') { | 123 if (path[0] == '/') { |
| 124 abs_parts = path; | 124 abs_parts = path; |
| 125 } else { | 125 } else { |
| 126 abs_parts = cwd_; | 126 abs_parts = cwd_; |
| 127 abs_parts.Append(path); | 127 abs_parts.Append(path); |
| 128 } | 128 } |
| 129 | 129 |
| 130 return abs_parts; | 130 return abs_parts; |
| 131 } | 131 } |
| 132 | 132 |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 AUTO_LOCK(handle_lock_); | 254 AUTO_LOCK(handle_lock_); |
| 255 | 255 |
| 256 handle_map_[fd].handle.reset(NULL); | 256 handle_map_[fd].handle.reset(NULL); |
| 257 free_fds_.push_back(fd); | 257 free_fds_.push_back(fd); |
| 258 | 258 |
| 259 // Force lower numbered FD to be available first. | 259 // Force lower numbered FD to be available first. |
| 260 std::push_heap(free_fds_.begin(), free_fds_.end(), std::greater<int>()); | 260 std::push_heap(free_fds_.begin(), free_fds_.end(), std::greater<int>()); |
| 261 } | 261 } |
| 262 | 262 |
| 263 } // namespace nacl_io | 263 } // namespace nacl_io |
| OLD | NEW |