[patch] Cleanup #includes in preparation for BZ#16734 fix

Paul Pluzhnikov ppluzhnikov@gmail.com
Tue Feb 17 00:26:00 GMT 2015


Greetings,

Following up on Joseph's suggestion of fixing the bugs before
committing the s/ALLOC_BUF/malloc/ patch, I tried building glibc with
the following (not intended to commit):

diff --git a/libio/libioP.h b/libio/libioP.h
index d8604ca..d1699de 100644
--- a/libio/libioP.h
+++ b/libio/libioP.h
@@ -719,7 +719,7 @@ extern _IO_off64_t _IO_seekpos_unlocked (_IO_FILE
*, _IO_off64_t, int)
 # endif
 #endif

-#if _G_HAVE_MMAP
+#if _G_HAVE_MMAP && 0

 # include <unistd.h>
 # include <fcntl.h>
@@ -737,7 +737,7 @@ extern _IO_off64_t _IO_seekpos_unlocked (_IO_FILE
*, _IO_off64_t, int)

 #endif /* _G_HAVE_MMAP */

-#if _G_HAVE_MMAP
+#if _G_HAVE_MMAP && 0

 # ifdef _LIBC
 /* When using this code in the GNU libc we must not pollute the name space.  */

That failed to build, due to missing #includes.

Attached trivial patch fixes that.

Thanks,


2015-02-16  Paul Pluzhnikov  <ppluzhnikov@google.com>

        * libio/fileops.c: Add missing sys/mman.h
        * libio/iopopen.c: Add missing fcntl.h, remove redundant unistd.h


-- 
Paul Pluzhnikov
-------------- next part --------------
diff --git a/libio/fileops.c b/libio/fileops.c
index b997e4b..297b478 100644
--- a/libio/fileops.c
+++ b/libio/fileops.c
@@ -32,6 +32,7 @@
 #include "libioP.h"
 #include <assert.h>
 #include <fcntl.h>
+#include <sys/mman.h>
 #include <sys/param.h>
 #include <sys/types.h>
 #include <sys/stat.h>
diff --git a/libio/iopopen.c b/libio/iopopen.c
index ac39485..53da776 100644
--- a/libio/iopopen.c
+++ b/libio/iopopen.c
@@ -29,11 +29,11 @@
 # define _POSIX_SOURCE
 #endif
 #include "libioP.h"
+#include <fcntl.h>
 #include <signal.h>
 #include <unistd.h>
 #include <stdlib.h>
 #ifdef _LIBC
-# include <unistd.h>
 # include <shlib-compat.h>
 # include <not-cancel.h>
 #endif


More information about the Libc-alpha mailing list