ref: 7f295c205577f604c8c078fd3f5626330e774ec9
parent: fdf3883ce43eefe329c93494c32b7005a86759fb
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sun Sep 14 17:20:13 EDT 2014
telnetd: let the kernel place the shared segment in segattach() (thanks kenji arisawa)
--- a/sys/src/cmd/ip/telnetd.c
+++ b/sys/src/cmd/ip/telnetd.c
@@ -541,23 +541,17 @@
}
/*
- * create a shared segment. Make is start 2 meg higher than the current
- * end of process memory.
+ * create a shared segment.
*/
void*
share(ulong len)
{
- uchar *vastart;
+ void *v;
- vastart = sbrk(0);
- if(vastart == (void*)-1)
- return 0;
- vastart += 2*1024*1024;
-
- if(segattach(0, "shared", vastart, len) == (void*)-1)
- return 0;
-
- return vastart;
+ v = segattach(0, "shared", 0, len);
+ if(v == (void*)-1)
+ return nil;
+ return v;
}
/*