| 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) || defined(OS_AIX) | 214 #if defined(OS_LINUX) || defined(OS_AIX) |
| 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 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 766 jmp_buf env; | 769 jmp_buf env; |
| 767 if (setjmp(env) == 0) { | 770 if (setjmp(env) == 0) { |
| 768 return CloneAndLongjmpInChild(flags, ptid, ctid, &env); | 771 return CloneAndLongjmpInChild(flags, ptid, ctid, &env); |
| 769 } | 772 } |
| 770 | 773 |
| 771 return 0; | 774 return 0; |
| 772 } | 775 } |
| 773 #endif // defined(OS_LINUX) || defined(OS_NACL_NONSFI) | 776 #endif // defined(OS_LINUX) || defined(OS_NACL_NONSFI) |
| 774 | 777 |
| 775 } // namespace base | 778 } // namespace base |
| OLD | NEW |