Define Genode::size_t as unsigned long

Fixes #2105
This commit is contained in:
Norman Feske 2016-09-15 14:40:37 +02:00 committed by Christian Helmuth
parent 7bed3967ae
commit e370e08e01
128 changed files with 280 additions and 257 deletions

View File

@ -47,7 +47,7 @@ class Genode::Native_capability::Data : public Avl_node<Data>, 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)); }

View File

@ -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<Pd_session_client*>(env()->pd_session());
env()->parent()->upgrade(cap, buf);

View File

@ -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");

View File

@ -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
{

View File

@ -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; };

View File

@ -16,8 +16,11 @@
/* basic Linux syscall bindings */
#include <linux_syscalls.h>
#define size_t __SIZE_TYPE__ /* see comment in 'linux_syscalls.h' */
#include <sys/stat.h>
#include <fcntl.h>
#undef size_t
/*******************************************************

View File

@ -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; }
};

View File

@ -18,10 +18,8 @@
#include <base/thread.h>
#include <rm_session/rm_session.h>
#include <linux_syscalls.h>
/* Linux includes */
#include <sys/mman.h>
#include <linux_syscalls.h>
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;

View File

@ -28,8 +28,6 @@
/* Linux includes */
#include <linux_syscalls.h>
#include <sys/un.h>
#include <sys/socket.h>
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];

View File

@ -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);
}
/**

View File

@ -145,10 +145,12 @@ int main()
#include <base/thread.h>
#include <base/env.h>
/* libc includes */
/* host libc includes */
#define size_t __SIZE_TYPE__ /* see comment in 'linux_syscalls.h' */
#include <pthread.h>
#include <stdio.h>
#include <errno.h>
#undef size_t
using namespace Genode;

View File

@ -32,18 +32,28 @@
#define _GNU_SOURCE 1 /* needed to enable the definition of 'stat64' */
#endif
/* Genode includes */
#include <util/string.h>
#include <base/printf.h>
#include <base/snprintf.h>
#include <base/log.h>
/*
* Resolve ambiguity between 'Genode::size_t' and the host's header's 'size_t'.
*/
#define size_t __SIZE_TYPE__
/* Linux includes */
#include <linux/futex.h>
#include <unistd.h>
#include <signal.h>
#include <sched.h>
#include <sys/syscall.h>
#include <sys/un.h>
#include <sys/socket.h>
#include <sys/mman.h>
/* Genode includes */
#include <util/string.h>
#include <base/printf.h>
#include <base/snprintf.h>
#include <base/log.h>
#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);
}

View File

@ -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 &);
/**

View File

@ -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

View File

@ -30,7 +30,7 @@ struct Genode::Io_mem_connection : Connection<Io_mem_session>, Io_mem_session_cl
Capability<Io_mem_session> _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");
}

View File

@ -33,7 +33,7 @@ struct Genode::Ram_connection : Connection<Ram_session>, 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);
}

View File

@ -245,7 +245,7 @@ class Genode::Root_component : public Rpc_object<Typed_root<SESSION_TYPE> >,
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);

View File

@ -34,7 +34,7 @@ struct Genode::Trace::Connection : Genode::Connection<Genode::Trace::Session>,
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);
}

View File

@ -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 *) { }
/**

View File

@ -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());
}

View File

@ -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));
},

View File

@ -60,7 +60,7 @@ struct Genode::Expanding_ram_session_client : Upgradeable_client<Genode::Ram_ses
* a bit too much quota for the most time.
*/
enum { ALLOC_OVERHEAD = 4096U };
Genode::snprintf(buf, sizeof(buf), "ram_quota=%zu",
Genode::snprintf(buf, sizeof(buf), "ram_quota=%lu",
size + ALLOC_OVERHEAD);
env()->parent()->resource_request(buf);
},
@ -83,7 +83,7 @@ struct Genode::Expanding_ram_session_client : Upgradeable_client<Genode::Ram_ses
* XXX Let transfer_quota throw 'Ram_session::Quota_exceeded'
*/
char buf[128];
Genode::snprintf(buf, sizeof(buf), "ram_quota=%zu", amount);
Genode::snprintf(buf, sizeof(buf), "ram_quota=%lu", amount);
env()->parent()->resource_request(buf);
}
return ret;

View File

@ -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

View File

@ -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);
}

View File

@ -11,18 +11,13 @@
* under the terms of the GNU General Public License version 2.
*/
#include <util/construct_at.h>
#include <base/allocator_avl.h>
#include <base/log.h>
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<Block>(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>(block_metadata, base, size, used);
/* insert block into avl tree */
_addr_tree.insert(block_metadata);

View File

@ -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)");

View File

@ -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;
}

View File

@ -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)

View File

@ -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

View File

@ -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;

View File

@ -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;

View File

@ -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 {

View File

@ -189,7 +189,7 @@ class Lx::Pci_dev : public pci_dev, public Lx_kit::List<Pci_dev>::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;

View File

@ -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;

View File

@ -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;
/**

View File

@ -32,6 +32,8 @@ class Lx::Malloc : public Genode::Allocator
{
public:
typedef Genode::size_t size_t;
enum { MAX_SIZE_LOG2 = 16 /* 64 KiB */ };
/**

View File

@ -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);
}

View File

@ -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();
}

View File

@ -793,6 +793,7 @@ class Usb::Root : public Genode::Root_component<Session_component>
Session_component *_create_session(const char *args)
{
using namespace Genode;
using Genode::size_t;
Session_label const label = label_from_args(args);
try {

View File

@ -33,7 +33,7 @@
#include <lx_kit/scheduler.h>
typedef Genode::size_t size_t;
typedef ::size_t size_t;
typedef Genode::addr_t addr_t;

View File

@ -173,6 +173,7 @@ class Root : public Genode::Root_component<Wifi_session_component,
Wifi_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);

View File

@ -85,12 +85,12 @@ Lx::backend_alloc(Genode::addr_t size, Genode::Cache_attribute cached)
cap = env()->ram_session()->alloc(size);
o = new (env()->heap()) Ram_object(cap);
} else {
size_t donate = size;
Genode::size_t donate = size;
cap = retry<Platform::Session::Out_of_metadata>(
[&] () { 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;

View File

@ -29,6 +29,7 @@ namespace Allocator {
namespace Allocator {
using namespace Genode;
using Genode::size_t;
struct Default_allocator_policy
{

View File

@ -16,6 +16,6 @@
#include <base/stdint.h>
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_ */

View File

@ -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<rump_component **>("__start_link_set_rump_components");
rc_end = obj->lookup<rump_component **>("__stop_link_set_rump_components");

View File

@ -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);
}

View File

@ -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) {

View File

@ -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;

View File

@ -14,7 +14,7 @@
#include <util/random.h>
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;

View File

@ -161,7 +161,7 @@ class Scout::Canvas : public Canvas_base
Texture<PT> *texture = static_cast<Texture<PT> *>(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);

View File

@ -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);

View File

@ -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();
}

View File

@ -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;

View File

@ -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);

View File

@ -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 ",

View File

@ -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,

View File

@ -21,31 +21,31 @@
namespace Libc {
class Plugin_registry : public List<Plugin>
{
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>
{
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_ */

View File

@ -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

View File

@ -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;

View File

@ -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*) { }

View File

@ -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) */

View File

@ -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 *));

View File

@ -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) }

View File

@ -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;

View File

@ -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)

View File

@ -25,8 +25,6 @@
#include <netdb.h>
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 *,

View File

@ -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");

View File

@ -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;

View File

@ -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);

View File

@ -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;

View File

@ -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);

View File

@ -83,7 +83,7 @@ void http_server_serve(int conn)
}
template <size_t N>
template <Genode::size_t N>
static Genode::String<N> read_string_attribute(Genode::Xml_node node, char const *attr,
Genode::String<N> default_value)
{

View File

@ -30,7 +30,7 @@ struct Audio_in::Connection : Genode::Connection<Session>, Audio_in::Session_cli
*/
Capability<Audio_in::Session> _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);
}

View File

@ -30,7 +30,7 @@ struct Audio_out::Connection : Genode::Connection<Session>, Audio_out::Session_c
*/
Capability<Audio_out::Session> _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);
}

View File

@ -30,7 +30,7 @@ struct Block::Connection : Genode::Connection<Session>, Session_client
Capability<Block::Session> _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);
}

View File

@ -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);
}

View File

@ -47,8 +47,8 @@ struct File_system::Connection_base : Genode::Connection<Session>, 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",

View File

@ -130,8 +130,9 @@ class Gpio::Root : public Genode::Root_component<Gpio::Session_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();
}

View File

@ -29,7 +29,7 @@ struct Gpio::Connection : Genode::Connection<Session>, Session_client
Connection(Genode::Env &env, unsigned long gpio_pin)
:
Genode::Connection<Session>(env, session(env.parent(),
"ram_quota=8K, gpio=%zd", gpio_pin)),
"ram_quota=8K, gpio=%ld", gpio_pin)),
Session_client(cap())
{ }

View File

@ -29,7 +29,7 @@ struct Loader::Connection : Genode::Connection<Session>, Session_client
Connection(Genode::Env &env, size_t ram_quota)
:
Genode::Connection<Session>(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>, Session_client
*/
Connection(size_t ram_quota)
:
Genode::Connection<Session>(session("ram_quota=%zd", ram_quota)),
Genode::Connection<Session>(session("ram_quota=%ld", ram_quota)),
Session_client(cap())
{ }
};

View File

@ -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_ */

View File

@ -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));

View File

@ -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));

View File

@ -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));

View File

@ -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));

View File

@ -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; }
/***************************

View File

@ -34,7 +34,7 @@ struct Nic::Connection : Genode::Connection<Session>, 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);
}

View File

@ -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();

View File

@ -30,7 +30,7 @@ struct Report::Connection : Genode::Connection<Session>, Session_client
Capability<Report::Session> _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);
}

View File

@ -117,7 +117,7 @@ struct Platform::Property_message
template <typename... ARGS>
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 <typename T, typename... ARGS>
@ -160,7 +160,7 @@ struct Platform::Property_message
construct_request<TAG>(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_ */

View File

@ -50,7 +50,7 @@ struct Terminal::Connection : Genode::Connection<Session>, Session_client
Connection(Genode::Env &env, char const *label = "")
:
Genode::Connection<Session>(env, session(env.parent(),
"ram_quota=%zd, label=\"%s\"",
"ram_quota=%ld, label=\"%s\"",
2*4096, label)),
Session_client(cap())
{

View File

@ -27,7 +27,7 @@ struct Uart::Connection : Genode::Connection<Session>, Session_client
*/
Connection(Genode::Env &env)
:
Genode::Connection<Session>(env, session(env.parent(), "ram_quota=%zd", 2*4096)),
Genode::Connection<Session>(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>, Session_client
*/
Connection()
:
Genode::Connection<Session>(session("ram_quota=%zd", 2*4096)),
Genode::Connection<Session>(session("ram_quota=%ld", 2*4096)),
Session_client(cap())
{
Terminal::Connection::wait_for_connection(cap());

View File

@ -31,7 +31,7 @@ struct Usb::Connection : Genode::Connection<Session>, 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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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;
});

View File

@ -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));

View File

@ -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); }

View File

@ -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_ */

Some files were not shown because too many files have changed in this diff Show More