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; }
| David Miller | Slow DOWN, please!!! |
| KAMEZAWA Hiroyuki | Re: 2.6.22-rc1-mm1 |
| Steven Rostedt | [RFC PATCH 1/3] Unified trace buffer |
| Steven Rostedt | [RFC PATCH 0/6] Convert all tasklets to workqueues |
git: | |
| Peter Klavins | Re: CRLF problems with Git on Win32 |
| J. Bruce Fields | Re: Git User's Survey 2007 unfinished summary continued |
| Linus Torvalds | Re: VCS comparison table |
| Junichi Uekawa | Re: [ANNOUNCE] GIT 1.5.4 |
| Arjan van de Ven | Re: [GIT]: Networking |
| Rémi | [PATCH 0/6] [RFC] Phonet pipes protocol (v2) |
| Jarek Poplawski | Re: [PATCH] pkt_sched: Destroy gen estimators under rtnl_lock(). |
| Jozsef Kadlecsik | Re: TCP connection stalls under 2.6.24.7 |
| Richard Stallman | Real men don't attack straw men |
| Rogier Krieger | Re: bcw(4) is gone |
| Leon Dippenaar | New tcp stack attack |
| Brandon Lee | DELL PERC 5iR slow performance |
| high memory | 6 hours ago | Linux kernel |
| semaphore access speed | 9 hours ago | Applications and Utilities |
| the kernel how to power off the machine | 10 hours ago | Linux kernel |
| Easter Eggs in windows XP | 12 hours ago | Windows |
| Shared swap partition | 13 hours ago | Linux general |
| Root password | 14 hours ago | Linux general |
| Where/when DNOTIFY is used? | 15 hours ago | Linux kernel |
| How to convert Linux Kernel built-in module into a loadable module | 18 hours ago | Linux kernel |
| Linux 2.6.24 and I/O schedulers | 18 hours ago | Linux kernel |
| USB Driver -- Interrupt Polling -- A Little Help Please | 1 day ago | Linux general |
