Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 3 Jul 2011 13:47:38 +0200
From:      Robert Millan <rmh@debian.org>
To:        freebsd-hackers@freebsd.org, Ed Maste <emaste@freebsd.org>
Subject:   [PATCH] PAGE_SIZE in libsbuf
Message-ID:  <CAOfDtXMVWT0jGw_o5ugBNW7Fiq1O2avDnprXAZ3s8aP-hsMTLA@mail.gmail.com>

next in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
On arm, ia64, powerpc and sparc, Linux doesn't define a static
PAGE_SIZE.  It can only be obtained via sysconf().  In addition,
GNU/Hurd doesn't define PAGE_SIZE at all.

This patch improves portability of libsbuf to be built on those platforms.

In case you'd like to know, Debian is using libsbuf not just for its
GNU/kFreeBSD port, but also provides it to developers in Debian
GNU/Linux:

http://packages.debian.org/search?keywords=libsbuf-dev
https://buildd.debian.org/status/package.php?p=freebsd-libs&suite=sid

-- 
Robert Millan

[-- Attachment #2 --]
Index: sys/kern/subr_sbuf.c
===================================================================
--- sys/kern/subr_sbuf.c	(revision 223721)
+++ sys/kern/subr_sbuf.c	(working copy)
@@ -76,6 +76,11 @@
 #define	SBUF_SETFLAG(s, f)	do { (s)->s_flags |= (f); } while (0)
 #define	SBUF_CLEARFLAG(s, f)	do { (s)->s_flags &= ~(f); } while (0)
 
+#if !defined(PAGE_SIZE) && !defined(_KERNEL)
+#include <unistd.h>
+#define PAGE_SIZE		sysconf(_SC_PAGESIZE)
+#endif
+
 #define	SBUF_MINEXTENDSIZE	16		/* Should be power of 2. */
 
 #ifdef PAGE_SIZE

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAOfDtXMVWT0jGw_o5ugBNW7Fiq1O2avDnprXAZ3s8aP-hsMTLA>