[Toybox] ls implementation

Rob Landley rob at landley.net
Mon Feb 20 16:38:10 PST 2012


On 02/15/2012 01:22 PM, Andre Renaud wrote:
>> Attached is a patch that adds support for having files on the command
>> line (as well as directories), and -R support.
> 
> Replying to myself - attached is an updated patch that includes the -R
> support, and adds in -n support.

Catching up, I already merged your earlier submission adding some of
this stuff, this patch doesn't apply cleanly on top of that one.  Could
you send me a version that applies to the current tree, please?

> I also noticed that it had grief with files > 2GB, so I've added #define
> _FILE_OFFSET_BITS 64 - is there a policy on this?

Not yet, but given that such files are pretty ubiquitous these days (yes
even on small systems, my Nexus One could take a 32 gig SD card), we
probably need it.

> I assume that adding
> this drags in quite a few extra libC dependencies, which may not be
> desired.

It's not so much the libc dependencies as forcing 32 bit systems to do
64 bit math for a common operation.  That said, I have no idea what
bionic does with this: it might not support it.  (I really need to get a
bionic toolchain installed on my netbook.  This is going to require more
than 3 gigabytes free space, isn't it...)

I have a file lib/portability.h which exists to hold the horrible #ifdef
stack for supporting multiple platforms.  Anything we can hide in there
and not worry the rest of the codebase about, I'm happy to do to support
multiple targets.  So macosx, bionic, bsd, you name it: if it fits
tidily in there inside its own #ifdef block have at.

Differences that we _can't_ hide away inside a header devoted to being
ugly, that's another matter and we can burn that bridge when we come to
it...

> Should there be a global config option to enable 64-bit file
> operations?

I doubt it.  On 64 bit targets it's more or less free, and on 32 bit
targets that _can_ support it the libc parts are already there so using
them isn't a huge deal.  Yeah it's a size hit, but in 2012 the 2 gig
file size limitation is no longer acceptable.

What I'm worried about is a build break, but if it _does_ cause a build
break then it's easy to add another config symbol and configure-time
test the way it's conditionally chopping out unshare right now.

  http://landley.net/hg/toybox/rev/426

(Even when cross-compiling, I don't have to run the resulting code to
see if it _compiles_...)

Rob

 1329784690.0


More information about the Toybox mailing list