From mboxrd@z Thu Jan 1 00:00:00 1970 To: 9fans@cse.psu.edu From: erik quanstrom Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Message-Id: <20051202211556.90E2D18AE15@dexter-peak.quanstro.net> Date: Fri, 2 Dec 2005 15:15:56 -0600 Subject: [9fans] upas/fs/imap4.c Topicbox-Message-UUID: b63e8ebc-ead0-11e9-9d60-3106f5b1d025 i needed to modify upas/fs/imap4.c to avoid an rfork(). i'm sure that russ will post a much better version in 30 seconds or so. ;-) - erik ; diff imap4.c $home/plan9~/src/cmd/upas/fs/imap4.c 6a7 > #include 403c404 < _exits(nil); --- > threadexitsall("execl"); 537a539,567 > static void requestdoc(Biobuf* b, ulong tag, ulong uid){ > fprint(2,"9X%lud UID FETCH %lud (UID RFC822.SIZE BODY[])\r\n",tag, uid); > Bprint(b, "9X%lud UID FETCH %lud (UID RFC822.SIZE BODY[])\r\n",tag, uid); > } > > static long slavereq(va_list* ap){ > Biobuf* b; > unsigned long tag; > unsigned long uid; > > b = va_arg(*ap, Biobuf*); > tag = va_arg(*ap, ulong); > uid = va_arg(*ap, ulong); > va_end(*ap); > > requestdoc(b,tag,uid); > return 0; > } > > static long slaveflush(va_list* ap){ > Biobuf* b; > > b = va_arg(*ap, Biobuf*); > va_end(*ap); > > Bflush(b); > return 0; > } > 542c572 < int i, ignore, nnew, t; --- > int i, ignore, nnew; 543a574,577 > Ioproc* io; > ulong t; > > if (imap->debug) fprint(2, "imap4read(doplumb=%d)\n", doplumb); 600,608c634,640 < t = imap->tag; < if(pipeline) < switch(rfork(RFPROC|RFMEM)){ < case -1: < sysfatal("rfork: %r"); < default: < break; < case 0: < for(m = mb->root->part; m != nil; m = m->next){ --- > io=0; // gcc cant figure out that io isn't used uninitialized. > if(pipeline) { > io = ioproc(); > t = imap->tag; > > for(m=mb->root->part; m!=nil; m=next){ > next = m->next; 611,615c643,644 < if(imap->debug) < fprint(2, "9X%d UID FETCH %lud (UID RFC822.SIZE BODY[])\r\n", < t, (ulong)m->imapuid); < Bprint(&imap->bout, "9X%d UID FETCH %lud (UID RFC822.SIZE BODY[])\r\n", < t++, (ulong)m->imapuid); --- > > iocall(io, slavereq, &imap->bout, t++, (ulong)m->imapuid); 617,618c646 < Bflush(&imap->bout); < _exits(nil); --- > iocall(io, slaveflush, &imap->bout); 627,629c655,656 < if(!pipeline){ < Bprint(&imap->bout, "9X%lud UID FETCH %lud (UID RFC822.SIZE BODY[])\r\n", < (ulong)imap->tag, (ulong)m->imapuid); --- > if (!pipeline){ > requestdoc(&imap->bout, (ulong)imap->tag++, (ulong)m->imapuid); 644,645c671,673 < if(pipeline) < waitpid(); --- > if(pipeline) { > closeioproc(io); > }