Landau, Bracha wrote:
> I have a xenomai-based application basically working on my mpc8272 based
> board. pthread_mutex_lock generally works (and returns zero), but in
> some cases returns 1 (yes, positive, not negative) which is an unknown
> error.
> Any idea why this may be happening?
1 is not an unknown error, it is EPERM. And the POSIX spec mandates that
errors returned by pthread_* services are the error status. They are not
stored in errno. This is even documented in Xenomai pthread_mutex_lock
documentation:
Returns:
0 on success
an error number if:
* EPERM, the caller context is invalid;
(...)
* EPERM, the mutex is not process-shared and does not belong to
the current process;
(...)
Valid contexts:
* Xenomai kernel-space thread;
* Xenomai user-space thread (switches to primary mode).
I use the following script to convert back and forth between libc errors
and their value:
#! /bin/sh
sed "s,#define\t\(.*\b$1\b.*\)/\*\(.*\)\*/,\1\2,;t;d" /usr/include/asm*/errno*
> ------------------------------------------------------------------------
> This e-mail is confidential, the property of NDS Ltd and intended for
> the addressee only. Any dissemination, copying or distribution of this
> message or any attachments by anyone other than the intended recipient
> is strictly prohibited.
If this message is confidential, why do you send it to a public mailing
list in the first place? Should we unsubscribe you from the mailing list
to preserve your confidentiality?
--
Gilles
_______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help