]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/ipc/mem/Pages.h
6 #ifndef SQUID_IPC_MEM_PAGES_H
7 #define SQUID_IPC_MEM_PAGES_H
9 #include "ipc/mem/Page.h"
17 /* Single page manipulation */
19 /// sets page ID and returns true unless no free pages are found
20 bool GetPage(const PageId::Purpose purpose
, PageId
&page
);
22 /// makes identified page available as a free page to future GetPage() callers
23 void PutPage(PageId
&page
);
25 /// converts page handler into a temporary writeable shared memory pointer
26 char *PagePointer(const PageId
&page
);
29 /* Limits and statistics */
31 /// the total number of shared memory pages that can be in use at any time
34 /// the total number of shared memory pages that can be in use at any
35 /// time for given purpose
36 size_t PageLimit(const int purpose
);
38 /// approximate total number of shared memory pages used now
41 /// approximate total number of shared memory pages used now for given purpose
42 size_t PageLevel(const int purpose
);
44 /// approximate total number of shared memory pages we can allocate now
45 inline size_t PagesAvailable() { return PageLimit() - PageLevel(); }
47 /// approximate total number of shared memory pages we can allocate
48 /// now for given purpose
49 inline size_t PagesAvailable(const int purpose
) { return PageLimit(purpose
) - PageLevel(purpose
); }
51 /// returns page size in bytes; all pages are assumed to be the same size
54 /// claim the need for a number of pages for a given purpose
55 void NotePageNeed(const int purpose
, const int count
);
61 #endif // SQUID_IPC_MEM_PAGES_H