From e370e08e01d19bdfd6bec05d033aa0bd25317112 Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Thu, 15 Sep 2016 14:40:37 +0200 Subject: [PATCH] Define Genode::size_t as unsigned long Fixes #2105 --- .../include/base/internal/capability_data.h | 2 +- repos/base-hw/src/lib/base/env.cc | 2 +- repos/base-hw/src/test/cpu_quota/main.cc | 4 +- repos/base-hw/src/test/cpu_scheduler/test.cc | 2 +- repos/base-hw/src/test/double_list/test.cc | 2 +- .../src/core/include/core_linux_syscalls.h | 3 ++ repos/base-linux/src/core/stack_area.cc | 4 +- .../src/include/base/internal/stack_area.h | 9 ++-- repos/base-linux/src/lib/base/ipc.cc | 4 +- repos/base-linux/src/lib/base/thread_env.cc | 2 +- .../base-linux/src/lib/lx_hybrid/lx_hybrid.cc | 4 +- .../src/lib/syscall/linux_syscalls.h | 22 ++++++--- repos/base/include/base/allocator.h | 8 ++-- repos/base/include/base/stdint.h | 6 +-- .../base/include/io_mem_session/connection.h | 2 +- repos/base/include/ram_session/connection.h | 2 +- repos/base/include/root/component.h | 2 +- repos/base/include/trace_session/connection.h | 2 +- repos/base/include/util/construct_at.h | 2 +- repos/base/src/core/dump_alloc.cc | 2 +- .../base/internal/expanding_parent_client.h | 2 +- .../internal/expanding_ram_session_client.h | 4 +- .../base/internal/unmanaged_singleton.h | 2 +- .../base/internal/upgradeable_client.h | 2 +- repos/base/src/lib/base/allocator_avl.cc | 17 ++----- repos/base/src/lib/base/signal.cc | 2 +- repos/base/src/lib/base/sliced_heap.cc | 2 +- repos/base/src/lib/cxx/new_delete.cc | 8 ++-- repos/base/src/test/rm_nested/main.cc | 2 +- repos/dde_bsd/src/lib/audio/bus.cc | 2 +- .../dde_ipxe/src/lib/dde_ipxe/dde_support.cc | 4 +- .../src/drivers/framebuffer/intel/lx_emul.cc | 1 + .../src/include/lx_kit/internal/pci_dev.h | 2 +- .../src/include/lx_kit/internal/slab_alloc.h | 4 ++ .../lx_kit/internal/slab_backend_alloc.h | 2 +- repos/dde_linux/src/include/lx_kit/malloc.h | 2 + .../src/include/lx_kit/mapped_io_mem_range.h | 2 +- .../src/lib/usb/include/usb_nic_component.h | 4 +- repos/dde_linux/src/lib/usb/raw/raw.cc | 1 + repos/dde_linux/src/lib/wifi/lxcc_emul.cc | 2 +- repos/dde_linux/src/lib/wifi/nic.cc | 1 + repos/dde_linux/src/lx_kit/pci.cc | 4 +- repos/dde_rump/include/util/allocator_fap.h | 1 + repos/dde_rump/include/util/random.h | 2 +- repos/dde_rump/src/lib/rump/bootstrap.cc | 2 +- repos/dde_rump/src/lib/rump/hypercall.cc | 2 +- repos/dde_rump/src/server/rump_cgd/cgd.cc | 4 +- repos/dde_rump/src/server/rump_cgd/random.cc | 2 +- repos/dde_rump/src/server/rump_fs/random.cc | 2 +- repos/demo/include/scout/canvas.h | 2 +- repos/demo/include/scout/platform.h | 2 +- repos/gems/src/app/backdrop/main.cc | 2 +- repos/gems/src/app/menu_view/types.h | 2 + repos/gems/src/server/tcp_terminal/main.cc | 2 +- repos/libports/include/libc-plugin/fd_alloc.h | 2 +- repos/libports/include/libc-plugin/plugin.h | 4 +- .../include/libc-plugin/plugin_registry.h | 46 +++++++++---------- repos/libports/include/lwip/genode.h | 4 +- .../libports/src/lib/libc/file_operations.cc | 2 +- repos/libports/src/lib/libc/libc_mem_alloc.h | 2 +- repos/libports/src/lib/libc/malloc.cc | 2 + repos/libports/src/lib/libc/plugin.cc | 4 +- .../libports/src/lib/libc/plugin_registry.cc | 2 +- repos/libports/src/lib/libc/vfs_plugin.cc | 24 +++++----- repos/libports/src/lib/libc_fuse/plugin.cc | 1 - repos/libports/src/lib/libc_resolv/plugin.cc | 2 - repos/libports/src/lib/pthread/thread.cc | 2 +- repos/libports/src/lib/qemu-usb/host.cc | 2 +- repos/libports/src/lib/qemu-usb/qemu_emul.cc | 6 +-- .../lib/qt5/qpluginwidget/qpluginwidget.cpp | 4 +- repos/libports/src/server/fuse_fs/util.h | 1 + .../src/test/lwip/http_srv_static/main.cc | 2 +- .../os/include/audio_in_session/connection.h | 2 +- .../os/include/audio_out_session/connection.h | 2 +- repos/os/include/block_session/connection.h | 2 +- repos/os/include/cli_monitor/child.h | 2 +- .../include/file_system_session/connection.h | 4 +- repos/os/include/gpio/component.h | 5 +- repos/os/include/gpio_session/connection.h | 2 +- repos/os/include/loader_session/connection.h | 4 +- repos/os/include/net/arp.h | 4 +- repos/os/include/net/dhcp.h | 6 +-- repos/os/include/net/ethernet.h | 3 +- repos/os/include/net/ipv4.h | 3 +- repos/os/include/net/tcp.h | 2 +- repos/os/include/net/udp.h | 3 +- repos/os/include/nic_session/connection.h | 2 +- repos/os/include/os/server.h | 6 ++- repos/os/include/report_session/connection.h | 2 +- .../spec/rpi/platform/property_message.h | 6 +-- .../os/include/terminal_session/connection.h | 2 +- repos/os/include/uart_session/connection.h | 4 +- repos/os/include/usb_session/connection.h | 2 +- repos/os/src/app/cli_monitor/format_util.h | 6 +-- repos/os/src/app/cli_monitor/line_editor.h | 2 +- repos/os/src/app/cli_monitor/main.cc | 2 +- .../os/src/drivers/ahci/spec/x86/platform.cc | 4 +- .../src/drivers/framebuffer/spec/imx53/ipu.h | 2 - repos/os/src/drivers/nic/spec/linux/main.cc | 2 +- .../platform/spec/rpi/framebuffer_message.h | 2 +- .../os/src/drivers/timer/include/timer_root.h | 2 +- .../server/loader/ram_session_client_guard.h | 4 +- repos/os/src/test/blk/bench/main.cc | 9 ++-- repos/os/src/test/fb_block_adapter/main.cc | 4 +- repos/os/src/test/packet_stream/main.cc | 5 +- repos/os/src/test/xml_generator/main.cc | 4 +- repos/os/src/test/xml_node/test.cc | 4 +- .../src/lib/l4lx/include/dataspace.h | 2 +- .../src/lib/l4lx/include/platform_env.h | 2 +- repos/ports/include/vmm/vcpu_dispatcher.h | 4 +- repos/ports/include/vmm/vcpu_thread.h | 2 +- .../app/gdb_monitor/cpu_session_component.cc | 2 +- .../app/gdb_monitor/cpu_session_component.h | 2 +- .../app/gdb_monitor/gdbserver/genode-low.cc | 4 +- repos/ports/src/app/openvpn/main.cc | 7 +-- .../src/app/seoul/boot_module_provider.h | 6 +-- repos/ports/src/app/seoul/disk.cc | 2 +- repos/ports/src/app/seoul/main.cc | 2 +- repos/ports/src/lib/libc_noux/plugin.cc | 32 ++++++------- repos/ports/src/noux/main.cc | 3 +- repos/ports/src/noux/net/socket_io_channel.h | 6 +-- repos/ports/src/virtualbox/devxhci.cc | 8 ++-- repos/ports/src/virtualbox/libc.cc | 8 ++-- repos/ports/src/virtualbox/pgm.cc | 6 +-- repos/ports/src/virtualbox/rt.cc | 10 ++-- repos/ports/src/virtualbox/spec/nova/sup.cc | 2 +- repos/ports/src/virtualbox5/spec/nova/sup.cc | 10 ++-- repos/ports/src/virtualbox5/sup.h | 2 +- 128 files changed, 280 insertions(+), 257 deletions(-) diff --git a/repos/base-foc/src/include/base/internal/capability_data.h b/repos/base-foc/src/include/base/internal/capability_data.h index c151cc3bf8..f68aa9a9ab 100644 --- a/repos/base-foc/src/include/base/internal/capability_data.h +++ b/repos/base-foc/src/include/base/internal/capability_data.h @@ -47,7 +47,7 @@ class Genode::Native_capability::Data : public Avl_node, Noncopyable uint8_t dec(); addr_t kcap() const; - void* operator new (size_t size, Data* idx) { return idx; } + void* operator new (__SIZE_TYPE__ size, Data* idx) { return idx; } void operator delete (void* idx) { memset(idx, 0, sizeof(Data)); } diff --git a/repos/base-hw/src/lib/base/env.cc b/repos/base-hw/src/lib/base/env.cc index 4df185925e..ddfdd45e58 100644 --- a/repos/base-hw/src/lib/base/env.cc +++ b/repos/base-hw/src/lib/base/env.cc @@ -22,7 +22,7 @@ void Genode::upgrade_pd_session_quota(Genode::size_t quota) { char buf[128]; - snprintf(buf, sizeof(buf), "ram_quota=%zu", quota); + snprintf(buf, sizeof(buf), "ram_quota=%lu", quota); Pd_session_capability cap = *static_cast(env()->pd_session()); env()->parent()->upgrade(cap, buf); diff --git a/repos/base-hw/src/test/cpu_quota/main.cc b/repos/base-hw/src/test/cpu_quota/main.cc index 57c8af7f73..753a8eb837 100644 --- a/repos/base-hw/src/test/cpu_quota/main.cc +++ b/repos/base-hw/src/test/cpu_quota/main.cc @@ -168,8 +168,8 @@ int main() sync_sig.threshold(3); sync_sig.sync(); Cpu_session::Quota quota = Genode::env()->cpu_session()->quota(); - Genode::printf("quota super period %zu\n", quota.super_period_us); - Genode::printf("quota %zu\n", quota.us); + Genode::printf("quota super period %lu\n", quota.super_period_us); + Genode::printf("quota %lu\n", quota.us); counter_a.result(); counter_b.result(); printf("done\n"); diff --git a/repos/base-hw/src/test/cpu_scheduler/test.cc b/repos/base-hw/src/test/cpu_scheduler/test.cc index d50731ae80..b613e2624d 100644 --- a/repos/base-hw/src/test/cpu_scheduler/test.cc +++ b/repos/base-hw/src/test/cpu_scheduler/test.cc @@ -25,7 +25,7 @@ using Genode::addr_t; using Kernel::Cpu_share; using Kernel::Cpu_scheduler; -void * operator new(size_t s, void * p) { return p; } +void * operator new(__SIZE_TYPE__ s, void * p) { return p; } struct Data { diff --git a/repos/base-hw/src/test/double_list/test.cc b/repos/base-hw/src/test/double_list/test.cc index fa01090223..840505dccc 100644 --- a/repos/base-hw/src/test/double_list/test.cc +++ b/repos/base-hw/src/test/double_list/test.cc @@ -27,7 +27,7 @@ using Genode::size_t; using Kernel::Double_list_typed; using Kernel::Double_list_item; -void * operator new(size_t s, void * p) { return p; } +void * operator new(__SIZE_TYPE__ s, void * p) { return p; } struct Item_load { char volatile x, y, z; }; diff --git a/repos/base-linux/src/core/include/core_linux_syscalls.h b/repos/base-linux/src/core/include/core_linux_syscalls.h index 918ce3efb0..129968b479 100644 --- a/repos/base-linux/src/core/include/core_linux_syscalls.h +++ b/repos/base-linux/src/core/include/core_linux_syscalls.h @@ -16,8 +16,11 @@ /* basic Linux syscall bindings */ #include + +#define size_t __SIZE_TYPE__ /* see comment in 'linux_syscalls.h' */ #include #include +#undef size_t /******************************************************* diff --git a/repos/base-linux/src/core/stack_area.cc b/repos/base-linux/src/core/stack_area.cc index 7ff1ee5546..6bba507a01 100644 --- a/repos/base-linux/src/core/stack_area.cc +++ b/repos/base-linux/src/core/stack_area.cc @@ -90,9 +90,9 @@ class Stack_area_ram_session : public Genode::Ram_session int transfer_quota(Genode::Ram_session_capability, Genode::size_t) { return 0; } - size_t quota() { return 0; } + Genode::size_t quota() { return 0; } - size_t used() { return 0; } + Genode::size_t used() { return 0; } }; diff --git a/repos/base-linux/src/include/base/internal/stack_area.h b/repos/base-linux/src/include/base/internal/stack_area.h index 69a9efd2a9..f0ad06cfa4 100644 --- a/repos/base-linux/src/include/base/internal/stack_area.h +++ b/repos/base-linux/src/include/base/internal/stack_area.h @@ -18,10 +18,8 @@ #include #include -#include - /* Linux includes */ -#include +#include extern Genode::addr_t _stack_area_start; @@ -47,8 +45,8 @@ static inline void flush_stack_area() { using namespace Genode; - void * const base = (void *)stack_area_virtual_base(); - size_t const size = stack_area_virtual_size(); + void * const base = (void *)stack_area_virtual_base(); + Genode::size_t const size = stack_area_virtual_size(); int ret; if ((ret = lx_munmap(base, size)) < 0) { @@ -61,6 +59,7 @@ static inline void flush_stack_area() static inline Genode::addr_t reserve_stack_area() { using namespace Genode; + using Genode::size_t; int const flags = MAP_ANONYMOUS | MAP_PRIVATE; int const prot = PROT_NONE; diff --git a/repos/base-linux/src/lib/base/ipc.cc b/repos/base-linux/src/lib/base/ipc.cc index 6ef14bc040..3f578e2f76 100644 --- a/repos/base-linux/src/lib/base/ipc.cc +++ b/repos/base-linux/src/lib/base/ipc.cc @@ -28,8 +28,6 @@ /* Linux includes */ #include -#include -#include using namespace Genode; @@ -69,7 +67,7 @@ struct Protocol_header /* badge of invoked object (on call) / exception code (on reply) */ unsigned long protocol_word; - size_t num_caps; + Genode::size_t num_caps; /* badges of the transferred capability arguments */ unsigned long badges[Msgbuf_base::MAX_CAPS_PER_MSG]; diff --git a/repos/base-linux/src/lib/base/thread_env.cc b/repos/base-linux/src/lib/base/thread_env.cc index 113865b9db..f2fceb0428 100644 --- a/repos/base-linux/src/lib/base/thread_env.cc +++ b/repos/base-linux/src/lib/base/thread_env.cc @@ -43,7 +43,7 @@ extern "C" int stdout_write(char const *); extern "C" __attribute__((weak)) int stdout_write(char const *s) { raw(s); - return strlen(s); + return Genode::strlen(s); } /** diff --git a/repos/base-linux/src/lib/lx_hybrid/lx_hybrid.cc b/repos/base-linux/src/lib/lx_hybrid/lx_hybrid.cc index 3862cbb8db..b6d89f5882 100644 --- a/repos/base-linux/src/lib/lx_hybrid/lx_hybrid.cc +++ b/repos/base-linux/src/lib/lx_hybrid/lx_hybrid.cc @@ -145,10 +145,12 @@ int main() #include #include -/* libc includes */ +/* host libc includes */ +#define size_t __SIZE_TYPE__ /* see comment in 'linux_syscalls.h' */ #include #include #include +#undef size_t using namespace Genode; diff --git a/repos/base-linux/src/lib/syscall/linux_syscalls.h b/repos/base-linux/src/lib/syscall/linux_syscalls.h index 4962c60ef2..cb0d232519 100644 --- a/repos/base-linux/src/lib/syscall/linux_syscalls.h +++ b/repos/base-linux/src/lib/syscall/linux_syscalls.h @@ -32,18 +32,28 @@ #define _GNU_SOURCE 1 /* needed to enable the definition of 'stat64' */ #endif +/* Genode includes */ +#include +#include +#include +#include + +/* + * Resolve ambiguity between 'Genode::size_t' and the host's header's 'size_t'. + */ +#define size_t __SIZE_TYPE__ + /* Linux includes */ #include #include #include #include #include +#include +#include +#include -/* Genode includes */ -#include -#include -#include -#include +#undef size_t /*********************************** @@ -197,7 +207,7 @@ inline void *lx_mmap(void *start, Genode::size_t length, int prot, int flags, } -inline int lx_munmap(void *addr, size_t length) +inline int lx_munmap(void *addr, Genode::size_t length) { return lx_syscall(SYS_munmap, addr, length); } diff --git a/repos/base/include/base/allocator.h b/repos/base/include/base/allocator.h index 41070cfa02..d0fe87794b 100644 --- a/repos/base/include/base/allocator.h +++ b/repos/base/include/base/allocator.h @@ -213,11 +213,11 @@ struct Genode::Range_allocator : Allocator }; -void *operator new (Genode::size_t, Genode::Allocator *); -void *operator new [] (Genode::size_t, Genode::Allocator *); +void *operator new (__SIZE_TYPE__, Genode::Allocator *); +void *operator new [] (__SIZE_TYPE__, Genode::Allocator *); -void *operator new (Genode::size_t, Genode::Allocator &); -void *operator new [] (Genode::size_t, Genode::Allocator &); +void *operator new (__SIZE_TYPE__, Genode::Allocator &); +void *operator new [] (__SIZE_TYPE__, Genode::Allocator &); /** diff --git a/repos/base/include/base/stdint.h b/repos/base/include/base/stdint.h index 5c1f032b5a..4b302e5f05 100644 --- a/repos/base/include/base/stdint.h +++ b/repos/base/include/base/stdint.h @@ -22,17 +22,17 @@ namespace Genode { /** * Integer type for non-negative size values */ - typedef __SIZE_TYPE__ size_t; + typedef unsigned long size_t; /** * Integer type for memory addresses */ - typedef unsigned long addr_t; + typedef unsigned long addr_t; /** * Integer type for memory offset values */ - typedef long off_t; + typedef long off_t; /** * Integer type corresponding to a machine register diff --git a/repos/base/include/io_mem_session/connection.h b/repos/base/include/io_mem_session/connection.h index 41f94a4ac8..a06faf4e8b 100644 --- a/repos/base/include/io_mem_session/connection.h +++ b/repos/base/include/io_mem_session/connection.h @@ -30,7 +30,7 @@ struct Genode::Io_mem_connection : Connection, Io_mem_session_cl Capability _session(Parent &parent, addr_t base, size_t size, bool write_combined) { - return session("ram_quota=4K, base=0x%p, size=0x%zx, wc=%s", + return session("ram_quota=4K, base=0x%p, size=0x%lx, wc=%s", base, size, write_combined ? "yes" : "no"); } diff --git a/repos/base/include/ram_session/connection.h b/repos/base/include/ram_session/connection.h index e9c340ba68..21222271fc 100644 --- a/repos/base/include/ram_session/connection.h +++ b/repos/base/include/ram_session/connection.h @@ -33,7 +33,7 @@ struct Genode::Ram_connection : Connection, Ram_session_client addr_t phys_start, size_t phys_size) { return session(parent, - "ram_quota=%u, phys_start=0x%lx, phys_size=0x%zx, " + "ram_quota=%u, phys_start=0x%lx, phys_size=0x%lx, " "label=\"%s\"", RAM_QUOTA, phys_start, phys_size, label); } diff --git a/repos/base/include/root/component.h b/repos/base/include/root/component.h index 39c89cfd4a..9eda01444e 100644 --- a/repos/base/include/root/component.h +++ b/repos/base/include/root/component.h @@ -245,7 +245,7 @@ class Genode::Root_component : public Rpc_object >, 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), "%zu", + snprintf(ram_quota_buf, sizeof(ram_quota_buf), "%lu", remaining_ram_quota); Arg_string::set_arg(adjusted_args, sizeof(adjusted_args), "ram_quota", ram_quota_buf); diff --git a/repos/base/include/trace_session/connection.h b/repos/base/include/trace_session/connection.h index 08154b0a43..90c63d2363 100644 --- a/repos/base/include/trace_session/connection.h +++ b/repos/base/include/trace_session/connection.h @@ -34,7 +34,7 @@ struct Genode::Trace::Connection : Genode::Connection, unsigned parent_levels) { return session(parent, - "ram_quota=%zu, arg_buffer_size=%zu, parent_levels=%u", + "ram_quota=%lu, arg_buffer_size=%lu, parent_levels=%u", ram_quota, arg_buffer_size, parent_levels); } diff --git a/repos/base/include/util/construct_at.h b/repos/base/include/util/construct_at.h index 1cf5b0d473..3b906d0f00 100644 --- a/repos/base/include/util/construct_at.h +++ b/repos/base/include/util/construct_at.h @@ -55,7 +55,7 @@ static inline T * Genode::construct_at(void *at, ARGS &&... args) { Placeable(ARGS &&... args) : T(args...) { } - void * operator new (size_t, void *ptr) { return ptr; } + void * operator new (__SIZE_TYPE__, void *ptr) { return ptr; } void operator delete (void *, void *) { } /** diff --git a/repos/base/src/core/dump_alloc.cc b/repos/base/src/core/dump_alloc.cc index 5194c9cb9c..66a17d4331 100644 --- a/repos/base/src/core/dump_alloc.cc +++ b/repos/base/src/core/dump_alloc.cc @@ -19,7 +19,7 @@ using namespace Genode; void Allocator_avl_base::Block::dump() { - printf(" Block: [%08lx,%08lx) size=%08zx avail=%08zx max_avail=%08zx\n", + printf(" Block: [%08lx,%08lx) size=%08lx avail=%08lx max_avail=%08lx\n", addr(), addr() + size(), size(), avail(), max_avail()); } diff --git a/repos/base/src/include/base/internal/expanding_parent_client.h b/repos/base/src/include/base/internal/expanding_parent_client.h index a2e7279fb8..9e29b82f22 100644 --- a/repos/base/src/include/base/internal/expanding_parent_client.h +++ b/repos/base/src/include/base/internal/expanding_parent_client.h @@ -107,7 +107,7 @@ class Genode::Expanding_parent_client : public Parent_client .ulong_value(0); char buf[128]; - snprintf(buf, sizeof(buf), "ram_quota=%zu", ram_quota); + snprintf(buf, sizeof(buf), "ram_quota=%lu", ram_quota); resource_request(Resource_args(buf)); }, diff --git a/repos/base/src/include/base/internal/expanding_ram_session_client.h b/repos/base/src/include/base/internal/expanding_ram_session_client.h index d35a180320..45d9d81986 100644 --- a/repos/base/src/include/base/internal/expanding_ram_session_client.h +++ b/repos/base/src/include/base/internal/expanding_ram_session_client.h @@ -60,7 +60,7 @@ struct Genode::Expanding_ram_session_client : Upgradeable_clientparent()->resource_request(buf); }, @@ -83,7 +83,7 @@ struct Genode::Expanding_ram_session_client : Upgradeable_clientparent()->resource_request(buf); } return ret; diff --git a/repos/base/src/include/base/internal/unmanaged_singleton.h b/repos/base/src/include/base/internal/unmanaged_singleton.h index b140f6abe1..02a0245115 100644 --- a/repos/base/src/include/base/internal/unmanaged_singleton.h +++ b/repos/base/src/include/base/internal/unmanaged_singleton.h @@ -40,7 +40,7 @@ * * \param p destination address */ -inline void * operator new(Genode::size_t, void * p) { return p; } +inline void * operator new(__SIZE_TYPE__, void * p) { return p; } /** * Helper class for the use of unmanaged_singleton with the singleton pattern diff --git a/repos/base/src/include/base/internal/upgradeable_client.h b/repos/base/src/include/base/internal/upgradeable_client.h index bc230e415f..49311fffb9 100644 --- a/repos/base/src/include/base/internal/upgradeable_client.h +++ b/repos/base/src/include/base/internal/upgradeable_client.h @@ -38,7 +38,7 @@ struct Genode::Upgradeable_client : CLIENT " (", quota, " bytes)"); char buf[128]; - snprintf(buf, sizeof(buf), "ram_quota=%zu", quota); + snprintf(buf, sizeof(buf), "ram_quota=%lu", quota); env()->parent()->upgrade(_cap, buf); } diff --git a/repos/base/src/lib/base/allocator_avl.cc b/repos/base/src/lib/base/allocator_avl.cc index 57cbea76d0..e49d867428 100644 --- a/repos/base/src/lib/base/allocator_avl.cc +++ b/repos/base/src/lib/base/allocator_avl.cc @@ -11,18 +11,13 @@ * under the terms of the GNU General Public License version 2. */ +#include #include #include using namespace Genode; -/** - * Placement operator - tool for directly calling a constructor - */ -inline void *operator new(size_t, void *at) { return at; } - - /************************** ** Block Implementation ** **************************/ @@ -102,13 +97,11 @@ void Allocator_avl_base::Block::recompute() Allocator_avl_base::Block *Allocator_avl_base::_alloc_block_metadata() { - void *b = 0; + void *b = nullptr; if (_md_alloc->alloc(sizeof(Block), &b)) + return construct_at(b, 0, 0, 0); - /* call constructor by using the placement new operator */ - return new((Block *)b) Block(0, 0, 0); - - return 0; + return nullptr; } @@ -131,7 +124,7 @@ int Allocator_avl_base::_add_block(Block *block_metadata, return -1; /* call constructor for new block */ - new (block_metadata) Block(base, size, used); + construct_at(block_metadata, base, size, used); /* insert block into avl tree */ _addr_tree.insert(block_metadata); diff --git a/repos/base/src/lib/base/signal.cc b/repos/base/src/lib/base/signal.cc index 4cc3d16690..10611efb8d 100644 --- a/repos/base/src/lib/base/signal.cc +++ b/repos/base/src/lib/base/signal.cc @@ -237,7 +237,7 @@ Signal_context_capability Signal_receiver::manage(Signal_context *context) [&] () { size_t const quota = 1024*sizeof(long); char buf[64]; - snprintf(buf, sizeof(buf), "ram_quota=%zu", quota); + snprintf(buf, sizeof(buf), "ram_quota=%ld", quota); log("upgrading quota donation for PD session (", quota, " bytes)"); diff --git a/repos/base/src/lib/base/sliced_heap.cc b/repos/base/src/lib/base/sliced_heap.cc index 2022948f8b..e9a5647d16 100644 --- a/repos/base/src/lib/base/sliced_heap.cc +++ b/repos/base/src/lib/base/sliced_heap.cc @@ -54,7 +54,7 @@ bool Sliced_heap::alloc(size_t size, void **out_addr) _ram_session.free(ds_cap); return false; } catch (Ram_session::Alloc_failed) { - error("Could not allocate dataspace with size %zu", size); + error("Could not allocate dataspace with size %lu", size); return false; } diff --git a/repos/base/src/lib/cxx/new_delete.cc b/repos/base/src/lib/cxx/new_delete.cc index b86b27a0b0..5f14a56e00 100644 --- a/repos/base/src/lib/cxx/new_delete.cc +++ b/repos/base/src/lib/cxx/new_delete.cc @@ -30,10 +30,10 @@ static void *try_alloc(Allocator *alloc, size_t size) } -void *operator new (size_t s, Allocator *a) { return try_alloc(a, s); } -void *operator new [] (size_t s, Allocator *a) { return try_alloc(a, s); } -void *operator new (size_t s, Allocator &a) { return a.alloc(s); } -void *operator new [] (size_t s, Allocator &a) { return a.alloc(s); } +void *operator new (__SIZE_TYPE__ s, Allocator *a) { return try_alloc(a, s); } +void *operator new [] (__SIZE_TYPE__ s, Allocator *a) { return try_alloc(a, s); } +void *operator new (__SIZE_TYPE__ s, Allocator &a) { return a.alloc(s); } +void *operator new [] (__SIZE_TYPE__ s, Allocator &a) { return a.alloc(s); } static void try_dealloc(void *ptr, Deallocator &dealloc) diff --git a/repos/base/src/test/rm_nested/main.cc b/repos/base/src/test/rm_nested/main.cc index 4848f70df3..8e3e7a717a 100644 --- a/repos/base/src/test/rm_nested/main.cc +++ b/repos/base/src/test/rm_nested/main.cc @@ -107,7 +107,7 @@ int main(int argc, char **argv) printf("attached sub dataspace at local address 0x%p\n", addr); Dataspace_client client(region_map.dataspace()); - printf("sub dataspace size is %zu should be %u\n", client.size(), MANAGED_SIZE); + printf("sub dataspace size is %lu should be %u\n", client.size(), MANAGED_SIZE); /* * Walk through the address range belonging to the region map diff --git a/repos/dde_bsd/src/lib/audio/bus.cc b/repos/dde_bsd/src/lib/audio/bus.cc index 3f3f7d72e2..fb94355085 100644 --- a/repos/dde_bsd/src/lib/audio/bus.cc +++ b/repos/dde_bsd/src/lib/audio/bus.cc @@ -405,7 +405,7 @@ extern "C" int pci_mapreg_map(struct pci_attach_args *pa, Platform::Device::ACCESS_16BIT); }, [&] () { char quota[32]; - Genode::snprintf(quota, sizeof(quota), "ram_quota=%zd", + Genode::snprintf(quota, sizeof(quota), "ram_quota=%ld", donate); drv->env().parent().upgrade(drv->pci().cap(), quota); donate *= 2; diff --git a/repos/dde_ipxe/src/lib/dde_ipxe/dde_support.cc b/repos/dde_ipxe/src/lib/dde_ipxe/dde_support.cc index 37bbbf5536..be639fb86e 100644 --- a/repos/dde_ipxe/src/lib/dde_ipxe/dde_support.cc +++ b/repos/dde_ipxe/src/lib/dde_ipxe/dde_support.cc @@ -178,7 +178,7 @@ struct Pci_driver [&] () { client.config_write(devfn, val, _access_size(val)); } , [&] () { char quota[32]; - Genode::snprintf(quota, sizeof(quota), "ram_quota=%zd", + Genode::snprintf(quota, sizeof(quota), "ram_quota=%ld", donate); Genode::env()->parent()->upgrade(_pci.cap(), quota); donate *= 2; @@ -224,7 +224,7 @@ struct Pci_driver [&] () { return _pci.alloc_dma_buffer(size); }, [&] () { char quota[32]; - Genode::snprintf(quota, sizeof(quota), "ram_quota=%zd", + Genode::snprintf(quota, sizeof(quota), "ram_quota=%ld", donate); Genode::env()->parent()->upgrade(_pci.cap(), quota); donate = donate * 2 > size ? 4096 : donate * 2; diff --git a/repos/dde_linux/src/drivers/framebuffer/intel/lx_emul.cc b/repos/dde_linux/src/drivers/framebuffer/intel/lx_emul.cc index 676ed02a68..cda3fe1d31 100644 --- a/repos/dde_linux/src/drivers/framebuffer/intel/lx_emul.cc +++ b/repos/dde_linux/src/drivers/framebuffer/intel/lx_emul.cc @@ -83,6 +83,7 @@ drm_display_mode * Framebuffer::Driver::_preferred_mode(drm_connector *connector) { using namespace Genode; + using Genode::size_t; /* try to read configuration for connector */ try { diff --git a/repos/dde_linux/src/include/lx_kit/internal/pci_dev.h b/repos/dde_linux/src/include/lx_kit/internal/pci_dev.h index e733dd33ad..370c763191 100644 --- a/repos/dde_linux/src/include/lx_kit/internal/pci_dev.h +++ b/repos/dde_linux/src/include/lx_kit/internal/pci_dev.h @@ -189,7 +189,7 @@ class Lx::Pci_dev : public pci_dev, public Lx_kit::List::Element [&] () { _client.config_write(devfn, val, _access_size(val)); }, [&] () { char quota[32]; - Genode::snprintf(quota, sizeof(quota), "ram_quota=%zd", + Genode::snprintf(quota, sizeof(quota), "ram_quota=%ld", donate); Genode::env()->parent()->upgrade(pci()->cap(), quota); donate *= 2; diff --git a/repos/dde_linux/src/include/lx_kit/internal/slab_alloc.h b/repos/dde_linux/src/include/lx_kit/internal/slab_alloc.h index 8fa8bf6050..dd9e2d1ce1 100644 --- a/repos/dde_linux/src/include/lx_kit/internal/slab_alloc.h +++ b/repos/dde_linux/src/include/lx_kit/internal/slab_alloc.h @@ -28,6 +28,10 @@ namespace Lx { class Slab_alloc; } class Lx::Slab_alloc : public Genode::Slab { + public: + + typedef Genode::size_t size_t; + private: size_t const _object_size; diff --git a/repos/dde_linux/src/include/lx_kit/internal/slab_backend_alloc.h b/repos/dde_linux/src/include/lx_kit/internal/slab_backend_alloc.h index bb4dcaf13c..0a4f6948d9 100644 --- a/repos/dde_linux/src/include/lx_kit/internal/slab_backend_alloc.h +++ b/repos/dde_linux/src/include/lx_kit/internal/slab_backend_alloc.h @@ -39,7 +39,7 @@ class Lx::Slab_backend_alloc : public Genode::Allocator /** * Allocate */ - virtual bool alloc(size_t size, void **out_addr) = 0; + virtual bool alloc(Genode::size_t size, void **out_addr) = 0; virtual void free(void *addr) = 0; /** diff --git a/repos/dde_linux/src/include/lx_kit/malloc.h b/repos/dde_linux/src/include/lx_kit/malloc.h index 818066fdaf..fc116ceec5 100644 --- a/repos/dde_linux/src/include/lx_kit/malloc.h +++ b/repos/dde_linux/src/include/lx_kit/malloc.h @@ -32,6 +32,8 @@ class Lx::Malloc : public Genode::Allocator { public: + typedef Genode::size_t size_t; + enum { MAX_SIZE_LOG2 = 16 /* 64 KiB */ }; /** diff --git a/repos/dde_linux/src/include/lx_kit/mapped_io_mem_range.h b/repos/dde_linux/src/include/lx_kit/mapped_io_mem_range.h index e5fc9eff3f..49d56830fe 100644 --- a/repos/dde_linux/src/include/lx_kit/mapped_io_mem_range.h +++ b/repos/dde_linux/src/include/lx_kit/mapped_io_mem_range.h @@ -26,7 +26,7 @@ namespace Lx { void *ioremap(addr_t, unsigned long, Cache_attribute); void iounmap(volatile void*); - Dataspace_capability ioremap_lookup(addr_t, size_t); + Dataspace_capability ioremap_lookup(addr_t, Genode::size_t); } diff --git a/repos/dde_linux/src/lib/usb/include/usb_nic_component.h b/repos/dde_linux/src/lib/usb/include/usb_nic_component.h index 41ab01971c..5407fffa28 100644 --- a/repos/dde_linux/src/lib/usb/include/usb_nic_component.h +++ b/repos/dde_linux/src/lib/usb/include/usb_nic_component.h @@ -20,6 +20,7 @@ namespace Usb_nic { using namespace Genode; + using Genode::size_t; class Session_component; struct Device; }; @@ -231,6 +232,7 @@ class Root : public Root_component Usb_nic::Session_component *_create_session(const char *args) { using namespace Genode; + using Genode::size_t; size_t ram_quota = Arg_string::find_arg(args, "ram_quota" ).ulong_value(0); size_t tx_buf_size = Arg_string::find_arg(args, "tx_buf_size").ulong_value(0); @@ -247,7 +249,7 @@ class Root : public Root_component */ if (tx_buf_size + rx_buf_size < tx_buf_size || tx_buf_size + rx_buf_size > ram_quota - session_size) { - Genode::error("insufficient 'ram_quota', got ", ram_quota, " need %zd", + Genode::error("insufficient 'ram_quota', got ", ram_quota, " need %ld", tx_buf_size + rx_buf_size + session_size); throw Genode::Root::Quota_exceeded(); } diff --git a/repos/dde_linux/src/lib/usb/raw/raw.cc b/repos/dde_linux/src/lib/usb/raw/raw.cc index 3b767f3a0d..3b67a708f9 100644 --- a/repos/dde_linux/src/lib/usb/raw/raw.cc +++ b/repos/dde_linux/src/lib/usb/raw/raw.cc @@ -793,6 +793,7 @@ class Usb::Root : public Genode::Root_component Session_component *_create_session(const char *args) { using namespace Genode; + using Genode::size_t; Session_label const label = label_from_args(args); try { diff --git a/repos/dde_linux/src/lib/wifi/lxcc_emul.cc b/repos/dde_linux/src/lib/wifi/lxcc_emul.cc index 1d3766e76b..2ab05b54c2 100644 --- a/repos/dde_linux/src/lib/wifi/lxcc_emul.cc +++ b/repos/dde_linux/src/lib/wifi/lxcc_emul.cc @@ -33,7 +33,7 @@ #include -typedef Genode::size_t size_t; +typedef ::size_t size_t; typedef Genode::addr_t addr_t; diff --git a/repos/dde_linux/src/lib/wifi/nic.cc b/repos/dde_linux/src/lib/wifi/nic.cc index 73a4487d8a..c0575b4450 100644 --- a/repos/dde_linux/src/lib/wifi/nic.cc +++ b/repos/dde_linux/src/lib/wifi/nic.cc @@ -173,6 +173,7 @@ class Root : public Genode::Root_componentram_session()->alloc(size); o = new (env()->heap()) Ram_object(cap); } else { - size_t donate = size; + Genode::size_t donate = size; cap = retry( [&] () { return Lx::pci()->alloc_dma_buffer(size); }, [&] () { char quota[32]; - Genode::snprintf(quota, sizeof(quota), "ram_quota=%zd", + Genode::snprintf(quota, sizeof(quota), "ram_quota=%ld", donate); Genode::env()->parent()->upgrade(Lx::pci()->cap(), quota); donate = donate * 2 > size ? 4096 : donate * 2; diff --git a/repos/dde_rump/include/util/allocator_fap.h b/repos/dde_rump/include/util/allocator_fap.h index 77fff3b6af..cea6f34d90 100644 --- a/repos/dde_rump/include/util/allocator_fap.h +++ b/repos/dde_rump/include/util/allocator_fap.h @@ -29,6 +29,7 @@ namespace Allocator { namespace Allocator { using namespace Genode; + using Genode::size_t; struct Default_allocator_policy { diff --git a/repos/dde_rump/include/util/random.h b/repos/dde_rump/include/util/random.h index 5e4672ec00..56e6433a6d 100644 --- a/repos/dde_rump/include/util/random.h +++ b/repos/dde_rump/include/util/random.h @@ -16,6 +16,6 @@ #include -int rumpuser_getrandom_backend(void *buf, Genode::size_t buflen, int flags, Genode::size_t *retp); +int rumpuser_getrandom_backend(void *buf, Genode::size_t buflen, int flags, __SIZE_TYPE__ *retp); #endif /* _INCLUDE__UTIL__RANDOM_H_ */ diff --git a/repos/dde_rump/src/lib/rump/bootstrap.cc b/repos/dde_rump/src/lib/rump/bootstrap.cc index 1124f5e78f..e3e9d76e21 100644 --- a/repos/dde_rump/src/lib/rump/bootstrap.cc +++ b/repos/dde_rump/src/lib/rump/bootstrap.cc @@ -199,7 +199,7 @@ static void _dl_init(Genode::Shared_object::Link_map const *map, if (verbose) log("MI: start: ", mi_start, " end: ", mi_end); if (mi_start && mi_end) - mod_init(mi_start, (size_t)(mi_end-mi_start)); + mod_init(mi_start, (Genode::size_t)(mi_end-mi_start)); rc_start = obj->lookup("__start_link_set_rump_components"); rc_end = obj->lookup("__stop_link_set_rump_components"); diff --git a/repos/dde_rump/src/lib/rump/hypercall.cc b/repos/dde_rump/src/lib/rump/hypercall.cc index 12dfafc04f..b34b17dede 100644 --- a/repos/dde_rump/src/lib/rump/hypercall.cc +++ b/repos/dde_rump/src/lib/rump/hypercall.cc @@ -304,7 +304,7 @@ int rumpuser_clock_sleep(int enum_rumpclock, int64_t sec, long nsec) ** Random pool ** *****************/ -int rumpuser_getrandom(void *buf, size_t buflen, int flags, size_t *retp) +int rumpuser_getrandom(void *buf, size_t buflen, int flags, __SIZE_TYPE__ *retp) { return rumpuser_getrandom_backend(buf, buflen, flags, retp); } diff --git a/repos/dde_rump/src/server/rump_cgd/cgd.cc b/repos/dde_rump/src/server/rump_cgd/cgd.cc index a83d3a8dba..46c95c6707 100644 --- a/repos/dde_rump/src/server/rump_cgd/cgd.cc +++ b/repos/dde_rump/src/server/rump_cgd/cgd.cc @@ -349,7 +349,7 @@ char const *Cgd::Device::name() const { return CGD_RAW_DEVICE; } * * \return bytes read */ -size_t Cgd::Device::read(char *dst, size_t len, seek_off_t seek_offset) +Genode::size_t Cgd::Device::read(char *dst, Genode::size_t len, seek_off_t seek_offset) { ssize_t ret = rump_sys_pread(_fd, dst, len, seek_offset); @@ -366,7 +366,7 @@ size_t Cgd::Device::read(char *dst, size_t len, seek_off_t seek_offset) * * \return bytes written */ -size_t Cgd::Device::write(char const *src, size_t len, seek_off_t seek_offset) +Genode::size_t Cgd::Device::write(char const *src, Genode::size_t len, seek_off_t seek_offset) { /* should we append? */ if (seek_offset == ~0ULL) { diff --git a/repos/dde_rump/src/server/rump_cgd/random.cc b/repos/dde_rump/src/server/rump_cgd/random.cc index 891c1c453e..18a55b3e28 100644 --- a/repos/dde_rump/src/server/rump_cgd/random.cc +++ b/repos/dde_rump/src/server/rump_cgd/random.cc @@ -56,7 +56,7 @@ struct Entropy }; -int rumpuser_getrandom_backend(void *buf, size_t buflen, int flags, size_t *retp) +int rumpuser_getrandom_backend(void *buf, size_t buflen, int flags, __SIZE_TYPE__ *retp) { *retp = Entropy::e()->read((char *)buf, buflen); *retp = buflen; diff --git a/repos/dde_rump/src/server/rump_fs/random.cc b/repos/dde_rump/src/server/rump_fs/random.cc index 142de81d2d..4658a07b10 100644 --- a/repos/dde_rump/src/server/rump_fs/random.cc +++ b/repos/dde_rump/src/server/rump_fs/random.cc @@ -14,7 +14,7 @@ #include -int rumpuser_getrandom_backend(void *buf, Genode::size_t buflen, int flags, Genode::size_t *retp) +int rumpuser_getrandom_backend(void *buf, Genode::size_t buflen, int flags, __SIZE_TYPE__ *retp) { *retp = buflen; return 0; diff --git a/repos/demo/include/scout/canvas.h b/repos/demo/include/scout/canvas.h index 051754eadc..0a4c2f0987 100644 --- a/repos/demo/include/scout/canvas.h +++ b/repos/demo/include/scout/canvas.h @@ -161,7 +161,7 @@ class Scout::Canvas : public Canvas_base Texture *texture = static_cast *>(texture_base); - size_t const num_pixels = texture->size().count(); + Genode::size_t const num_pixels = texture->size().count(); if (texture->alpha()) env()->heap()->free(texture->alpha(), num_pixels); diff --git a/repos/demo/include/scout/platform.h b/repos/demo/include/scout/platform.h index d2bb1d73ca..89dfdea599 100644 --- a/repos/demo/include/scout/platform.h +++ b/repos/demo/include/scout/platform.h @@ -34,7 +34,7 @@ namespace Scout { } -inline void *operator new(Genode::size_t size) +inline void *operator new(__SIZE_TYPE__ size) { using Genode::env; void *addr = env()->heap()->alloc(size); diff --git a/repos/gems/src/app/backdrop/main.cc b/repos/gems/src/app/backdrop/main.cc index a38150b6b9..a73323d7c8 100644 --- a/repos/gems/src/app/backdrop/main.cc +++ b/repos/gems/src/app/backdrop/main.cc @@ -65,7 +65,7 @@ struct Backdrop::Main Attached_dataspace fb_ds { _ds_cap(nitpicker) }; - size_t surface_num_bytes() const + Genode::size_t surface_num_bytes() const { return size().count()*mode.bytes_per_pixel(); } diff --git a/repos/gems/src/app/menu_view/types.h b/repos/gems/src/app/menu_view/types.h index b5626b753a..ed29f4ed01 100644 --- a/repos/gems/src/app/menu_view/types.h +++ b/repos/gems/src/app/menu_view/types.h @@ -34,6 +34,8 @@ namespace Menu_view { using namespace Genode; + using Genode::size_t; + typedef Surface_base::Point Point; typedef Surface_base::Area Area; typedef Surface_base::Rect Rect; diff --git a/repos/gems/src/server/tcp_terminal/main.cc b/repos/gems/src/server/tcp_terminal/main.cc index 51903ddecd..9d4167a070 100644 --- a/repos/gems/src/server/tcp_terminal/main.cc +++ b/repos/gems/src/server/tcp_terminal/main.cc @@ -474,7 +474,7 @@ namespace Terminal { /* * XXX read I/O buffer size from args */ - size_t io_buffer_size = 4096; + Genode::size_t io_buffer_size = 4096; try { Session_label const label = label_from_args(args); diff --git a/repos/libports/include/libc-plugin/fd_alloc.h b/repos/libports/include/libc-plugin/fd_alloc.h index 50d8821e08..c906fd5442 100644 --- a/repos/libports/include/libc-plugin/fd_alloc.h +++ b/repos/libports/include/libc-plugin/fd_alloc.h @@ -50,7 +50,7 @@ namespace Libc { void path(char const *newpath) { if (newpath) { - size_t const path_size = ::strlen(newpath) + 1; + Genode::size_t const path_size = ::strlen(newpath) + 1; char *buf = (char*)malloc(path_size); if (!buf) { Genode::error("could not allocate path buffer for libc_fd ", diff --git a/repos/libports/include/libc-plugin/plugin.h b/repos/libports/include/libc-plugin/plugin.h index 4ab781370e..c1b6b6b70e 100644 --- a/repos/libports/include/libc-plugin/plugin.h +++ b/repos/libports/include/libc-plugin/plugin.h @@ -37,6 +37,8 @@ namespace Libc { int _priority; + typedef Genode::size_t size_t; + public: Plugin(int priority = 0); @@ -54,7 +56,7 @@ namespace Libc { struct ::addrinfo **res); virtual bool supports_open(const char *pathname, int flags); virtual bool supports_pipe(); - virtual bool supports_readlink(const char *path, char *buf, size_t bufsiz); + virtual bool supports_readlink(const char *path, char *buf, ::size_t bufsiz); virtual bool supports_rename(const char *oldpath, const char *newpath); virtual bool supports_rmdir(const char *path); virtual bool supports_select(int nfds, diff --git a/repos/libports/include/libc-plugin/plugin_registry.h b/repos/libports/include/libc-plugin/plugin_registry.h index 841ba1b36e..f1257c3d44 100644 --- a/repos/libports/include/libc-plugin/plugin_registry.h +++ b/repos/libports/include/libc-plugin/plugin_registry.h @@ -21,31 +21,31 @@ namespace Libc { - class Plugin_registry : public List - { - public: - - Plugin *get_plugin_for_access(char const *pathname, int amode); - Plugin *get_plugin_for_execve(char const *filename, char *const argv[], - char *const envp[]); - Plugin *get_plugin_for_freeaddrinfo(struct addrinfo *res); - Plugin *get_plugin_for_getaddrinfo(const char *node, const char *service, - const struct addrinfo *hints, - struct addrinfo **res); - Plugin *get_plugin_for_mkdir(const char *path, mode_t mode); - Plugin *get_plugin_for_open(const char *pathname, int flags); - Plugin *get_plugin_for_pipe(); - Plugin *get_plugin_for_readlink(const char *path, char *buf, size_t bufsiz); - Plugin *get_plugin_for_rename(const char *oldpath, const char *newpath); - Plugin *get_plugin_for_rmdir(const char *path); - Plugin *get_plugin_for_socket(int domain, int type, int protocol); - Plugin *get_plugin_for_stat(const char *path, struct stat *); - Plugin *get_plugin_for_symlink(const char *oldpath, const char *newpath); - Plugin *get_plugin_for_unlink(const char *path); - }; + struct Plugin_registry; extern Plugin_registry *plugin_registry(); - } + +struct Libc::Plugin_registry : List +{ + Plugin *get_plugin_for_access(char const *pathname, int amode); + Plugin *get_plugin_for_execve(char const *filename, char *const argv[], + char *const envp[]); + Plugin *get_plugin_for_freeaddrinfo(struct addrinfo *res); + Plugin *get_plugin_for_getaddrinfo(const char *node, const char *service, + const struct addrinfo *hints, + struct addrinfo **res); + Plugin *get_plugin_for_mkdir(const char *path, mode_t mode); + Plugin *get_plugin_for_open(const char *pathname, int flags); + Plugin *get_plugin_for_pipe(); + Plugin *get_plugin_for_readlink(const char *path, char *buf, ::size_t bufsiz); + Plugin *get_plugin_for_rename(const char *oldpath, const char *newpath); + Plugin *get_plugin_for_rmdir(const char *path); + Plugin *get_plugin_for_socket(int domain, int type, int protocol); + Plugin *get_plugin_for_stat(const char *path, struct stat *); + Plugin *get_plugin_for_symlink(const char *oldpath, const char *newpath); + Plugin *get_plugin_for_unlink(const char *path); +}; + #endif /* _LIBC_PLUGIN__PLUGIN_REGISTRY_H_ */ diff --git a/repos/libports/include/lwip/genode.h b/repos/libports/include/lwip/genode.h index a855260102..311adc1336 100644 --- a/repos/libports/include/lwip/genode.h +++ b/repos/libports/include/lwip/genode.h @@ -44,8 +44,8 @@ void lwip_tcpip_init(void); int lwip_nic_init(genode_int32_t ip_addr, genode_int32_t netmask, genode_int32_t gateway, - __SIZE_TYPE__ tx_buf_size, - __SIZE_TYPE__ rx_buf_size); + unsigned long tx_buf_size, + unsigned long rx_buf_size); /** * Pass on link-state changes to lwIP diff --git a/repos/libports/src/lib/libc/file_operations.cc b/repos/libports/src/lib/libc/file_operations.cc index 67d0defb0d..f6e5126a50 100644 --- a/repos/libports/src/lib/libc/file_operations.cc +++ b/repos/libports/src/lib/libc/file_operations.cc @@ -548,7 +548,7 @@ extern "C" ssize_t read(int libc_fd, void *buf, ::size_t count) } -extern "C" ssize_t readlink(const char *path, char *buf, size_t bufsiz) +extern "C" ssize_t readlink(const char *path, char *buf, ::size_t bufsiz) { try { Absolute_path resolved_path; diff --git a/repos/libports/src/lib/libc/libc_mem_alloc.h b/repos/libports/src/lib/libc/libc_mem_alloc.h index 4f9e3122a5..27d55af40c 100644 --- a/repos/libports/src/lib/libc/libc_mem_alloc.h +++ b/repos/libports/src/lib/libc/libc_mem_alloc.h @@ -48,7 +48,7 @@ namespace Libc { Dataspace(Genode::Ram_dataspace_capability c, void *a) : cap(c), local_addr(a) {} - inline void * operator new(Genode::size_t, void* addr) { + inline void * operator new(__SIZE_TYPE__, void* addr) { return addr; } inline void operator delete(void*) { } diff --git a/repos/libports/src/lib/libc/malloc.cc b/repos/libports/src/lib/libc/malloc.cc index f6901275b2..efa3d22de9 100644 --- a/repos/libports/src/lib/libc/malloc.cc +++ b/repos/libports/src/lib/libc/malloc.cc @@ -68,6 +68,8 @@ class Malloc : public Genode::Allocator { private: + typedef Genode::size_t size_t; + enum { SLAB_START = 2, /* 4 Byte (log2) */ SLAB_STOP = 11, /* 2048 Byte (log2) */ diff --git a/repos/libports/src/lib/libc/plugin.cc b/repos/libports/src/lib/libc/plugin.cc index 05e96f30c5..b4b337f147 100644 --- a/repos/libports/src/lib/libc/plugin.cc +++ b/repos/libports/src/lib/libc/plugin.cc @@ -87,7 +87,7 @@ bool Plugin::supports_pipe() } -bool Plugin::supports_readlink(const char *path, char *buf, size_t bufsiz) +bool Plugin::supports_readlink(const char *path, char *buf, ::size_t bufsiz) { return false; } @@ -204,7 +204,7 @@ DUMMY(void *, (void *)(-1), mmap, (void *addr, ::size_t length, int prot, int fl File_descriptor *, ::off_t offset)); DUMMY(int, -1, munmap, (void *, ::size_t)); DUMMY(int, -1, pipe, (File_descriptor*[2])); -DUMMY(ssize_t, -1, readlink, (const char *, char *, size_t)); +DUMMY(ssize_t, -1, readlink, (const char *, char *, ::size_t)); DUMMY(int, -1, rename, (const char *, const char *)); DUMMY(int, -1, rmdir, (const char*)); DUMMY(int, -1, select, (int, fd_set *, fd_set *, fd_set *, struct timeval *)); diff --git a/repos/libports/src/lib/libc/plugin_registry.cc b/repos/libports/src/lib/libc/plugin_registry.cc index 0d38498481..241c8e9ae9 100644 --- a/repos/libports/src/lib/libc/plugin_registry.cc +++ b/repos/libports/src/lib/libc/plugin_registry.cc @@ -67,7 +67,7 @@ Plugin *Plugin_registry::get_plugin_for_pipe() { GET_PLUGIN_FOR(pipe) } -Plugin *Plugin_registry::get_plugin_for_readlink(const char *path, char *buf, size_t bufsiz) { +Plugin *Plugin_registry::get_plugin_for_readlink(const char *path, char *buf, ::size_t bufsiz) { GET_PLUGIN_FOR(readlink, path, buf, bufsiz) } diff --git a/repos/libports/src/lib/libc/vfs_plugin.cc b/repos/libports/src/lib/libc/vfs_plugin.cc index 718b4594ec..7f20ddb1f9 100644 --- a/repos/libports/src/lib/libc/vfs_plugin.cc +++ b/repos/libports/src/lib/libc/vfs_plugin.cc @@ -213,16 +213,16 @@ class Libc::Vfs_plugin : public Libc::Plugin ~Vfs_plugin() { } - bool supports_access(const char *, int) override { return true; } - bool supports_mkdir(const char *, mode_t) override { return true; } - bool supports_open(const char *, int) override { return true; } - bool supports_readlink(const char *, char *, size_t) override { return true; } - bool supports_rename(const char *, const char *) override { return true; } - bool supports_rmdir(const char *) override { return true; } - bool supports_stat(const char *) override { return true; } - bool supports_symlink(const char *, const char *) override { return true; } - bool supports_unlink(const char *) override { return true; } - bool supports_mmap() override { return true; } + bool supports_access(const char *, int) override { return true; } + bool supports_mkdir(const char *, mode_t) override { return true; } + bool supports_open(const char *, int) override { return true; } + bool supports_readlink(const char *, char *, ::size_t) override { return true; } + bool supports_rename(const char *, const char *) override { return true; } + bool supports_rmdir(const char *) override { return true; } + bool supports_stat(const char *) override { return true; } + bool supports_symlink(const char *, const char *) override { return true; } + bool supports_unlink(const char *) override { return true; } + bool supports_mmap() override { return true; } Libc::File_descriptor *open(const char *, int, int libc_fd); @@ -244,7 +244,7 @@ class Libc::Vfs_plugin : public Libc::Plugin ::off_t lseek(Libc::File_descriptor *fd, ::off_t offset, int whence) override; int mkdir(const char *, mode_t) override; ssize_t read(Libc::File_descriptor *, void *, ::size_t) override; - ssize_t readlink(const char *, char *, size_t) override; + ssize_t readlink(const char *, char *, ::size_t) override; int rename(const char *, const char *) override; int rmdir(const char *) override; int stat(const char *, struct stat *) override; @@ -747,7 +747,7 @@ int Libc::Vfs_plugin::symlink(const char *oldpath, const char *newpath) } -ssize_t Libc::Vfs_plugin::readlink(const char *path, char *buf, size_t buf_size) +ssize_t Libc::Vfs_plugin::readlink(const char *path, char *buf, ::size_t buf_size) { typedef Vfs::Directory_service::Readlink_result Result; diff --git a/repos/libports/src/lib/libc_fuse/plugin.cc b/repos/libports/src/lib/libc_fuse/plugin.cc index 49aef45abe..2861152665 100644 --- a/repos/libports/src/lib/libc_fuse/plugin.cc +++ b/repos/libports/src/lib/libc_fuse/plugin.cc @@ -34,7 +34,6 @@ using namespace Genode; -void *operator new (size_t, void *ptr) { return ptr; } /* a little helper to prevent code duplication */ static inline int check_result(int res) diff --git a/repos/libports/src/lib/libc_resolv/plugin.cc b/repos/libports/src/lib/libc_resolv/plugin.cc index cd6fcfdc8c..8778e5bdc7 100644 --- a/repos/libports/src/lib/libc_resolv/plugin.cc +++ b/repos/libports/src/lib/libc_resolv/plugin.cc @@ -25,8 +25,6 @@ #include -void *operator new (size_t, void *ptr) { return ptr; } - extern "C" void libc_freeaddrinfo(struct ::addrinfo *); extern "C" int libc_getaddrinfo(const char *, const char *, const struct ::addrinfo *, diff --git a/repos/libports/src/lib/pthread/thread.cc b/repos/libports/src/lib/pthread/thread.cc index c086008170..2e41331a8b 100644 --- a/repos/libports/src/lib/pthread/thread.cc +++ b/repos/libports/src/lib/pthread/thread.cc @@ -212,7 +212,7 @@ extern "C" { int pthread_attr_getstack(const pthread_attr_t *attr, void **stackaddr, - size_t *stacksize) + ::size_t *stacksize) { /* FIXME */ warning("pthread_attr_getstack() called, might not work correctly"); diff --git a/repos/libports/src/lib/qemu-usb/host.cc b/repos/libports/src/lib/qemu-usb/host.cc index 1a34114bd0..0213da5427 100644 --- a/repos/libports/src/lib/qemu-usb/host.cc +++ b/repos/libports/src/lib/qemu-usb/host.cc @@ -400,7 +400,7 @@ static void usb_host_handle_data(USBDevice *udev, USBPacket *p) USBHostDevice *d = USB_HOST_DEVICE(udev); Usb_host_device *dev = (Usb_host_device *)d->data; - size_t size = 0; + Genode::size_t size = 0; unsigned timeout = 0; Usb::Packet_descriptor::Type type = Usb::Packet_descriptor::BULK; diff --git a/repos/libports/src/lib/qemu-usb/qemu_emul.cc b/repos/libports/src/lib/qemu-usb/qemu_emul.cc index 77a17edaa3..6713483731 100644 --- a/repos/libports/src/lib/qemu-usb/qemu_emul.cc +++ b/repos/libports/src/lib/qemu-usb/qemu_emul.cc @@ -530,9 +530,9 @@ struct Controller : public Qemu::Controller } } - size_t mmio_size() const { return _mmio_size; } + Genode::size_t mmio_size() const { return _mmio_size; } - int mmio_read(Genode::off_t offset, void *buf, size_t size) + int mmio_read(Genode::off_t offset, void *buf, Genode::size_t size) { Genode::Lock::Guard g(_lock); Mmio &mmio = find_region(offset); @@ -558,7 +558,7 @@ struct Controller : public Qemu::Controller return 0; } - int mmio_write(Genode::off_t offset, void const *buf, size_t size) + int mmio_write(Genode::off_t offset, void const *buf, Genode::size_t size) { Genode::Lock::Guard g(_lock); Mmio &mmio = find_region(offset); diff --git a/repos/libports/src/lib/qt5/qpluginwidget/qpluginwidget.cpp b/repos/libports/src/lib/qt5/qpluginwidget/qpluginwidget.cpp index 2d158a0625..8f6e6c891c 100644 --- a/repos/libports/src/lib/qt5/qpluginwidget/qpluginwidget.cpp +++ b/repos/libports/src/lib/qt5/qpluginwidget/qpluginwidget.cpp @@ -109,7 +109,7 @@ void PluginStarter::_start_plugin(QString &file_name, QByteArray const &file_buf Genode::log(__func__, ": file_size_uncompressed=", file_size); - size_t ram_quota = Arg_string::find_arg(_args.constData(), "ram_quota").ulong_value(0) + file_size; + Genode::size_t ram_quota = Arg_string::find_arg(_args.constData(), "ram_quota").ulong_value(0) + file_size; if ((long)env()->ram_session()->avail() - (long)ram_quota < QPluginWidget::RAM_QUOTA) { Genode::error("quota exceeded"); @@ -159,7 +159,7 @@ void PluginStarter::_start_plugin(QString &file_name, QByteArray const &file_buf _pc->commit_rom_module(file_name.toUtf8().constData()); } } else { - size_t ram_quota = Arg_string::find_arg(_args.constData(), "ram_quota").ulong_value(0); + Genode::size_t ram_quota = Arg_string::find_arg(_args.constData(), "ram_quota").ulong_value(0); if ((long)env()->ram_session()->avail() - (long)ram_quota < QPluginWidget::RAM_QUOTA) { _plugin_loading_state = QUOTA_EXCEEDED_ERROR; diff --git a/repos/libports/src/server/fuse_fs/util.h b/repos/libports/src/server/fuse_fs/util.h index 62206b483c..1e2fddc73f 100644 --- a/repos/libports/src/server/fuse_fs/util.h +++ b/repos/libports/src/server/fuse_fs/util.h @@ -35,6 +35,7 @@ static inline char const *basename(char const *path) static bool string_contains(char const *str, char const *substr) { using namespace Genode; + using Genode::size_t; size_t str_len = strlen(str); size_t substr_len = strlen(substr); diff --git a/repos/libports/src/test/lwip/http_srv_static/main.cc b/repos/libports/src/test/lwip/http_srv_static/main.cc index 9f5bc3c90a..914db6ee35 100644 --- a/repos/libports/src/test/lwip/http_srv_static/main.cc +++ b/repos/libports/src/test/lwip/http_srv_static/main.cc @@ -83,7 +83,7 @@ void http_server_serve(int conn) } -template +template static Genode::String read_string_attribute(Genode::Xml_node node, char const *attr, Genode::String default_value) { diff --git a/repos/os/include/audio_in_session/connection.h b/repos/os/include/audio_in_session/connection.h index d9bb4a0290..bc57529983 100644 --- a/repos/os/include/audio_in_session/connection.h +++ b/repos/os/include/audio_in_session/connection.h @@ -30,7 +30,7 @@ struct Audio_in::Connection : Genode::Connection, Audio_in::Session_cli */ Capability _session(Genode::Parent &parent, char const *channel) { - return session(parent, "ram_quota=%zd, channel=\"%s\"", + return session(parent, "ram_quota=%ld, channel=\"%s\"", 2*4096 + sizeof(Stream), channel); } diff --git a/repos/os/include/audio_out_session/connection.h b/repos/os/include/audio_out_session/connection.h index f4ca451c4b..393a1dbdf3 100644 --- a/repos/os/include/audio_out_session/connection.h +++ b/repos/os/include/audio_out_session/connection.h @@ -30,7 +30,7 @@ struct Audio_out::Connection : Genode::Connection, Audio_out::Session_c */ Capability _session(Genode::Parent &parent, char const *channel) { - return session(parent, "ram_quota=%zd, channel=\"%s\"", + return session(parent, "ram_quota=%ld, channel=\"%s\"", 2*4096 + sizeof(Stream), channel); } diff --git a/repos/os/include/block_session/connection.h b/repos/os/include/block_session/connection.h index e4ac68d69a..6635223447 100644 --- a/repos/os/include/block_session/connection.h +++ b/repos/os/include/block_session/connection.h @@ -30,7 +30,7 @@ struct Block::Connection : Genode::Connection, Session_client Capability _session(Genode::Parent &parent, char const *label, Genode::size_t tx_buf_size) { - return session(parent, "ram_quota=%zd, tx_buf_size=%zd, label=\"%s\"", + return session(parent, "ram_quota=%ld, tx_buf_size=%ld, label=\"%s\"", 3*4096 + tx_buf_size, tx_buf_size, label); } diff --git a/repos/os/include/cli_monitor/child.h b/repos/os/include/cli_monitor/child.h index c72ef8abc3..413d32a6f8 100644 --- a/repos/os/include/cli_monitor/child.h +++ b/repos/os/include/cli_monitor/child.h @@ -153,7 +153,7 @@ class Child_base : public Genode::Child_policy return; /* resource request in flight */ char buf[128]; - Genode::snprintf(buf, sizeof(buf), "ram_quota=%zd", amount); + Genode::snprintf(buf, sizeof(buf), "ram_quota=%ld", amount); _withdraw_on_yield_response = greedy; _child.yield(buf); } diff --git a/repos/os/include/file_system_session/connection.h b/repos/os/include/file_system_session/connection.h index 457226d0ab..a33430a59c 100644 --- a/repos/os/include/file_system_session/connection.h +++ b/repos/os/include/file_system_session/connection.h @@ -47,8 +47,8 @@ struct File_system::Connection_base : Genode::Connection, Session_clien size_t tx_buf_size) { return session(parent, - "ram_quota=%zd, " - "tx_buf_size=%zd, " + "ram_quota=%ld, " + "tx_buf_size=%ld, " "label=\"%s\", " "root=\"%s\", " "writeable=%d", diff --git a/repos/os/include/gpio/component.h b/repos/os/include/gpio/component.h index 419b330b33..f419f18422 100644 --- a/repos/os/include/gpio/component.h +++ b/repos/os/include/gpio/component.h @@ -130,8 +130,9 @@ class Gpio::Root : public Genode::Root_component throw Invalid_args(); if (ram_quota < sizeof(Session_component)) { - PWRN("Insufficient dontated ram_quota (%zd bytes), require %zd bytes", - ram_quota, sizeof(Session_component)); + Genode::warning("insufficient dontated ram_quota " + "(", ram_quota, " bytes), " + "require ", sizeof(Session_component), " bytes"); throw Genode::Root::Quota_exceeded(); } diff --git a/repos/os/include/gpio_session/connection.h b/repos/os/include/gpio_session/connection.h index ca75012be1..80c58a2f44 100644 --- a/repos/os/include/gpio_session/connection.h +++ b/repos/os/include/gpio_session/connection.h @@ -29,7 +29,7 @@ struct Gpio::Connection : Genode::Connection, Session_client Connection(Genode::Env &env, unsigned long gpio_pin) : Genode::Connection(env, session(env.parent(), - "ram_quota=8K, gpio=%zd", gpio_pin)), + "ram_quota=8K, gpio=%ld", gpio_pin)), Session_client(cap()) { } diff --git a/repos/os/include/loader_session/connection.h b/repos/os/include/loader_session/connection.h index 64b7d8e513..d903499b7e 100644 --- a/repos/os/include/loader_session/connection.h +++ b/repos/os/include/loader_session/connection.h @@ -29,7 +29,7 @@ struct Loader::Connection : Genode::Connection, Session_client Connection(Genode::Env &env, size_t ram_quota) : Genode::Connection(env, session(env.parent(), - "ram_quota=%zd", ram_quota)), + "ram_quota=%ld", ram_quota)), Session_client(cap()) { } @@ -42,7 +42,7 @@ struct Loader::Connection : Genode::Connection, Session_client */ Connection(size_t ram_quota) : - Genode::Connection(session("ram_quota=%zd", ram_quota)), + Genode::Connection(session("ram_quota=%ld", ram_quota)), Session_client(cap()) { } }; diff --git a/repos/os/include/net/arp.h b/repos/os/include/net/arp.h index 399c2306ce..a48a3bee9e 100644 --- a/repos/os/include/net/arp.h +++ b/repos/os/include/net/arp.h @@ -312,8 +312,8 @@ class Net::Arp_packet /** * Placement new */ - void * operator new(Genode::size_t size, void* addr) { - return addr; } + void * operator new(__SIZE_TYPE__ size, void* addr) { return addr; } + } __attribute__((packed)); #endif /* _NET__ARP_H_ */ diff --git a/repos/os/include/net/dhcp.h b/repos/os/include/net/dhcp.h index 603b48b3ac..2cfc90ae72 100644 --- a/repos/os/include/net/dhcp.h +++ b/repos/os/include/net/dhcp.h @@ -125,8 +125,7 @@ class Net::Dhcp_packet /** * Placement new. */ - void * operator new(Genode::size_t size, void* addr) { - return addr; } + void * operator new(__SIZE_TYPE__, void* addr) { return addr; } } __attribute__((packed)); @@ -272,8 +271,7 @@ class Net::Dhcp_packet /** * Placement new. */ - void * operator new(Genode::size_t size, void* addr) { - return addr; } + void * operator new(__SIZE_TYPE__ size, void* addr) { return addr; } } __attribute__((packed)); diff --git a/repos/os/include/net/ethernet.h b/repos/os/include/net/ethernet.h index b52f36fac4..bf0c06d173 100644 --- a/repos/os/include/net/ethernet.h +++ b/repos/os/include/net/ethernet.h @@ -180,8 +180,7 @@ class Net::Ethernet_frame /** * Placement new operator. */ - void * operator new(Genode::size_t size, void* addr) { - return addr; } + void * operator new(__SIZE_TYPE__ size, void* addr) { return addr; } } __attribute__((packed)); diff --git a/repos/os/include/net/ipv4.h b/repos/os/include/net/ipv4.h index 1b0ff39fab..8fc4713d7f 100644 --- a/repos/os/include/net/ipv4.h +++ b/repos/os/include/net/ipv4.h @@ -192,8 +192,7 @@ class Net::Ipv4_packet /** * Placement new. */ - void * operator new(Genode::size_t size, void* addr) { - return addr; } + void * operator new(__SIZE_TYPE__ size, void* addr) { return addr; } } __attribute__((packed)); diff --git a/repos/os/include/net/tcp.h b/repos/os/include/net/tcp.h index 24443b750e..a4664532a3 100644 --- a/repos/os/include/net/tcp.h +++ b/repos/os/include/net/tcp.h @@ -134,7 +134,7 @@ class Net::Tcp_packet /** * Placement new */ - void * operator new(size_t size, void * addr) { return addr; } + void * operator new(__SIZE_TYPE__ size, void * addr) { return addr; } } __attribute__((packed)); diff --git a/repos/os/include/net/udp.h b/repos/os/include/net/udp.h index 35eca9596a..57d10c934a 100644 --- a/repos/os/include/net/udp.h +++ b/repos/os/include/net/udp.h @@ -94,8 +94,7 @@ class Net::Udp_packet /** * Placement new. */ - void * operator new(Genode::size_t size, void* addr) { - return addr; } + void * operator new(__SIZE_TYPE__, void* addr) { return addr; } /*************************** diff --git a/repos/os/include/nic_session/connection.h b/repos/os/include/nic_session/connection.h index cf9c12bb05..d3a10f6728 100644 --- a/repos/os/include/nic_session/connection.h +++ b/repos/os/include/nic_session/connection.h @@ -34,7 +34,7 @@ struct Nic::Connection : Genode::Connection, Session_client Genode::size_t rx_buf_size) { return session(parent, - "ram_quota=%zd, tx_buf_size=%zd, rx_buf_size=%zd, label=\"%s\"", + "ram_quota=%ld, tx_buf_size=%ld, rx_buf_size=%ld, label=\"%s\"", 6*4096 + tx_buf_size + rx_buf_size, tx_buf_size, rx_buf_size, label); } diff --git a/repos/os/include/os/server.h b/repos/os/include/os/server.h index ec5f865e88..fca8881248 100644 --- a/repos/os/include/os/server.h +++ b/repos/os/include/os/server.h @@ -28,7 +28,11 @@ namespace Server { ** Functions to be provided by the server implementation ** ***********************************************************/ - size_t stack_size(); + /* + * Avoid the ambiguity of 'size_t' if the header is included from + * libc-using code. + */ + Genode::size_t stack_size(); char const *name(); diff --git a/repos/os/include/report_session/connection.h b/repos/os/include/report_session/connection.h index fdecad2eb4..5749442023 100644 --- a/repos/os/include/report_session/connection.h +++ b/repos/os/include/report_session/connection.h @@ -30,7 +30,7 @@ struct Report::Connection : Genode::Connection, Session_client Capability _session(Genode::Parent &parent, char const *label, size_t buffer_size) { - return session(parent, "label=\"%s\", ram_quota=%zd, buffer_size=%zd", + return session(parent, "label=\"%s\", ram_quota=%ld, buffer_size=%zd", label, 2*4096 + buffer_size, buffer_size); } diff --git a/repos/os/include/spec/rpi/platform/property_message.h b/repos/os/include/spec/rpi/platform/property_message.h index 08e09437d4..b283ef673c 100644 --- a/repos/os/include/spec/rpi/platform/property_message.h +++ b/repos/os/include/spec/rpi/platform/property_message.h @@ -117,7 +117,7 @@ struct Platform::Property_message template Placeable(ARGS... args) : T(args...) { } - inline void *operator new (size_t, void *ptr) { return ptr; } + inline void *operator new (__SIZE_TYPE__, void *ptr) { return ptr; } }; template @@ -160,7 +160,7 @@ struct Platform::Property_message construct_request(0, request_args...); } - inline void *operator new (size_t, void *ptr) { return ptr; } + inline void *operator new (__SIZE_TYPE__, void *ptr) { return ptr; } }; void reset() @@ -220,7 +220,7 @@ struct Platform::Property_message } } - inline void *operator new (size_t, void *ptr) { return ptr; } + inline void *operator new (__SIZE_TYPE__, void *ptr) { return ptr; } }; #endif /* _PLATFORM__PROPERTY_MESSAGE_H_ */ diff --git a/repos/os/include/terminal_session/connection.h b/repos/os/include/terminal_session/connection.h index 522e9f5074..5fbebe2696 100644 --- a/repos/os/include/terminal_session/connection.h +++ b/repos/os/include/terminal_session/connection.h @@ -50,7 +50,7 @@ struct Terminal::Connection : Genode::Connection, Session_client Connection(Genode::Env &env, char const *label = "") : Genode::Connection(env, session(env.parent(), - "ram_quota=%zd, label=\"%s\"", + "ram_quota=%ld, label=\"%s\"", 2*4096, label)), Session_client(cap()) { diff --git a/repos/os/include/uart_session/connection.h b/repos/os/include/uart_session/connection.h index e738b6a679..5816e4f1df 100644 --- a/repos/os/include/uart_session/connection.h +++ b/repos/os/include/uart_session/connection.h @@ -27,7 +27,7 @@ struct Uart::Connection : Genode::Connection, Session_client */ Connection(Genode::Env &env) : - Genode::Connection(env, session(env.parent(), "ram_quota=%zd", 2*4096)), + Genode::Connection(env, session(env.parent(), "ram_quota=%ld", 2*4096)), Session_client(cap()) { Terminal::Connection::wait_for_connection(cap()); @@ -42,7 +42,7 @@ struct Uart::Connection : Genode::Connection, Session_client */ Connection() : - Genode::Connection(session("ram_quota=%zd", 2*4096)), + Genode::Connection(session("ram_quota=%ld", 2*4096)), Session_client(cap()) { Terminal::Connection::wait_for_connection(cap()); diff --git a/repos/os/include/usb_session/connection.h b/repos/os/include/usb_session/connection.h index d7cd5e5079..d38abdf335 100644 --- a/repos/os/include/usb_session/connection.h +++ b/repos/os/include/usb_session/connection.h @@ -31,7 +31,7 @@ struct Usb::Connection : Genode::Connection, Session_client char const *label, Genode::size_t tx_buf_size) { - return session(parent, "ram_quota=%zd, tx_buf_size=%zd, label=\"%s\"", + return session(parent, "ram_quota=%ld, tx_buf_size=%ld, label=\"%s\"", 3 * 4096 + tx_buf_size, tx_buf_size, label); } diff --git a/repos/os/src/app/cli_monitor/format_util.h b/repos/os/src/app/cli_monitor/format_util.h index 8dd0e8ba84..3fb1e32f6c 100644 --- a/repos/os/src/app/cli_monitor/format_util.h +++ b/repos/os/src/app/cli_monitor/format_util.h @@ -25,12 +25,12 @@ static inline size_t format_number(char *dst, size_t len, size_t const value, size_t const quotient, char const *unit) { size_t const integer = value / quotient; - size_t const n = snprintf(dst, len, "%zd.", integer); + size_t const n = snprintf(dst, len, "%ld.", integer); size_t const remainder = ((value - (integer * quotient))*100) / quotient; if (len == n) return n; - return n + snprintf(dst + n, len - n, "%s%zd%s", + return n + snprintf(dst + n, len - n, "%s%ld%s", remainder < 10 ? "0" : "", remainder, unit); } @@ -48,7 +48,7 @@ static inline size_t format_bytes(char *dst, size_t len, size_t bytes) if (bytes > KB) return format_number(dst, len, bytes, KB, " KiB"); - return snprintf(dst, len, "%zd bytes", bytes); + return snprintf(dst, len, "%ld bytes", bytes); } diff --git a/repos/os/src/app/cli_monitor/line_editor.h b/repos/os/src/app/cli_monitor/line_editor.h index ce47400417..8fd917d189 100644 --- a/repos/os/src/app/cli_monitor/line_editor.h +++ b/repos/os/src/app/cli_monitor/line_editor.h @@ -375,7 +375,7 @@ class Line_editor void _move_cursor_to(unsigned pos) { char seq[10]; - snprintf(seq, sizeof(seq), "\e[%zdG", pos + _prompt_len); + snprintf(seq, sizeof(seq), "\e[%ldG", pos + _prompt_len); _write(seq); } diff --git a/repos/os/src/app/cli_monitor/main.cc b/repos/os/src/app/cli_monitor/main.cc index c4f2536e51..f971030782 100644 --- a/repos/os/src/app/cli_monitor/main.cc +++ b/repos/os/src/app/cli_monitor/main.cc @@ -35,7 +35,7 @@ using Genode::Xml_node; -inline void *operator new (size_t size) +inline void *operator new (__SIZE_TYPE__ size) { return Genode::env()->heap()->alloc(size); } diff --git a/repos/os/src/drivers/ahci/spec/x86/platform.cc b/repos/os/src/drivers/ahci/spec/x86/platform.cc index 45d34dd4aa..7c4752dd1a 100644 --- a/repos/os/src/drivers/ahci/spec/x86/platform.cc +++ b/repos/os/src/drivers/ahci/spec/x86/platform.cc @@ -103,7 +103,7 @@ struct X86_hba : Platform::Hba [&] () { pci_device->config_write(op, cmd, width); }, [&] () { char quota[32]; - Genode::snprintf(quota, sizeof(quota), "ram_quota=%zd", + Genode::snprintf(quota, sizeof(quota), "ram_quota=%ld", donate); env.parent().upgrade(pci.cap(), quota); donate *= 2; @@ -135,7 +135,7 @@ struct X86_hba : Platform::Hba [&] () { return pci.alloc_dma_buffer(size); }, [&] () { char quota[32]; - snprintf(quota, sizeof(quota), "ram_quota=%zd", donate); + snprintf(quota, sizeof(quota), "ram_quota=%ld", donate); env.parent().upgrade(pci.cap(), quota); donate = donate * 2 > size ? 4096 : donate * 2; }); diff --git a/repos/os/src/drivers/framebuffer/spec/imx53/ipu.h b/repos/os/src/drivers/framebuffer/spec/imx53/ipu.h index baf4cd5667..ee66cf5037 100644 --- a/repos/os/src/drivers/framebuffer/spec/imx53/ipu.h +++ b/repos/os/src/drivers/framebuffer/spec/imx53/ipu.h @@ -208,8 +208,6 @@ class Ipu : Genode::Mmio Genode::uint32_t res3[3]; Cp_mem() { Genode::memset(this, 0, sizeof(Cp_mem)); } - - void * operator new(Genode::size_t size, void* addr) { return addr; } } __attribute__((packed)); diff --git a/repos/os/src/drivers/nic/spec/linux/main.cc b/repos/os/src/drivers/nic/spec/linux/main.cc index 13a801f1df..93b91da1cc 100644 --- a/repos/os/src/drivers/nic/spec/linux/main.cc +++ b/repos/os/src/drivers/nic/spec/linux/main.cc @@ -234,5 +234,5 @@ struct Server::Main char const * Server::name() { return "nic_ep"; } -size_t Server::stack_size() { return 2*1024*sizeof(long); } +Genode::size_t Server::stack_size() { return 2*1024*sizeof(long); } void Server::construct(Entrypoint &ep) { static Main main(ep); } diff --git a/repos/os/src/drivers/platform/spec/rpi/framebuffer_message.h b/repos/os/src/drivers/platform/spec/rpi/framebuffer_message.h index 62ab7843dc..59690102e3 100644 --- a/repos/os/src/drivers/platform/spec/rpi/framebuffer_message.h +++ b/repos/os/src/drivers/platform/spec/rpi/framebuffer_message.h @@ -58,7 +58,7 @@ struct Platform::Framebuffer_message : Framebuffer_info printf(" size: 0x%08x\n", size); } - inline void *operator new (Genode::size_t, void *ptr) { return ptr; } + inline void *operator new (__SIZE_TYPE__, void *ptr) { return ptr; } }; #endif /* _FRAMEBUFFER_MESSAGE_H_ */ diff --git a/repos/os/src/drivers/timer/include/timer_root.h b/repos/os/src/drivers/timer/include/timer_root.h index 1ba73139cc..165d413572 100644 --- a/repos/os/src/drivers/timer/include/timer_root.h +++ b/repos/os/src/drivers/timer/include/timer_root.h @@ -43,7 +43,7 @@ class Timer::Root_component : public Genode::Root_component Genode::size_t ram_quota = Genode::Arg_string::find_arg(args, "ram_quota").ulong_value(0); if (ram_quota < sizeof(Session_component)) { - PWRN("Insufficient donated ram_quota (%zd bytes), require %zd bytes", + PWRN("Insufficient donated ram_quota (%ld bytes), require %zd bytes", ram_quota, sizeof(Session_component)); } diff --git a/repos/os/src/server/loader/ram_session_client_guard.h b/repos/os/src/server/loader/ram_session_client_guard.h index 67f41878cb..37163c29be 100644 --- a/repos/os/src/server/loader/ram_session_client_guard.h +++ b/repos/os/src/server/loader/ram_session_client_guard.h @@ -39,7 +39,7 @@ namespace Genode { Lock::Guard _consumed_lock_guard(_consumed_lock); if ((_amount - _consumed) < size) { - PWRN("Quota exceeded! amount=%zu, size=%zu, consumed=%zu", + PWRN("Quota exceeded! amount=%lu, size=%lu, consumed=%lu", _amount, size, _consumed); return Ram_dataspace_capability(); } @@ -66,7 +66,7 @@ namespace Genode { Lock::Guard _consumed_lock_guard(_consumed_lock); if ((_amount - _consumed) < amount) { - PWRN("Quota exceeded! amount=%zu, size=%zu, consumed=%zu", + PWRN("Quota exceeded! amount=%lu, size=%lu, consumed=%lu", _amount, amount, _consumed); return -1; } diff --git a/repos/os/src/test/blk/bench/main.cc b/repos/os/src/test/blk/bench/main.cc index 8d1f2bcc76..8913f98f95 100644 --- a/repos/os/src/test/blk/bench/main.cc +++ b/repos/os/src/test/blk/bench/main.cc @@ -25,6 +25,8 @@ class Test::Throughput { private: + typedef Genode::size_t size_t; + Allocator_avl _alloc{env()->heap() }; Block::Connection _session { &_alloc, TX_BUFFER }; Timer::Connection _timer; @@ -100,7 +102,7 @@ class Test::Throughput return; _stop = _timer.elapsed_ms(); - ::printf("%s %zu KB in %lu ms (%.02f MB/s)\n", + ::printf("%s %lu KB in %lu ms (%.02f MB/s)\n", !_read_done ? "Read" : "Wrote", _bytes / 1024, _stop - _start, ((double)_bytes / (1024 * 1024)) / ((double)(_stop - _start) / 1000)); @@ -152,8 +154,9 @@ struct Test::Main namespace Server { - char const *name() { return "block_bench_ep"; }; - size_t stack_size() { return 2*1024*sizeof(long); } + + char const *name() { return "block_bench_ep"; }; + Genode::size_t stack_size() { return 2*1024*sizeof(long); } void construct(Entrypoint &ep) { diff --git a/repos/os/src/test/fb_block_adapter/main.cc b/repos/os/src/test/fb_block_adapter/main.cc index c996468fc6..f1d0096317 100644 --- a/repos/os/src/test/fb_block_adapter/main.cc +++ b/repos/os/src/test/fb_block_adapter/main.cc @@ -63,7 +63,7 @@ class Driver : public Block::Driver { /* sanity check block number */ if (block_number + block_count > _fb_size / BLOCK_SIZE) { - PWRN("Out of range: requested %zd blocks from block %llu", + PWRN("Out of range: requested %ld blocks from block %llu", block_count, block_number); return; } @@ -82,7 +82,7 @@ class Driver : public Block::Driver { /* sanity check block number */ if (block_number + block_count > _fb_size / BLOCK_SIZE) { - PWRN("Out of range: requested %zd blocks from block %llu", + PWRN("Out of range: requested %ld blocks from block %llu", block_count, block_number); return; } diff --git a/repos/os/src/test/packet_stream/main.cc b/repos/os/src/test/packet_stream/main.cc index fb7667c710..0e8c32216f 100644 --- a/repos/os/src/test/packet_stream/main.cc +++ b/repos/os/src/test/packet_stream/main.cc @@ -68,8 +68,9 @@ class Source : private Genode::Thread_deprecated, if (!content) { Genode::warning("source: invalid packet"); } - Genode::log("Source: allocated packet (offset=0x%lx, size=0x%zd\n", - packet.offset(), packet.size()); + Genode::log("Source: allocated packet (" + "offset=", Genode::Hex(packet.offset()), " " + "size=", Genode::Hex(packet.size()), ")"); for (unsigned i = 0; i < packet.size(); i++) content[i] = i; diff --git a/repos/os/src/test/xml_generator/main.cc b/repos/os/src/test/xml_generator/main.cc index df988c1b76..e34b7ceae9 100644 --- a/repos/os/src/test/xml_generator/main.cc +++ b/repos/os/src/test/xml_generator/main.cc @@ -75,7 +75,7 @@ int main(int argc, char **argv) * corresponding run script). */ size_t used = fill_buffer_with_xml(dst, sizeof(dst)); - printf("result:\n\n%s\nused %zd bytes\n", dst, used); + printf("result:\n\n%s\nused %ld bytes\n", dst, used); /* * Test buffer overflow @@ -107,7 +107,7 @@ int main(int argc, char **argv) /* compare result with original pattern */ if (decoded_len != sizeof(pattern)) { - printf("decoded content has unexpected length %zd\n", decoded_len); + printf("decoded content has unexpected length %ld\n", decoded_len); return 1; } if (Genode::memcmp(decoded, pattern, sizeof(pattern))) { diff --git a/repos/os/src/test/xml_node/test.cc b/repos/os/src/test/xml_node/test.cc index 2eeb3494a3..7923c906f3 100644 --- a/repos/os/src/test/xml_node/test.cc +++ b/repos/os/src/test/xml_node/test.cc @@ -168,7 +168,7 @@ static void print_xml_token_info(Token xml_token) { static char content_buf[128]; xml_token.string(content_buf, sizeof(content_buf)); - printf("token type=\"%s\", len=%zd, content=\"%s\"\n", + printf("token type=\"%s\", len=%ld, content=\"%s\"\n", token_type_string(xml_token.type()), xml_token.len(), content_buf); } @@ -230,7 +230,7 @@ static void print_xml_node_info(Xml_node xml_node, int indent = 0) xml_node.value(buf, sizeof(buf)); printf("leaf content = \"%s\"\n", buf); } else - printf("number of subnodes = %zd\n", + printf("number of subnodes = %ld\n", xml_node.num_sub_nodes()); print_xml_attr_info(xml_node, indent + 2); diff --git a/repos/ports-foc/src/lib/l4lx/include/dataspace.h b/repos/ports-foc/src/lib/l4lx/include/dataspace.h index e7c3d3a44e..495308fe41 100644 --- a/repos/ports-foc/src/lib/l4lx/include/dataspace.h +++ b/repos/ports-foc/src/lib/l4lx/include/dataspace.h @@ -157,7 +157,7 @@ namespace L4lx { Genode::size_t ram_avail = Genode::env()->ram_session()->avail(); if (greedy && ram_avail < 4*CHUNK_SIZE) { char buf[128]; - Genode::snprintf(buf, sizeof(buf), "ram_quota=%zd", + Genode::snprintf(buf, sizeof(buf), "ram_quota=%ld", 4*CHUNK_SIZE - ram_avail); Genode::env()->parent()->resource_request(buf); } diff --git a/repos/ports-foc/src/lib/l4lx/include/platform_env.h b/repos/ports-foc/src/lib/l4lx/include/platform_env.h index 5566483e51..ba750f9d31 100644 --- a/repos/ports-foc/src/lib/l4lx/include/platform_env.h +++ b/repos/ports-foc/src/lib/l4lx/include/platform_env.h @@ -76,7 +76,7 @@ struct Upgradeable_client : CLIENT "(", quota, " bytes)"); char buf[128]; - Genode::snprintf(buf, sizeof(buf), "ram_quota=%zd", quota); + Genode::snprintf(buf, sizeof(buf), "ram_quota=%ld", quota); Genode::env()->parent()->upgrade(_cap, buf); } diff --git a/repos/ports/include/vmm/vcpu_dispatcher.h b/repos/ports/include/vmm/vcpu_dispatcher.h index a82d4ee255..0599b620d6 100644 --- a/repos/ports/include/vmm/vcpu_dispatcher.h +++ b/repos/ports/include/vmm/vcpu_dispatcher.h @@ -69,7 +69,7 @@ class Vmm::Vcpu_dispatcher : public T unsigned int exit_reason = 0; - Vcpu_dispatcher(size_t stack_size, Pd_session &pd, + Vcpu_dispatcher(Genode::size_t stack_size, Pd_session &pd, Cpu_session * cpu_session, Genode::Affinity::Location location) : @@ -84,7 +84,7 @@ class Vmm::Vcpu_dispatcher : public T } template - Vcpu_dispatcher(size_t stack_size, Pd_session &pd, + Vcpu_dispatcher(Genode::size_t stack_size, Pd_session &pd, Cpu_session * cpu_session, Genode::Affinity::Location location, X attr, void *(*start_routine) (void *), void *arg) diff --git a/repos/ports/include/vmm/vcpu_thread.h b/repos/ports/include/vmm/vcpu_thread.h index 149d3a11a3..d776d3d1e6 100644 --- a/repos/ports/include/vmm/vcpu_thread.h +++ b/repos/ports/include/vmm/vcpu_thread.h @@ -112,7 +112,7 @@ class Vmm::Vcpu_same_pd : public Vmm::Vcpu_thread, Genode::Thread public: - Vcpu_same_pd(size_t stack_size, Cpu_session * cpu_session, + Vcpu_same_pd(Genode::size_t stack_size, Cpu_session * cpu_session, Genode::Affinity::Location location) : Thread(WEIGHT, "vCPU", stack_size, Type::NORMAL, cpu_session, location) diff --git a/repos/ports/src/app/gdb_monitor/cpu_session_component.cc b/repos/ports/src/app/gdb_monitor/cpu_session_component.cc index d1eed9f7b0..c7fc190cb6 100644 --- a/repos/ports/src/app/gdb_monitor/cpu_session_component.cc +++ b/repos/ports/src/app/gdb_monitor/cpu_session_component.cc @@ -329,7 +329,7 @@ Cpu_session_component::~Cpu_session_component() int Cpu_session_component::ref_account(Cpu_session_capability) { return -1; } -int Cpu_session_component::transfer_quota(Cpu_session_capability, size_t) { return -1; } +int Cpu_session_component::transfer_quota(Cpu_session_capability, Genode::size_t) { return -1; } Cpu_session::Quota Cpu_session_component::quota() { return Quota(); } diff --git a/repos/ports/src/app/gdb_monitor/cpu_session_component.h b/repos/ports/src/app/gdb_monitor/cpu_session_component.h index a1da9b9507..04b2b7ee19 100644 --- a/repos/ports/src/app/gdb_monitor/cpu_session_component.h +++ b/repos/ports/src/app/gdb_monitor/cpu_session_component.h @@ -104,7 +104,7 @@ class Gdb_monitor::Cpu_session_component : public Rpc_object Affinity::Space affinity_space() const override; Dataspace_capability trace_control() override; int ref_account(Cpu_session_capability c) override; - int transfer_quota(Cpu_session_capability c, size_t q) override; + int transfer_quota(Cpu_session_capability c, Genode::size_t q) override; Quota quota() override; Capability native_cpu() override; }; diff --git a/repos/ports/src/app/gdb_monitor/gdbserver/genode-low.cc b/repos/ports/src/app/gdb_monitor/gdbserver/genode-low.cc index 3f51a885d1..3d4eee7269 100644 --- a/repos/ports/src/app/gdb_monitor/gdbserver/genode-low.cc +++ b/repos/ports/src/app/gdb_monitor/gdbserver/genode-low.cc @@ -484,13 +484,13 @@ void genode_store_registers(struct regcache *regcache, int regno) if (regno == -1) { for (regno = 0; regno < the_low_target.num_regs; regno++) { - if ((size_t)register_size(regno) <= sizeof(reg_content)) { + if ((Genode::size_t)register_size(regno) <= sizeof(reg_content)) { collect_register(regcache, regno, ®_content); genode_store_register(regno, reg_content); } } } else { - if ((size_t)register_size(regno) <= sizeof(reg_content)) { + if ((Genode::size_t)register_size(regno) <= sizeof(reg_content)) { collect_register(regcache, regno, ®_content); genode_store_register(regno, reg_content); } diff --git a/repos/ports/src/app/openvpn/main.cc b/repos/ports/src/app/openvpn/main.cc index 040788fe96..1541328322 100644 --- a/repos/ports/src/app/openvpn/main.cc +++ b/repos/ports/src/app/openvpn/main.cc @@ -211,6 +211,7 @@ class Root : public Genode::Root_component ram_quota - session_size) { - Genode::error("insufficient 'ram_quota', got %zd, need %zd", - ram_quota, tx_buf_size + rx_buf_size + session_size); + Genode::error("insufficient 'ram_quota', got %ld, need %ld", + ram_quota, tx_buf_size + rx_buf_size + session_size); throw Genode::Root::Quota_exceeded(); } @@ -287,6 +288,6 @@ struct Main namespace Server { char const *name() { return "openvpn_ep"; } - size_t stack_size() { return 8 * 1024 * sizeof (addr_t); } + Genode::size_t stack_size() { return 8 * 1024 * sizeof (addr_t); } void construct(Entrypoint &ep) { static Main server(ep); } } diff --git a/repos/ports/src/app/seoul/boot_module_provider.h b/repos/ports/src/app/seoul/boot_module_provider.h index 2f756be326..d5e554501f 100644 --- a/repos/ports/src/app/seoul/boot_module_provider.h +++ b/repos/ports/src/app/seoul/boot_module_provider.h @@ -96,7 +96,7 @@ class Boot_module_provider */ Rom_connection rom(name); Dataspace_capability ds = rom.dataspace(); - size_t const src_len = Dataspace_client(ds).size(); + Genode::size_t const src_len = Dataspace_client(ds).size(); if (src_len > dst_len) { warning(__func__, ": src_len=", src_len, " dst_len=", dst_len); @@ -173,12 +173,12 @@ class Boot_module_provider if (mod_node.has_type("rom") || mod_node.has_type("inline")) { - size_t cmd_len = 0; + Genode::size_t cmd_len = 0; char name[MODULE_NAME_MAX_LEN]; mod_node.attribute("name").value(name, sizeof(name)); - size_t const name_len = Genode::strlen(name); + Genode::size_t const name_len = Genode::strlen(name); /* * Check if destination buffer can hold the name including diff --git a/repos/ports/src/app/seoul/disk.cc b/repos/ports/src/app/seoul/disk.cc index 11de9683d1..4ee4f49bc6 100644 --- a/repos/ports/src/app/seoul/disk.cc +++ b/repos/ports/src/app/seoul/disk.cc @@ -217,7 +217,7 @@ bool Vancouver_disk::receive(MessageDisk &msg) &_diskcon[msg.disknr].blk_size, &_diskcon[msg.disknr].ops); - Logging::printf("Got info: %llu blocks (%zu B), ops (R: %x, W:%x)\n ", + Logging::printf("Got info: %llu blocks (%lu B), ops (R: %x, W:%x)\n ", _diskcon[msg.disknr].blk_cnt, _diskcon[msg.disknr].blk_size, _diskcon[msg.disknr].ops.supported(Block::Packet_descriptor::READ), diff --git a/repos/ports/src/app/seoul/main.cc b/repos/ports/src/app/seoul/main.cc index 625da7e667..56bcda80a9 100644 --- a/repos/ports/src/app/seoul/main.cc +++ b/repos/ports/src/app/seoul/main.cc @@ -931,7 +931,7 @@ class Machine : public StaticReceiver msg.phys = _guest_memory.remaining_size; if (verbose_debug) - Logging::printf("-> allocated from guest %08zx+%lx\n", + Logging::printf("-> allocated from guest %08lx+%lx\n", _guest_memory.remaining_size, msg.value); return true; diff --git a/repos/ports/src/lib/libc_noux/plugin.cc b/repos/ports/src/lib/libc_noux/plugin.cc index 6898a523a9..0df3405943 100644 --- a/repos/ports/src/lib/libc_noux/plugin.cc +++ b/repos/ports/src/lib/libc_noux/plugin.cc @@ -931,20 +931,20 @@ namespace { } } - bool supports_access(const char *, int) { return true; } + bool supports_access(const char *, int) { return true; } bool supports_execve(char const *, char *const[], - char *const[]) { return true; } - bool supports_open(char const *, int) { return true; } - bool supports_stat(char const *) { return true; } - bool supports_symlink(char const *, char const*) { return true; } - bool supports_pipe() { return true; } - bool supports_unlink(char const *) { return true; } - bool supports_readlink(const char *, char *, size_t) { return true; } - bool supports_rename(const char *, const char *) { return true; } - bool supports_rmdir(char const *) { return true; } - bool supports_mkdir(const char *, mode_t) { return true; } - bool supports_socket(int, int, int) { return true; } - bool supports_mmap() { return true; } + char *const[]) { return true; } + bool supports_open(char const *, int) { return true; } + bool supports_stat(char const *) { return true; } + bool supports_symlink(char const *, char const*) { return true; } + bool supports_pipe() { return true; } + bool supports_unlink(char const *) { return true; } + bool supports_readlink(const char *, char *, ::size_t) { return true; } + bool supports_rename(const char *, const char *) { return true; } + bool supports_rmdir(char const *) { return true; } + bool supports_mkdir(const char *, mode_t) { return true; } + bool supports_socket(int, int, int) { return true; } + bool supports_mmap() { return true; } int access(char const *, int); Libc::File_descriptor *open(char const *, int); @@ -962,7 +962,7 @@ namespace { ssize_t getdirentries(Libc::File_descriptor *, char *, ::size_t, ::off_t *); ::off_t lseek(Libc::File_descriptor *, ::off_t offset, int whence); ssize_t read(Libc::File_descriptor *, void *, ::size_t); - ssize_t readlink(const char *path, char *buf, size_t bufsiz); + ssize_t readlink(const char *path, char *buf, ::size_t bufsiz); int rename(const char *oldpath, const char *newpath); int rmdir(char const *path); int stat(char const *, struct stat *); @@ -1715,7 +1715,7 @@ namespace { } - ssize_t Plugin::readlink(const char *path, char *buf, size_t bufsiz) + ssize_t Plugin::readlink(const char *path, char *buf, ::size_t bufsiz) { if (verbose) log(__func__, ": path=", path, ", bufsiz=", bufsiz); @@ -2049,7 +2049,7 @@ namespace { } - ssize_t Plugin::recvfrom(Libc::File_descriptor *fd, void *buf, size_t len, int flags, + ssize_t Plugin::recvfrom(Libc::File_descriptor *fd, void *buf, ::size_t len, int flags, struct sockaddr *src_addr, socklen_t *addrlen) { if (!buf) { errno = EFAULT; return -1; } diff --git a/repos/ports/src/noux/main.cc b/repos/ports/src/noux/main.cc index f99e18e96d..bddef3e7df 100644 --- a/repos/ports/src/noux/main.cc +++ b/repos/ports/src/noux/main.cc @@ -1099,7 +1099,8 @@ Genode::Lock &Noux::signal_lock() } -void *operator new (Genode::size_t size) { +void *operator new (__SIZE_TYPE__ size) +{ void * ptr = Genode::env()->heap()->alloc(size); if (!ptr) return ptr; diff --git a/repos/ports/src/noux/net/socket_io_channel.h b/repos/ports/src/noux/net/socket_io_channel.h index 39da1eaf6f..ab8a669a08 100644 --- a/repos/ports/src/noux/net/socket_io_channel.h +++ b/repos/ports/src/noux/net/socket_io_channel.h @@ -69,7 +69,7 @@ namespace Noux { * Io_channel interface implementation (only needed methods) */ - bool write(Sysio *sysio, size_t &count) + bool write(Sysio *sysio, ::size_t &count) { ssize_t result = ::write(_socket, sysio->write_in.chunk, sysio->write_in.count); @@ -96,7 +96,7 @@ namespace Noux { bool read(Sysio *sysio) { - size_t const max_count = Genode::min(sysio->read_in.count, sizeof(sysio->read_out.chunk)); + ::size_t const max_count = Genode::min(sysio->read_in.count, sizeof(sysio->read_out.chunk)); ssize_t result = ::read(_socket, sysio->read_out.chunk, max_count); @@ -490,7 +490,7 @@ namespace Noux { Io_channel_backend *backend() { return _backend; } - bool write(Sysio *sysio, size_t &count) + bool write(Sysio *sysio, ::size_t &count) { return _backend->write(sysio, count); } diff --git a/repos/ports/src/virtualbox/devxhci.cc b/repos/ports/src/virtualbox/devxhci.cc index f429d38b59..7cd08cf4f2 100644 --- a/repos/ports/src/virtualbox/devxhci.cc +++ b/repos/ports/src/virtualbox/devxhci.cc @@ -296,20 +296,20 @@ struct Pci_device : public Qemu::Pci_device void raise_interrupt(int level) override { PDMDevHlpPCISetIrqNoWait(pci_dev, 0, level); } - int read_dma(Qemu::addr_t addr, void *buf, size_t size) override { + int read_dma(Qemu::addr_t addr, void *buf, Qemu::size_t size) override { return PDMDevHlpPhysRead(pci_dev, addr, buf, size); } - int write_dma(Qemu::addr_t addr, void const *buf, size_t size) override { + int write_dma(Qemu::addr_t addr, void const *buf, Qemu::size_t size) override { return PDMDevHlpPhysWrite(pci_dev, addr, buf, size); } - void *map_dma(Qemu::addr_t base, size_t size) + void *map_dma(Qemu::addr_t base, Qemu::size_t size) { void *addr; PGMR3PhysTlbGCPhys2Ptr(nullptr, base, true, &addr); return addr; } - void unmap_dma(void *addr, size_t size) { } + void unmap_dma(void *addr, Qemu::size_t size) { } }; diff --git a/repos/ports/src/virtualbox/libc.cc b/repos/ports/src/virtualbox/libc.cc index 0936d2a62e..024773bfb9 100644 --- a/repos/ports/src/virtualbox/libc.cc +++ b/repos/ports/src/virtualbox/libc.cc @@ -38,20 +38,18 @@ static const bool verbose = false; -using Genode::size_t; - /* * We cannot use the libc's version of malloc because it does not satisfies * the alignment constraints asserted by 'Runtime/r3/alloc.cpp'. */ -extern "C" void *malloc(size_t size) +extern "C" void *malloc(::size_t size) { return Libc::mem_alloc()->alloc(size, Genode::log2(RTMEM_ALIGNMENT)); } -extern "C" void *calloc(size_t nmemb, size_t size) +extern "C" void *calloc(::size_t nmemb, ::size_t size) { void *ret = malloc(nmemb*size); if (ret) @@ -66,7 +64,7 @@ extern "C" void free(void *ptr) } -extern "C" void *realloc(void *ptr, Genode::size_t size) +extern "C" void *realloc(void *ptr, ::size_t size) { if (!ptr) return malloc(size); diff --git a/repos/ports/src/virtualbox/pgm.cc b/repos/ports/src/virtualbox/pgm.cc index ff1f8ed79d..54c463ab84 100644 --- a/repos/ports/src/virtualbox/pgm.cc +++ b/repos/ports/src/virtualbox/pgm.cc @@ -218,7 +218,7 @@ int PGMR3PhysMMIO2Unmap(PVM pVM, PPDMDEVINS pDevIns, uint32_t iRegion, RTGCPHYS GCPhys) { RTGCPHYS GCPhysStart = GCPhys; - size_t size = 1; + Genode::size_t size = 1; bool io = vmm_memory()->lookup_range(GCPhysStart, size); Assert(io); Assert(GCPhysStart == GCPhys); @@ -264,7 +264,7 @@ int PGMR3HandlerPhysicalRegister(PVM pVM, PGMPHYSHANDLERTYPE enmType, int PGMHandlerPhysicalDeregister(PVM pVM, RTGCPHYS GCPhys) { - size_t size = 1; + Genode::size_t size = 1; #ifdef VBOX_WITH_REM PFNPGMR3PHYSHANDLER pfnHandlerR3 = 0; @@ -570,7 +570,7 @@ extern "C" int MMIO2_MAPPED_SYNC(PVM pVM, RTGCPHYS GCPhys, size_t cbWrite, } RTGCPHYS map_start = GCPhys; - size_t map_size = 1; + Genode::size_t map_size = 1; bool io = vmm_memory()->lookup_range(map_start, map_size); Assert(io); diff --git a/repos/ports/src/virtualbox/rt.cc b/repos/ports/src/virtualbox/rt.cc index eacbccebd9..523f7299db 100644 --- a/repos/ports/src/virtualbox/rt.cc +++ b/repos/ports/src/virtualbox/rt.cc @@ -135,7 +135,7 @@ class Avl_ds : public Genode::Avl_node MEMORY_CACHED = 16 * 1024 * 1024, }; - size_t cbx = cb * 4; + ::size_t cbx = cb * 4; while (_unused_ds.first() && cbx && (_mem_allocated + cb > MEMORY_MAX || _mem_unused + cb > MEMORY_CACHED || @@ -214,10 +214,10 @@ static void *alloc_mem(size_t cb, const char *pszTag, bool executable = false) Ram_dataspace_capability ds = env()->ram_session()->alloc(cb); Assert(ds.valid()); - size_t const whole_size = 0; - Genode::off_t const offset = 0; - bool const any_addr = false; - void * any_local_addr = nullptr; + Genode::size_t const whole_size = 0; + Genode::off_t const offset = 0; + bool const any_addr = false; + void * any_local_addr = nullptr; void * local_addr = env()->rm_session()->attach(ds, whole_size, offset, any_addr, any_local_addr, diff --git a/repos/ports/src/virtualbox/spec/nova/sup.cc b/repos/ports/src/virtualbox/spec/nova/sup.cc index b7dee220a5..d3ba666bac 100644 --- a/repos/ports/src/virtualbox/spec/nova/sup.cc +++ b/repos/ports/src/virtualbox/spec/nova/sup.cc @@ -260,7 +260,7 @@ extern "C" void pthread_yield(void) } -void *operator new (Genode::size_t size, int log2_align) +void *operator new (__SIZE_TYPE__ size, int log2_align) { static Libc::Mem_alloc_impl heap(Genode::env()->rm_session()); return heap.alloc(size, log2_align); diff --git a/repos/ports/src/virtualbox5/spec/nova/sup.cc b/repos/ports/src/virtualbox5/spec/nova/sup.cc index 8dbdf872fb..21e824836f 100644 --- a/repos/ports/src/virtualbox5/spec/nova/sup.cc +++ b/repos/ports/src/virtualbox5/spec/nova/sup.cc @@ -38,7 +38,7 @@ #include "mm.h" -extern "C" bool PGMUnmapMemoryGenode(void *, size_t); +extern "C" bool PGMUnmapMemoryGenode(void *, ::size_t); /* XXX does not work on 32bit host - since vm memory is from 0 - 4G and * such large areas can't be attached to a process @@ -103,7 +103,7 @@ int SUPR3CallVMMR0Fast(PVMR0 pVMR0, unsigned uOperation, VMCPUID idCpu) return VERR_INTERNAL_ERROR; } -int SUPR3PageAllocEx(size_t cPages, uint32_t fFlags, void **ppvPages, +int SUPR3PageAllocEx(::size_t cPages, uint32_t fFlags, void **ppvPages, PRTR0PTR pR0Ptr, PSUPPAGE paPages) { Assert(ppvPages); @@ -496,7 +496,7 @@ void genode_update_tsc(void (*update_func)(void), unsigned long update_us) } -bool PGMUnmapMemoryGenode(void * vmm_local, size_t size) +bool PGMUnmapMemoryGenode(void * vmm_local, ::size_t size) { Assert(vmm_local); @@ -530,14 +530,14 @@ extern "C" void pthread_yield(void) } -void *operator new (Genode::size_t size, int log2_align) +void *operator new (__SIZE_TYPE__ size, int log2_align) { static Libc::Mem_alloc_impl heap(Genode::env()->rm_session()); return heap.alloc(size, log2_align); } -bool create_emt_vcpu(pthread_t * pthread, size_t stack, +bool create_emt_vcpu(pthread_t * pthread, ::size_t stack, const pthread_attr_t *attr, void *(*start_routine)(void *), void *arg, Genode::Cpu_session * cpu_session, diff --git a/repos/ports/src/virtualbox5/sup.h b/repos/ports/src/virtualbox5/sup.h index b2029feeee..001d5c99fe 100644 --- a/repos/ports/src/virtualbox5/sup.h +++ b/repos/ports/src/virtualbox5/sup.h @@ -26,7 +26,7 @@ * Returns true if a vCPU could be started. If false we run without * hardware acceleration support. */ -bool create_emt_vcpu(pthread_t * pthread, size_t stack, +bool create_emt_vcpu(pthread_t * pthread, ::size_t stack, const pthread_attr_t *attr, void *(*start_routine)(void *), void *arg, Genode::Cpu_session * cpu_session,