All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
To: trem <tremyfr@domain.hid>
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai-core] [PATCH] add tut02-skeleton
Date: Mon, 28 May 2007 22:17:41 +0200	[thread overview]
Message-ID: <18011.14565.787935.188919@domain.hid> (raw)
In-Reply-To: <f3fcrk$3eg$1@domain.hid>

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
perror.
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.


  reply	other threads:[~2007-05-28 20:17 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-28 15:23 [Xenomai-core] [PATCH] add tut02-skeleton trem
2007-05-28 17:40 ` Jan Kiszka
2007-05-28 18:26 ` Gilles Chanteperdrix
2007-05-28 20:08   ` trem
2007-05-28 20:17     ` Gilles Chanteperdrix [this message]
2007-05-28 21:58       ` trem
2007-05-29  9:37         ` Jan Kiszka

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=18011.14565.787935.188919@domain.hid \
    --to=gilles.chanteperdrix@xenomai.org \
    --cc=tremyfr@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.