Thanks for your help.

I tried to put in "printk"s in the kernel implementation of the xenomai 
pthread_mutex_lock, and it did not work. Neither did xnprintf. I did this in 
order to find out what is the exact cause of the error; generally adding 
printk's in the kernel implementation of functions did work, but on this one it 
didn't.

Is there any way to discern what exactly the problem is? This code was working 
on earlier versions of Xenomai (2.2) and did not generate an error on this 
instance of calling pthread_mutex_lock.

-----Original Message-----
From: Gilles Chanteperdrix [mailto:[email protected]]
Sent: Monday, June 29, 2009 5:32 PM
To: Landau, Bracha
Cc: [email protected]
Subject: Re: [Xenomai-help] pthread_mutex_lock returns 1

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


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 you have received this message in error, please immediately 
notify the [email protected] and destroy the original message. Messages sent 
to and from NDS may be monitored. NDS cannot guarantee any message delivery 
method is secure or error-free. Information could be intercepted, corrupted, 
lost, destroyed, arrive late or incomplete, or contain viruses. We do not 
accept responsibility for any errors or omissions in this message and/or 
attachment that arise as a result of transmission. You should carry out your 
own virus checks before opening any attachment. Any views or opinions presented 
are solely those of the author and do not necessarily represent those of NDS.

To protect the environment please do not print this e-mail unless necessary.

NDS Limited Registered Office: One London Road, Staines,Middlesex TW18 4EX, 
United Kingdom. A company registered in England and Wales Registered no. 
3080780 VAT no. GB 603 8808 40-00

_______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help

Reply via email to