mirror of
https://github.com/genodelabs/genode.git
synced 2025-04-07 19:34:56 +00:00
parent
d6a92e956a
commit
a79f7d234b
@ -73,7 +73,7 @@ namespace Libc {
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
File_descriptor_allocator();
|
||||
File_descriptor_allocator(Genode::Allocator &md_alloc);
|
||||
|
||||
/**
|
||||
* Allocate file descriptor
|
||||
|
@ -16,32 +16,32 @@
|
||||
#include <util/construct_at.h>
|
||||
#include <base/env.h>
|
||||
#include <base/log.h>
|
||||
#include <libc/allocator.h>
|
||||
|
||||
/* libc plugin interface */
|
||||
#include <libc-plugin/fd_alloc.h>
|
||||
|
||||
namespace Libc {
|
||||
|
||||
File_descriptor_allocator *file_descriptor_allocator()
|
||||
{
|
||||
static bool constructed = 0;
|
||||
static char placeholder[sizeof(File_descriptor_allocator)];
|
||||
if (!constructed) {
|
||||
Genode::construct_at<File_descriptor_allocator>(placeholder);
|
||||
constructed = 1;
|
||||
}
|
||||
|
||||
return reinterpret_cast<File_descriptor_allocator *>(placeholder);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
using namespace Libc;
|
||||
using namespace Genode;
|
||||
|
||||
|
||||
File_descriptor_allocator::File_descriptor_allocator()
|
||||
: Allocator_avl_tpl<File_descriptor>(Genode::env()->heap())
|
||||
File_descriptor_allocator *Libc::file_descriptor_allocator()
|
||||
{
|
||||
static bool constructed = false;
|
||||
static char placeholder[sizeof(File_descriptor_allocator)];
|
||||
static Libc::Allocator md_alloc;
|
||||
|
||||
if (!constructed) {
|
||||
Genode::construct_at<File_descriptor_allocator>(placeholder, md_alloc);
|
||||
constructed = true;
|
||||
}
|
||||
|
||||
return reinterpret_cast<File_descriptor_allocator *>(placeholder);
|
||||
}
|
||||
|
||||
|
||||
File_descriptor_allocator::File_descriptor_allocator(Genode::Allocator &md_alloc)
|
||||
: Allocator_avl_tpl<File_descriptor>(&md_alloc)
|
||||
{
|
||||
add_range(0, MAX_NUM_FDS);
|
||||
}
|
||||
|
@ -12,6 +12,9 @@
|
||||
#include <base/env.h>
|
||||
#include <base/log.h>
|
||||
|
||||
/* Genode libc includes */
|
||||
#include <errno.h>
|
||||
|
||||
/* libc-internal includes */
|
||||
#include <libc-plugin/plugin.h>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user