mirror of
https://github.com/genodelabs/genode.git
synced 2025-04-19 08:36:49 +00:00
base: add base/error.h for common error types
This commit is contained in:
parent
9febe62a78
commit
7e0d2084fb
36
repos/base/include/base/error.h
Normal file
36
repos/base/include/base/error.h
Normal file
@ -0,0 +1,36 @@
|
||||
/*
|
||||
* \brief Error types
|
||||
* \author Norman Feske
|
||||
* \date 2025-03-05
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2025 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU Affero General Public License version 3.
|
||||
*/
|
||||
|
||||
#ifndef _INCLUDE__BASE__ERROR_H_
|
||||
#define _INCLUDE__BASE__ERROR_H_
|
||||
|
||||
namespace Genode {
|
||||
|
||||
/**
|
||||
* Common error returned by constrained allocators
|
||||
*
|
||||
* OUT_OF_RAM and OUT_OF_CAPS can in principle be resolved by upgrading
|
||||
* the resource budget of the allocator.
|
||||
*
|
||||
* DENIED expresses a situation where the allocator cannot satisfy the
|
||||
* allocation for unresolvable reasons. For example, the allocator may
|
||||
* have a hard limit of the number of allocations, or the allocation of
|
||||
* a large contiguous range is prevented by internal fragmentation, or
|
||||
* a requested alignment constraint cannot be met. In these cases, the
|
||||
* allocator reflects the condition to the caller to stay healthy and let
|
||||
* the caller fail gracefully or consciously panic at the caller side.
|
||||
*/
|
||||
enum class Alloc_error { OUT_OF_RAM, OUT_OF_CAPS, DENIED };
|
||||
}
|
||||
|
||||
#endif /* _INCLUDE__BASE__ERROR_H_ */
|
@ -15,6 +15,7 @@
|
||||
#define _INCLUDE__BASE__RAM_H_
|
||||
|
||||
#include <util/allocation.h>
|
||||
#include <base/error.h>
|
||||
#include <base/capability.h>
|
||||
#include <base/quota_guard.h>
|
||||
#include <base/cache.h>
|
||||
@ -25,8 +26,7 @@ namespace Genode::Ram {
|
||||
struct Dataspace : Genode::Dataspace { };
|
||||
|
||||
using Capability = Genode::Capability<Dataspace>;
|
||||
|
||||
enum class Error { OUT_OF_RAM, OUT_OF_CAPS, DENIED };
|
||||
using Error = Alloc_error;
|
||||
|
||||
struct Unmapped_allocator;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user