in reply to using Linux getdents syscall

The simplest thing to do is to compile the C program and run it from your Perl program. Use qx(), or open my $pipe, '-|', '/your/c/program', and just read its output. Unless I'm missing something, I don't see any reason to use Perl's syscall, unpack structs, allocate buffers and do other complicated things.

Replies are listed 'Best First'.
Re^2: using Linux getdents syscall
by afoken (Chancellor) on Nov 24, 2015 at 07:00 UTC

    So, you think that starting an external process just to list directories has LESS overhead than opendir/readdir/closedir? Sorry, but that is nonsense! See Re: using Linux getdents syscall

    Alexander

    --
    Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
Re^2: using Linux getdents syscall
by glasswalk3r (Friar) on Nov 24, 2015 at 12:12 UTC

    I would rather remove the file from inside the C code and avoid doing another system call with Perl... but there is no fun in doing that.

    Alceu Rodrigues de Freitas Junior
    ---------------------------------
    "You have enemies? Good. That means you've stood up for something, sometime in your life." - Sir Winston Churchill