delorie.com/archives/browse.cgi | search |
X-Recipient: | archive-cygwin AT delorie DOT com |
DomainKey-Signature: | a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id |
:list-unsubscribe:list-subscribe:list-archive:list-post | |
:list-help:sender:message-id:date:from:mime-version:to:subject | |
:content-type; q=dns; s=default; b=UiCM68vRYr6sZ5oZCHoyP8lwqk7Ye | |
OX0LTKDt0xcy1ugAXvWq86Qzho/D2JV4AjhDiGjLDCykUngNshjIiuCLYt8yn+Bz | |
E50p74c9nq7IO3YV0lBv5U2uaGFObL4j6L5VK/URm4cBr9U9OJSfC3glk9KHQhQT | |
TXYYOBEyKaFFgo= | |
DKIM-Signature: | v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id |
:list-unsubscribe:list-subscribe:list-archive:list-post | |
:list-help:sender:message-id:date:from:mime-version:to:subject | |
:content-type; s=default; bh=uSfYKiTtT+iqg7bx5imLOuKRvJo=; b=byb | |
XOi/dNu/f99Z/boSopHlCz+18H5SyJnc1SReUkzIImkYGAyw5qtxFp2pmWJroNks | |
loJqtOyf2PmOGrdSwg5fh+3emhA6NjE6UD04SfIwAz3B3S6ZOl0lJiP/PDIxg6et | |
R+9bV9P6YIaqgfpQ59RWu8P+v2bqrLJIFgOQUxZ0= | |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
List-Id: | <cygwin.cygwin.com> |
List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
List-Archive: | <http://sourceware.org/ml/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
Sender: | cygwin-owner AT cygwin DOT com |
Mail-Followup-To: | cygwin AT cygwin DOT com |
Delivered-To: | mailing list cygwin AT cygwin DOT com |
X-Spam-SWARE-Status: | No, score=-10.2 required=5.0 tests=AWL,BAYES_00,KHOP_PGP_SIGNED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.1 |
Message-ID: | <51A78E70.1010600@redhat.com> |
Date: | Thu, 30 May 2013 11:37:52 -0600 |
From: | Eric Blake <eblake AT redhat DOT com> |
User-Agent: | Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130514 Thunderbird/17.0.6 |
MIME-Version: | 1.0 |
To: | cygwin AT cygwin DOT com |
Subject: | bug in <sys/un.h> |
OpenPGP: | url=http://people.redhat.com/eblake/eblake.gpg |
X-Virus-Found: | No |
------enig2OKFTCGPFRMFBBFJTWUDA Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable STC - this program does nothing useful when executed; it merely exists to show a compilation problem extracted from a larger program: $ cat foo.c #ifdef WORKAROUND # include <sys/socket.h> #endif #include <sys/un.h> #include <sys/socket.h> int main(void) { const struct msghdr msg; return sendmsg(0, &msg, 0); } $ gcc -o foo -Wall foo.c foo.c: In function 'main': foo.c:9:5: warning: passing argument 2 of 'sendmsg' from incompatible pointer type /usr/include/sys/socket.h:42:11: note: expected 'const struct msghdr *' but argument is of type 'const struct msghdr *' $ gcc -o foo -Wall foo.c -DWORKAROUND $ Gcc has a less-than-stellar error message (expect type X but have type X); it could do a better job about pointing out that it is complaining about two different 'type X' declarations, and where they come from. But the root cause is that if <sys/un.h> is included first, then the use of 'struct msghdr' applied in the declaration of sendmsg() is somehow scoped incorrectly (local to the declaration rather than the global type), so that the compiler really is complaining about two different incompatible 'struct msghdr' layouts. I'm not quite sure what the fix should be, but since I hit the problem today, I'm at least pointing it out. The same test case compiles without needing a workaround on Linux with glibc 2.16. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org ------enig2OKFTCGPFRMFBBFJTWUDA Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.13 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJRp45wAAoJEKeha0olJ0NqmY0IAK1P00k6tWa3kfoS7AJskXl2 AnjYGa9/5vaOf0rJJYnUAg4riqYQNJB6d7XhHrrq4npqHhgkvzN4YCgeQNzl/t9Q mU18aTCYQ4P30ekQW/rTBKmdbqOJHnwXHPIMp9RPifyfekqfKoBulAGUEwJydyqO YWwKJQojz0vzTT9aZnF5RMqKNOwsTipvkRGxEfYiz7cMdgzu3royd6ywZIa9Qtjt Rw2C5SsA+S+10TGho1gLxX+aK1H/nWli3gmTu+yIuY1kpxYgZd5N57iiQb6t+4x0 IQe8eQ9M7q/xsKMshydqLRMoEJXak0gSmYaOUB2tJuluVK6eAUvq44WmaL1RxJU= =DO5k -----END PGP SIGNATURE----- ------enig2OKFTCGPFRMFBBFJTWUDA--
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |