Messages in this thread | | | Date | Mon, 20 Sep 2004 14:11:54 +0200 | From | DervishD <> | Subject | Re: OOM & [OT] util-linux-2.12e |
| |
Hi Paulo :)
* Paulo Marques <pmarques@grupopie.com> dixit: > >>>>- fix all broken apps that still rely on mtab. like GNU df(1) > >>>df does not rely on /etc/mtab. It relies on getmntent. > >> Then my GNU df has any problem :??? > >No, if any then getmntent. > I don't get this. From "man getmntent" it seems that getmntent is just a > parser for /etc/mtab, and that you must call "setmntent" with the > filename you want to parse.
From the code of coreutils 5.2.1, lib/mountlist.c, df uses the default name for the mounted filesystems table. Under glibc, it uses _PATH_MOUNTED that is, effectively, "/etc/mtab". BTW, 'MOUNTED' is shown in glibc headers as a deprecated alias.
> So if you do "setmntent("/etc/mtab",...)" you're explicitly saying > that you want getmntent to use /etc/mtab. This is just a open/read > in disguise. > Am I missing something?
Maybe: df (well, lib/mountlist.c) shouldn't try to 'detect' which kernel are you running, if one with /etc/mtab or a newer one that only supports /proc/mounts (which needs procfs support, BTW, and that can be a problem too). Is glibc who should do all that, and try to open /etc/mtab and /proc/mounts, in that order. Being a userspace app, df should not mess with kernel interface changes. In the worst case, it *could* try to open /etc/mtab (with setmntent, I mean) and if that fails, open /proc/mounts if the operating system is Linux (which can be easily decided at './configure' time).
I'm really not sure about what should be fixed. IMHO, getmntent should only try to open _PATH_MOUNTED. Any other desired behaviour should be set using setmntent. Just my 0,02 EUR.
Raúl Núñez de Arenas Coronado
-- Linux Registered User 88736 http://www.pleyades.net & http://raul.pleyades.net/ - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |