mirror of
https://github.com/genodelabs/genode.git
synced 2025-04-16 07:27:35 +00:00
base: show size as %zu instead %zd
For big numbers otherwise negative sizes for memory chunks are displayed. Issue #1011
This commit is contained in:
parent
b8beba5bf3
commit
b893968232
@ -70,7 +70,7 @@ namespace Genode {
|
||||
bool alloc(size_t size, void **out_addr)
|
||||
{
|
||||
if ((_amount - _consumed) < (size + _allocator->overhead(size))) {
|
||||
PWRN("Quota exceeded! amount=%zd, size=%zd, consumed=%zd",
|
||||
PWRN("Quota exceeded! amount=%zu, size=%zu, consumed=%zu",
|
||||
_amount, (size + _allocator->overhead(size)), _consumed);
|
||||
return false;
|
||||
}
|
||||
|
@ -203,7 +203,7 @@ namespace Genode {
|
||||
size_t needed = sizeof(SESSION_TYPE) + md_alloc()->overhead(sizeof(SESSION_TYPE));
|
||||
|
||||
if (needed > ram_quota) {
|
||||
PERR("Insufficient ram quota, provided=%zd, required=%zd",
|
||||
PERR("Insufficient ram quota, provided=%zu, required=%zu",
|
||||
ram_quota, needed);
|
||||
throw Root::Quota_exceeded();
|
||||
}
|
||||
@ -221,7 +221,7 @@ namespace Genode {
|
||||
char adjusted_args[MAX_ARGS_LEN];
|
||||
strncpy(adjusted_args, args.string(), sizeof(adjusted_args));
|
||||
char ram_quota_buf[64];
|
||||
snprintf(ram_quota_buf, sizeof(ram_quota_buf), "%zd",
|
||||
snprintf(ram_quota_buf, sizeof(ram_quota_buf), "%zu",
|
||||
remaining_ram_quota);
|
||||
Arg_string::set_arg(adjusted_args, sizeof(adjusted_args),
|
||||
"ram_quota", ram_quota_buf);
|
||||
|
@ -31,7 +31,7 @@ struct Genode::Trace::Connection : Genode::Connection<Genode::Trace::Session>,
|
||||
*/
|
||||
Connection(size_t ram_quota, size_t arg_buffer_size, unsigned parent_levels) :
|
||||
Genode::Connection<Session>(
|
||||
session("ram_quota=%zd, arg_buffer_size=%zd, parent_levels=%u",
|
||||
session("ram_quota=%zu, arg_buffer_size=%zu, parent_levels=%u",
|
||||
ram_quota, arg_buffer_size, parent_levels)),
|
||||
Session_client(cap()) { }
|
||||
};
|
||||
|
@ -57,7 +57,7 @@ namespace {
|
||||
{
|
||||
if (_from.valid() && _to.valid() &&
|
||||
Ram_session_client(_from).transfer_quota(_to, quantum)) {
|
||||
PWRN("not enough quota for a donation of %zd bytes", quantum);
|
||||
PWRN("not enough quota for a donation of %zu bytes", quantum);
|
||||
throw Parent::Quota_exceeded();
|
||||
}
|
||||
}
|
||||
|
4
base/src/base/env/platform_env.h
vendored
4
base/src/base/env/platform_env.h
vendored
@ -148,9 +148,9 @@ class Genode::Platform_env : public Genode::Env, public Emergency_ram_reserve
|
||||
|
||||
void release() {
|
||||
|
||||
PDBG("used before freeing emergency=%zd", _resources.ram.used());
|
||||
PDBG("used before freeing emergency=%zu", _resources.ram.used());
|
||||
_resources.ram.free(_emergency_ram_ds);
|
||||
PDBG("used after freeing emergency=%zd", _resources.ram.used());
|
||||
PDBG("used after freeing emergency=%zu", _resources.ram.used());
|
||||
}
|
||||
|
||||
|
||||
|
10
base/src/base/env/platform_env_common.h
vendored
10
base/src/base/env/platform_env_common.h
vendored
@ -71,11 +71,11 @@ struct Upgradeable_client : CLIENT
|
||||
|
||||
void upgrade_ram(Genode::size_t quota)
|
||||
{
|
||||
PINF("upgrading quota donation for Env::%s (%zd bytes)",
|
||||
PINF("upgrading quota donation for Env::%s (%zu bytes)",
|
||||
CLIENT::Rpc_interface::service_name(), quota);
|
||||
|
||||
char buf[128];
|
||||
Genode::snprintf(buf, sizeof(buf), "ram_quota=%zd", quota);
|
||||
Genode::snprintf(buf, sizeof(buf), "ram_quota=%zu", quota);
|
||||
|
||||
Genode::env()->parent()->upgrade(_cap, buf);
|
||||
}
|
||||
@ -118,7 +118,7 @@ struct Genode::Expanding_ram_session_client : Upgradeable_client<Genode::Ram_ses
|
||||
* a bit too much quota for the most time.
|
||||
*/
|
||||
enum { ALLOC_OVERHEAD = 1024U };
|
||||
Genode::snprintf(buf, sizeof(buf), "ram_quota=%zd",
|
||||
Genode::snprintf(buf, sizeof(buf), "ram_quota=%zu",
|
||||
size + ALLOC_OVERHEAD);
|
||||
env()->parent()->resource_request(buf);
|
||||
},
|
||||
@ -141,7 +141,7 @@ struct Genode::Expanding_ram_session_client : Upgradeable_client<Genode::Ram_ses
|
||||
* XXX Let transfer_quota throw 'Ram_session::Quota_exceeded'
|
||||
*/
|
||||
char buf[128];
|
||||
Genode::snprintf(buf, sizeof(buf), "ram_quota=%zd", amount);
|
||||
Genode::snprintf(buf, sizeof(buf), "ram_quota=%zu", amount);
|
||||
env()->parent()->resource_request(buf);
|
||||
}
|
||||
return ret;
|
||||
@ -229,7 +229,7 @@ class Genode::Expanding_parent_client : public Parent_client
|
||||
.ulong_value(0);
|
||||
|
||||
char buf[128];
|
||||
snprintf(buf, sizeof(buf), "ram_quota=%zd", ram_quota);
|
||||
snprintf(buf, sizeof(buf), "ram_quota=%zu", ram_quota);
|
||||
|
||||
resource_request(Resource_args(buf));
|
||||
},
|
||||
|
@ -84,7 +84,7 @@ bool Sliced_heap::alloc(size_t size, void **out_addr)
|
||||
_ram_session->free(ds_cap);
|
||||
return false;
|
||||
} catch (Ram_session::Alloc_failed) {
|
||||
PERR("Could not allocate dataspace with size %zd", size);
|
||||
PERR("Could not allocate dataspace with size %zu", size);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -35,13 +35,13 @@ bool Core_mem_allocator::Mapped_mem_allocator::alloc(size_t size, void **out_add
|
||||
|
||||
/* allocate physical pages */
|
||||
if (!_phys_alloc->alloc(page_rounded_size, &phys_addr)) {
|
||||
PERR("Could not allocate physical memory region of size %zd\n", page_rounded_size);
|
||||
PERR("Could not allocate physical memory region of size %zu\n", page_rounded_size);
|
||||
return false;
|
||||
}
|
||||
|
||||
/* allocate range in core's virtual address space */
|
||||
if (!_virt_alloc->alloc(page_rounded_size, &virt_addr)) {
|
||||
PERR("Could not allocate virtual address range in core of size %zd\n", page_rounded_size);
|
||||
PERR("Could not allocate virtual address range in core of size %zu\n", page_rounded_size);
|
||||
|
||||
/* revert physical allocation */
|
||||
_phys_alloc->free(phys_addr);
|
||||
@ -49,7 +49,7 @@ bool Core_mem_allocator::Mapped_mem_allocator::alloc(size_t size, void **out_add
|
||||
}
|
||||
|
||||
if (verbose_core_mem_alloc)
|
||||
printf("added core memory block of %zd bytes at virt=%p phys=%p\n",
|
||||
printf("added core memory block of %zu bytes at virt=%p phys=%p\n",
|
||||
page_rounded_size, virt_addr, phys_addr);
|
||||
|
||||
/* make physical page accessible at the designated virtual address */
|
||||
|
@ -68,7 +68,7 @@ namespace Genode {
|
||||
long remaining_ram_quota = ram_quota - sizeof(Irq_session_component) -
|
||||
_md_alloc->overhead(sizeof(Irq_session_component));
|
||||
if (remaining_ram_quota < 0) {
|
||||
PERR("Insufficient ram quota, provided=%zd, required=%zd",
|
||||
PERR("Insufficient ram quota, provided=%zu, required=%zu",
|
||||
ram_quota, sizeof(Irq_session_component) +
|
||||
_md_alloc->overhead(sizeof(Irq_session_component)));
|
||||
return Session_capability();
|
||||
|
@ -269,7 +269,7 @@ int main()
|
||||
core's heap and not accounted by the component's meta data allocator */
|
||||
Genode::size_t init_quota = platform()->ram_alloc()->avail() - 172*1024;
|
||||
env()->ram_session()->transfer_quota(init_ram_session_cap, init_quota);
|
||||
PDBG("transferred %zd MB to init", init_quota / (1024*1024));
|
||||
PDBG("transferred %zu MB to init", init_quota / (1024*1024));
|
||||
|
||||
Core_child *init = new (env()->heap())
|
||||
Core_child(Rom_session_client(init_rom_session_cap).dataspace(),
|
||||
|
@ -71,7 +71,7 @@ int Ram_session_component::_transfer_quota(Ram_session_component *dst, size_t am
|
||||
/* decrease quota limit of this session - check against used quota */
|
||||
if (_quota_limit < amount + _payload) {
|
||||
PWRN("Insufficient quota for transfer: %s", _label);
|
||||
PWRN(" have %zd, need %zd", _quota_limit - _payload, amount);
|
||||
PWRN(" have %zu, need %zu", _quota_limit - _payload, amount);
|
||||
return -3;
|
||||
}
|
||||
|
||||
@ -124,11 +124,11 @@ Ram_dataspace_capability Ram_session_component::alloc(size_t ds_size, bool cache
|
||||
if (used_quota() + SBS + ds_size > _quota_limit) {
|
||||
|
||||
PWRN("Quota exceeded: %s", _label);
|
||||
PWRN(" memory for slab: %zd", _ds_slab.consumed());
|
||||
PWRN(" used quota: %zd", used_quota());
|
||||
PWRN(" ds_size: %zd", ds_size);
|
||||
PWRN(" sizeof(Ram_session_component): %zd", sizeof(Ram_session_component));
|
||||
PWRN(" quota_limit: %zd", _quota_limit);
|
||||
PWRN(" memory for slab: %zu", _ds_slab.consumed());
|
||||
PWRN(" used quota: %zu", used_quota());
|
||||
PWRN(" ds_size: %zu", ds_size);
|
||||
PWRN(" sizeof(Ram_session_component): %zu", sizeof(Ram_session_component));
|
||||
PWRN(" quota_limit: %zu", _quota_limit);
|
||||
|
||||
throw Quota_exceeded();
|
||||
}
|
||||
@ -157,7 +157,7 @@ Ram_dataspace_capability Ram_session_component::alloc(size_t ds_size, bool cache
|
||||
* fragmentation could cause a failing allocation.
|
||||
*/
|
||||
if (!alloc_succeeded) {
|
||||
PERR("We ran out of physical memory while allocating %zd bytes", ds_size);
|
||||
PERR("We ran out of physical memory while allocating %zu bytes", ds_size);
|
||||
throw Quota_exceeded();
|
||||
}
|
||||
|
||||
@ -183,7 +183,7 @@ Ram_dataspace_capability Ram_session_component::alloc(size_t ds_size, bool cache
|
||||
_clear_ds(ds);
|
||||
|
||||
if (verbose)
|
||||
PDBG("ds_size=%zd, used_quota=%zd quota_limit=%zd",
|
||||
PDBG("ds_size=%zu, used_quota=%zu quota_limit=%zu",
|
||||
ds_size, used_quota(), _quota_limit);
|
||||
|
||||
Dataspace_capability result = _ds_ep->manage(ds);
|
||||
@ -234,7 +234,7 @@ int Ram_session_component::transfer_quota(Ram_session_capability ram_session_cap
|
||||
size_t amount)
|
||||
{
|
||||
if (verbose)
|
||||
PDBG("amount=%zd", amount);
|
||||
PDBG("amount=%zu", amount);
|
||||
|
||||
Object_pool<Ram_session_component>::Guard dst(_ram_session_ep->lookup_and_lock(ram_session_cap));
|
||||
return _transfer_quota(dst, amount);
|
||||
@ -263,7 +263,7 @@ Ram_session_component::~Ram_session_component()
|
||||
for (Dataspace_component *ds; (ds = _ds_slab.raw()->first_object()); _free_ds(ds));
|
||||
|
||||
if (_payload != 0)
|
||||
PWRN("Remaining payload of %zd in ram session to destroy", _payload);
|
||||
PWRN("Remaining payload of %zu in ram session to destroy", _payload);
|
||||
|
||||
if (!_ref_account) return;
|
||||
|
||||
|
@ -119,7 +119,7 @@ namespace Init {
|
||||
ram_quota = avail_slack_ram_quota();
|
||||
if (config_verbose)
|
||||
Genode::printf("Warning: Specified quota exceeds available quota.\n"
|
||||
" Proceeding with a quota of %zd bytes.\n",
|
||||
" Proceeding with a quota of %zu bytes.\n",
|
||||
(Genode::size_t)ram_quota);
|
||||
}
|
||||
return ram_quota;
|
||||
@ -531,7 +531,7 @@ namespace Init {
|
||||
|
||||
if (config_verbose) {
|
||||
Genode::printf("child \"%s\"\n", _name.unique);
|
||||
Genode::printf(" RAM quota: %zd\n", _resources.ram_quota);
|
||||
Genode::printf(" RAM quota: %zu\n", _resources.ram_quota);
|
||||
Genode::printf(" ELF binary: %s\n", _name.file);
|
||||
Genode::printf(" priority: %ld\n", _resources.priority);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user