]>
Commit | Line | Data |
---|---|---|
3e0ddf16 AR |
1 | /* |
2 | * $Id$ | |
3 | * | |
4 | */ | |
5 | ||
6 | #ifndef SQUID_IPC_MEM_PAGES_H | |
7 | #define SQUID_IPC_MEM_PAGES_H | |
8 | ||
9 | namespace Ipc { | |
10 | ||
11 | namespace Mem { | |
12 | ||
13 | class PageId; | |
14 | ||
15 | /// initializes and configures shared memory [pools] for all kids | |
16 | void Init(); | |
17 | ||
18 | /// attaches this kid to the already configured shared memory [pools] | |
19 | void Attach(); | |
20 | ||
21 | ||
22 | /* Single page manipulation */ | |
23 | ||
24 | /// sets page ID and returns true unless no free pages are found | |
25 | bool GetPage(PageId &page); | |
26 | ||
27 | /// makes identified page available as a free page to future GetPage() callers | |
56f8aa50 | 28 | void PutPage(PageId &page); |
3e0ddf16 AR |
29 | |
30 | /// converts page handler into a temporary writeable shared memory pointer | |
31 | void *PagePointer(const PageId &page); | |
32 | ||
33 | ||
34 | /* Limits and statistics */ | |
35 | ||
36 | /// the total number of shared memory bytes that can be in use at any time | |
37 | uint64_t Limit(); | |
38 | ||
39 | /// approximate total number of shared memory bytes used now | |
40 | uint64_t Level(); | |
41 | ||
42 | /// approximate total number of shared memory bytes we can allocate now | |
43 | inline uint64_t Available() { return Limit() - Level(); } | |
44 | ||
45 | } // namespace Mem | |
46 | ||
47 | } // namespace Ipc | |
48 | ||
49 | #endif // SQUID_IPC_MEM_PAGES_H |