emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gnulib fsusage


From: Po Lu
Subject: gnulib fsusage
Date: Thu, 19 Jan 2023 10:24:29 +0800

Apparently lib/fsusage.o is not built when there is no suitable way for
it to get the necessary information, but it is still used
unconditionally by Emacs.

Is this the right way to detect whether or not get_fs_usage is actually
present?

diff --git a/src/fileio.c b/src/fileio.c
index 6fa524b3bb4..87d7e901203 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -6360,6 +6360,10 @@ DEFUN ("file-system-info", Ffile_system_info, 
Sfile_system_info, 1, 1, 0,
       error ("Invalid handler in `file-name-handler-alist'");
     }
 
+#if defined STAT_STATFS2_BSIZE || defined STAT_STATFS2_FRSIZE  \
+  || defined STAT_STATFS2_FSIZE || defined STAT_STATFS3_OSF1   \
+  || defined STAT_STATFS4 || defined STAT_STATVFS              \
+  || defined STAT_STATVFS64
   struct fs_usage u;
   if (get_fs_usage (SSDATA (ENCODE_FILE (filename)), NULL, &u) != 0)
     return errno == ENOSYS ? Qnil : file_attribute_errno (filename, errno);
@@ -6367,6 +6371,9 @@ DEFUN ("file-system-info", Ffile_system_info, 
Sfile_system_info, 1, 1, 0,
                blocks_to_bytes (u.fsu_blocksize, u.fsu_bfree, false),
                blocks_to_bytes (u.fsu_blocksize, u.fsu_bavail,
                                 u.fsu_bavail_top_bit_set));
+#else
+  return Qnil;
+#endif
 }
 
 #endif /* !DOS_NT */

It's probably not, but I don't have any better ideas.

Thanks.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]