trem wrote:
 > Hi
 > Thanks for the reply (jan too). I've tried to use all of your feedback,
 > and I send you the new release of this tut02.
 > (...)
 > +    /* no memory-swapping for this programm */
 > +    ret = mlockall(MCL_CURRENT | MCL_FUTURE);
 > +    if (ret) {
 > +            fprintf(stderr, "ERROR : mlockall failled: %s\n", 
 > strerror(-ret));
 > +            fflush(stdout);
 > +            exit(1);
 > +    }

Some further comment, mlockall returns its error in errno, so you should
replace strerror(-ret) with strerror(errno), or to make it short, use
Also note that since you fflush stdout after having printed the error
message, if there are any non printed message in stdout, they will only
appear after the error message, which will make it hard for the user to
catch the error message. Besides, exit already flushes the file
descriptors, so flushing stdout before calling exit is useless. IMHO,
you should call fflush(stdout) before printing the error message.


                                            Gilles Chanteperdrix.

Xenomai-core mailing list

Reply via email to