| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/process_metrics.h" | 5 #include "base/process/process_metrics.h" |
| 6 | 6 |
| 7 #include <limits.h> | 7 #include <limits.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 #include <sys/resource.h> | 10 #include <sys/resource.h> |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 #elif defined(OS_SOLARIS) | 32 #elif defined(OS_SOLARIS) |
| 33 static const rlim_t kSystemDefaultMaxFds = 8192; | 33 static const rlim_t kSystemDefaultMaxFds = 8192; |
| 34 #elif defined(OS_FREEBSD) | 34 #elif defined(OS_FREEBSD) |
| 35 static const rlim_t kSystemDefaultMaxFds = 8192; | 35 static const rlim_t kSystemDefaultMaxFds = 8192; |
| 36 #elif defined(OS_NETBSD) | 36 #elif defined(OS_NETBSD) |
| 37 static const rlim_t kSystemDefaultMaxFds = 1024; | 37 static const rlim_t kSystemDefaultMaxFds = 1024; |
| 38 #elif defined(OS_OPENBSD) | 38 #elif defined(OS_OPENBSD) |
| 39 static const rlim_t kSystemDefaultMaxFds = 256; | 39 static const rlim_t kSystemDefaultMaxFds = 256; |
| 40 #elif defined(OS_ANDROID) | 40 #elif defined(OS_ANDROID) |
| 41 static const rlim_t kSystemDefaultMaxFds = 1024; | 41 static const rlim_t kSystemDefaultMaxFds = 1024; |
| 42 #elif defined(OS_AIX) |
| 43 static const rlim_t kSystemDefaultMaxFds = 8192; |
| 42 #endif | 44 #endif |
| 43 | 45 |
| 44 size_t GetMaxFds() { | 46 size_t GetMaxFds() { |
| 45 rlim_t max_fds; | 47 rlim_t max_fds; |
| 46 struct rlimit nofile; | 48 struct rlimit nofile; |
| 47 if (getrlimit(RLIMIT_NOFILE, &nofile)) { | 49 if (getrlimit(RLIMIT_NOFILE, &nofile)) { |
| 48 // getrlimit failed. Take a best guess. | 50 // getrlimit failed. Take a best guess. |
| 49 max_fds = kSystemDefaultMaxFds; | 51 max_fds = kSystemDefaultMaxFds; |
| 50 RAW_LOG(ERROR, "getrlimit(RLIMIT_NOFILE) failed"); | 52 RAW_LOG(ERROR, "getrlimit(RLIMIT_NOFILE) failed"); |
| 51 } else { | 53 } else { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 73 } else { | 75 } else { |
| 74 PLOG(INFO) << "Failed to get file descriptor limit"; | 76 PLOG(INFO) << "Failed to get file descriptor limit"; |
| 75 } | 77 } |
| 76 } | 78 } |
| 77 | 79 |
| 78 size_t GetPageSize() { | 80 size_t GetPageSize() { |
| 79 return getpagesize(); | 81 return getpagesize(); |
| 80 } | 82 } |
| 81 | 83 |
| 82 } // namespace base | 84 } // namespace base |
| OLD | NEW |