[Toybox] [CLEANUP] stat: Some cleanup

Felix Janda felix.janda at posteo.de
Sun Apr 21 14:40:16 PDT 2013


On 04/21/13 at 12:09am, Rob Landley wrote:
> On 04/19/2013 05:28:27 PM, Felix Janda wrote:
> > [snip]
> > The functionality of get_access_str() is also implemented in the ls  
> > toy
> > (likely much better). Should something like it be in the library?
> 
> Once code can be shared by a second command, putting it in lib makes  
> sense.
> 
> > Actually since stat and ls are both frontends to the stat system call
> > more is duplicated.
> 
> If you can come up with a clean way to share the code, go for it.

Ok, actually I'd only put something like get_access_str() of stat into
the lib.

> I note that I have a pending todo item in ls: ls -l /dev/null doesn't  
> show the major/minor numbers. (Oops. Needs another output mode for  
> device nodes. If I did one, it's not triggering right...)

Ok.

> > I also wonder whether toybox will ever have SELinux support... My  
> > local
> > man page does even not document the -Z option to stat.
> 
> I'm leaning against it. If you saw my toybox talk at ELC (it's on  
> youtube) I talked about security approaches and containers vs selinux.

I anticipated that (and read your outline and skimmed the video). So it
would be ok to remove the SELinux parts from the command (which anyway
only say that they are not implemented)?

Removing these the only thing that "Needs to be implemented" is "%T" for
file systems i.e. file system type in human readable form. So to
implement this one would need to find names for the magic numbers in
linux/magic.h.

(Interesting:

#define XENFS_SUPER_MAGIC       0xabba1974

But fortunately no deadbeef.)

Should "%T" be implemented?

Apart from this I think everything using only the information from
stat/statfs should be implemented (like %t %T for devices). Then there
are %w and %W, which regard file birth time, and for which one would
need an xstat system call... (

https://lwn.net/Articles/397442/

says something about file birth times and links to an article on xstat.)

Felix

 1366580416.0


More information about the Toybox mailing list