| Thread overview |
|---|
March 04, 2008 Re: Tango FileRoots | ||||
|---|---|---|---|---|
| ||||
Jesse Phillips Wrote:
> On Sun, 02 Mar 2008 17:02:33 -0500, Ty Tower wrote:
>
> > Lars Ivar Igesund Wrote:
> >
> >> Jesse Phillips wrote:
> >>
> >> > I'm interested in knowing why FileRoots.list() uses /etc/mtab for its root folders in linux? To my knowledge Linux only has one root and if anything its sub directories would be considered the roots. I just don't see the point of using mtab, but then again I'm looking at it from how file managers look at the system.
> >>
> >> The unix root / isn't the most useful thing to ask for, thus mtab is used to show all mounted devices.
> >>
> >> --
> >> Lars Ivar Igesund
> >> blog at http://larsivi.net
> >> DSource, #d.tango & #D: larsivi
> >> Dancing the Tango
> >
> > ftab mounts the original devices and empowers them mtab looks after the devices added later ie plugging in the usb stick or something like that
> >
> > is the file used in that sort of context?
>
> it can't, it reads the file when called, so it will only get already mounted devices, a file change listener of some sort would have to be created to track later mounted devices.
>
> For me must of the mounted items in mtab are useless, but it can be easily version'd out as needed.
Probably should add (perhaps you already know)
/etc/fstab Lists the filesystems mounted automatically at startup by the mount -a command (in /etc/rc or equivalent startup file).
/etc/mtab A list of currently mounted file systems. Setup by boot scripts and updated by the mount command.
So if you want a list of what's mounted right now mtab is the place to go
| ||||
March 04, 2008 Re: Tango FileRoots | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Ty Tower | Reply to ty,
> So if you want a list of what's mounted right now mtab is the place to
> go
>
isn't there something in /proc that grovels in the kernel? I would rather get info from the kernel than a state file updated by some apps. (I don't have a *nux box handy to try with)
| |||
March 04, 2008 Re: Tango FileRoots | ||||
|---|---|---|---|---|
| ||||
Ty Tower wrote: > BCS wrote: > > >>Reply to ty, >>isn't there something in /proc that grovels in the kernel? I would >>rather get info from the kernel than a state file updated by some >>apps. (I don't have a *nux box handy to try with) > > > Heh heh ! This is classic . Pardon my humorous response. When we > grovel in the dirt we get down and dirty lying and squirming in the > dirt. > > I don't know but you probably are saying that there is something in > the kernel that returns that information as well. Now that I have a Linux box handy... take a look at the /proc/mounts file. Mine gives this: $ cat /proc/mounts rootfs / rootfs rw 0 0 /dev/root / ext3 rw 0 0 /proc /proc proc rw 0 0 usbdevfs /proc/bus/usb usbdevfs rw 0 0 none /dev/pts devpts rw 0 0 none /dev/shm tmpfs rw 0 0 IIRC this is a file in a "fileystem" that is actually a device for reading kernel and system state. This reflects the actual current state of the system, not the last thing written to some file. > I can't say . I am > not that familiar with the kernel but my understanding is > that /etc/mtab is updated by the kernel as each device is added or > removed instantly. Potentially someone could over wright /etc/mtab with junk. Not likely but... > I don't think any applications act on it except > maybe Hal. > > And did you mean "*nix" as Unix/Linux box ,I think so > yup | ||||
March 04, 2008 Re: Tango FileRoots | ||||
|---|---|---|---|---|
| ||||
Posted in reply to BCS | On Tue, Mar 4, 2008 at 7:04 AM, BCS <ao@pathlink.com> wrote:
> isn't there something in /proc that grovels in the kernel? I would rather
> get info from the kernel than a state file updated by some apps. (I don't
> have a *nux box handy to try with)
On Linux, sure. But that wouldn't be portable at all, /proc is quite Linux-specific.
Anders
| |||
March 04, 2008 Re: Tango FileRoots | ||||
|---|---|---|---|---|
| ||||
Posted in reply to BCS | BCS Wrote:
> Now that I have a Linux box handy...
>
> take a look at the /proc/mounts file. Mine gives this:
>
> $ cat /proc/mounts
> rootfs / rootfs rw 0 0
> /dev/root / ext3 rw 0 0
> /proc /proc proc rw 0 0
> usbdevfs /proc/bus/usb usbdevfs rw 0 0
> none /dev/pts devpts rw 0 0
> none /dev/shm tmpfs rw 0 0
>
> IIRC this is a file in a "fileystem" that is actually a device for reading kernel and system state. This reflects the actual current state of the system, not the last thing written to some file.
>
> > I can't say . I am
> > not that familiar with the kernel but my understanding is
> > that /etc/mtab is updated by the kernel as each device is added or
> > removed instantly.
>
> Potentially someone could over wright /etc/mtab with junk. Not likely but...
>
> > I don't think any applications act on it except
> > maybe Hal.
> >
> > And did you mean "*nix" as Unix/Linux box ,I think so
> >
>
> yup
Good stuff - I am learning each day Thanks
| |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply