From mboxrd@z Thu Jan 1 00:00:00 1970 From: dhog@plan9.bell-labs.com Message-Id: <200006161950.PAA05591@cse.psu.edu> To: 9fans@cse.psu.edu Subject: Re: [9fans] C-program error.. Date: Fri, 16 Jun 2000 15:50:42 -0400 MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Topicbox-Message-UUID: c1e04f9c-eac8-11e9-9e20-41e7f4b1d025 In your example, s in recvit() is expected (by recv()) to point to storage for the data sent on the channel (all 32 bytes worth), but you have left it uninitialized. Also, print() has an internal buffer of 4096 bytes; you need to increase the stack size or you'll get mysterious errors caused by stack corruption. Try this version: #include #include #include #define STACKSIZE (8*1024) void recvit(void *arg) { char *s; Channel *in = arg; recv(in, &s); print("%s\n", s); free(s); } void threadmain(int argc, char *argv[]) { char *m; Channel *sch; sch = chancreate(sizeof(char*), 0); m = strdup("hello world!"); print("main: %s\n", m); proccreate(recvit, (void *)sch, STACKSIZE); send(sch, &m); print("done\n"); }