[OpenIndiana-discuss] struct msghdr and _XPG4_2
the outsider
openindiana at out-side.nl
Wed May 25 08:04:53 UTC 2016
Interesting topic!
A quick search brought me this:
https://bugs.php.net/bug.php?id=66013 (but it seems you found it too)
It seems you are bound to XPG4_2...
http://docs.oracle.com/cd/E19253-01/817-4415/sockets-27/index.html
http://linux.die.net/man/2/recvmsg
http://pubs.opengroup.org/onlinepubs/7908799/xns/syssocket.h.html
I read:
"The field msg_control, which has length msg_controllen, points to a buffer
for other protocol control-related messages or miscellaneous ancillary data.
When recvmsg() is called, msg_controllen should contain the length of the
available buffer in msg_control; upon return from a successful call it will
contain the length of the control message sequence."
So the use of msg_control is optional if I read it correctly.
-----Oorspronkelijk bericht-----
Van: Alexander Pyhalov [mailto:alp at rsu.ru]
Verzonden: woensdag 25 mei 2016 9:16
Aan: Discussion list for OpenIndiana <openindiana-discuss at openindiana.org>
Onderwerp: [OpenIndiana-discuss] struct msghdr and _XPG4_2
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
_______________________________________________
openindiana-discuss mailing list
openindiana-discuss at openindiana.org
http://openindiana.org/mailman/listinfo/openindiana-discuss
More information about the openindiana-discuss
mailing list