L4Re - L4 Runtime Environment
L4::Factory Class Reference

C++ Factory interface to create kernel objects. More...

+ Inheritance diagram for L4::Factory:
+ Collaboration diagram for L4::Factory:

Data Structures

struct  Lstr
 Special type to add a pascal string into the factory create stream. More...
 
struct  Nil
 Special type to add a void argument into the factory create stream. More...
 
class  S
 Stream class for the create() argument stream. More...
 

Public Member Functions

S create (Cap< void > target, long obj, l4_utcb_t *utcb=l4_utcb()) throw ()
 Generic create call to the factory. More...
 
template<typename OBJ >
S create (Cap< OBJ > target, l4_utcb_t *utcb=l4_utcb()) throw ()
 Create call for typed capabilities. More...
 
l4_msgtag_t create_task (Cap< Task > const &target_cap, l4_fpage_t const &utcb_area, l4_utcb_t *utcb=l4_utcb()) throw ()
 Create a new task. More...
 
l4_msgtag_t create_thread (Cap< Thread > const &target_cap, l4_utcb_t *utcb=l4_utcb()) throw ()
 Create a new thread. More...
 
l4_msgtag_t create_factory (Cap< Factory > const &target_cap, unsigned long limit, l4_utcb_t *utcb=l4_utcb()) throw ()
 Create a new factory. More...
 
l4_msgtag_t create_gate (Cap< void > const &target_cap, Cap< Thread > const &thread_cap, l4_umword_t label, l4_utcb_t *utcb=l4_utcb()) throw ()
 Create a new IPC gate. More...
 
l4_msgtag_t create_irq (Cap< Irq >const &target_cap, l4_utcb_t *utcb=l4_utcb()) throw ()
 Create a new IRQ. More...
 
l4_msgtag_t create_vm (Cap< Vm >const &target_cap, l4_utcb_t *utcb=l4_utcb()) throw ()
 Create a new virtual machine. More...
 
- Public Member Functions inherited from L4::Kobject
l4_msgtag_t dec_refcnt (l4_mword_t diff, l4_utcb_t *utcb=l4_utcb())
 Decrement the in kernel reference counter for the object. More...
 

Additional Inherited Members

- Protected Types inherited from L4::Kobject_t< Factory, Kobject, L4_PROTO_FACTORY >
typedef Factory Class
 The target interface type (inheriting from Kobject_t)
 
typedef Typeid::Iface< PROTO, Factory__Iface
 The interface description for the derived class.
 
typedef Typeid::Merge_list< Typeid::Iface_list< __Iface >, typename Kobject ::__Iface_list > __Iface_list
 The list of all RPC interfaces provided directly or through inheritance.
 
- Protected Member Functions inherited from L4::Kobject_t< Factory, Kobject, L4_PROTO_FACTORY >
L4::Cap< Classc () const
 Get the capability to ourselves.
 
- Protected Member Functions inherited from L4::Kobject
l4_cap_idx_t cap () const throw ()
 Return capability selector. More...
 
- Static Protected Member Functions inherited from L4::Kobject_t< Factory, Kobject, L4_PROTO_FACTORY >
static void __check_protocols__ ()
 Helper to check for protocol conflicts.
 

Detailed Description

C++ Factory interface to create kernel objects.

A factory is used to create all kinds of kernel objects:

The factory is equipped with a limit that limits the amount of kernel memory available to that factory.

Note
The limit does not give any guarantee for the amount of available kernel memory.
Include File
#include <l4/sys/factory>

For the C interface refer to Factory.

Definition at line 55 of file factory.

Member Function Documentation

◆ create() [1/2]

S L4::Factory::create ( Cap< void >  target,
long  obj,
l4_utcb_t utcb = l4_utcb() 
)
throw (
)
inline

Generic create call to the factory.

Parameters
[out]targetCapability selector for the new object. The caller must allocate the capability slot. The kernel stores the new objects's capability into this slot.
objThe protocol ID that specifies which kind of object shall be created.
utcbThe UTCB to use for the operation.
Returns
A create stream that allows adding additional arguments to the create() call.

This method does currently not directly invoke the factory. It returns a stream that shall invoke the factory after adding all additional arguments.

Usage:

L4::Cap<L4Re::Namespace> ns = L4Re::Util::cap_alloc.alloc<L4Re::Namespace>();
factory->create(ns, L4Re::Namespace::Protocol) << "Argument text";

Definition at line 253 of file factory.

Referenced by L4Re::Mem_alloc::alloc().

+ Here is the caller graph for this function:

◆ create() [2/2]

template<typename OBJ >
S L4::Factory::create ( Cap< OBJ >  target,
l4_utcb_t utcb = l4_utcb() 
)
throw (
)
inline

Create call for typed capabilities.

Template Parameters
OBJCapability type of the object to be created.
Parameters
[out]targetCapability of type OBJ.
utcbUTCB to use.
Returns
Argument stream to call the factory.
See also
create

Definition at line 270 of file factory.

◆ create_factory()

l4_msgtag_t L4::Factory::create_factory ( Cap< Factory > const &  target_cap,
unsigned long  limit,
l4_utcb_t utcb = l4_utcb() 
)
throw (
)
inline

Create a new factory.

Parameters
[out]target_capThe kernel stores the new factory's capability into this slot.
limitLimit for the new factory in bytes.
utcbThe UTCB to use for the operation.
Returns
Syscall return tag
Note
The limit of the new factory is subtracted from the available amount of the factory used for creation.

Definition at line 336 of file factory.

◆ create_gate()

l4_msgtag_t L4::Factory::create_gate ( Cap< void > const &  target_cap,
Cap< Thread > const &  thread_cap,
l4_umword_t  label,
l4_utcb_t utcb = l4_utcb() 
)
throw (
)
inline

Create a new IPC gate.

Parameters
[out]target_capThe kernel stores the new IPC gate's capability into this slot.
thread_capOptional capability selector of the thread to bind the gate to. Use L4_INVALID_CAP to create an unbound IPC gate.
labelOptional label of the gate (is used if thread_cap is valid).
utcbThe UTCB to use for the operation.
Returns
Syscall return tag containing one of the following return codes.
Return values
L4_EOKNo error occurred.
-L4_ENOMEMOut-of-memory during allocation of the Ipc_gate object.
-L4_ENOENTthread_cap is void or points to something that is not a thread.
-L4_EPERMNo write rights on thread_cap.

An unbound IPC gate can be bound to a thread using L4::Ipc_gate::bind_thread().

See also
L4::Ipc_gate

Definition at line 366 of file factory.

◆ create_irq()

l4_msgtag_t L4::Factory::create_irq ( Cap< Irq >const &  target_cap,
l4_utcb_t utcb = l4_utcb() 
)
throw (
)
inline

Create a new IRQ.

Parameters
[out]target_capThe kernel stores the new IRQ's capability into this slot.
utcbThe UTCB to use for the operation.
Returns
Syscall return tag
Deprecated:
Use create() with Cap<Irq> as argument instead.
See also
L4::Irq

Definition at line 384 of file factory.

◆ create_task()

l4_msgtag_t L4::Factory::create_task ( Cap< Task > const &  target_cap,
l4_fpage_t const &  utcb_area,
l4_utcb_t utcb = l4_utcb() 
)
throw (
)
inline

Create a new task.

Parameters
[out]target_capThe kernel stores the new task's capability into this slot.
utcb_areaFlexpage that describes an area in the address space of the new task, where the kernel should map the kernel-allocated kernel-user memory to. The kernel uses the kernel-user memory to store UTCBs and vCPU state-save-areas of the new task.
utcbThe UTCB to use for the operation.
Returns
Syscall return tag
Note
The size of the UTCB area specifies indirectly the number of UTCBs available for this task. Refer to L4::Task::add_ku_mem / l4_task_add_ku_mem() for adding more of this type of memory.
See also
L4::Task

Definition at line 300 of file factory.

◆ create_thread()

l4_msgtag_t L4::Factory::create_thread ( Cap< Thread > const &  target_cap,
l4_utcb_t utcb = l4_utcb() 
)
throw (
)
inline

Create a new thread.

Parameters
[out]target_capThe kernel stores the new thread's capability into this slot.
utcbThe UTCB to use for the operation.
Returns
Syscall return tag
Deprecated:
Use create() with Cap<Thread> as argument instead.
See also
L4::Thread

Definition at line 318 of file factory.

◆ create_vm()

l4_msgtag_t L4::Factory::create_vm ( Cap< Vm >const &  target_cap,
l4_utcb_t utcb = l4_utcb() 
)
throw (
)
inline

Create a new virtual machine.

Parameters
[out]target_capThe kernel stores the new VM's capability into this slot.
utcbThe UTCB to use for the operation.
Returns
Syscall return tag
Deprecated:
Use create() with Cap<Vm> as argument instead.
See also
L4::Vm

Definition at line 402 of file factory.


The documentation for this class was generated from the following file: