summaryrefslogtreecommitdiffstats
path: root/mojo/system/constants.h
blob: b92eef102218e4463d15f78bc28f9b4863706c90 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef MOJO_SYSTEM_CONSTANTS_H_
#define MOJO_SYSTEM_CONSTANTS_H_

#include <stddef.h>

namespace mojo {
namespace system {

// Maximum number of open (Mojo) handles.
// TODO(vtl): This doesn't count "live" handles, some of which may live in
// messages.
const size_t kMaxHandleTableSize = 1000000;

// Maximum number of active memory mappings.
const size_t kMaxMappingTableSize = 1000000;

const size_t kMaxWaitManyNumHandles = kMaxHandleTableSize;

const size_t kMaxMessageNumBytes = 4 * 1024 * 1024;

const size_t kMaxMessageNumHandles = 10000;

// Maximum capacity of a data pipe, in bytes. This value must fit into a
// |uint32_t|.
// WARNING: If you bump it closer to 2^32, you must audit all the code to check
// that we don't overflow (2^31 would definitely be risky; up to 2^30 is
// probably okay).
const size_t kMaxDataPipeCapacityBytes = 256 * 1024 * 1024;  // 256 MB.

const size_t kDefaultDataPipeCapacityBytes = 1024 * 1024;  // 1 MB.

// Alignment for the "start" of the data buffer used by data pipes. (The
// alignment of elements will depend on this and the element size.)
const size_t kDataPipeBufferAlignmentBytes = 16;

// TODO(vtl): Set this hard limit appropriately (e.g., higher on 64-bit). (This
// will also entail some auditing to make sure I'm not messing up my checks
// anywhere.)
const size_t kMaxSharedMemoryNumBytes = 1024 * 1024 * 1024;  // 1 GB.

}  // namespace system
}  // namespace mojo

#endif  // MOJO_SYSTEM_CONSTANTS_H_