Pages.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2023 The Squid Software Foundation and contributors
3  *
4  * Squid software is distributed under GPLv2+ license and includes
5  * contributions from numerous individuals and organizations.
6  * Please see the COPYING and CONTRIBUTORS files for details.
7  */
8 
9 #ifndef SQUID_SRC_IPC_MEM_PAGES_H
10 #define SQUID_SRC_IPC_MEM_PAGES_H
11 
12 #include "ipc/mem/Page.h"
13 
14 namespace Ipc
15 {
16 
17 namespace Mem
18 {
19 
20 /* Single page manipulation */
21 
23 bool GetPage(const PageId::Purpose purpose, PageId &page);
24 
26 void PutPage(PageId &page);
27 
29 char *PagePointer(const PageId &page);
30 
31 /* Limits and statistics */
32 
34 size_t PageLimit();
35 
38 size_t PageLimit(const int purpose);
39 
41 size_t PageLevel();
42 
44 size_t PageLevel(const int purpose);
45 
47 inline size_t PagesAvailable() { return PageLimit() - PageLevel(); }
48 
51 inline size_t PagesAvailable(const int purpose) { return PageLimit(purpose) - PageLevel(purpose); }
52 
54 size_t PageSize();
55 
57 void NotePageNeed(const int purpose, const int count);
58 
59 } // namespace Mem
60 
61 } // namespace Ipc
62 
63 #endif /* SQUID_SRC_IPC_MEM_PAGES_H */
64 
Memory Management.
Definition: Allocator.h:16
void NotePageNeed(const int purpose, const int count)
claim the need for a number of pages for a given purpose
Definition: Pages.cc:72
size_t PageLevel()
approximate total number of shared memory pages used now
Definition: Pages.cc:80
void PutPage(PageId &page)
makes identified page available as a free page to future GetPage() callers
Definition: Pages.cc:41
char * PagePointer(const PageId &page)
converts page handler into a temporary writeable shared memory pointer
Definition: Pages.cc:48
size_t PageLimit()
the total number of shared memory pages that can be in use at any time
Definition: Pages.cc:55
bool GetPage(const PageId::Purpose purpose, PageId &page)
sets page ID and returns true unless no free pages are found
Definition: Pages.cc:34
size_t PagesAvailable()
approximate total number of shared memory pages we can allocate now
Definition: Pages.h:47
size_t PageSize()
returns page size in bytes; all pages are assumed to be the same size
Definition: Pages.cc:28
Definition: IpcIoFile.h:23

 

Introduction

Documentation

Support

Miscellaneous