]>
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"
15 /* Single page manipulation */
17 /// sets page ID and returns true unless no free pages are found
18 bool GetPage(const PageId::Purpose purpose
, PageId
&page
);
20 /// makes identified page available as a free page to future GetPage() callers
21 void PutPage(PageId
&page
);
23 /// converts page handler into a temporary writeable shared memory pointer
24 char *PagePointer(const PageId
&page
);
27 /* Limits and statistics */
29 /// the total number of shared memory pages that can be in use at any time
32 /// the total number of shared memory pages that can be in use at any
33 /// time for given purpose
34 size_t PageLimit(const int purpose
);
36 /// approximate total number of shared memory pages used now
39 /// approximate total number of shared memory pages used now for given purpose
40 size_t PageLevel(const int purpose
);
42 /// approximate total number of shared memory pages we can allocate now
43 inline size_t PagesAvailable() { return PageLimit() - PageLevel(); }
45 /// approximate total number of shared memory pages we can allocate
46 /// now for given purpose
47 inline size_t PagesAvailable(const int purpose
) { return PageLimit(purpose
) - PageLevel(purpose
); }
49 /// returns page size in bytes; all pages are assumed to be the same size
56 #endif // SQUID_IPC_MEM_PAGES_H