[Tracker] Patch to fix solaris build



Hello Jamie,
The attached patch fixes build on Solaris.

I didn't tested on Linux, but it should work, since there are just few
modifications.

--
best
Michal Pryc

Index: src/trackerd/tracker-utils.c
===================================================================
--- src/trackerd/tracker-utils.c        (revision 836)
+++ src/trackerd/tracker-utils.c        (working copy)
@@ -17,8 +17,6 @@
  * Boston, MA  02110-1301, USA.
  */
 
-#define _XOPEN_SOURCE 600
-
 #ifndef _GNU_SOURCE
 #define _GNU_SOURCE
 #endif
@@ -1726,8 +1724,9 @@
        }
 
        /* disable readahead as we only want a fix length */
+#ifdef HAVE_POSIX_FADVISE
        posix_fadvise (fd, 0, 0, POSIX_FADV_RANDOM);
-
+#endif
        buffer_length = read (fd, buffer, TEXT_SNIFF_SIZE);
 
        if (buffer_length < 3) {
@@ -1761,7 +1760,9 @@
 
 return_false:
        /* flush cache as we wont touch file again */
+#ifdef HAVE_POSIX_FADVISE
        posix_fadvise (fd, 0, 0, POSIX_FADV_DONTNEED);
+#endif
        close (fd);
        return FALSE;
 
Index: src/trackerd/tracker-db-sqlite.c
===================================================================
--- src/trackerd/tracker-db-sqlite.c    (revision 836)
+++ src/trackerd/tracker-db-sqlite.c    (working copy)
@@ -17,8 +17,6 @@
  * Boston, MA  02110-1301, USA.
  */
 
-#define _XOPEN_SOURCE 600
-
 #ifndef _GNU_SOURCE
 #define _GNU_SOURCE
 #endif
@@ -2762,8 +2760,9 @@
        byte_array = g_byte_array_sized_new (MAX_TEXT_BUFFER);
 
        /* boost readahead */
+#ifdef HAVE_POSIX_FADVISE
        posix_fadvise (fd, 0, 0, POSIX_FADV_SEQUENTIAL);
-
+#endif
        
        while (!finished) {
 
@@ -2875,8 +2874,9 @@
        deflateEnd(&strm);
 
        /* flush cache for file as we wont touch it again */
+#ifdef HAVE_POSIX_FADVISE
        posix_fadvise (fd, 0, 0, POSIX_FADV_DONTNEED);
-
+#endif
        close (fd);
 
        if (finished) {
Index: configure.ac
===================================================================
--- configure.ac        (revision 836)
+++ configure.ac        (working copy)
@@ -25,7 +25,13 @@
 
 AC_CHECK_HEADER([zlib.h], [], [AC_MSG_ERROR([You must have zlib.h and zlib installed])])
 
+dnl can posix_fadvise be used
+AC_CHECK_DECLS(posix_fadvise, [], [], [
+#define _XOPEN_SOURCE 600
+#include <fcntl.h>])
+
 # Checks for functions
+AC_CHECK_FUNCS([posix_fadvise])
 AC_CHECK_FUNCS([getline])
 
 dnl Library Checks



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