]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/ipc/mem/Page.h
2 * Copyright (C) 1996-2017 The Squid Software Foundation and contributors
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.
9 #ifndef SQUID_IPC_MEM_PAGE_H
10 #define SQUID_IPC_MEM_PAGE_H
20 /// Shared memory page identifier, address, or handler
24 PageId(): pool(0), number(0), purpose(maxPurpose
) {}
26 /// true if and only if both critical components have been initialized
27 bool set() const { return pool
&& number
; }
29 // safer than bool which would enable silent casts to int
30 typedef const uint32_t PageId::*SaferBool
;
31 operator SaferBool() const { return set() ? &PageId::number
: NULL
; }
33 uint32_t pool
; ///< page pool ID within Squid
34 // uint32_t segment; ///< memory segment ID within the pool; unused for now
35 uint32_t number
; ///< page number within the segment
37 enum Purpose
{ cachePage
, ioPage
, maxPurpose
};
38 Purpose purpose
; ///< page purpose
41 /// writes page address (e.g., "sh_page5.3"), for debugging
42 std::ostream
&operator <<(std::ostream
&os
, const PageId
&page
);
48 #endif // SQUID_IPC_MEM_PAGE_H