]> git.ipfire.org Git - thirdparty/squid.git/blob - src/ipc/mem/Pages.h
Removed CVS $ markers
[thirdparty/squid.git] / src / ipc / mem / Pages.h
1 /*
2 */
3
4 #ifndef SQUID_IPC_MEM_PAGES_H
5 #define SQUID_IPC_MEM_PAGES_H
6
7 #include "ipc/mem/Page.h"
8
9 namespace Ipc
10 {
11
12 namespace Mem
13 {
14
15 /* Single page manipulation */
16
17 /// sets page ID and returns true unless no free pages are found
18 bool GetPage(const PageId::Purpose purpose, 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 char *PagePointer(const PageId &page);
25
26 /* Limits and statistics */
27
28 /// the total number of shared memory pages that can be in use at any time
29 size_t PageLimit();
30
31 /// the total number of shared memory pages that can be in use at any
32 /// time for given purpose
33 size_t PageLimit(const int purpose);
34
35 /// approximate total number of shared memory pages used now
36 size_t PageLevel();
37
38 /// approximate total number of shared memory pages used now for given purpose
39 size_t PageLevel(const int purpose);
40
41 /// approximate total number of shared memory pages we can allocate now
42 inline size_t PagesAvailable() { return PageLimit() - PageLevel(); }
43
44 /// approximate total number of shared memory pages we can allocate
45 /// now for given purpose
46 inline size_t PagesAvailable(const int purpose) { return PageLimit(purpose) - PageLevel(purpose); }
47
48 /// returns page size in bytes; all pages are assumed to be the same size
49 size_t PageSize();
50
51 /// claim the need for a number of pages for a given purpose
52 void NotePageNeed(const int purpose, const int count);
53
54 } // namespace Mem
55
56 } // namespace Ipc
57
58 #endif // SQUID_IPC_MEM_PAGES_H