summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordhodell <dhodell@1665872d-e22b-0410-9e5d-a57ad4215e6d>2006-10-13 18:03:34 +0000
committerdhodell <dhodell@1665872d-e22b-0410-9e5d-a57ad4215e6d>2006-10-13 18:03:34 +0000
commitb4fbd5bf4456a77e60a69ef66ffdff399dcf0661 (patch)
tree3f7a979907abe2e97fcb99c17d5ef622d2d467aa
parentc311350b3b220f6e6ea78183a7aed217f28c3e33 (diff)
downloadportableumem-b4fbd5bf4456a77e60a69ef66ffdff399dcf0661.tar.gz
Insert bits to allow successful compilation (and apparent success in
running) on FreeBSD. git-svn-id: https://labs.omniti.com/portableumem/trunk@27 1665872d-e22b-0410-9e5d-a57ad4215e6d
-rw-r--r--init_lib.c8
-rw-r--r--malloc.c2
-rw-r--r--sol_compat.h2
-rw-r--r--umem.c2
4 files changed, 11 insertions, 3 deletions
diff --git a/init_lib.c b/init_lib.c
index 0479af4..a6461bb 100644
--- a/init_lib.c
+++ b/init_lib.c
@@ -47,6 +47,10 @@
#include <fcntl.h>
#include <string.h>
+#ifdef __FreeBSD__
+#include <machine/param.h>
+#endif
+
void
vmem_heap_init(void)
{
@@ -84,8 +88,10 @@ umem_type_init(caddr_t start, size_t len, size_t pgsize)
SYSTEM_INFO info;
GetSystemInfo(&info);
pagesize = info.dwPageSize;
-#else
+#elseif !defined(__FreeBSD__)
pagesize = _sysconf(_SC_PAGESIZE);
+#else
+ pagesize = PAGE_SIZE;
#endif
}
diff --git a/malloc.c b/malloc.c
index e107858..45fae6e 100644
--- a/malloc.c
+++ b/malloc.c
@@ -33,7 +33,9 @@
#include <string.h>
+#ifdef HAVE_SYS_SYSMACROS_H
#include <sys/sysmacros.h>
+#endif
#include "umem_base.h"
diff --git a/sol_compat.h b/sol_compat.h
index 6b670ce..e0b8c4c 100644
--- a/sol_compat.h
+++ b/sol_compat.h
@@ -165,7 +165,7 @@ static INLINE uint_t ec_atomic_inc(uint_t *mem)
#ifdef _WIN32
#define issetugid() 0
-#else
+#elseif !defined(__FreeBSD__)
#define issetugid() (geteuid() == 0)
#endif
diff --git a/umem.c b/umem.c
index 7dbcff1..54d6f51 100644
--- a/umem.c
+++ b/umem.c
@@ -518,7 +518,7 @@ umem_log_header_t *umem_failure_log;
umem_log_header_t *umem_slab_log;
extern thread_t _thr_self(void);
-#if defined(__MACH__)
+#if defined(__MACH__) || defined(__FreeBSD__)
# define CPUHINT() ((int)(_thr_self()))
#endif