[OpenIndiana-discuss] struct msghdr and _XPG4_2

Alexander Pyhalov alp at rsu.ru
Wed May 25 07:15:33 UTC 2016


Hi.
It seems illumos/Solaris is the only OS which doesn't have msg_control 
and msg_controllen in struct msghdr by default. So, code like this (this 
time taken from scrren), fails.

   struct sockaddr_un a;
   struct msghdr msg;
   struct iovec iov;
   char control[1024];

   len = sizeof(a);
   debug("Ha, there was someone knocking on my socket??\n");
   if ((ns = accept(ns, (struct sockaddr *) &a, (void *)&len)) < 0)
     {
       Msg(errno, "accept");
       return;
     }

   p = (char *) &m;
   left = sizeof(m);
   bzero(&msg, sizeof(msg));
   iov.iov_base = &m;
   iov.iov_len = left;
   msg.msg_iov = &iov;
   msg.msg_iovlen  = 1;
   msg.msg_controllen = sizeof(control);
   msg.msg_control = &control;

I know I can define _XPG4_2 or experiment with _XOPEN_SOURCE, but it 
seems ugly. Is it because of some standard requirements or just 
historical artifact? Can we somehow alleviate this issue?
-- 
Best regards,
Alexander Pyhalov,
system administrator of Southern Federal University IT department



More information about the openindiana-discuss mailing list