2013-08-21 09:37:21 +00:00
|
|
|
/*
|
|
|
|
* \brief VirtualBox runtime (RT)
|
|
|
|
* \author Norman Feske
|
|
|
|
* \date 2013-08-20
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
2017-02-20 12:23:52 +00:00
|
|
|
* Copyright (C) 2013-2017 Genode Labs GmbH
|
2013-08-21 09:37:21 +00:00
|
|
|
*
|
|
|
|
* This file is distributed under the terms of the GNU General Public License
|
|
|
|
* version 2.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Genode includes */
|
base: avoid use of deprecated base/printf.h
Besides adapting the components to the use of base/log.h, the patch
cleans up a few base headers, i.e., it removes unused includes from
root/component.h, specifically base/heap.h and
ram_session/ram_session.h. Hence, components that relied on the implicit
inclusion of those headers have to manually include those headers now.
While adjusting the log messages, I repeatedly stumbled over the problem
that printing char * arguments is ambiguous. It is unclear whether to
print the argument as pointer or null-terminated string. To overcome
this problem, the patch introduces a new type 'Cstring' that allows the
caller to express that the argument should be handled as null-terminated
string. As a nice side effect, with this type in place, the optional len
argument of the 'String' class could be removed. Instead of supplying a
pair of (char const *, size_t), the constructor accepts a 'Cstring'.
This, in turn, clears the way let the 'String' constructor use the new
output mechanism to assemble a string from multiple arguments (and
thereby getting rid of snprintf within Genode in the near future).
To enforce the explicit resolution of the char * ambiguity, the 'char *'
overload of the 'print' function is marked as deleted.
Issue #1987
2016-07-13 17:07:09 +00:00
|
|
|
#include <base/log.h>
|
2013-08-21 09:37:21 +00:00
|
|
|
#include <util/string.h>
|
2014-05-23 07:26:57 +00:00
|
|
|
#include <rtc_session/connection.h>
|
2013-08-21 09:37:21 +00:00
|
|
|
|
|
|
|
/* libc includes */
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <signal.h>
|
2014-05-23 07:26:57 +00:00
|
|
|
#include <sys/time.h>
|
2014-09-23 11:01:47 +00:00
|
|
|
#include <sys/mount.h> /* statfs */
|
2016-06-15 15:51:59 +00:00
|
|
|
#include <sys/statvfs.h>
|
2014-05-23 07:26:57 +00:00
|
|
|
#include <unistd.h>
|
|
|
|
#include <errno.h>
|
2014-09-23 11:01:47 +00:00
|
|
|
#include <fcntl.h> /* open */
|
|
|
|
|
2016-06-15 15:51:59 +00:00
|
|
|
#include "libc_errno.h"
|
2014-09-23 11:01:47 +00:00
|
|
|
|
2017-02-08 13:07:53 +00:00
|
|
|
/* Genode specific Vbox include */
|
|
|
|
#include "vmm.h"
|
2013-08-21 09:37:21 +00:00
|
|
|
|
|
|
|
/* libc memory allocator */
|
|
|
|
#include <libc_mem_alloc.h>
|
|
|
|
|
|
|
|
/* VirtualBox includes */
|
|
|
|
#include <iprt/mem.h>
|
2014-09-23 11:01:47 +00:00
|
|
|
#include <iprt/assert.h>
|
2013-08-21 09:37:21 +00:00
|
|
|
|
2014-09-23 11:01:47 +00:00
|
|
|
static const bool verbose = false;
|
2013-08-21 09:37:21 +00:00
|
|
|
|
2017-02-08 13:07:53 +00:00
|
|
|
/*
|
|
|
|
* We need an initial buffer currently, since the libc issues during
|
|
|
|
* initialization malloc (dup) calls to the one defined below. At this
|
|
|
|
* point we have not any env pointer.
|
|
|
|
* Additionally static constructors are executed currently before the libc
|
|
|
|
* is done with initialization and so we also have no Env pointer here.
|
|
|
|
*/
|
2017-04-20 18:42:39 +00:00
|
|
|
static char buffer[3 * 1024];
|
2017-02-08 13:07:53 +00:00
|
|
|
static unsigned buffer_len = 0;
|
|
|
|
|
|
|
|
static bool initial_memory(void * ptr)
|
|
|
|
{
|
|
|
|
return buffer <= ptr && ptr < buffer + sizeof(buffer);
|
|
|
|
}
|
|
|
|
|
2013-08-21 09:37:21 +00:00
|
|
|
/*
|
|
|
|
* We cannot use the libc's version of malloc because it does not satisfies
|
|
|
|
* the alignment constraints asserted by 'Runtime/r3/alloc.cpp'.
|
|
|
|
*/
|
2017-02-08 13:07:53 +00:00
|
|
|
static Libc::Mem_alloc_impl * memory()
|
|
|
|
{
|
|
|
|
try { genode_env(); } catch (...) { return nullptr; }
|
|
|
|
|
|
|
|
static Libc::Mem_alloc_impl mem( genode_env().rm(), genode_env().ram());
|
|
|
|
return &mem;
|
|
|
|
}
|
2013-08-21 09:37:21 +00:00
|
|
|
|
2016-09-15 12:40:37 +00:00
|
|
|
extern "C" void *malloc(::size_t size)
|
2013-08-21 09:37:21 +00:00
|
|
|
{
|
2017-02-08 13:07:53 +00:00
|
|
|
if (memory())
|
|
|
|
return memory()->alloc(size, Genode::log2(RTMEM_ALIGNMENT));
|
|
|
|
|
|
|
|
void * ret = buffer + buffer_len;
|
|
|
|
buffer_len += (size + RTMEM_ALIGNMENT - 1) & ~(0ULL + RTMEM_ALIGNMENT - 1);
|
|
|
|
|
|
|
|
if (buffer_len <= sizeof(buffer))
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
struct Not_enough_initial_memory : Genode::Exception { };
|
|
|
|
throw Not_enough_initial_memory();
|
2013-08-21 09:37:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-09-15 12:40:37 +00:00
|
|
|
extern "C" void *calloc(::size_t nmemb, ::size_t size)
|
2013-08-21 09:37:21 +00:00
|
|
|
{
|
|
|
|
void *ret = malloc(nmemb*size);
|
2016-06-15 15:51:59 +00:00
|
|
|
if (ret)
|
|
|
|
Genode::memset(ret, 0, nmemb*size);
|
2013-08-21 09:37:21 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
extern "C" void free(void *ptr)
|
|
|
|
{
|
2017-02-08 13:07:53 +00:00
|
|
|
if (!initial_memory(ptr))
|
|
|
|
memory()->free(ptr);
|
2013-08-21 09:37:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-09-15 12:40:37 +00:00
|
|
|
extern "C" void *realloc(void *ptr, ::size_t size)
|
2013-08-21 09:37:21 +00:00
|
|
|
{
|
|
|
|
if (!ptr)
|
|
|
|
return malloc(size);
|
|
|
|
|
|
|
|
if (!size) {
|
|
|
|
free(ptr);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2017-02-08 13:07:53 +00:00
|
|
|
unsigned long old_size = size;
|
|
|
|
|
|
|
|
if (!initial_memory(ptr)) {
|
|
|
|
/* determine size of old block content (without header) */
|
|
|
|
old_size = memory()->size_at(ptr);
|
2013-08-21 09:37:21 +00:00
|
|
|
|
2017-02-08 13:07:53 +00:00
|
|
|
/* do not reallocate if new size is less than the current size */
|
|
|
|
if (size <= old_size)
|
|
|
|
return ptr;
|
|
|
|
}
|
2013-08-21 09:37:21 +00:00
|
|
|
|
|
|
|
/* allocate new block */
|
|
|
|
void *new_addr = malloc(size);
|
|
|
|
|
|
|
|
/* copy content from old block into new block */
|
|
|
|
if (new_addr)
|
|
|
|
Genode::memcpy(new_addr, ptr, Genode::min(old_size, (unsigned long)size));
|
|
|
|
|
|
|
|
/* free old block */
|
|
|
|
free(ptr);
|
|
|
|
|
|
|
|
return new_addr;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
extern "C" char *getenv(const char *name)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Logging to the pseudo file '/log' is done via the libc plugin provided
|
|
|
|
* by 'logging.cc'.
|
|
|
|
*/
|
|
|
|
if (Genode::strcmp(name, "VBOX_LOG_DEST") == 0 ||
|
|
|
|
Genode::strcmp(name, "VBOX_RELEASE_LOG_DEST") == 0)
|
|
|
|
return (char *)"file=log";
|
|
|
|
|
|
|
|
if (Genode::strcmp(name, "VBOX_LOG") == 0 ||
|
|
|
|
Genode::strcmp(name, "VBOX_RELEASE_LOG") == 0)
|
2015-06-12 17:10:33 +00:00
|
|
|
return (char *)"+rem_disas.e.l.f"
|
2013-08-21 09:37:21 +00:00
|
|
|
"+rem_printf.e.l.f"
|
|
|
|
// "+rem_run.e.l.f"
|
|
|
|
// "+pgm.e.l.f"
|
2016-10-05 14:51:35 +00:00
|
|
|
// "+pdm"
|
2015-01-14 16:31:34 +00:00
|
|
|
// "+cpum.e.l.f"
|
2014-07-02 15:35:56 +00:00
|
|
|
// "+dev_pcnet.e.l.f"
|
2013-08-21 09:37:21 +00:00
|
|
|
// "+dev_pic.e.l.f"
|
|
|
|
// "+dev_apic.e.l.f"
|
2016-10-05 14:51:35 +00:00
|
|
|
// "+dev_vmm.e"
|
2015-03-06 15:46:47 +00:00
|
|
|
// "+usb_mouse.e.l.f"
|
2014-05-23 07:26:57 +00:00
|
|
|
// "+main.e.l.f"
|
|
|
|
// "+hgcm.e.l.f"
|
2014-09-23 11:01:47 +00:00
|
|
|
// "+shared_folders.e.l.f"
|
2014-11-28 16:14:54 +00:00
|
|
|
// "+drv_host_serial.e.l.f"
|
2015-06-03 12:39:01 +00:00
|
|
|
// "+dev_audio.e.l.f"
|
2013-08-21 09:37:21 +00:00
|
|
|
;
|
|
|
|
|
|
|
|
if (Genode::strcmp(name, "VBOX_LOG_FLAGS") == 0 ||
|
|
|
|
Genode::strcmp(name, "VBOX_RELEASE_LOG_FLAGS") == 0)
|
|
|
|
return (char *)"thread";
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
extern "C" int sigaction(int signum, const struct sigaction *act,
|
|
|
|
struct sigaction *oldact)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Break infinite loop at 'VBox/Runtime/r3/init.cpp' :451
|
2015-02-12 10:26:18 +00:00
|
|
|
*/
|
2013-08-21 09:37:21 +00:00
|
|
|
if (oldact)
|
|
|
|
oldact->sa_flags = SA_SIGINFO;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
2014-05-23 07:26:57 +00:00
|
|
|
|
|
|
|
|
2014-09-23 11:01:47 +00:00
|
|
|
/* our libc provides a _nanosleep function */
|
|
|
|
extern "C" int _nanosleep(const struct timespec *req, struct timespec *rem);
|
|
|
|
extern "C" int nanosleep(const struct timespec *req, struct timespec *rem)
|
|
|
|
{
|
|
|
|
Assert(req);
|
2016-06-15 15:51:59 +00:00
|
|
|
|
2014-09-23 11:01:47 +00:00
|
|
|
return _nanosleep(req, rem);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Some dummy implementation for LibC functions */
|
|
|
|
|
|
|
|
extern "C" pid_t getpid(void)
|
|
|
|
{
|
|
|
|
if (verbose)
|
base: avoid use of deprecated base/printf.h
Besides adapting the components to the use of base/log.h, the patch
cleans up a few base headers, i.e., it removes unused includes from
root/component.h, specifically base/heap.h and
ram_session/ram_session.h. Hence, components that relied on the implicit
inclusion of those headers have to manually include those headers now.
While adjusting the log messages, I repeatedly stumbled over the problem
that printing char * arguments is ambiguous. It is unclear whether to
print the argument as pointer or null-terminated string. To overcome
this problem, the patch introduces a new type 'Cstring' that allows the
caller to express that the argument should be handled as null-terminated
string. As a nice side effect, with this type in place, the optional len
argument of the 'String' class could be removed. Instead of supplying a
pair of (char const *, size_t), the constructor accepts a 'Cstring'.
This, in turn, clears the way let the 'String' constructor use the new
output mechanism to assemble a string from multiple arguments (and
thereby getting rid of snprintf within Genode in the near future).
To enforce the explicit resolution of the char * ambiguity, the 'char *'
overload of the 'print' function is marked as deleted.
Issue #1987
2016-07-13 17:07:09 +00:00
|
|
|
Genode::log(__func__, " called - rip ", __builtin_return_address(0));
|
2014-09-23 11:01:47 +00:00
|
|
|
|
|
|
|
return 1345;
|
|
|
|
}
|
|
|
|
|
|
|
|
extern "C" int sigprocmask(int how, const sigset_t *set, sigset_t *oldset)
|
|
|
|
{
|
|
|
|
if (verbose)
|
base: avoid use of deprecated base/printf.h
Besides adapting the components to the use of base/log.h, the patch
cleans up a few base headers, i.e., it removes unused includes from
root/component.h, specifically base/heap.h and
ram_session/ram_session.h. Hence, components that relied on the implicit
inclusion of those headers have to manually include those headers now.
While adjusting the log messages, I repeatedly stumbled over the problem
that printing char * arguments is ambiguous. It is unclear whether to
print the argument as pointer or null-terminated string. To overcome
this problem, the patch introduces a new type 'Cstring' that allows the
caller to express that the argument should be handled as null-terminated
string. As a nice side effect, with this type in place, the optional len
argument of the 'String' class could be removed. Instead of supplying a
pair of (char const *, size_t), the constructor accepts a 'Cstring'.
This, in turn, clears the way let the 'String' constructor use the new
output mechanism to assemble a string from multiple arguments (and
thereby getting rid of snprintf within Genode in the near future).
To enforce the explicit resolution of the char * ambiguity, the 'char *'
overload of the 'print' function is marked as deleted.
Issue #1987
2016-07-13 17:07:09 +00:00
|
|
|
Genode::log(__func__, " called - rip ", __builtin_return_address(0));
|
2014-09-23 11:01:47 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
extern "C" int _sigaction(int, const struct sigaction *, struct sigaction *)
|
|
|
|
{
|
|
|
|
if (verbose)
|
base: avoid use of deprecated base/printf.h
Besides adapting the components to the use of base/log.h, the patch
cleans up a few base headers, i.e., it removes unused includes from
root/component.h, specifically base/heap.h and
ram_session/ram_session.h. Hence, components that relied on the implicit
inclusion of those headers have to manually include those headers now.
While adjusting the log messages, I repeatedly stumbled over the problem
that printing char * arguments is ambiguous. It is unclear whether to
print the argument as pointer or null-terminated string. To overcome
this problem, the patch introduces a new type 'Cstring' that allows the
caller to express that the argument should be handled as null-terminated
string. As a nice side effect, with this type in place, the optional len
argument of the 'String' class could be removed. Instead of supplying a
pair of (char const *, size_t), the constructor accepts a 'Cstring'.
This, in turn, clears the way let the 'String' constructor use the new
output mechanism to assemble a string from multiple arguments (and
thereby getting rid of snprintf within Genode in the near future).
To enforce the explicit resolution of the char * ambiguity, the 'char *'
overload of the 'print' function is marked as deleted.
Issue #1987
2016-07-13 17:07:09 +00:00
|
|
|
Genode::log(__func__, " called - rip ", __builtin_return_address(0));
|
2014-09-23 11:01:47 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
extern "C" int futimes(int fd, const struct timeval tv[2])
|
|
|
|
{
|
base: avoid use of deprecated base/printf.h
Besides adapting the components to the use of base/log.h, the patch
cleans up a few base headers, i.e., it removes unused includes from
root/component.h, specifically base/heap.h and
ram_session/ram_session.h. Hence, components that relied on the implicit
inclusion of those headers have to manually include those headers now.
While adjusting the log messages, I repeatedly stumbled over the problem
that printing char * arguments is ambiguous. It is unclear whether to
print the argument as pointer or null-terminated string. To overcome
this problem, the patch introduces a new type 'Cstring' that allows the
caller to express that the argument should be handled as null-terminated
string. As a nice side effect, with this type in place, the optional len
argument of the 'String' class could be removed. Instead of supplying a
pair of (char const *, size_t), the constructor accepts a 'Cstring'.
This, in turn, clears the way let the 'String' constructor use the new
output mechanism to assemble a string from multiple arguments (and
thereby getting rid of snprintf within Genode in the near future).
To enforce the explicit resolution of the char * ambiguity, the 'char *'
overload of the 'print' function is marked as deleted.
Issue #1987
2016-07-13 17:07:09 +00:00
|
|
|
Genode::log("%s called - rip %p", __func__, __builtin_return_address(0));
|
2014-09-23 11:01:47 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
extern "C" int lutimes(const char *filename, const struct timeval tv[2])
|
|
|
|
{
|
base: avoid use of deprecated base/printf.h
Besides adapting the components to the use of base/log.h, the patch
cleans up a few base headers, i.e., it removes unused includes from
root/component.h, specifically base/heap.h and
ram_session/ram_session.h. Hence, components that relied on the implicit
inclusion of those headers have to manually include those headers now.
While adjusting the log messages, I repeatedly stumbled over the problem
that printing char * arguments is ambiguous. It is unclear whether to
print the argument as pointer or null-terminated string. To overcome
this problem, the patch introduces a new type 'Cstring' that allows the
caller to express that the argument should be handled as null-terminated
string. As a nice side effect, with this type in place, the optional len
argument of the 'String' class could be removed. Instead of supplying a
pair of (char const *, size_t), the constructor accepts a 'Cstring'.
This, in turn, clears the way let the 'String' constructor use the new
output mechanism to assemble a string from multiple arguments (and
thereby getting rid of snprintf within Genode in the near future).
To enforce the explicit resolution of the char * ambiguity, the 'char *'
overload of the 'print' function is marked as deleted.
Issue #1987
2016-07-13 17:07:09 +00:00
|
|
|
Genode::log(__func__, ": called - file '", filename, "' - rip ",
|
|
|
|
__builtin_return_address(0));
|
2014-09-23 11:01:47 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
extern "C" int _sigprocmask()
|
|
|
|
{
|
|
|
|
if (verbose)
|
base: avoid use of deprecated base/printf.h
Besides adapting the components to the use of base/log.h, the patch
cleans up a few base headers, i.e., it removes unused includes from
root/component.h, specifically base/heap.h and
ram_session/ram_session.h. Hence, components that relied on the implicit
inclusion of those headers have to manually include those headers now.
While adjusting the log messages, I repeatedly stumbled over the problem
that printing char * arguments is ambiguous. It is unclear whether to
print the argument as pointer or null-terminated string. To overcome
this problem, the patch introduces a new type 'Cstring' that allows the
caller to express that the argument should be handled as null-terminated
string. As a nice side effect, with this type in place, the optional len
argument of the 'String' class could be removed. Instead of supplying a
pair of (char const *, size_t), the constructor accepts a 'Cstring'.
This, in turn, clears the way let the 'String' constructor use the new
output mechanism to assemble a string from multiple arguments (and
thereby getting rid of snprintf within Genode in the near future).
To enforce the explicit resolution of the char * ambiguity, the 'char *'
overload of the 'print' function is marked as deleted.
Issue #1987
2016-07-13 17:07:09 +00:00
|
|
|
Genode::log("%s called - rip %p", __func__, __builtin_return_address(0));
|
2014-09-23 11:01:47 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-05-23 07:26:57 +00:00
|
|
|
|
|
|
|
/**
|
2014-09-23 11:01:47 +00:00
|
|
|
* Used by Shared Folders Guest additions
|
2014-05-23 07:26:57 +00:00
|
|
|
*/
|
2014-09-23 11:01:47 +00:00
|
|
|
extern "C" int statfs(const char *path, struct statfs *buf)
|
|
|
|
{
|
2016-06-15 15:51:59 +00:00
|
|
|
if (!buf)
|
|
|
|
return Libc::Errno(EFAULT);
|
|
|
|
|
2014-09-23 11:01:47 +00:00
|
|
|
int fd = open(path, 0);
|
|
|
|
|
|
|
|
if (fd < 0)
|
|
|
|
return fd;
|
|
|
|
|
2016-06-15 15:51:59 +00:00
|
|
|
struct statvfs result;
|
|
|
|
int res = fstatvfs(fd, &result);
|
2014-09-23 11:01:47 +00:00
|
|
|
|
|
|
|
close(fd);
|
|
|
|
|
2016-06-15 15:51:59 +00:00
|
|
|
if (res)
|
|
|
|
return res;
|
|
|
|
|
|
|
|
Genode::memset(buf, 0, sizeof(*buf));
|
|
|
|
|
|
|
|
buf->f_bavail = result.f_bavail;
|
|
|
|
buf->f_bfree = result.f_bfree;
|
|
|
|
buf->f_blocks = result.f_blocks;
|
|
|
|
buf->f_ffree = result.f_ffree;
|
|
|
|
buf->f_files = result.f_files;
|
|
|
|
buf->f_bsize = result.f_bsize;
|
|
|
|
|
|
|
|
bool show_warning = !buf->f_bsize || !buf->f_blocks || !buf->f_bavail;
|
|
|
|
|
|
|
|
if (!buf->f_bsize)
|
|
|
|
buf->f_bsize = 4096;
|
|
|
|
if (!buf->f_blocks)
|
|
|
|
buf->f_blocks = 128 * 1024;
|
|
|
|
if (!buf->f_bavail)
|
|
|
|
buf->f_bavail = buf->f_blocks;
|
|
|
|
|
|
|
|
if (show_warning)
|
base: avoid use of deprecated base/printf.h
Besides adapting the components to the use of base/log.h, the patch
cleans up a few base headers, i.e., it removes unused includes from
root/component.h, specifically base/heap.h and
ram_session/ram_session.h. Hence, components that relied on the implicit
inclusion of those headers have to manually include those headers now.
While adjusting the log messages, I repeatedly stumbled over the problem
that printing char * arguments is ambiguous. It is unclear whether to
print the argument as pointer or null-terminated string. To overcome
this problem, the patch introduces a new type 'Cstring' that allows the
caller to express that the argument should be handled as null-terminated
string. As a nice side effect, with this type in place, the optional len
argument of the 'String' class could be removed. Instead of supplying a
pair of (char const *, size_t), the constructor accepts a 'Cstring'.
This, in turn, clears the way let the 'String' constructor use the new
output mechanism to assemble a string from multiple arguments (and
thereby getting rid of snprintf within Genode in the near future).
To enforce the explicit resolution of the char * ambiguity, the 'char *'
overload of the 'print' function is marked as deleted.
Issue #1987
2016-07-13 17:07:09 +00:00
|
|
|
Genode::warning("statfs provides bogus values for '", path, "' (probably a shared folder)");
|
2016-06-15 15:51:59 +00:00
|
|
|
|
2014-09-23 11:01:47 +00:00
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2014-05-23 07:26:57 +00:00
|
|
|
extern "C" long pathconf(char const *path, int name)
|
|
|
|
{
|
2014-09-23 11:01:47 +00:00
|
|
|
if (name == _PC_NAME_MAX) return 255;
|
2014-05-23 07:26:57 +00:00
|
|
|
|
base: avoid use of deprecated base/printf.h
Besides adapting the components to the use of base/log.h, the patch
cleans up a few base headers, i.e., it removes unused includes from
root/component.h, specifically base/heap.h and
ram_session/ram_session.h. Hence, components that relied on the implicit
inclusion of those headers have to manually include those headers now.
While adjusting the log messages, I repeatedly stumbled over the problem
that printing char * arguments is ambiguous. It is unclear whether to
print the argument as pointer or null-terminated string. To overcome
this problem, the patch introduces a new type 'Cstring' that allows the
caller to express that the argument should be handled as null-terminated
string. As a nice side effect, with this type in place, the optional len
argument of the 'String' class could be removed. Instead of supplying a
pair of (char const *, size_t), the constructor accepts a 'Cstring'.
This, in turn, clears the way let the 'String' constructor use the new
output mechanism to assemble a string from multiple arguments (and
thereby getting rid of snprintf within Genode in the near future).
To enforce the explicit resolution of the char * ambiguity, the 'char *'
overload of the 'print' function is marked as deleted.
Issue #1987
2016-07-13 17:07:09 +00:00
|
|
|
Genode::error("pathconf does not support config option ", name);
|
2014-05-23 07:26:57 +00:00
|
|
|
errno = EINVAL;
|
|
|
|
return -1;
|
|
|
|
}
|