]> git.ipfire.org Git - thirdparty/squid.git/blob - src/ipc/mem/Pages.h
Cleanup Pages initialization:
[thirdparty/squid.git] / src / ipc / mem / Pages.h
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 /* Single page manipulation */
16
17 /// sets page ID and returns true unless no free pages are found
18 bool GetPage(PageId &page);
19
20 /// makes identified page available as a free page to future GetPage() callers
21 void PutPage(PageId &page);
22
23 /// converts page handler into a temporary writeable shared memory pointer
24 void *PagePointer(const PageId &page);
25
26
27 /* Limits and statistics */
28
29 /// the total number of shared memory bytes that can be in use at any time
30 size_t Limit();
31
32 /// approximate total number of shared memory bytes used now
33 size_t Level();
34
35 /// approximate total number of shared memory bytes we can allocate now
36 inline size_t Available() { return Limit() - Level(); }
37
38 /// returns page size in bytes; all pages are assumed to be the same size
39 size_t PageSize();
40
41 } // namespace Mem
42
43 } // namespace Ipc
44
45 #endif // SQUID_IPC_MEM_PAGES_H