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
3 // found in the LICENSE file.
5 #include "base/process_util.h"
7 #import <Foundation/Foundation.h>
9 #include <sys/resource.h>
11 #include "base/logging.h"
13 // This is just enough of a shim to let the support needed by test_support
14 // link. In general, process_util isn't valid on iOS.
18 ProcessId GetCurrentProcId() {
22 ProcessHandle GetCurrentProcessHandle() {
23 return GetCurrentProcId();
26 void EnableTerminationOnHeapCorruption() {
27 // On iOS, there nothing to do AFAIK.
30 void EnableTerminationOnOutOfMemory() {
31 // iOS provides this for free!
34 void RaiseProcessToHighPriority() {
35 // Impossible on iOS. Do nothing.
39 static const rlim_t kSystemDefaultMaxFds = 256;
42 if (getrlimit(RLIMIT_NOFILE, &nofile)) {
43 // Error case: Take a best guess.
44 max_fds = kSystemDefaultMaxFds;
46 max_fds = nofile.rlim_cur;
49 if (max_fds > INT_MAX)
52 return static_cast<size_t>(max_fds);