Theodore Ts'o: "Re: cc1 fails silently" (Dec 4, 21:13):It does seem so, but always remeber that du doesn't count blocks exactly: it uses a heuristic algorithm that doesn't work on sparse files etc. I'd still check the filesystem - that's the most likely problem. And then over to happier things: here's sources to mount and umount, as corsini wanted something that keeps track of mounted devices, and as I couldn't find anything more interesting to do I just hacked these together . These versions keep the file "/etc/mtab" up-to-date, just like real mount/umount should do. You can certainly confuse them, but they are a bit better than nothing. This is a 1/2 hour hack, so don't expect wonders, but my limited testing hasn't shown any problems yet. /etc/mtab will later be needed for "df", but as ustat isn't implemented yet, df won't work. Oh well. Meanwhile you can get mount-info by "cat /etc/mtab". Linus ---- mount.c ---------------- #include <stdio.h> #include <errno.h> #include <unistd.h> #include <fcntl.h> #define TAB_FILE "/etc/mtab" #define LOCK_FILE "/etc/mtab~" int tab = -1; int lock = -1; volatile void die(void) { if (lock >= 0) unlink(LOCK_FILE); exit(1); } main(int argc, char ** argv) { int i; char buffer[1024]; if (argc !=3) { fprintf(stderr,"mount: usage: mount dev dir\n"); die(); } lock = open(LOCK_FILE,O_CREAT | O_EXCL,0644); if (lock < 0) { fprintf(stderr,"mount: unable to open lock-file\n"); die(); } chmod(LOCK_FILE,0644); tab = open(TAB_FILE,O_RDONLY); if (mount(argv[1],argv[2],0)) { fprintf(stderr,"mount: error %d\n",errno); die(); } if (tab >= 0) while ((i=read(tab,buffer,1024))>0) write(lock,buffer,i); i=strlen(argv[1]); argv[1][i]=' '; write(lock,argv[1],i+1); i=strlen(argv[2]); argv[2][i]='\n'; write(lock,argv[2],i+1); unlink(TAB_FILE); link(LOCK_FILE,TAB_FILE); unlink(LOCK_FILE); return 0; } ----- umount.c --------------- #include <stdio.h> #include <errno.h> #include <unistd.h> #include <fcntl.h> #define TAB_FILE "/etc/mtab" #define LOCK_FILE "/etc/mtab~" #define CHECK 0 #define WRITE 1 #define NOWRITE 2 int tab = -1; int lock = -1; static int read_char(void) { static char buffer[1024]; static int i=0; static int pos=0; if (tab < 0) return -1; if (pos == i) { i = read(tab,buffer,1024); pos = 0; } if (i <= 0) return -1; return (unsigned) buffer[pos++]; } static void write_char(int c) { static char buffer[1024]; static int i=0; if (c<0) { if (i) write(lock,buffer,i); i = 0; return; } buffer[i++] = c; if (i<1024) return; write(lock,buffer,i); i=0; } volatile void die(void) { if (lock >= 0) unlink(LOCK_FILE); exit(1); } main(int argc, char ** argv) { int c,i,len; int state; if (argc != 2) { fprintf(stderr,"umount: usage: umount dev\n"); die(); } lock = open(LOCK_FILE,O_CREAT | O_EXCL,0600); if (lock < 0) { fprintf(stderr,"umount: unable to open lock-file\n"); die(); } tab = open(TAB_FILE,O_RDONLY); if (umount(argv[1])) { fprintf(stderr,"umount: error %d\n",errno); die(); } len = strlen(argv[1]); state = CHECK; i = 0; do { c = read_char(); if (state==CHECK && !argv[1][i] && (c==' ' || c=='\n')) state=NOWRITE; if (c=='\n') { if (state != NOWRITE) write_char(c); state = CHECK; i = 0; continue; } if (state == NOWRITE) continue; if (state == WRITE) { write_char(c); continue; } if (c == argv[1][i]) i++; else { for (state=0 ; state<i ;state++) write_char((unsigned)argv[1][state]); state = WRITE; i = 0; write_char(c); } } while (c >= 0); write_char(-1); unlink(TAB_FILE); link(LOCK_FILE,TAB_FILE); unlink(LOCK_FILE); return 0; }
| Greg Kroah-Hartman | [PATCH 004/196] Chinese: add translation of SubmittingPatches |
| Amit K. Arora | [RFC] Heads up on sys_fallocate() |
| Laurent Riffard | Re: 2.6.25-rc2-mm1: WARNING at arch/x86/mm/ioremap.c:129 |
| Alan Cox | Re: x86: 4kstacks default |
| Jarek Poplawski | Re: [PATCH] pkt_sched: Destroy gen estimators under rtnl_lock(). |
| Gerrit Renker | [PATCH 34/37] dccp: Auto-load (when supported) CCID plugins for negotiation |
| Maciej W. Rozycki | Re: [PATCH] PHYLIB: IRQ event workqueue handling fixes |
| John P Poet | Realtek 8111C transmit timed out |
git: | |
