summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--getconf/getconf.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/getconf/getconf.c b/getconf/getconf.c
index 9517925..5a9da22 100644
--- a/getconf/getconf.c
+++ b/getconf/getconf.c
@@ -6,6 +6,10 @@
*/
+#ifdef __linux__
+# include <sys/statvfs.h> /* statvfs */
+# include <sys/vfs.h> /* statfs */
+#endif
#include <errno.h> /* errno */
#include <limits.h> /* limit_vars */
#include <stdbool.h> /* bool type and true/false */
@@ -544,6 +548,45 @@ int do_path_var(char *environment, char *path_var, char *pathname)
errno = 0;
+#ifdef __linux__
+ switch(path_vars[var].value)
+ {
+ case _PC_REC_XFER_ALIGN:
+ case _PC_ALLOC_SIZE_MIN:
+ {
+ struct statvfs vfsres;
+ if(statvfs(pathname, &vfsres) == 0)
+ {
+ result = vfsres.f_frsize;
+ printf("%ld\n", result);
+ return 0;
+ }
+ break;
+ }
+ case _PC_REC_MIN_XFER_SIZE:
+ {
+ struct statvfs vfsres;
+ if(statvfs(pathname, &vfsres) == 0)
+ {
+ result = vfsres.f_bsize;
+ printf("%ld\n", result);
+ return 0;
+ }
+ break;
+ }
+ case _PC_NAME_MAX:
+ {
+ struct statfs fsres;
+ if(statfs(pathname, &fsres) == 0)
+ {
+ result = fsres.f_namelen;
+ printf("%ld\n", result);
+ return 0;
+ }
+ break;
+ }
+ }
+#endif
result = pathconf(pathname, path_vars[var].value);
if(errno != 0)
{