+#else
+ /*
+ * Buffer size is shrinking
+ * Just put the tail end back in the map
+ */
+ if (sizealloc < tp->b_bufsize) {
+ rmfree(buffermap, (long)(tp->b_bufsize - sizealloc),
+ (long)(tp->b_un.b_addr + sizealloc));
+ tp->b_bufsize = sizealloc;
+ goto out;
+ }
+ /*
+ * Buffer is being expanded or created
+ * If being expanded, attempt to get contiguous
+ * section, otherwise get a new chunk and copy.
+ * If no space, free up a buffer on the AGE list
+ * and try again.
+ */
+ do {
+ if ((osize = tp->b_bufsize)) {
+ a = (char *)rmget(buffermap, (long)(sizealloc-osize),
+ (long)(tp->b_un.b_addr + osize));
+ if (a == 0) {
+ a = (char *)rmalloc(buffermap, (long)sizealloc);
+ if (a != 0) {
+ bcopy(tp->b_un.b_addr, a, osize);
+ rmfree(buffermap, (long)osize,
+ (long)tp->b_un.b_addr);
+ tp->b_un.b_addr = a;
+ }
+ }
+ } else {
+ a = (char *)rmalloc(buffermap, (long)sizealloc);
+ if (a != 0)
+ tp->b_un.b_addr = a;
+ }
+ } while (a == 0 && bfreemem());
+ if (a == 0) {
+ brelse(tp);
+ return (0);
+ }
+ tp->b_bufsize = sizealloc;
+#endif