Block* netifbread(Netif *nif, Chan *c, long n, vlong offset) { Netfile *f; Block *bp; if((c->qid.type & QTDIR) || NETTYPE(c->qid.path) != Ndataqid) return devbread(c, n, offset); f = nif->f[NETID(c->qid.path)]; if(f->fat){ /* * Frame at a time (fat) allows us to provide * non-blocking performance with blocking semantics * for consumers that know ahead of time data is * contained within a single frame. Once empty, we * get in line with other blocking reads and wait our * turn. */ for(;;){ if(bp = qget(f->iq)) return bp; if(waserror()) return nil; qsleep(f->iq); poperror(); } } return qbread(f->iq, n); }
//====================================================================== // Main code //====================================================================== int recvXModem(SerialPort& port) { receive(port); qsleep(2); return exitCode; }