| 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 "base/process/launch.h" | 5 #include "base/process/launch.h" |
| 6 | 6 |
| 7 #include <dirent.h> | 7 #include <dirent.h> |
| 8 #include <errno.h> | 8 #include <errno.h> |
| 9 #include <fcntl.h> | 9 #include <fcntl.h> |
| 10 #include <sched.h> | 10 #include <sched.h> |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 typedef std::unique_ptr<DIR, ScopedDIRClose> ScopedDIR; | 212 typedef std::unique_ptr<DIR, ScopedDIRClose> ScopedDIR; |
| 213 | 213 |
| 214 #if defined(OS_LINUX) | 214 #if defined(OS_LINUX) |
| 215 static const char kFDDir[] = "/proc/self/fd"; | 215 static const char kFDDir[] = "/proc/self/fd"; |
| 216 #elif defined(OS_MACOSX) | 216 #elif defined(OS_MACOSX) |
| 217 static const char kFDDir[] = "/dev/fd"; | 217 static const char kFDDir[] = "/dev/fd"; |
| 218 #elif defined(OS_SOLARIS) | 218 #elif defined(OS_SOLARIS) |
| 219 static const char kFDDir[] = "/dev/fd"; | 219 static const char kFDDir[] = "/dev/fd"; |
| 220 #elif defined(OS_FREEBSD) | 220 #elif defined(OS_FREEBSD) |
| 221 static const char kFDDir[] = "/dev/fd"; | 221 static const char kFDDir[] = "/dev/fd"; |
| 222 #elif defined(OS_FUCHSIA) |
| 223 // TODO(scottmg): This is probably incorrect. |
| 224 static const char kFDDir[] = "/dev/fd"; |
| 222 #elif defined(OS_OPENBSD) | 225 #elif defined(OS_OPENBSD) |
| 223 static const char kFDDir[] = "/dev/fd"; | 226 static const char kFDDir[] = "/dev/fd"; |
| 224 #elif defined(OS_ANDROID) | 227 #elif defined(OS_ANDROID) |
| 225 static const char kFDDir[] = "/proc/self/fd"; | 228 static const char kFDDir[] = "/proc/self/fd"; |
| 226 #endif | 229 #endif |
| 227 | 230 |
| 228 void CloseSuperfluousFds(const base::InjectiveMultimap& saved_mapping) { | 231 void CloseSuperfluousFds(const base::InjectiveMultimap& saved_mapping) { |
| 229 // DANGER: no calls to malloc or locks are allowed from now on: | 232 // DANGER: no calls to malloc or locks are allowed from now on: |
| 230 // http://crbug.com/36678 | 233 // http://crbug.com/36678 |
| 231 | 234 |
| (...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 758 jmp_buf env; | 761 jmp_buf env; |
| 759 if (setjmp(env) == 0) { | 762 if (setjmp(env) == 0) { |
| 760 return CloneAndLongjmpInChild(flags, ptid, ctid, &env); | 763 return CloneAndLongjmpInChild(flags, ptid, ctid, &env); |
| 761 } | 764 } |
| 762 | 765 |
| 763 return 0; | 766 return 0; |
| 764 } | 767 } |
| 765 #endif // defined(OS_LINUX) || defined(OS_NACL_NONSFI) | 768 #endif // defined(OS_LINUX) || defined(OS_NACL_NONSFI) |
| 766 | 769 |
| 767 } // namespace base | 770 } // namespace base |
| OLD | NEW |