summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES2
-rw-r--r--include/version.h2
-rw-r--r--man/4/INDEX1
-rw-r--r--os/port/lib.h3
-rw-r--r--os/port/portdat.h2
-rw-r--r--os/port/portfns.h1
-rw-r--r--os/port/xalloc.c11
7 files changed, 15 insertions, 7 deletions
diff --git a/CHANGES b/CHANGES
index 1667763e..ae9c315b 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,5 @@
+20070407
+ /os/port/^(portdat.h lib.h portfns.h xalloc.c) compatiblity changes with plan 9
20070319
emu/port/devsrv.c and os/port/devsrv.c delete wc at correct time
20070312
diff --git a/include/version.h b/include/version.h
index 140be5b6..4f5902d2 100644
--- a/include/version.h
+++ b/include/version.h
@@ -1 +1 @@
-#define VERSION "Fourth Edition (20070327)"
+#define VERSION "Fourth Edition (20070407)"
diff --git a/man/4/INDEX b/man/4/INDEX
index 61e69196..ce9e711e 100644
--- a/man/4/INDEX
+++ b/man/4/INDEX
@@ -28,3 +28,4 @@ registry registry
regquery registry
spree spree
tarfs tarfs
+trfs trfs
diff --git a/os/port/lib.h b/os/port/lib.h
index d6af4fa5..c9414b5a 100644
--- a/os/port/lib.h
+++ b/os/port/lib.h
@@ -2,6 +2,9 @@
/*
* functions (possibly) linked in, complete, from libc.
*/
+#define nelem(n) (sizeof(n)/sizeof(n[0]))
+#define offsetof(s, m) (ulong)(&(((s*)0)->m))
+#define assert(x) if(x){}else _assert("x")
/*
* mem routines
diff --git a/os/port/portdat.h b/os/port/portdat.h
index 103961e0..81e92012 100644
--- a/os/port/portdat.h
+++ b/os/port/portdat.h
@@ -53,8 +53,6 @@ typedef int Devgen(Chan*, char*, Dirtab*, int, int, Dir*);
#include "fcall.h"
#include <pool.h>
-#define nelem(n) (sizeof(n)/sizeof(n[0]))
-
struct Ref
{
Lock l;
diff --git a/os/port/portfns.h b/os/port/portfns.h
index d6bcdcf0..619be83f 100644
--- a/os/port/portfns.h
+++ b/os/port/portfns.h
@@ -9,7 +9,6 @@ Block* adjustblock(Block*, int);
Block* allocb(int);
int anyhigher(void);
int anyready(void);
-#define assert(x) if(x){}else _assert("assert(x) failed")
void _assert(char*);
Block* bl2mem(uchar*, Block*, int);
int blocklen(Block*);
diff --git a/os/port/xalloc.c b/os/port/xalloc.c
index 73310089..286881c2 100644
--- a/os/port/xalloc.c
+++ b/os/port/xalloc.c
@@ -163,9 +163,14 @@ xmerge(void *vp, void *vq)
{
Xhdr *p, *q;
- p = vp;
- if((uchar*)vp+p->size == (uchar*)vq) {
- q = vq;
+ p = (Xhdr*)(((ulong)vp - offsetof(Xhdr, data[0])));
+ q = (Xhdr*)(((ulong)vq - offsetof(Xhdr, data[0])));
+ if(p->magix != Magichole || q->magix != Magichole) {
+ xsummary();
+ panic("xmerge(%#p, %#p) bad magic %#lux, %#lux\n",
+ vp, vq, p->magix, q->magix);
+ }
+ if((uchar*)p+p->size == (uchar*)q) {
p->size += q->size;
return 1;
}