mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-21 22:47:50 +00:00
parent
5ec7a0e2f8
commit
b2dd0ab436
@ -19,6 +19,7 @@
|
|||||||
#include <base/log.h>
|
#include <base/log.h>
|
||||||
#include <vfs/types.h>
|
#include <vfs/types.h>
|
||||||
#include <util/string.h>
|
#include <util/string.h>
|
||||||
|
#include <libc/allocator.h>
|
||||||
|
|
||||||
/* libc includes */
|
/* libc includes */
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
@ -49,6 +50,8 @@ namespace Libc {
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
Libc::Allocator global_allocator;
|
||||||
|
|
||||||
using Libc::Errno;
|
using Libc::Errno;
|
||||||
|
|
||||||
struct Absolute_path : Vfs::Absolute_path
|
struct Absolute_path : Vfs::Absolute_path
|
||||||
@ -380,7 +383,7 @@ extern "C" int socket_fs_accept(int libc_fd, sockaddr *addr, socklen_t *addrlen)
|
|||||||
}
|
}
|
||||||
|
|
||||||
Absolute_path accept_path(accept_socket, Libc::config_socket());
|
Absolute_path accept_path(accept_socket, Libc::config_socket());
|
||||||
Socket_context *accept_context = new (Genode::env()->heap())
|
Socket_context *accept_context = new (&global_allocator)
|
||||||
Socket_context(accept_path);
|
Socket_context(accept_path);
|
||||||
Libc::File_descriptor *accept_fd =
|
Libc::File_descriptor *accept_fd =
|
||||||
Libc::file_descriptor_allocator()->alloc(&socket_plugin(), accept_context);
|
Libc::file_descriptor_allocator()->alloc(&socket_plugin(), accept_context);
|
||||||
@ -695,7 +698,7 @@ extern "C" int socket_fs_socket(int domain, int type, int protocol)
|
|||||||
path.append(socket_path.string());
|
path.append(socket_path.string());
|
||||||
} catch (New_socket_failed) { return Errno(EINVAL); }
|
} catch (New_socket_failed) { return Errno(EINVAL); }
|
||||||
|
|
||||||
Socket_context *context = new (Genode::env()->heap())
|
Socket_context *context = new (&global_allocator)
|
||||||
Socket_context(path);
|
Socket_context(path);
|
||||||
Libc::File_descriptor *fd =
|
Libc::File_descriptor *fd =
|
||||||
Libc::file_descriptor_allocator()->alloc(&socket_plugin(), context);
|
Libc::file_descriptor_allocator()->alloc(&socket_plugin(), context);
|
||||||
@ -797,7 +800,7 @@ int Socket_plugin::close(Libc::File_descriptor *fd)
|
|||||||
|
|
||||||
::unlink(context->path.base());
|
::unlink(context->path.base());
|
||||||
|
|
||||||
Genode::destroy(Genode::env()->heap(), context);
|
Genode::destroy(&global_allocator, context);
|
||||||
Libc::file_descriptor_allocator()->free(fd);
|
Libc::file_descriptor_allocator()->free(fd);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user