All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
To: matthieu.connaulte_xenomai@domain.hid
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai-help] Problem with tcb.handle and taskDesc.td_tid
Date: Tue, 26 Aug 2008 16:37:27 +0200	[thread overview]
Message-ID: <48B41527.70507@domain.hid> (raw)
In-Reply-To: <dcca602eeac0de54e5e7095d60c77710@domain.hid>

Matthieu wrote:
> 
> On Tue, 26 Aug 2008 14:55:19 +0200, Gilles Chanteperdrix
> <gilles.chanteperdrix@xenomai.org> wrote:
>> Gilles Chanteperdrix wrote:
>>> Matthieu wrote:
>>>> Hi
>>>>
>>>> I would like to understand the coherence between the task identifier of
>> the
>>>> task control block and the task id given by taskDesk (function
>>>> taskInfoGet()). In fact, I init a task with taskInit, I get the tid
>> using
>>>> tid=tcb.handle. The use of taskInfoGet(tid, taskDesc) gives me a
>>>> taskDesk.td_tid different from the tid.
>>>>
>>>> I want to test if the task is suspended using taskIsSuspended(tid) or
>>>> taskIsSuspended(taskDesc.td_tid), but both get me  a 3d0001 errno (code
>>>> error of WIND_OBJ_ERR_BASE S_objLib_OBJ_ID_ERROR). The PID given by
>>>> /proc/xenomai/stat also has no connection. Idem with a ps -AfL
>>>>
>>>> Thank you in advance for your explanations
>>> You are not supposed to use the internal fields of the structures. A
>>> valid id is one returned by the taskIdSelf(), taskNameToId(),
>>> taskIdDefault(). I can not find a service which returns the task Id for
>>> a given TCB. Is it what you are looking for ?
>> By the way, if you could call taskInfoGet, you already have a valid task
>> id...
>>
> 
> But using taskNameToId, taskSuspend(tid) makes the same error and so is
> taskInfoGet().

Ok. So, we have a bug and these functions do not work as expected.

In the sources, I saw that taskInfoGet seems to be a
> reentrant routine (see ksrc/skins/vxworks/syscall.c where a taskInfoGet is
> call in the taskInfoGet routine) 

If by reentrant you mean recursive, no, not at all, taskInfoGet is not
recursive. You see, the interface between user-space and kernel-space is
not a simple function call, it is a system call, that is the way the
whole Linux kernel works. The difference between Linux and Xenomai is
that Xenomai APIs are symetric between kernel-space and user-space. So,
the function implementing a kernel-space service is used to implement
the system call used by the user-space service of the same name.

What you see in ksrc/skins/vxworks/syscall.c is that the function
__wind_task_info_get, which is the handler of the vxworks skin
__vxworks_taskinfo_get system call, calls the kernel-space taskInfoGet
function, so there is no recursion.
in src/skins/vxworks/taskInfo.c, you will see that the taskInfoGet
function emits the _vxworks_taskinfo_get system call.

-- 
                                                 Gilles.


  reply	other threads:[~2008-08-26 14:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-26  9:45 [Xenomai-help] Problem with tcb.handle and taskDesc.td_tid Matthieu
2008-08-26 12:44 ` Gilles Chanteperdrix
2008-08-26 12:55   ` Gilles Chanteperdrix
2008-08-26 14:15     ` [Xenomai-help] " Matthieu
2008-08-26 14:37       ` Gilles Chanteperdrix [this message]
2008-08-27  7:07         ` [Xenomai-help] " Matthieu
     [not found]         ` <6001ba171dd65d7fb2e8846949e76d94@domain.hid>
2008-08-27  7:09           ` [Xenomai-help] " Gilles Chanteperdrix
2008-08-27  8:09         ` Philippe Gerum
2008-08-28  7:00           ` [Xenomai-help] " Matthieu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=48B41527.70507@domain.hid \
    --to=gilles.chanteperdrix@xenomai.org \
    --cc=matthieu.connaulte_xenomai@domain.hid \
    --cc=xenomai@xenomai.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.