* rt_task_inquire() equivalent for POSIX ?
@ 2019-11-06 21:04 Pierre FICHEUX
2019-11-07 0:20 ` Lowell Gilbert
2019-11-07 8:04 ` Steve Freyder
0 siblings, 2 replies; 7+ messages in thread
From: Pierre FICHEUX @ 2019-11-06 21:04 UTC (permalink / raw)
To: xenomai
Hi,
Is there a way to get the Xenomai thread "pid" with POSIX API ? I didn't
see anything in the "thread management" section.
thx
--
Pierre FICHEUX -/- CTO Smile ECS, France -\- pierre.ficheux@smile.fr
http://www.smile.fr
https://smile.eu/fr/offres/embarque-iot
I would love to change the world, but they won't give me the source code
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: rt_task_inquire() equivalent for POSIX ?
2019-11-06 21:04 rt_task_inquire() equivalent for POSIX ? Pierre FICHEUX
@ 2019-11-07 0:20 ` Lowell Gilbert
2019-11-07 5:47 ` Pierre FICHEUX
2019-11-07 8:04 ` Steve Freyder
1 sibling, 1 reply; 7+ messages in thread
From: Lowell Gilbert @ 2019-11-07 0:20 UTC (permalink / raw)
To: Pierre FICHEUX via Xenomai
Pierre FICHEUX via Xenomai <xenomai@xenomai.org> writes:
> Is there a way to get the Xenomai thread "pid" with POSIX API ? I didn't
> see anything in the "thread management" section.
getpid()?
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: rt_task_inquire() equivalent for POSIX ?
2019-11-07 0:20 ` Lowell Gilbert
@ 2019-11-07 5:47 ` Pierre FICHEUX
2019-11-07 7:56 ` Julien Blanc
0 siblings, 1 reply; 7+ messages in thread
From: Pierre FICHEUX @ 2019-11-07 5:47 UTC (permalink / raw)
To: Lowell Gilbert; +Cc: Pierre FICHEUX via Xenomai
I've tried it but got the pid of the "main" thread not the RT one (that's
normal...).
regards
Le jeu. 7 nov. 2019 à 01:20, Lowell Gilbert <kludge@be-well.ilk.org> a
écrit :
> Pierre FICHEUX via Xenomai <xenomai@xenomai.org> writes:
>
> > Is there a way to get the Xenomai thread "pid" with POSIX API ? I didn't
> > see anything in the "thread management" section.
>
> getpid()?
>
--
Pierre FICHEUX -/- CTO Smile ECS, France -\- pierre.ficheux@smile.fr
http://www.smile.fr
https://smile.eu/fr/offres/embarque-iot
I would love to change the world, but they won't give me the source code
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: rt_task_inquire() equivalent for POSIX ?
2019-11-07 5:47 ` Pierre FICHEUX
@ 2019-11-07 7:56 ` Julien Blanc
2019-11-07 8:44 ` Philippe Gerum
0 siblings, 1 reply; 7+ messages in thread
From: Julien Blanc @ 2019-11-07 7:56 UTC (permalink / raw)
To: Pierre FICHEUX; +Cc: Pierre FICHEUX via Xenomai
Le jeudi 07 novembre 2019 à 06:47 +0100, Pierre FICHEUX via Xenomai a
écrit :
> I've tried it but got the pid of the "main" thread not the RT one
> (that's
> normal...).
>
extern "C"
{
int cobalt_thread_pid(pthread_t);
}
int tid = cobalt_thread_pid(pthread_self())
but i’m not sure what you mean by the cobalt thread id vs posix thread
id. IIRC they have the same value (ie, syscal(__NR_gettid) would give
the same value (for rt threads), maybe at the expense of a mode
switch).
Regards,
Julien Blanc
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: rt_task_inquire() equivalent for POSIX ?
2019-11-06 21:04 rt_task_inquire() equivalent for POSIX ? Pierre FICHEUX
2019-11-07 0:20 ` Lowell Gilbert
@ 2019-11-07 8:04 ` Steve Freyder
1 sibling, 0 replies; 7+ messages in thread
From: Steve Freyder @ 2019-11-07 8:04 UTC (permalink / raw)
To: Pierre FICHEUX; +Cc: xenomai
On 11/6/2019 3:04 PM, Pierre FICHEUX via Xenomai wrote:
> Hi,
>
> Is there a way to get the Xenomai thread "pid" with POSIX API ? I didn't
> see anything in the "thread management" section.
>
> thx
>
Hi,
This file:
https://xenomai.org/documentation/xenomai-3/pdf/xeno3prm.pdf
makes several references to pthread_self() which implies that's the way
to do what you are looking for here.
However (to your point), it doesn't explicitly document (in section 6.60
Thread management) pthread_self() itself, whereas this file:
https://xenomai.org/documentation/xenomai-2.6/pdf/posix-api.pdf
in section 3.12.3 documents pthread_self() along with pthread_create()
and the other "POSIX thread management" functions.
Perhaps when the 3.0 documentation was written, there was a decision
made to not document any of the "standard POSIX thread management"
functions unless there was also an RT variant of the function (sitting
behind a wrapper) which had behaviour beyond what one could expect to
find in the standard (non RT) POSIX documentation. Perhaps there's a
statement to that effect somewhere in the Xenomai-3 documentation, and
if not, maybe there should be.
Regards,
Steve
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: rt_task_inquire() equivalent for POSIX ?
2019-11-07 7:56 ` Julien Blanc
@ 2019-11-07 8:44 ` Philippe Gerum
2019-11-07 9:03 ` Pierre FICHEUX
0 siblings, 1 reply; 7+ messages in thread
From: Philippe Gerum @ 2019-11-07 8:44 UTC (permalink / raw)
To: Julien Blanc, Pierre FICHEUX; +Cc: Pierre FICHEUX via Xenomai
On 2019-11-07 08:56, Julien Blanc via Xenomai wrote:
> Le jeudi 07 novembre 2019 à 06:47 +0100, Pierre FICHEUX via Xenomai a
> écrit :
>> I've tried it but got the pid of the "main" thread not the RT one
>> (that's
>> normal...).
>>
>
> extern "C"
> {
> int cobalt_thread_pid(pthread_t);
> }
>
> int tid = cobalt_thread_pid(pthread_self())
>
> but i’m not sure what you mean by the cobalt thread id vs posix thread
> id. IIRC they have the same value (ie, syscal(__NR_gettid) would give
> the same value (for rt threads), maybe at the expense of a mode
> switch).
This may be worth a read for context:
http://man7.org/linux/man-pages/man2/gettid.2.html
cobalt_thread_pid() translates POSIX thread identifiers to kernel thread identifiers some Linux-specific calls need (e.g. thread-directed signals).
--
Philippe.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: rt_task_inquire() equivalent for POSIX ?
2019-11-07 8:44 ` Philippe Gerum
@ 2019-11-07 9:03 ` Pierre FICHEUX
0 siblings, 0 replies; 7+ messages in thread
From: Pierre FICHEUX @ 2019-11-07 9:03 UTC (permalink / raw)
To: Philippe Gerum; +Cc: Julien Blanc, Pierre FICHEUX via Xenomai
Thx a lot, works fine with cobalt_thread_pid() !
regards
Le jeu. 7 nov. 2019 à 09:44, Philippe Gerum <rpm@xenomai.org> a écrit :
> On 2019-11-07 08:56, Julien Blanc via Xenomai wrote:
> > Le jeudi 07 novembre 2019 à 06:47 +0100, Pierre FICHEUX via Xenomai a
> > écrit :
> >> I've tried it but got the pid of the "main" thread not the RT one
> >> (that's
> >> normal...).
> >>
> >
> > extern "C"
> > {
> > int cobalt_thread_pid(pthread_t);
> > }
> >
> > int tid = cobalt_thread_pid(pthread_self())
> >
> > but i’m not sure what you mean by the cobalt thread id vs posix thread
> > id. IIRC they have the same value (ie, syscal(__NR_gettid) would give
> > the same value (for rt threads), maybe at the expense of a mode
> > switch).
>
> This may be worth a read for context:
> http://man7.org/linux/man-pages/man2/gettid.2.html
>
> cobalt_thread_pid() translates POSIX thread identifiers to kernel thread
> identifiers some Linux-specific calls need (e.g. thread-directed signals).
>
> --
> Philippe.
>
--
Pierre FICHEUX -/- CTO Smile ECS, France -\- pierre.ficheux@smile.fr
http://www.smile.fr
https://smile.eu/fr/offres/embarque-iot
I would love to change the world, but they won't give me the source code
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2019-11-07 9:03 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-06 21:04 rt_task_inquire() equivalent for POSIX ? Pierre FICHEUX
2019-11-07 0:20 ` Lowell Gilbert
2019-11-07 5:47 ` Pierre FICHEUX
2019-11-07 7:56 ` Julien Blanc
2019-11-07 8:44 ` Philippe Gerum
2019-11-07 9:03 ` Pierre FICHEUX
2019-11-07 8:04 ` Steve Freyder
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.