Le 06/09/2012 08:01, Alexander Burger a écrit :
Hi Laurent,

back to your original mail:

By the way, if anyone know what lib to use for (native) to make a
lstat syscall so I can replace the stat shell call, I'd be very
grateful: I can't find where it is! (contrary to what I thought, it
is NOT in libc...)

It seems the internal symbol is '__xstat'.

From "/usr/include/x86_64-linux-gnu/sys/stat.h":

    __extern_inline int
    __NTH (stat (__const char *__path, struct stat *__statbuf))
    {
      return __xstat (_STAT_VER, __path, __statbuf);
    }

That's a pity, because it makes it rather unportable.



So... If I need more speed, I'll have to make a C lib calling lstat, then call this one with (native)... I think I'll stay with the shell call ;-)


BTW, instead of using 'line', 'split' and 'pack' in

(de stat (Path)
    (mapcar pack
       (split
          (in
             (list "stat" "-c" "%f %s %u %g %h %i %X %Y %Z" Path)
             (line) )
          " " ) ) )

and later parsing it with 'hex' and 'format', you could read it
directly:

(in (list "stat" "-c" "%f %s %u %g %h %i %X %Y %Z" Path)
    (make
       (link (hex (till " "))
       (do 8
          (link (read)) ) ) ) )


Thanks for this! I intended to replace the call to (multimap) when I discovered that I had only one (hex) to call...

Regards,
--
Laurent ARTAUD (laurent.art...@free.fr)
--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to