Your C code uses a much larger buffer. Maybe that circumvents some edge case that your Perl logic doesn't handle.
Also, the buffer handling is different between your C and Perl programs. With Perl, you cut from the front of your buffer while with C, you walk a pointer over it. I would rewrite the Perl program to use substr maybe to mimic the C code closer.
Also, is there a reason why you're avoiding readdir?
| [reply] [d/l] |
I'll try to do those suggestions and see what happens next.
About substr, I am already using it... so I'm not sure what do you mean by using it to emulate the C pointer. Even though I'm modifying the original buffer, I would expect that I would get at least the first entry correctly... I played around with unpack, but my guess is that I just don't have the same data on the perl buffer (neither identify what is being available over there, my guess is that I missing a long integer.
This is to solve a very specific problem with NFS exports: some directories got clobbered with so many files (above 300k) that even listing them with ls takes a lot of time. Unfortunately, I don't have root access to evaluate what is going over there, but using getdents allow me to get the list of files much more quickly.
That's what I need in most cases (I'll simply remove the files from there, no need to stat them.readdir() presents the same issues as ls.
Alceu Rodrigues de Freitas Junior
---------------------------------
"You have enemies? Good. That means you've stood up for something, sometime in your life." - Sir Winston Churchill
| [reply] [d/l] [select] |