Be more 8-bit safe. [rsc] --rw-rw-r-- M 771144 glenda sys 4074 Feb 11 09:15 sys/lib/lex/ncform /n/sourcesdump/2006/0211/plan9/sys/lib/lex/ncform:9,15 - /n/sourcesdump/2006/0212/plan9/sys/lib/lex/ncform:9,15 extern struct yysvf *yyestate; int yyprevious = YYNEWLINE; # ifdef LEXDEBUG - extern void allprint(char); + extern void allprint(int); # endif yylook(void){ struct yysvf *yystate, **lsp; /n/sourcesdump/2006/0211/plan9/sys/lib/lex/ncform:113,119 - /n/sourcesdump/2006/0212/plan9/sys/lib/lex/ncform:113,119 } # ifdef LEXDEBUG if(debug){ - fprintf(yyout,"stopped at %d with ",*(lsp-1)-yysvec-1); + fprintf(yyout,"stopped at %d with ",lsp>yylstate?*(lsp-1)-yysvec-1:0); allprint(yych); putchar('\n'); } Document _tos. [rsc] --rw-rw-r-- M 771144 glenda sys 4191 Feb 11 09:09 sys/man/2/exec /n/sourcesdump/2006/0211/plan9/sys/man/2/exec:1,6 - /n/sourcesdump/2006/0212/plan9/sys/man/2/exec:1,6 .TH EXEC 2 .SH NAME - exec, execl, _clock, _privates, _nprivates \- execute a file + exec, execl, _privates, _nprivates, _tps \- execute a file .SH SYNOPSIS .B #include .br /n/sourcesdump/2006/0211/plan9/sys/man/2/exec:14,26 - /n/sourcesdump/2006/0212/plan9/sys/man/2/exec:14,41 int execl(char *name, ...) .PP .B - long *_clock; - .PP - .B void **_privates; .PP .B int _nprivates; + .PP + .B + #include + .PP + .ft L + typedef struct Tos Tos; + struct Tos { + struct { ... } prof; /* profiling data */ + uvlong cyclefreq; /* cycle clock frequency */ + vlong kcycles; /* kernel cycles */ + vlong pcycles; /* process cycles (kernel + user) */ + ulong pid; /* process id */ + ulong clock; /* profiling clock */ + /* top of stack */ + }; + .PP + .B + extern Tos *_tos; .fi .SH DESCRIPTION .I Exec /n/sourcesdump/2006/0211/plan9/sys/man/2/exec:114,128 - /n/sourcesdump/2006/0212/plan9/sys/man/2/exec:129,134 (see .IR notify (2)). .PP - When the new program begins, the global cell - .B _clock - is set to the address of a cell that keeps approximate time - expended by the process at user level. - The time is measured in milliseconds but is updated at - a system-dependent lower rate. - This clock is typically used by the profiler but is available - to all programs. - .PP The global cell .B _privates points to an array of /n/sourcesdump/2006/0211/plan9/sys/man/2/exec:129,134 - /n/sourcesdump/2006/0212/plan9/sys/man/2/exec:135,162 .B _nprivates elements of per-process private data. This storage is private for each process, even if the processes share data segments. + .PP + When the new program begins, the global pointer + .B _tos + is set to the address of a structure + that holds information + allowing accurate time keeping and clock reading in user space. + If there is a user-space accessible fast clock (a processor + cycle counter), + .B cyclefreq + will be set to its frequency in Hz. + .B Kcycles + .RB ( pcycles ) + counts the number of cycles + this process has spent in kernel mode + (kernel and user mode). + .B Clock + is the user-profiling clock (see + .IR prof (1)). + Its time is measured in milliseconds but is updated at + a system-dependent lower rate. + This clock is typically used by the profiler but is available + to all programs. .PP The above conventions apply to C programs; the raw system interface to the new image is as follows: Use correct names. [rsc] --rw-rw-r-- M 771144 glenda sys 3442 Feb 11 09:16 sys/src/cmd/ip/snoopy/bootp.c /n/sourcesdump/2006/0211/plan9/sys/src/cmd/ip/snoopy/bootp.c:79,85 - /n/sourcesdump/2006/0212/plan9/sys/src/cmd/ip/snoopy/bootp.c:79,85 Mux *m; if(f->op == '='){ - compile_cmp(arp.name, f, p_fields); + compile_cmp(bootp.name, f, p_fields); return; } for(m = p_mux; m->name != nil; m++) [rsc] --rw-rw-r-- M 771144 glenda sys 3327 Feb 11 09:16 sys/src/cmd/ip/snoopy/gre.c [diffs elided - too long] [diff -c /n/sourcesdump/2006/0211/plan9/sys/src/cmd/ip/snoopy/gre.c /n/sourcesdump/2006/0212/plan9/sys/src/cmd/ip/snoopy/gre.c] [rsc] --rw-rw-r-- M 771144 glenda sys 2970 Feb 11 09:16 sys/src/cmd/ip/snoopy/icmp.c /n/sourcesdump/2006/0211/plan9/sys/src/cmd/ip/snoopy/icmp.c:73,79 - /n/sourcesdump/2006/0212/plan9/sys/src/cmd/ip/snoopy/icmp.c:73,79 p_compile(Filter *f) { if(f->op == '='){ - compile_cmp(udp.name, f, p_fields); + compile_cmp(icmp.name, f, p_fields); return; } if(strcmp(f->s, "ip") == 0){ [rsc] --rw-rw-r-- M 771144 glenda sys 2260 Feb 11 09:16 sys/src/cmd/ip/snoopy/il.c /n/sourcesdump/2006/0211/plan9/sys/src/cmd/ip/snoopy/il.c:54,60 - /n/sourcesdump/2006/0212/plan9/sys/src/cmd/ip/snoopy/il.c:54,60 Mux *m; if(f->op == '='){ - compile_cmp(udp.name, f, p_fields); + compile_cmp(il.name, f, p_fields); return; } for(m = p_mux; m->name != nil; m++) [rsc] --rw-rw-r-- M 771144 glenda sys 885 Feb 11 09:16 sys/src/cmd/ip/snoopy/mkfile /n/sourcesdump/2006/0211/plan9/sys/src/cmd/ip/snoopy/mkfile:11,16 - /n/sourcesdump/2006/0212/plan9/sys/src/cmd/ip/snoopy/mkfile:11,17 eapol\ eapol_key\ ether\ + gre\ hdlc\ icmp6\ icmp\ [rsc] --rw-rw-r-- M 771144 glenda sys 3602 Feb 11 09:16 sys/src/cmd/ip/snoopy/tcp.c /n/sourcesdump/2006/0211/plan9/sys/src/cmd/ip/snoopy/tcp.c:74,80 - /n/sourcesdump/2006/0212/plan9/sys/src/cmd/ip/snoopy/tcp.c:74,80 Mux *m; if(f->op == '='){ - compile_cmp(udp.name, f, p_fields); + compile_cmp(tcp.name, f, p_fields); return; } for(m = p_mux; m->name != nil; m++) Handle empty patterns correctly. [rsc] --rw-rw-r-- M 771144 glenda sys 21874 Feb 11 09:16 sys/src/cmd/replica/applylog.c /n/sourcesdump/2006/0211/plan9/sys/src/cmd/replica/applylog.c:68,73 - /n/sourcesdump/2006/0212/plan9/sys/src/cmd/replica/applylog.c:68,75 for(i=0; i 0) return cliError(usage); + n = cacheDirty(fsys->fs->cache); fsSync(fsys->fs); + consPrint("\t%s sync: wrote %d blocks\n", fsys->name, n); return 1; } [rsc] --rw-rw-r-- M 771144 rsc sys 43883 Feb 11 09:13 sys/src/cmd/fossil/cache.c [diffs elided - too long] [diff -c /n/sourcesdump/2006/0211/plan9/sys/src/cmd/fossil/cache.c /n/sourcesdump/2006/0212/plan9/sys/src/cmd/fossil/cache.c] [rsc] --rw-rw-r-- M 771144 rsc sys 29983 Feb 11 09:14 sys/src/cmd/fossil/file.c /n/sourcesdump/2006/0211/plan9/sys/src/cmd/fossil/file.c:894,900 - /n/sourcesdump/2006/0212/plan9/sys/src/cmd/fossil/file.c:894,900 f->dir.qidSpace = 1; f->dir.qidOffset = offset; f->dir.qidMax = max; - ret = fileMetaFlush2(f, nil); + ret = fileMetaFlush2(f, nil)>=0; fileMetaUnlock(f); fileUnlock(f); return ret; /n/sourcesdump/2006/0211/plan9/sys/src/cmd/fossil/file.c:965,986 - /n/sourcesdump/2006/0212/plan9/sys/src/cmd/fossil/file.c:965,986 return 1; } - void + int fileMetaFlush(File *f, int rec) { File **kids, *p; int nkids; - int i; + int i, rv; fileMetaLock(f); - fileMetaFlush2(f, nil); + rv = fileMetaFlush2(f, nil); fileMetaUnlock(f); if(!rec || !fileIsDir(f)) - return; + return rv; if(!fileLock(f)) - return; + return rv; nkids = 0; for(p=f->down; p; p=p->next) nkids++; /n/sourcesdump/2006/0211/plan9/sys/src/cmd/fossil/file.c:993,1002 - /n/sourcesdump/2006/0212/plan9/sys/src/cmd/fossil/file.c:993,1003 fileUnlock(f); for(i=0; idirty) - return 1; + return 0; if(oelem == nil) oelem = f->dir.elem; /n/sourcesdump/2006/0211/plan9/sys/src/cmd/fossil/file.c:1021,1027 - /n/sourcesdump/2006/0212/plan9/sys/src/cmd/fossil/file.c:1022,1028 fp = f->up; if(!sourceLock(fp->msource, -1)) - return 0; + return -1; /* can happen if source is clri'ed out from under us */ if(f->boff == NilBlock) goto Err1; /n/sourcesdump/2006/0211/plan9/sys/src/cmd/fossil/file.c:1090,1096 - /n/sourcesdump/2006/0212/plan9/sys/src/cmd/fossil/file.c:1091,1097 blockPut(b); Err1: sourceUnlock(fp->msource); - return 0; + return -1; } static int [rsc] --rw-rw-r-- M 771144 rsc sys 3228 Feb 11 09:14 sys/src/cmd/fossil/fns.h /n/sourcesdump/2006/0211/plan9/sys/src/cmd/fossil/fns.h:25,30 - /n/sourcesdump/2006/0212/plan9/sys/src/cmd/fossil/fns.h:25,31 Block* cacheAllocBlock(Cache*, int, u32int, u32int, u32int); void cacheFlush(Cache*, int); u32int cacheLocalSize(Cache*, int); + int cacheDirty(Cache*); int readLabel(Cache*, Label*, u32int addr); Block* blockCopy(Block*, u32int, u32int, u32int); [rsc] --rw-rw-r-- M 771144 rsc sys 4365 Feb 11 09:14 sys/src/cmd/fossil/fossil-acid /n/sourcesdump/2006/0211/plan9/sys/src/cmd/fossil/fossil-acid:66,77 - /n/sourcesdump/2006/0212/plan9/sys/src/cmd/fossil/fossil-acid:66,78 // try to say something intelligent about why a process is stuck. _pauses = { - "open", - "pread", - "pwrite", - "sleep", - "vtSleep", - "vtLock", + open, + pread, + pwrite, + sleep, + vtSleep, + vtLock, + vtRLock, }; defn deadlocklist(l) /n/sourcesdump/2006/0211/plan9/sys/src/cmd/fossil/fossil-acid:93,99 - /n/sourcesdump/2006/0212/plan9/sys/src/cmd/fossil/fossil-acid:94,102 stallframe = 0; stallname = ""; fossilframe = 0; + frame = {0}; while stk do { + lastframe = frame; frame = head stk; name = fmt(frame[0], 'a'); if !stallframe && match(name, _pauses) >= 0 then { /n/sourcesdump/2006/0211/plan9/sys/src/cmd/fossil/fossil-acid:106,111 - /n/sourcesdump/2006/0212/plan9/sys/src/cmd/fossil/fossil-acid:109,121 pfl(frame[1]); } if !fossilframe && regexp("^/sys/src/cmd/fossil/.*", pcfile(frame[0])) then { + if !stallframe then { + stallframe = lastframe; + stallname = fmt(lastframe[0], 'a'); + print("\tunexpected stall: ", stallname, "\n"); + if match(stallname, _pauses) >= 0 then + print("\t\t but it matches!\n"); + } fossilframe = frame; print("\t", fmt(frame[0], 'a'), "("); params(frame[2]); /n/sourcesdump/2006/0211/plan9/sys/src/cmd/fossil/fossil-acid:117,123 - /n/sourcesdump/2006/0212/plan9/sys/src/cmd/fossil/fossil-acid:127,133 print("\twaiting to lock block b=(Block)", *cacheLocalLookup:b\X, "\n"); if name == cacheLocal && stallname == vtSleep then print("\tsleeping on block b=(Block)", *cacheLocal:b\X, "\n"); - if name == blockFlush && stallname == vtSleep then + if name == blockWrite && stallname == vtSleep then print("\tsleeping on block b=(Block)", *blockFlush:b\X, "\n"); } stk = tail stk; /n/sourcesdump/2006/0211/plan9/sys/src/cmd/fossil/fossil-acid:127,134 - /n/sourcesdump/2006/0212/plan9/sys/src/cmd/fossil/fossil-acid:137,148 vtrendez(*vtSleep:q); if stallname == vtLock then vtlock(*vtLock:p); - if !stallframe || !fossilframe then - print("\tconfused\n"); + if !stallframe || !fossilframe then { + print("\tconfused:"); + if !stallframe then print(" stallframe?"); + if !fossilframe then print(" fossilframe?"); + print("\n"); + } print("\n"); } [rsc] --rw-rw-r-- M 771144 rsc sys 21572 Feb 11 09:14 sys/src/cmd/fossil/fs.c /n/sourcesdump/2006/0211/plan9/sys/src/cmd/fossil/fs.c:782,793 - /n/sourcesdump/2006/0212/plan9/sys/src/cmd/fossil/fs.c:782,795 static void fsMetaFlush(void *a) { + int rv; Fs *fs = a; vtRLock(fs->elk); - fileMetaFlush(fs->file, 1); + rv = fileMetaFlush(fs->file, 1); vtRUnlock(fs->elk); - cacheFlush(fs->cache, 0); + if(rv > 0) + cacheFlush(fs->cache, 0); } static int [rsc] --rw-rw-r-- M 771144 rsc sys 1581 Feb 11 09:14 sys/src/cmd/fossil/fs.h /n/sourcesdump/2006/0211/plan9/sys/src/cmd/fossil/fs.h:49,55 - /n/sourcesdump/2006/0212/plan9/sys/src/cmd/fossil/fs.h:49,55 File *fileIncRef(File*); int fileDecRef(File*); int fileIsRoot(File*); - void fileMetaFlush(File*, int); + int fileMetaFlush(File*, int); int fileSetQidSpace(File*, u64int, u64int); int fileTruncate(File*, char*); int fileIsRoFs(File*); [rsc] --rw-rw-r-- M 771144 rsc sys 2640 Feb 11 09:14 sys/src/cmd/fossil/mkfile /n/sourcesdump/2006/0211/plan9/sys/src/cmd/fossil/mkfile:61,80 - /n/sourcesdump/2006/0212/plan9/sys/src/cmd/fossil/mkfile:61,102 slay 8.flfmt | rc slay 8.fossil | rc unmount /n/fossil || status='' - {syscall seek 1 64000000 0; echo} >>/tmp/fossil + 9fs emelieother + bind -c /n/emelieother/rsc/tmp /tmp + {syscall seek 1 6400000000 0; echo} >>/tmp/fossil 8.flfmt -y /tmp/fossil 8.conf -w /tmp/fossil flproto - 8.fossil -f /tmp/fossil && mount -c /srv/test.fossil /n/fossil + 8.fossil -f /tmp/fossil + cat /srv/test.fscons & + echo fsys main >>/srv/test.fscons + mount /srv/test.fossil /n/fossil + cd /n/fossil/tmp + dd -bs 1048576 -count 256 -if /dev/zero -of a + rm a + echo sync >>/srv/test.fscons + echo sync >>/srv/test.fscons + echo sync >>/srv/test.fscons + sleep 1 + echo sync >>/srv/test.fscons + sleep 1 + echo sync >>/srv/test.fscons + sleep 1 + echo sync >>/srv/test.fscons + echo check >>/srv/test.fscons + echo check >>/srv/test.fscons + echo check >>/srv/test.fscons + + # cp /env/timezone /n/fossil/tmp # cp /lib/words /n/fossil/tmp - dircp /sys/src/cmd/aux /n/fossil/tmp - chmod +t /n/fossil/tmp/lis - echo SHOULD NOT SEE THIS >>/n/fossil/tmp/lis - echo snap -a >>/srv/test.fscons - sleep 2 - mount /srv/test.fossil /n/dump main/archive - cat /n/dump/*/*/tmp/lis - + # dircp /n/sources/plan9/sys/src/cmd/aux /n/fossil/tmp + # >/n/fossil/tmp/lis + # chmod +t /n/fossil/tmp/lis + # echo SHOULD NOT SEE THIS >>/n/fossil/tmp/lis + # echo snap >>/srv/test.fscons + # sleep 2 + # mount /srv/test.fossil /n/dump main/archive + # cat /n/dump/*/*/tmp/lis # @{cd /n/fossil/tmp && time tar xTf /sys/src/cmd/fossil/test.tar} # unmount /n/fossil # rm /srv/fossil Add ping -f. [rsc] --rw-rw-r-- M 771144 glenda sys 3489 Feb 11 09:12 sys/man/8/ping /n/sourcesdump/2006/0211/plan9/sys/man/8/ping:4,10 - /n/sourcesdump/2006/0212/plan9/sys/man/8/ping:4,10 .SH SYNOPSIS .B ping [ - .B -alq + .B -aflq ] [ .B -i .I interval /n/sourcesdump/2006/0211/plan9/sys/man/8/ping:73,78 - /n/sourcesdump/2006/0212/plan9/sys/man/8/ping:73,81 .TP .B a adds the IP source and destination addresses to each report. + .TP + .B f + send messages as fast as possible (flood). .TP .B i sets the time between messages [rsc] --rw-rw-r-- M 771144 glenda sys 5708 Feb 11 09:12 sys/src/cmd/ip/ping.c /n/sourcesdump/2006/0211/plan9/sys/src/cmd/ip/ping.c:67,72 - /n/sourcesdump/2006/0212/plan9/sys/src/cmd/ip/ping.c:67,73 vlong sum; ushort firstseq; int addresses; + int flood; void usage(void); void lost(Req*, Icmp*); /n/sourcesdump/2006/0211/plan9/sys/src/cmd/ip/ping.c:93,98 - /n/sourcesdump/2006/0212/plan9/sys/src/cmd/ip/ping.c:94,100 Req **l, *r; lock(&listlock); + last = nil; for(l = &first; *l; ){ r = *l; /n/sourcesdump/2006/0211/plan9/sys/src/cmd/ip/ping.c:110,116 - /n/sourcesdump/2006/0212/plan9/sys/src/cmd/ip/ping.c:112,118 if(r->replied == 0) lost(r, ip); free(r); - } else { + }else{ last = r; l = &(r->next); } /n/sourcesdump/2006/0211/plan9/sys/src/cmd/ip/ping.c:147,152 - /n/sourcesdump/2006/0212/plan9/sys/src/cmd/ip/ping.c:149,156 hnputs(ip->seq, seq); r->seq = seq; r->next = nil; + r->replied = 0; + r->time = nsec(); /* avoid early free in reply! */ lock(&listlock); if(first == nil) first = r; /n/sourcesdump/2006/0211/plan9/sys/src/cmd/ip/ping.c:154,160 - /n/sourcesdump/2006/0212/plan9/sys/src/cmd/ip/ping.c:158,163 last->next = r; last = r; unlock(&listlock); - r->replied = 0; r->time = nsec(); if(write(fd, ip, msglen) < msglen){ fprint(2, "%s: write failed: %r\n", argv0); /n/sourcesdump/2006/0211/plan9/sys/src/cmd/ip/ping.c:261,272 - /n/sourcesdump/2006/0212/plan9/sys/src/cmd/ip/ping.c:264,278 case 'r': rint = 1; break; + case 'f': + flood = 1; + break; } ARGEND; if(msglen < 32) msglen = 64; if(msglen >= 65*1024) msglen = 65*1024-1; - if(interval <= 0) + if(interval <= 0 && !flood) interval = SLEEPMS; if(argc < 1) Various mmu cleanups. [rsc] --rw-rw-r-- M 771144 glenda sys 55143 Feb 11 09:13 sys/src/9/pc/sd53c8xx.c /n/sourcesdump/2006/0211/plan9/sys/src/9/pc/sd53c8xx.c:1941,1948 - /n/sourcesdump/2006/0212/plan9/sys/src/9/pc/sd53c8xx.c:1941,1946 return r->status = status; } - #define vpt ((ulong*)VPT) - #define VPTX(va) (((ulong)(va))>>12) static void cribbios(Controller *c) { [rsc] --rw-rw-r-- M 771144 rsc sys 2678 Feb 11 09:10 sys/src/9/pc/realmode.c /n/sourcesdump/2006/0211/plan9/sys/src/9/pc/realmode.c:28,33 - /n/sourcesdump/2006/0212/plan9/sys/src/9/pc/realmode.c:28,34 realmode(Ureg *ureg) { int s; + ulong cr3; extern void realmode0(void); /* in l.s */ extern void i8259off(void), i8259on(void); /n/sourcesdump/2006/0211/plan9/sys/src/9/pc/realmode.c:42,47 - /n/sourcesdump/2006/0212/plan9/sys/src/9/pc/realmode.c:43,49 s = splhi(); m->pdb[PDX(0)] = m->pdb[PDX(KZERO)]; /* identity map low */ + cr3 = getcr3(); putcr3(PADDR(m->pdb)); i8259off(); realmode0(); /n/sourcesdump/2006/0211/plan9/sys/src/9/pc/realmode.c:51,59 - /n/sourcesdump/2006/0212/plan9/sys/src/9/pc/realmode.c:53,61 * Don't turn interrupts on before the kernel is ready! */ i8259on(); - putcr3(m->tss->cr3); } m->pdb[PDX(0)] = 0; /* remove low mapping */ + putcr3(cr3); splx(s); *ureg = realmoderegs; unlock(&rmlock); [rsc] --rw-rw-r-- M 771144 glenda sys 23014 Feb 11 09:13 sys/src/9/port/devcons.c /n/sourcesdump/2006/0211/plan9/sys/src/9/port/devcons.c:289,300 - /n/sourcesdump/2006/0212/plan9/sys/src/9/port/devcons.c:289,300 va_start(arg, fmt); n = vseprint(buf+strlen(buf), buf+sizeof(buf), fmt, arg) - buf; va_end(arg); - buf[n] = '\n'; - uartputs(buf, n+1); + iprint("%s\n", buf); if(consdebug) (*consdebug)(); spllo(); prflush(); + buf[n] = '\n'; putstrn(buf, n+1); dumpstack(); [rsc] --rw-rw-r-- M 771144 glenda sys 3200 Feb 11 09:09 sys/src/9/port/qlock.c /n/sourcesdump/2006/0211/plan9/sys/src/9/port/qlock.c:19,27 - /n/sourcesdump/2006/0212/plan9/sys/src/9/port/qlock.c:19,27 Proc *p; if(m->ilockdepth != 0) - print("qlock: %lux: ilockdepth %d", getcallerpc(&q), m->ilockdepth); + print("qlock: %lux: ilockdepth %d\n", getcallerpc(&q), m->ilockdepth); if(up != nil && up->nlocks.ref) - print("qlock: %lux: nlocks %lud", getcallerpc(&q), up->nlocks.ref); + print("qlock: %lux: nlocks %lud\n", getcallerpc(&q), up->nlocks.ref); if(q->use.key == 0x55555555) panic("qlock: q %p, key 5*\n", q); [rsc] --rw-rw-r-- M 771144 glenda sys 6236 Feb 11 13:09 sys/src/9/pc/i8253.c /n/sourcesdump/2006/0211/plan9/sys/src/9/pc/i8253.c:201,207 - /n/sourcesdump/2006/0212/plan9/sys/src/9/pc/i8253.c:201,207 period = want - now; if(period < MinPeriod) period = MinPeriod; - else if(period > (4*MaxPeriod)/5) /* strong attraction to MaxPeriod */ + else if(period > MaxPeriod) period = MaxPeriod; } Avoid unnecessary memory usage. [rsc] --rw-rw-r-- M 771144 rsc sys 10919 Feb 11 09:15 sys/src/cmd/aux/disksim.c /n/sourcesdump/2006/0211/plan9/sys/src/cmd/aux/disksim.c:246,252 - /n/sourcesdump/2006/0212/plan9/sys/src/cmd/aux/disksim.c:246,252 uint i0, i1, i2; vlong oaddr; - if(fd) + if(fd >= 0) alloc = 1; addr >>= LOGBLKSZ; Make man page lookup case-insensitive. [rsc] --rw-rw-r-- M 771144 glenda sys 9069 Feb 11 09:15 sys/src/cmd/ip/httpd/man2html.c /n/sourcesdump/2006/0211/plan9/sys/src/cmd/ip/httpd/man2html.c:162,167 - /n/sourcesdump/2006/0212/plan9/sys/src/cmd/ip/httpd/man2html.c:162,175 } void + strlwr(char *p) + { + for(; *p; p++) + if('A' <= *p && *p <= 'Z') + *p += 'a'-'A'; + } + + void redirectto(char *uri) { if(connect){ /n/sourcesdump/2006/0211/plan9/sys/src/cmd/ip/httpd/man2html.c:313,323 - /n/sourcesdump/2006/0212/plan9/sys/src/cmd/ip/httpd/man2html.c:321,340 p = strstr(uri, "/intro"); if(p == nil){ + while(*uri == '/') + uri++; /* redirect section requests */ snprint(file, sizeof(file), "/sys/man/%s", uri); d = dirstat(file); - if(d == nil) + if(d == nil){ + strlwr(file); + if(dirstat(file) != nil){ + snprint(file, sizeof(file), "/magic/man2html/%s", uri); + strlwr(file); + redirectto(file); + } error(uri, "man page not found"); + } x = d->qid.type; free(d); if(x & QTDIR){ Fix usage. [rsc] --rw-rw-r-- M 771144 glenda sys 2257 Feb 11 15:33 sys/man/1/grep /n/sourcesdump/2006/0211/plan9/sys/man/1/grep:8,18 - /n/sourcesdump/2006/0212/plan9/sys/man/1/grep:8,18 ] [ .B -e + ] .I pattern - [ + | .B -f .I patternfile - ] [ .I file ... ] [rsc] --rw-rw-r-- M 771144 glenda sys 2257 Feb 11 15:33 sys/man/1/grep Fix man page formatting. [rsc] --rw-rw-r-- M 771144 glenda sys 4368 Feb 11 11:05 sys/man/1/2l /n/sourcesdump/2006/0211/plan9/sys/man/1/2l:73,79 - /n/sourcesdump/2006/0212/plan9/sys/man/1/2l:73,79 explicitly so it will be read a second time. .PP The loader options are: - .TP 1i + .TP 0.75i .B -l (As a bare option.) Suppress the default loading of the startup linkage and libraries /n/sourcesdump/2006/0211/plan9/sys/man/1/2l:115,124 - /n/sourcesdump/2006/0212/plan9/sys/man/1/2l:115,121 under .BR -p ). .TP - .B -x - [ - .I file - ] + .BI -x " [ file ]" Produce an export table in the executable. The optional .I file /n/sourcesdump/2006/0211/plan9/sys/man/1/2l:126,135 - /n/sourcesdump/2006/0212/plan9/sys/man/1/2l:123,129 See .IR dynld (2). .TP - .B -u - [ - .I file - ] + .BI -u " [ file ]" Produce an export table, import table and a dynamic load section in the executable. The optional Not needed anymore. [rsc] --rw-rw-r-- M 771144 glenda sys 2667 Feb 11 15:38 sys/src/ape/lib/ap/syscall/mkfile /n/sourcesdump/2006/0211/plan9/sys/src/ape/lib/ap/syscall/mkfile:1,6 - /n/sourcesdump/2006/0212/plan9/sys/src/ape/lib/ap/syscall/mkfile:1,5 NPROC=1 name; p++)