From: Jeff Webb <jeff.webb@domain.hid>
To: xenomai@xenomai.org
Subject: [Xenomai-help] sem_timedwait return value
Date: Fri, 01 Dec 2006 14:12:21 -0600 [thread overview]
Message-ID: <45708CA5.8040004@domain.hid> (raw)
[-- 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)
next reply other threads:[~2006-12-01 20:12 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-12-01 20:12 Jeff Webb [this message]
2006-12-01 23:00 ` [Xenomai-help] sem_timedwait return value Philippe Gerum
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=45708CA5.8040004@domain.hid \
--to=jeff.webb@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.