From owner-cvs-all Sat Dec 28 19:57: 7 2002 Delivered-To: cvs-all@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 35E6837B40F; Sat, 28 Dec 2002 19:57:01 -0800 (PST) Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by mx1.FreeBSD.org (Postfix) with ESMTP id E146A43EB2; Sat, 28 Dec 2002 19:56:59 -0800 (PST) (envelope-from bde@zeta.org.au) Received: from katana.zip.com.au (katana.zip.com.au [61.8.7.246]) by mailman.zeta.org.au (8.9.3/8.8.7) with ESMTP id OAA29415; Sun, 29 Dec 2002 14:56:51 +1100 Date: Sun, 29 Dec 2002 14:58:43 +1100 (EST) From: Bruce Evans X-X-Sender: bde@gamplex.bde.org To: Poul-Henning Kamp Cc: cvs-committers@FreeBSD.org, Subject: Re: cvs commit: src/sys/sys _iovec.h socket.h uio.h In-Reply-To: <200212282217.gBSMHTRJ050345@repoman.freebsd.org> Message-ID: <20021229144258.H39748-100000@gamplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Sat, 28 Dec 2002, Poul-Henning Kamp wrote: > phk 2002/12/28 14:17:29 PST > > Modified files: > sys/sys socket.h uio.h > Added files: > sys/sys _iovec.h > Log: > It is bad style to define the same structure in multiple header > files which might be included together. This is an implementation detail. We often use this technique (especially for non-struct types) to avoid having lots of little headers. The most basic type may be size_t; it is declared separately in dozens of headers. Structure types are not really different from scalar types here. > Things like debuggers and lint-like programs get their knickers in > a twist (rightly so one might add) when they find different locations > for the same named struct depending on which .h file were included > first. Wrongly so. > This is a stellar example of Very Bad Thinking on the part of the > standards dudes who wrote that both sys/uio.h and sys/socket.h > should define struct iovec the same way. This does seem to be a bug introduced in POSIX.1-200x. struct iovec isn't in sys/socket.h in SUSv2 or 4.4BSD. > Fix this by putting struct iovec into its own miniature sys/_iovec.h > file and #include that from sys/socket.h and sys/uio.h. > > Sensible people could just put iovec into sys/_types.h but there > is probably some standard or other which will be violated if we > did something that horrible. Among other bugs, the names "iovec", "iov_base" and "iov_len" are not permitted in any standard header except the ones that are specified to declare struct iovec. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message