l4/sys/syscalls.h: No such file or directory

Adam Lackorzynski adam at os.inf.tu-dresden.de
Tue Sep 2 00:27:35 CEST 2014


On Mon Sep 01, 2014 at 18:31:40 +0200, Valentin Hauner wrote:
> On 09/01/2014 12:02 AM, Adam Lackorzynski wrote:
> I'm currently struggling with creating a new task. I guess, according to
> the initial post of this mailing list thread, using the following
> interface is deprecated?
> https://os.inf.tu-dresden.de/L4/l4libman/l4_task_new.html

It belongs to a previous and now incompatible version of L4. It won't
work anymore.

> So I've found l4_factory_create_task in factory.h. Unfortunately, there
> seems to be no example in ./l4/pkg how to use it.

Most use the C++ interface, so looking for 'create_task' is better.

> My first try is the following:
> 
> >l4_cap_idx_t task_cap = l4re_util_cap_alloc();
> >l4_fpage_t task_fpage = l4_fpage(l4re_env()->first_free_utcb, 1024,
> L4_CAP_FPAGE_RW);
> >l4_factory_create_task(l4re_env()->factory, task_cap, task_fpage);
> >// Create thread, start thread control sequence ...
> >l4_thread_control_bind((l4_utcb_t *)l4re_env()->first_free_utcb, task_cap);
> >// Commit & shift first_free_utcb ...
> 
> But when executing the example, the states of all threads created are
> set to 'dead'. I'm not sure about using first_free_utcb as start address
> for the flex-page as it is used as a offset for threads' UTCBs normally.

When creating a new task you're free to put the UTCB area anywhere in
the task's address space. Also, the size argument of l4_fpage is the
size in log2, so maybe 12 is a good number (the minimum because it's a
page). Of course you can use the same address range for the new task, so
using l4re_env()->first_free_utcb is ok (lower bits are truncated by
l4_fpage, so just using it is ok).

> Can you give a small working example for creating new tasks?
> Basically, I want to create a new task for each thread demanded by my
> end users. So the number of tasks and threads to create is variable.

examples/sys/vcpu/vcpu.cc creates a task, however does not directly put
a thread in there, you have to adapt that part a bit.
Why not use ned for creating tasks?



Adam
-- 
Adam                 adam at os.inf.tu-dresden.de
  Lackorzynski         http://os.inf.tu-dresden.de/~adam/



More information about the l4-hackers mailing list