[PATCH] PAGE_SIZE in libsbuf
Robert Millan
rmh at debian.org
Sun Jul 3 11:47:39 UTC 2011
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
-------------- next part --------------
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
More information about the freebsd-hackers
mailing list