All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@domain.hid>
To: roland Tollenaar <rolandtollenaar@domain.hid>
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai-help] warnings and tangled threads.
Date: Wed, 28 Feb 2007 09:40:16 +0100	[thread overview]
Message-ID: <45E53FF0.7050200@domain.hid> (raw)
In-Reply-To: <45E5357B.4090107@domain.hid>

[-- Attachment #1: Type: text/plain, Size: 2763 bytes --]

Jan Kiszka wrote:
> roland Tollenaar wrote:
>> Hi,
>>
>> Ok I have CAN functionality of some form running in my tasks.
>> Initializing seems to be successful and I have written some kind of
>> wrapper to create a can_write() function of my own which also seems to
>> be -kind of-  working. I have one question and one problem.
>>
>> I keep on getting this compile warning
>>
>> In file included from /mnt/appusb/xenomai/include/rtdm/rtcan.h:250,
>>                 from cancom.cpp:15:
>> /mnt/appusb/xenomai/include/rtdm/rtdm.h: In function `ssize_t
>> rt_dev_sendto(int, const void*, size_t, int, const sockaddr*,
>> socklen_t)':
>> /mnt/appusb/xenomai/include/rtdm/rtdm.h:323: warning: missing
>> initializer for member `msghdr::msg_flags'
>>
>> Its in rtdm.h so I have not looked closely at it yet but I presume I
>> must be doing something wrong to be getting it?
> 
> That seems to be due to non-default -Wmissing-field-initializers, right?
> Will have a look if we can quiet gcc.
> 

This works for me here (and is a bit more telling as well):

--- include/rtdm/rtdm.h (Revision 2265)
+++ include/rtdm/rtdm.h (Arbeitskopie)
@@ -295,13 +295,22 @@ static inline ssize_t rt_dev_recvfrom(in
                                       struct sockaddr *from,
                                       socklen_t *fromlen)
 {
-    struct iovec    iov = {buf, len};
-    struct msghdr   msg =
-        {from, (from != NULL) ? *fromlen : 0, &iov, 1, NULL, 0};
-    int             ret;
+    struct iovec iov = {
+        .iov_base = buf,
+        .iov_len = len
+    };
+    struct msghdr msg =
+        .msg_name = from,
+        .msg_namelen = from ? *fromlen : 0,
+        .msg_iov = &iov,
+        .msg_iovlen = 1,
+        .msg_control = NULL,
+        .msg_controllen = 0
+    };
+    int ret;
 
     ret = rt_dev_recvmsg(fd, &msg, flags);
-    if ((ret >= 0) && (from != NULL))
+    if (ret >= 0 && from)
         *fromlen = msg.msg_namelen;
     return ret;
 }
@@ -345,9 +354,18 @@ static inline ssize_t rt_dev_sendto(int 
                                     int flags, const struct sockaddr *to,
                                     socklen_t tolen)
 {
-    struct iovec    iov = {(void *)buf, len};
-    struct msghdr   msg =
-        {(struct sockaddr *)to, tolen, &iov, 1, NULL, 0};
+    struct iovec iov = {
+        .iov_base = (void *)buf,
+        .iov_len = len
+    };
+    struct msghdr msg = {
+        .msg_name = (struct sockaddr *)to,
+        .msg_namelen = tolen,
+        .msg_iov = &iov,
+        .msg_iovlen = 1,
+        .msg_control = NULL, 
+        .msg_controllen = 0
+    };
 
     return rt_dev_sendmsg(fd, &msg, flags);
 }


Can you confirm it?

Jan


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 250 bytes --]

  reply	other threads:[~2007-02-28  8:40 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-27 23:25 [Xenomai-help] warnings and tangled threads roland Tollenaar
2007-02-28  7:55 ` Jan Kiszka
2007-02-28  8:40   ` Jan Kiszka [this message]
2007-02-28 13:53     ` Jan Kiszka
2007-03-01 19:51       ` roland Tollenaar
2007-03-01 20:27         ` Jan Kiszka
2007-03-01 20:27         ` Dmitry Adamushko
2007-02-28 18:00   ` roland Tollenaar
2007-02-28 20:10     ` Wolfgang Grandegger

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=45E53FF0.7050200@domain.hid \
    --to=jan.kiszka@domain.hid \
    --cc=rolandtollenaar@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.