All of lore.kernel.org
 help / color / mirror / Atom feed
From: Philippe Gerum <rpm@xenomai.org>
To: Markus Osterried <Markus.Osterried@domain.hid>
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai-core] Found bug in pSOS ev_receive()
Date: Wed, 07 Feb 2007 12:15:49 +0100	[thread overview]
Message-ID: <1170846949.21675.7.camel@domain.hid> (raw)
In-Reply-To: <1170845844.21675.2.camel@domain.hid>

On Wed, 2007-02-07 at 11:57 +0100, Philippe Gerum wrote:
> On Wed, 2007-02-07 at 11:36 +0100, Markus Osterried wrote:
> > Hello,
> > 
> > in pSOS skin function ev_receive() in file event.c I've found a bug.
> > When  ev_receive() is called with EV_WAIT and an event is received, the
> > task is unblocked and everything is okay, then in this case the copy of the
> > actual received events into *events_r is missing.
> 
> Confirmed and fixed, thanks.
> 
> --- ksrc/skins/psos+/event.c	(revision 2108)
> +++ ksrc/skins/psos+/event.c	(working copy)
> @@ -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))
> +			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.

--- ksrc/skins/psos+/event.c	(revision 2134)
+++ ksrc/skins/psos+/event.c	(working copy)
@@ -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.




      reply	other threads:[~2007-02-07 11:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-07 10:36 [Xenomai-core] Found bug in pSOS ev_receive() Markus Osterried
2007-02-07 10:57 ` Philippe Gerum
2007-02-07 11:15   ` Philippe Gerum [this message]

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=1170846949.21675.7.camel@domain.hid \
    --to=rpm@xenomai.org \
    --cc=Markus.Osterried@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.