Date: Sun, 29 Dec 2002 14:58:43 +1100 (EST) From: Bruce Evans <bde@zeta.org.au> To: Poul-Henning Kamp <phk@FreeBSD.org> Cc: cvs-committers@FreeBSD.org, <cvs-all@FreeBSD.org> Subject: Re: cvs commit: src/sys/sys _iovec.h socket.h uio.h Message-ID: <20021229144258.H39748-100000@gamplex.bde.org> In-Reply-To: <200212282217.gBSMHTRJ050345@repoman.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20021229144258.H39748-100000>