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: signature.asc
Description: OpenPGP digital signature

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

Reply via email to