Antwort: Re: [Xenomai-core] Found bug in pSOS ev_receive()
In timeout case events_r is don't care.
When using pSOS skin in user space, __ev_receive() in syscall.c copy events_r to user space only when ev_receive was successful. But this comply with pSOS manual: "If successful, ev_receive() returns the actual events captured by the call in the
location pointed to by events_r."
Philippe Gerum
<[email protected] An: Markus Osterried <[email protected]>
g> Kopie: [email protected]
Gesendet von: Blindkopie:
Philippe Gerum Thema: Re: [Xenomai-core] Found bug in pSOS ev_receive()
<philippe.gerum
@gmail.com>
07.02.2007
12:15
Bitte antworten
an rpm
Quoted 6 lines · Philippe Gerum
Quoted 5 lines · Markus Osterried
Hello,
in pSOS skin function
ev_receive()in fileevent.cI've found a bug. Whenev_receive()is called withEV_WAITand an event is received, the task is unblocked and everything is okay, then in this case the copy of
the
Quoted 7 lines
Quoted 1 line
actual received events into
*events_ris missing.Confirmed and fixed, thanks.
skins/psos+/event.c (working copy) line 84
Quoted 8 lines
skins/psos+/event.c (working copy) renamed from skins/psos+/event.c (revision 2108) +2
-2@@ -79,9 +79,10 @@ if (xnthread_test_info(&task->threadbase, XNBREAK)) err = -EINTR; - else if (xnthread_test_info(&task->threadbase, XNTIMEO)) { + else { *events_r = task->waitargs.evgroup.events; - err = ERR_TIMEOUT; + if (xnthread_test_info(&task->threadbase,
XNTIMEO))
skins/psos+/event.c (working copy) line 88
Quoted 5 lines
skins/psos+/event.c (working copy) renamed from skins/psos+/event.c (revision 2108) +1
-0+ err = ERR_TIMEOUT; } unlock_and_exit:
Actually, there was a second bug hiding in the timeout case, where the copy back value was wrong, we should have returned the current state of the event flag group and we returned the pended event mask instead. The following patch against 2.3.0 fixes both issues.
skins/psos+/event.c (working copy) renamed from skins/psos+/event.c (revision 2134) +3 -2
@@ -80,9 +80,10 @@ if (xnthread_test_info(&task->threadbase, XNBREAK)) err = -EINTR; else if (xnthread_test_info(&task->threadbase, XNTIMEO)) { + err = ERR_TIMEOUT; + *events_r = evgroup->events; + } else *events_r = task->waitargs.evgroup.events; - err = ERR_TIMEOUT; - } unlock_and_exit:
--
Philippe.
Quoted 1 line · Markus Osterried
In timeout case
events_ris don't care.
I would swear having seen a copy back being documented in the timeout case in some oldish pSOS 2.3 manual a looong time ago, but since I don't have it at hand anymore, maybe it's just -ENOBRAIN on my side.
Quoted 5 lines
When using pSOS skin in user space,
__ev_receive()insyscall.ccopyevents_rto user space only whenev_receivewas successful. But this comply with pSOS manual: "If successful,ev_receive()returns the actual events captured by the call in the
location pointed to byevents_r."
Good. Thanks.
Quoted 85 lines
Philippe Gerum
<[email protected] An: Markus Osterried <[email protected]>
g> Kopie: [email protected]
Gesendet von: Blindkopie:
Philippe Gerum Thema: Re: [Xenomai-core] Found bug in pSOSev_receive()
<philippe.gerum
@gmail.com>07.02.2007
12:15
Bitte antworten
an rpmQuoted 6 lines · Philippe Gerum
Quoted 5 lines · Markus Osterried
Hello,
in pSOS skin function
ev_receive()in fileevent.cI've found a bug. Whenev_receive()is called withEV_WAITand an event is received, the task is unblocked and everything is okay, then in this case the copy ofthe
Quoted 7 lines
Quoted 1 line
actual received events into
*events_ris missing.Confirmed and fixed, thanks.
skins/psos+/event.c (working copy) line 84
Quoted 8 lines
skins/psos+/event.c (working copy) renamed from skins/psos+/event.c (revision 2108) +2
-2@@ -79,9 +79,10 @@ if (xnthread_test_info(&task->threadbase, XNBREAK)) err = -EINTR; - else if (xnthread_test_info(&task->threadbase, XNTIMEO)) { + else { *events_r = task->waitargs.evgroup.events; - err = ERR_TIMEOUT; + if (xnthread_test_info(&task->threadbase,XNTIMEO))
skins/psos+/event.c (working copy) line 88
Quoted 5 lines
skins/psos+/event.c (working copy) renamed from skins/psos+/event.c (revision 2108) +1
-0+ err = ERR_TIMEOUT; } unlock_and_exit:Actually, there was a second bug hiding in the timeout case, where the copy back value was wrong, we should have returned the current state of the event flag group and we returned the pended event mask instead. The following patch against 2.3.0 fixes both issues.
skins/psos+/event.c (working copy) renamed from skins/psos+/event.c (revision 2134) +3
-3@@ -80,9 +80,10 @@ if (xnthread_test_info(&task->threadbase, XNBREAK)) err = -EINTR; else if (xnthread_test_info(&task->threadbase, XNTIMEO)) { + err = ERR_TIMEOUT; + *events_r = evgroup->events; + } else *events_r = task->waitargs.evgroup.events; - err = ERR_TIMEOUT; - } unlock_and_exit: --Philippe.
Signature · 1 line
Philippe.