Patchwork libext2fs: change getpagesize to sysconf

login
register
mail settings
Submitter Mike Frysinger
Date Dec. 7, 2011, 4:16 p.m.
Message ID <1323274568-13551-1-git-send-email-vapier@gentoo.org>
Download mbox | patch
Permalink /patch/129987/
State Accepted
Headers show

Comments

Mike Frysinger - Dec. 7, 2011, 4:16 p.m.
Newer versions of glibc no longer export the getpagesize() prototype when
using recent versions of POSIX (_XOPEN_SOURCE).  So building tdb.c gives
use implicit function declaration warnings.  Fix the issue by using the
portable sysconf() function which returns the same answer.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
 lib/ext2fs/tdb.c |    6 +-----
 1 files changed, 1 insertions(+), 5 deletions(-)
Theodore Ts'o - Jan. 10, 2012, 2:38 a.m.
On Wed, Dec 07, 2011 at 11:16:08AM -0500, Mike Frysinger wrote:
> Newer versions of glibc no longer export the getpagesize() prototype when
> using recent versions of POSIX (_XOPEN_SOURCE).  So building tdb.c gives
> use implicit function declaration warnings.  Fix the issue by using the
> portable sysconf() function which returns the same answer.
> 
> Signed-off-by: Mike Frysinger <vapier@gentoo.org>

Applied, thanks.

						- Ted
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/lib/ext2fs/tdb.c b/lib/ext2fs/tdb.c
index 83c834e..61e30ed 100644
--- a/lib/ext2fs/tdb.c
+++ b/lib/ext2fs/tdb.c
@@ -114,10 +114,6 @@  static TDB_DATA tdb_null;
 #define u32 unsigned
 #endif
 
-#ifndef HAVE_GETPAGESIZE
-#define getpagesize() 0x2000
-#endif
-
 typedef u32 tdb_len_t;
 typedef u32 tdb_off_t;
 
@@ -3839,7 +3835,7 @@  struct tdb_context *tdb_open_ex(const char *name, int hash_size, int tdb_flags,
 	tdb->hash_fn = hash_fn ? hash_fn : default_tdb_hash;
 
 	/* cache the page size */
-	tdb->page_size = getpagesize();
+	tdb->page_size = sysconf(_SC_PAGESIZE);
 	if (tdb->page_size <= 0) {
 		tdb->page_size = 0x2000;
 	}