* [Xenomai-help] sem_timedwait return value
@ 2006-12-01 20:12 Jeff Webb
2006-12-01 23:00 ` Philippe Gerum
0 siblings, 1 reply; 2+ messages in thread
From: Jeff Webb @ 2006-12-01 20:12 UTC (permalink / raw)
To: xenomai
[-- Attachment #1: Type: text/plain, Size: 663 bytes --]
In my userspace POSIX program, I get a '-1' return value from sem_timedwait, even when the function succeeds. When the function succeeds, errno is '-1' as well. I am using this workaround at the moment:
result = sem_timedwait(&cas_sem, &wake_time);
if (result < 0 && errno > 0) /* errno > 0 to work around xenomai bug */
{
print_msg(WARN_MSG, "sem_wait returned with error code %d\n",
errno);
continue;
}
I am using xenomai 2.2.4, but I think the problem exists in other branches as well. I believe the attached patch against the trunk should fix the problem. Do you agree?
Thanks,
Jeff
[-- Attachment #2: sem_timedwait.patch --]
[-- Type: text/x-patch, Size: 516 bytes --]
Index: ksrc/skins/posix/syscall.c
===================================================================
--- ksrc/skins/posix/syscall.c (revision 1911)
+++ ksrc/skins/posix/syscall.c (working copy)
@@ -492,7 +492,7 @@
&ts,
(void __user *)__xn_reg_arg2(regs), sizeof(ts));
- return sem_timedwait(&sm.native_sem, &ts) == 0 ? : -thread_get_errno();
+ return sem_timedwait(&sm.native_sem, &ts) == 0 ? 0 : -thread_get_errno();
}
static int __sem_trywait(struct task_struct *curr, struct pt_regs *regs)
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [Xenomai-help] sem_timedwait return value
2006-12-01 20:12 [Xenomai-help] sem_timedwait return value Jeff Webb
@ 2006-12-01 23:00 ` Philippe Gerum
0 siblings, 0 replies; 2+ messages in thread
From: Philippe Gerum @ 2006-12-01 23:00 UTC (permalink / raw)
To: Jeff Webb; +Cc: xenomai
On Fri, 2006-12-01 at 14:12 -0600, Jeff Webb wrote:
> In my userspace POSIX program, I get a '-1' return value from sem_timedwait, even when the function succeeds. When the function succeeds, errno is '-1' as well. I am using this workaround at the moment:
>
> result = sem_timedwait(&cas_sem, &wake_time);
> if (result < 0 && errno > 0) /* errno > 0 to work around xenomai bug */
> {
> print_msg(WARN_MSG, "sem_wait returned with error code %d\n",
> errno);
> continue;
> }
>
> I am using xenomai 2.2.4, but I think the problem exists in other branches as well. I believe the attached patch against the trunk should fix the problem. Do you agree?
>
Oops, yes. This bug belongs to me. Applied, thanks.
> Thanks,
>
> Jeff
> _______________________________________________
> Xenomai-help mailing list
> Xenomai-help@domain.hid
> https://mail.gna.org/listinfo/xenomai-help
--
Philippe.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-12-01 23:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-12-01 20:12 [Xenomai-help] sem_timedwait return value Jeff Webb
2006-12-01 23:00 ` Philippe Gerum
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.