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_IPC_MEM_PAGES_H
10#define SQUID_IPC_MEM_PAGES_H
11
12#include "ipc/mem/Page.h"
13
14namespace Ipc
15{
16
17namespace Mem
18{
19
20/* Single page manipulation */
21
23bool GetPage(const PageId::Purpose purpose, PageId &page);
24
26void PutPage(PageId &page);
27
29char *PagePointer(const PageId &page);
30
31/* Limits and statistics */
32
34size_t PageLimit();
35
38size_t PageLimit(const int purpose);
39
41size_t PageLevel();
42
44size_t PageLevel(const int purpose);
45
47inline size_t PagesAvailable() { return PageLimit() - PageLevel(); }
48
51inline size_t PagesAvailable(const int purpose) { return PageLimit(purpose) - PageLevel(purpose); }
52
54size_t PageSize();
55
57void NotePageNeed(const int purpose, const int count);
58
59} // namespace Mem
60
61} // namespace Ipc
62
63#endif // SQUID_IPC_MEM_PAGES_H
64
size_t PageLevel()
approximate total number of shared memory pages used now
Definition: Pages.cc:80
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
void NotePageNeed(const int purpose, const int count)
claim the need for a number of pages for a given purpose
Definition: Pages.cc:72
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
Definition: IpcIoFile.h:24
Memory Management.
Definition: Allocator.h:17

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors