* [Xenomai] Debian bug report #677633: Xenomai posix skin : bug with nanosleep function
@ 2012-06-15 20:10 Roland Stigge
2012-06-15 20:34 ` Gilles Chanteperdrix
2012-06-15 21:11 ` Gilles Chanteperdrix
0 siblings, 2 replies; 3+ messages in thread
From: Roland Stigge @ 2012-06-15 20:10 UTC (permalink / raw)
To: Xenomai
Hi,
may I present the below bug report from Debian to the noble ranks of
Xenomai developers.
See also http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=677633
Bug or feature? ;-)
Thanks in advance,
Roland
=========================================================================
Package: xenomai
Version: 2.6.0
Kernel:2.6.38.8 - Xenomai:2.6.0
arch:i686 i386 GNU/Linux
Hi,
The nanosleep_test.c code shows a malfunction of the nanosleep function
when a timer periodically triggering a signal.
When nanosleep is interrupted the variable holding the rest of the time
to sleep is immediately zero.
However, no bug is reported without the xenomai's posix skin.
Duchesne Alexandre
duch.alexandre@gmail.com
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Xenomai] Debian bug report #677633: Xenomai posix skin : bug with nanosleep function
2012-06-15 20:10 [Xenomai] Debian bug report #677633: Xenomai posix skin : bug with nanosleep function Roland Stigge
@ 2012-06-15 20:34 ` Gilles Chanteperdrix
2012-06-15 21:11 ` Gilles Chanteperdrix
1 sibling, 0 replies; 3+ messages in thread
From: Gilles Chanteperdrix @ 2012-06-15 20:34 UTC (permalink / raw)
To: Roland Stigge; +Cc: Xenomai
On 06/15/2012 10:10 PM, Roland Stigge wrote:
> Hi,
>
> may I present the below bug report from Debian to the noble ranks of
> Xenomai developers.
>
> See also http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=677633
>
> Bug or feature? ;-)
It is a bug, and on old one, the faulty piece of code dates back to july
2007.
--
Gilles.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Xenomai] Debian bug report #677633: Xenomai posix skin : bug with nanosleep function
2012-06-15 20:10 [Xenomai] Debian bug report #677633: Xenomai posix skin : bug with nanosleep function Roland Stigge
2012-06-15 20:34 ` Gilles Chanteperdrix
@ 2012-06-15 21:11 ` Gilles Chanteperdrix
1 sibling, 0 replies; 3+ messages in thread
From: Gilles Chanteperdrix @ 2012-06-15 21:11 UTC (permalink / raw)
To: Roland Stigge; +Cc: 677633, Xenomai
On 06/15/2012 10:10 PM, Roland Stigge wrote:
>
> Hi,
>
> The nanosleep_test.c code shows a malfunction of the nanosleep function
> when a timer periodically triggering a signal.
> When nanosleep is interrupted the variable holding the rest of the time
> to sleep is immediately zero.
>
>
>
> However, no bug is reported without the xenomai's posix skin.
The following patch should fix the bug:
diff --git a/ksrc/skins/posix/clock.c b/ksrc/skins/posix/clock.c
index 024260d..107ebb0 100644
--- a/ksrc/skins/posix/clock.c
+++ b/ksrc/skins/posix/clock.c
@@ -336,15 +336,12 @@ int clock_nanosleep(clockid_t clock_id,
if (xnthread_test_info(cur, XNBREAK)) {
if (flags == 0 && rmtp) {
- xnticks_t now, expiry;
xnsticks_t rem;
- now = clock_get_ticks(clock_id);
- expiry = xntimer_get_date(&cur->rtimer);
+ rem = xntimer_get_timeout_stopped(&cur->rtimer);
xnlock_put_irqrestore(&nklock, s);
- rem = expiry - now;
- ticks2ts(rmtp, rem > 0 ? rem : 0);
+ ticks2ts(rmtp, rem > 1 ? rem : 0);
} else
xnlock_put_irqrestore(&nklock, s);
Note however that with xenomai, a signal received during nanosleep will
trigger a switch to secondary mode. So, this usage is only possible for
a real-time thread in exceptional conditions (to handle an error for
instance), not when latency matters.
--
Gilles.
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-06-15 21:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-15 20:10 [Xenomai] Debian bug report #677633: Xenomai posix skin : bug with nanosleep function Roland Stigge
2012-06-15 20:34 ` Gilles Chanteperdrix
2012-06-15 21:11 ` Gilles Chanteperdrix
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.