[Toybox] Integration of SMACK

José Bollo jobol at nonadev.net
Mon May 4 02:22:28 PDT 2015


Le jeudi 30 avril 2015 à 11:51 -0500, Rob Landley a écrit :
> On 04/30/2015 08:14 AM, José Bollo wrote:
> > Le jeudi 30 avril 2015 à 14:49 +0200, José Bollo a écrit :
> > 
> >> I'm working on your proposal and will soon produce a submission. The
> >> current difficulty is that calling "dirtree_parentfd(dt)" is currently
> >> not reliable. I'm still working on... Result in few minutes.
> > 
> > See https://github.com/jobol/toybox/tree/smack-6
> 
> I'll take a look.
> 
> > I had to pass the dirfd as parameter to zmack and entrylen.
> 
> We're passing the dirtree pointer as an argument to zmack and entrylen,
> so presumably it can call dirtree_parentfd() on that dirtree pointer in
> the function.
> 
> > Tentatives
> > to use the data field of dirtrees weren't successful.
> 
> We're already using the data field, ls.c line 282:
> 
> // Read directory contents. We dup() the fd because this will close it.
> indir->data = dup(dirfd);
> dirtree_recurse(indir, filter, (flags&FLAG_L) ? DIRTREE_SYMFOLLOW : 0);

Hi,

Am I blacklisted ? I did not receive any messages after this one! I had
to check the archives...

About the use of dirtree_parentfd(), it is only valid within the call to
dirtree_recurse() because last lines of this function are:

  closedir(dir);
  node->data = -1;

But from the implementation of ls, it is easy to see that it is not the
case here. dirtree_recurse is called to list entries, not more.

You can not use fgetxattr on a file opened with 0_PATH. Then O_READ is
needed and it implies the use of O_NOATIME.

The combination of options -ffunction-sections -fdata-sections and
--gc-sections is great and to be known thank for the hint.

About casting 64 bit integers to 32 bit integers explicitely, it is a
mater of quality, not only of feeling. The opposite conversion is safe
because any 32 bit integer has a 64 bit integer value. But converting a
64 bit integer to a 32 bit integer may be not possible (in theoritically
2^32-1 cases on 2^32 -a detail?-). So making the cast explicitely is
better and in most cases avoids a compiler warning.

About spaces. The question is the following: make a ls and then resize
the terminal to have just on column less than what is printed and you
will see that ls doesn't resize well: it doesn't count the interleved
spaces. Jan had well improved ls on this issue.

Best regards
Jose


 1430731348.0


More information about the Toybox mailing list