[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
how to check for dirent.d_type support from shell, python or perl?
From: |
Jim Meyering |
Subject: |
how to check for dirent.d_type support from shell, python or perl? |
Date: |
Thu, 12 May 2011 18:41:18 +0200 |
I'd like to skip my new strace-vs-ls --color test on any
system (OS and/or file system) that lacks dirent.d_type support.
Ideally, it'd be a tiny bourne shell, python or perl script
to tell me if calling readdir on a given directory (let's say ".")
would provide struct dirent data including usable d_type values.
[For reference, some file system types do not support that, e.g.,
reiser3 and xfs, while others do, like ext4 and tmpfs. ]
Unfortunately, so far it appears there is no way to get to
the d_type member from any of those languages.
Does anyone know a way that does not require compiling
and running a C program?
I though strace -v might help, but e.g., strace -v ls empty-dir shows
only the getdents syscalls. No details about readdir-returned data.
- how to check for dirent.d_type support from shell, python or perl?,
Jim Meyering <=