[Patch] gio-standalone build fail on solaris because of statfs is different with Linux



Hi Alexl,

When I try to build gio-standalone trunk code on Solaris with suncc, I get build fail with following message:

/ws/onnv-tools-prc/SUNWspro/SS11/bin/cc -DHAVE_CONFIG_H -I. -I.. -I.. -I.. -DGIO_MODULE_DIR=\"/export/home/halton/work/dist/lib/gio/modules\" -D_REENTRANT -D_PTHREADS -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -DG_LOG_DOMAIN=\"GIO\" -DG_DISABLE_DEPRECATED -DDBUS_API_SUBJECT_TO_CHANGE -D_POSIX_PTHREAD_SEMANTICS -c glocalfile.c  -KPIC -DPIC -o .libs/glocalfile.o
"glocalfile.c", line 777: undefined struct/union member: f_type

On Solaris:
http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/uts/common/sys/statfs.h

f_type is f_fstyp
does not have f_bavail

The patch is attached.

Halton.

Index: trunk/gio/glocalfile.c
===================================================================
--- trunk/gio/glocalfile.c	(revision 722)
+++ trunk/gio/glocalfile.c	(working copy)
@@ -30,6 +30,9 @@
 #include <sys/types.h>
 #include <unistd.h>
 
+#if HAVE_STATFS
+#include <sys/statfs.h>
+#endif
 #if HAVE_SYS_STATVFS_H
 #include <sys/statvfs.h>
 #endif
@@ -768,13 +771,20 @@
   
   if (g_file_attribute_matcher_matches (attribute_matcher,
 					G_FILE_ATTRIBUTE_FS_FREE))
+#if defined(sun) && defined(__SVR4)
+#else
     g_file_info_set_attribute_uint64 (info, G_FILE_ATTRIBUTE_FS_FREE, block_size * statfs_buffer.f_bavail);
+#endif
   if (g_file_attribute_matcher_matches (attribute_matcher,
 					G_FILE_ATTRIBUTE_FS_SIZE))
     g_file_info_set_attribute_uint64 (info, G_FILE_ATTRIBUTE_FS_SIZE, block_size * statfs_buffer.f_blocks);
 
 #if HAVE_STATFS
+#if defined(sun) && defined(__SVR4)
+  fstype = get_fs_type (statfs_buffer.f_fstyp);
+#else
   fstype = get_fs_type (statfs_buffer.f_type);
+#endif
   if (fstype &&
       g_file_attribute_matcher_matches (attribute_matcher,
 					G_FILE_ATTRIBUTE_FS_TYPE))


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