This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: Sharing of bits/fcntl.h on Linux (SPARC, x86)
On 10/19/2012 07:38 PM, Roland McGrath wrote:
This is not going to work directly since struct flock needs the include
of <sys/types.h> for __off64_t.
You could put #include <bits/types.h> right before the 'struct flock'
definition like io/bits/fcntl.h does.
But actually, what we should do is move the <bits/types.h> include in
io/fcntl.h up to the top. (It doesn't need to be conditional, since it's a
name-space-clean internal header anyway.) Now it implicitly assumes that
<bits/fcntl.h> causes __mode_t, __off_t, and __pid_t to be defined, which
it shouldn't do.
That means that now we always include <bits/types.h> - and in the past
we always included <sys/types.h>. I hope there are not subtile
problems with this change.
I've tested the single change on Linux/x86-64 - both with and without
my other changes. Ok to commit?
Andreas
2012-10-19 Roland McGrath <roland@hack.frob.com>
* io/fcntl.h: Move include of <bits/types.h> to the top and
include it unconditionally.
diff --git a/io/fcntl.h b/io/fcntl.h
index c7d5e69..81f34bf 100644
--- a/io/fcntl.h
+++ b/io/fcntl.h
@@ -27,6 +27,9 @@
/* This must be early so <bits/fcntl.h> can define types winningly. */
__BEGIN_DECLS
+/* Get __mode_t, __dev_t and __off_t .*/
+#include <bits/types.h>
+
/* Get the definitions of O_*, F_*, FD_*: all the
numbers and flag bits for `open', `fcntl', et al. */
#include <bits/fcntl.h>
@@ -56,7 +59,6 @@ typedef __pid_t pid_t;
/* For XPG all symbols from <sys/stat.h> should also be available. */
#if defined __USE_XOPEN || defined __USE_XOPEN2K8
-# include <bits/types.h> /* For __mode_t and __dev_t. */
# define __need_timespec
# include <time.h>
# include <bits/stat.h>
--
Andreas Jaeger aj@{suse.com,opensuse.org} Twitter/Identica: jaegerandi
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn,Jennifer Guild,Felix Imendörffer,HRB16746 (AG Nürnberg)
GPG fingerprint = 93A3 365E CE47 B889 DF7F FED1 389A 563C C272 A126