9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] segattach in telnetd
@ 2014-09-14  2:54 arisawa
  2014-09-14  3:17 ` cinap_lenrek
  0 siblings, 1 reply; 12+ messages in thread
From: arisawa @ 2014-09-14  2:54 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

Hello,

we have an example for segattach() in /sys/src/cmd/ip/telnetd.c

void*
share(ulong len)
{
	uchar *vastart;

	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;
}

I think it should be
-	if(segattach(0, "shared", vastart, len) == (void*)-1)
+	if((vastart = segattach(0, "shared", vastart, len)) == (void*)-1)

Kenji Arisawa




^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2014-09-15 16:59 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-14  2:54 [9fans] segattach in telnetd arisawa
2014-09-14  3:17 ` cinap_lenrek
2014-09-14  3:49   ` arisawa
2014-09-14  4:23     ` cinap_lenrek
2014-09-14  4:41   ` arisawa
2014-09-14  4:51     ` cinap_lenrek
2014-09-14  5:33       ` arisawa
2014-09-14  5:55         ` cinap_lenrek
2014-09-14 14:43         ` erik quanstrom
2014-09-14 19:04           ` Charles Forsyth
2014-09-15 16:59           ` erik quanstrom
2014-09-14  5:04     ` cinap_lenrek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).