Re: AW: question about posix timer expiration

2021-05-26 Thread Chris Johns
On 21/5/21 9:44 pm, gabriel.moy...@dlr.de wrote:
> Did you compile ptpd with kqueue only? I’ve tried with posix timer, which are
> implemented in rtems, but it seems that the handler with siginfo_t is not 
> called
> correctly. I’ve managed to get it working using a workaround but I’ll continue
> with kqueue, thx!.

Yes I did build with kqueue. I added the kqueue support to ptpdv2 because libbsd
does not support signal type events. I found this out the hard why when getting
ptpdv2 to run. I had posix timers running but libbsd threads did not wake. I
chased this down to code like ...

https://git.rtems.org/rtems-libbsd/tree/rtemsbsd/rtems/rtems-kernel-muteximpl.c#n45

The state set does not include signals so the kernel does not wake the thread.

I discussed this with Sebastian at the time and agreed supporting signals in
libbsd was a lot of work and open a range of possible issues so it was simpler
to add kqueue support to ptpdv2.

I also agree with Sebastian that kqueue is a better interface than select etc
and we should encourage its use. I think ptpdv2 benefits from using kqueue over
select and posix timers.

Chris
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

AW: question about posix timer expiration

2021-05-21 Thread Gabriel.Moyano
Hi Chris,

Did you compile ptpd with kqueue only? I’ve tried with posix timer, which are 
implemented in rtems, but it seems that the handler with siginfo_t is not 
called correctly. I’ve managed to get it working using a workaround but I’ll 
continue with kqueue, thx!.

Regards,
Gabriel


Von: Chris Johns 
Gesendet: Mittwoch, 19. Mai 2021 10:30
An: Moyano Heredia, Victor Gabriel 
Cc: devel@rtems.org
Betreff: Re: question about posix timer expiration




On 18 May 2021, at 10:02 pm, 
gabriel.moy...@dlr.de wrote:

From further investigation I’ve found that when a timer expires, 
_POSIX_Timer_TSR() is called and this uses pthread_kill() to send a signal. 
Shouldn’t ptimer->inf.sigev_value be used here in order to create a siginfo_t 
object with the right value?

Did anyone have to deal with this while using posix timers?

Thanks!

Von: devel mailto:devel-boun...@rtems.org>> Im Auftrag 
von gabriel.moy...@dlr.de
Gesendet: Mittwoch, 12. Mai 2021 14:37
An: devel@rtems.org
Betreff: question about posix timer expiration

Hello everyone,

Currently I am trying to get running ptpd on rtems (following the Chris’ work, 
thx btw).

Ptpd uses posix timers and when a timer expires a handler with this signature 
void(int sig, siginfo_t *info, void *ucontext) is called.

Is this on libbsd? If it is I would have expected kqueue being used so I am not 
sure where this is happening.

Chris


 Unfortunately (*info) doesn’t have the right values, eg. info->si_code should 
be SI_TIMER but it is SI_USER and also info->si_signo should be the same as sig 
but it’s not.



Diving into the code I’ve found where the handler is called (also where *info 
is created). This is done in the function _POSIX_signals_Check_signal() in the 
file psignalunblockthread.c. It doesn’t seems that info is updated with the 
values (I guess) should take from object ptimer, which was created by 
create_timer().



My question is: is this handler fully supported? Or maybe I’m missing something 
else.



Thanks in advance,

Gabriel

——
Deutsches Zentrum für Luft- und Raumfahrt e.V. (DLR)
Institute for Software Technology | SC-OSS | Lilienthalplatz 7 | 38108 
Braunschweig  | Germany

Gabriel Moyano | Research Scientist in Onboard Software Systems group
gabriel.moy...@dlr.de
DLR.de

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

AW: question about posix timer expiration

2021-05-18 Thread Gabriel.Moyano
>From further investigation I've found that when a timer expires, 
>_POSIX_Timer_TSR() is called and this uses pthread_kill() to send a signal. 
>Shouldn't ptimer->inf.sigev_value be used here in order to create a siginfo_t 
>object with the right value?

Did anyone have to deal with this while using posix timers?

Thanks!

Von: devel  Im Auftrag von gabriel.moy...@dlr.de
Gesendet: Mittwoch, 12. Mai 2021 14:37
An: devel@rtems.org
Betreff: question about posix timer expiration

Hello everyone,

Currently I am trying to get running ptpd on rtems (following the Chris' work, 
thx btw).

Ptpd uses posix timers and when a timer expires a handler with this signature 
void(int sig, siginfo_t *info, void *ucontext) is called. Unfortunately (*info) 
doesn't have the right values, eg. info->si_code should be SI_TIMER but it is 
SI_USER and also info->si_signo should be the same as sig but it's not.



Diving into the code I've found where the handler is called (also where *info 
is created). This is done in the function _POSIX_signals_Check_signal() in the 
file psignalunblockthread.c. It doesn't seems that info is updated with the 
values (I guess) should take from object ptimer, which was created by 
create_timer().



My question is: is this handler fully supported? Or maybe I'm missing something 
else.



Thanks in advance,

Gabriel

--
Deutsches Zentrum für Luft- und Raumfahrt e.V. (DLR)
Institute for Software Technology | SC-OSS | Lilienthalplatz 7 | 38108 
Braunschweig  | Germany

Gabriel Moyano | Research Scientist in Onboard Software Systems group
gabriel.moy...@dlr.de
DLR.de

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel