stub_libmem.cc
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2017 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 #include "squid.h"
10 
11 #define STUB_API "mem/libmem.la"
12 #include "STUB.h"
13 
14 #include "mem/AllocatorProxy.h"
15 void *Mem::AllocatorProxy::alloc() {return xmalloc(64*1024);}
16 void Mem::AllocatorProxy::freeOne(void *address) {xfree(address);}
17 int Mem::AllocatorProxy::inUseCount() const {return 0;}
18 //static MemPoolMeter tmpMemPoolMeter;
19 //MemPoolMeter const &Mem::AllocatorProxy::getMeter() const STUB_RETVAL(tmpMemPoolMeter)
21 
22 #include "mem/forward.h"
23 void Mem::Init() STUB_NOP
24 void Mem::Report() STUB_NOP
25 void Mem::Stats(StoreEntry *) STUB_NOP
27 void Report(std::ostream &) STUB_NOP
28 void PoolReport(const MemPoolStats *, const MemPoolMeter *, std::ostream &) STUB_NOP
29 //const size_t squidSystemPageSize = 4096;
30 void memClean(void) STUB
31 void memInitModule(void) STUB
32 void memCleanModule(void) STUB
33 void memConfigure(void) STUB
34 
35 void * memAllocate(mem_type)
36 {
37  // let's waste plenty of memory. This should cover any possible need
38  return xmalloc(64*1024);
39 }
40 
41 void *memAllocString(size_t net_size, size_t * gross_size) {return memAllocBuf(net_size, gross_size);}
42 
43 void *
44 memAllocBuf(size_t net_size, size_t * gross_size)
45 {
46  *gross_size=net_size;
47  return xcalloc(1, net_size);
48 }
49 
50 /* net_size is the new size, *gross size is the old gross size, to be changed to
51  * the new gross size as a side-effect.
52  */
53 void *
54 memReallocBuf(void *oldbuf, size_t net_size, size_t * gross_size)
55 {
56  void *rv=xrealloc(oldbuf,net_size);
57 // if (net_size > *gross_size)
58 // memset(rv+net_size,0,net_size-*gross_size);
59  *gross_size=net_size;
60  return rv;
61 }
62 
63 void memFree(void *p, int) {xfree(p);}
64 void memFreeString(size_t, void *buf) {xfree(buf);}
65 void memFreeBuf(size_t, void *buf) {xfree(buf);}
66 static void cxx_xfree(void * ptr) {xfree(ptr);}
67 FREE *memFreeBufFunc(size_t) {return cxx_xfree;}
68 int memInUse(mem_type) STUB_RETVAL(0)
69 void memDataInit(mem_type, const char *, size_t, int, bool) STUB_NOP
71 
72 #include "mem/Pool.h"
74 void MemPoolMeter::flush() STUB
76 MemPools &MemPools::GetInstance() {return tmpMemPools;}
78  pools(nullptr),
79  mem_idle_limit(0),
80  poolCount(0),
81  defaultIsChunked(false)
82 {}
84 MemImplementingAllocator * MemPools::create(const char *, size_t) STUB_RETVAL(nullptr);
85 void MemPools::setIdleLimit(ssize_t) STUB
86 ssize_t MemPools::idleLimit() const STUB_RETVAL(0)
87 void MemPools::clean(time_t) STUB
88 void MemPools::setDefaultPoolChunking(bool const &) STUB
89 
90 //MemAllocator::MemAllocator(char const *aLabel);
91 char const *MemAllocator::objectType() const STUB_RETVAL(nullptr)
92 int MemAllocator::inUseCount() STUB_RETVAL(0)
93 size_t MemAllocator::RoundedSize(size_t minSize) STUB_RETVAL(minSize)
94 
95 //MemImplementingAllocator::MemImplementingAllocator(char const *, size_t) STUB_NOP
96 //MemImplementingAllocator::~MemImplementingAllocator();
99 void MemImplementingAllocator::flushMetersFull() STUB
100 void MemImplementingAllocator::flushMeters() STUB
101 void *MemImplementingAllocator::alloc() STUB_RETVAL(nullptr)
102 void MemImplementingAllocator::freeOne(void *) STUB
103 
109 
MemImplementingAllocator * memPoolIterateNext(MemPoolIterator *)
Definition: stub_libmem.cc:105
void Stats(StoreEntry *)
Definition: old_api.cc:171
#define xcalloc
Definition: membanger.c:57
void Report()
Definition: old_api.cc:454
int inUseCount() const
void * memAllocString(size_t net_size, size_t *gross_size)
Definition: stub_libmem.cc:41
void CleanIdlePools(void *unused)
Definition: old_api.cc:375
void flushMeters()
Definition: Pool.cc:174
void * memAllocBuf(size_t net_size, size_t *gross_size)
Definition: stub_libmem.cc:44
char * p
Definition: membanger.c:43
void FREE(void *)
Definition: forward.h:36
void memCleanModule(void)
Definition: stub_libmem.cc:32
void memClean(void)
Main cleanup handler.
Definition: stub_libmem.cc:30
Definition: Pool.h:116
int memInUse(mem_type)
Definition: stub_libmem.cc:68
#define STUB_RETVAL(x)
Definition: STUB.h:41
FREE * memFreeBufFunc(size_t)
Definition: stub_libmem.cc:67
void Init()
Definition: old_api.cc:412
void * xrealloc(void *s, size_t sz)
Definition: xalloc.cc:137
#define STUB
macro to stub a void function.
Definition: STUB.h:33
void memCheckInit(void)
Definition: stub_libmem.cc:70
void memConfigure(void)
Definition: stub_libmem.cc:33
void * memReallocBuf(void *oldbuf, size_t net_size, size_t *gross_size)
Definition: stub_libmem.cc:54
int memPoolGetGlobalStats(MemPoolGlobalStats *)
Definition: stub_libmem.cc:107
void * memAllocate(mem_type)
Allocate one element from the typed pool.
Definition: stub_libmem.cc:35
void memInitModule(void)
Definition: stub_libmem.cc:31
void const char * buf
Definition: stub_helper.cc:16
static MemPools tmpMemPools
Definition: stub_libmem.cc:75
static void cxx_xfree(void *ptr)
Definition: stub_libmem.cc:66
int memPoolsTotalAllocated(void)
Definition: stub_libmem.cc:108
#define xmalloc
void freeOne(void *)
Free a element allocated by Mem::AllocatorProxy::alloc()
MemPoolMeter()
Definition: Pool.cc:165
void memPoolIterateDone(MemPoolIterator **)
Definition: stub_libmem.cc:106
void memFree(void *p, int)
Free a element allocated by memAllocate()
Definition: stub_libmem.cc:63
MemPools()
Definition: Pool.cc:84
void memDataInit(mem_type, const char *, size_t, int, bool)
Definition: stub_libmem.cc:69
#define STUB_NOP
Definition: STUB.h:37
void memFreeBuf(size_t, void *buf)
Definition: stub_libmem.cc:65
#define xfree
void memFreeString(size_t, void *buf)
Definition: stub_libmem.cc:64
MemPoolIterator * memPoolIterate(void)
Definition: stub_libmem.cc:104
int getStats(MemPoolStats *stats)
#define STUB_RETSTATREF(x)
Definition: STUB.h:54
void * alloc()
Allocate one element from the pool.
#define false
Definition: GnuRegex.c:233
void PoolReport(const MemPoolStats *mp_st, const MemPoolMeter *AllMeter, std::ostream &)
Definition: old_api.cc:584

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors