From: Michael Welling <mwelling@ieee.org>
To: xenomai@xenomai.org,
Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>,
Jan Kiszka <jan.kiszka@siemens.com>
Subject: Re: [Xenomai] [PATCH v2] demo: cross-link: Properly handle ioctl error
Date: Mon, 22 Feb 2016 17:30:25 -0600 [thread overview]
Message-ID: <20160222233025.GA28057@deathstar> (raw)
In-Reply-To: <1456177287-15501-1-git-send-email-mwelling@ieee.org>
On Mon, Feb 22, 2016 at 03:41:27PM -0600, Michael Welling wrote:
> Update cross-link demo to properly report ioctl errors.
>
> Signed-off-by: Michael Welling <mwelling@ieee.org>
> ---
> v2: Update all instances that incorrectly handle ioctl errors.
>
> demo/alchemy/cobalt/cross-link.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/demo/alchemy/cobalt/cross-link.c b/demo/alchemy/cobalt/cross-link.c
> index 8c0f53f..fa3cc91 100644
> --- a/demo/alchemy/cobalt/cross-link.c
> +++ b/demo/alchemy/cobalt/cross-link.c
> @@ -23,6 +23,7 @@
> #include <stdio.h>
> #include <signal.h>
> #include <unistd.h>
> +#include <errno.h>
> #include <sys/mman.h>
> #include <alchemy/task.h>
> #include <alchemy/timer.h>
> @@ -199,6 +200,7 @@ static void read_task_proc(void *arg)
> /* waiting for event */
> err = ioctl(read_fd, RTSER_RTIOC_WAIT_EVENT, &rx_event);
> if (err) {
> + err = -errno;
> printf(RTASK_PREFIX
> "error on RTSER_RTIOC_WAIT_EVENT, %s\n",
> strerror(-err));
> @@ -254,6 +256,7 @@ int main(int argc, char* argv[])
> /* writing write-config */
> err = ioctl(write_fd, RTSER_RTIOC_SET_CONFIG, &write_config);
> if (err) {
> + err = -errno;
> printf(MAIN_PREFIX "error while RTSER_RTIOC_SET_CONFIG, %s\n",
> strerror(-err));
> goto error;
> @@ -273,6 +276,7 @@ int main(int argc, char* argv[])
> /* writing read-config */
> err = ioctl(read_fd, RTSER_RTIOC_SET_CONFIG, &read_config);
> if (err) {
> + err = -errno;
> printf(MAIN_PREFIX "error while ioctl, %s\n",
> strerror(-err));
> goto error;
After I got an email about this patch offlist, I found even more issues with
error number handling.
Not only are the ioctl calls wrong but the read, open, and write calls are too.
Here comes v3.
> --
> 2.1.4
>
prev parent reply other threads:[~2016-02-22 23:30 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-22 21:41 [Xenomai] [PATCH v2] demo: cross-link: Properly handle ioctl error Michael Welling
2016-02-22 23:30 ` Michael Welling [this message]
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=20160222233025.GA28057@deathstar \
--to=mwelling@ieee.org \
--cc=gilles.chanteperdrix@xenomai.org \
--cc=jan.kiszka@siemens.com \
--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.