NB very dirty workaround for transmission.git on Solaris 11

SUN_logo2_smallA very dirty trick/workaround for Transmission client for Solaris 11, just a quick solution, need to be reworked.

libtransmission/file-posix.c -> git diff file-posix.c 

diff --git a/libtransmission/file-posix.c b/libtransmission/file-posix.c
index 610afa8..6ff5df5 100644
--- a/libtransmission/file-posix.c
+++ b/libtransmission/file-posix.c
@@ -71,6 +71,18 @@
  #endif
 #endif
 
+/* ilyxa */
+#ifdef __sun__
+#define   LOCK_SH   1    /* shared lock */
+#define   LOCK_EX   2    /* exclusive lock */
+#define   LOCK_NB   4    /* don't block when locking */
+#define   LOCK_UN   8    /* unlock */
+//#define F_GETLK         7               /* get record locking information */
+//#define F_SETLK         8               /* set record locking information */
+//#define F_SETLKW        9               /* F_SETLK; wait if blocked */
+#endif
+
+
 static void
 set_system_error (tr_error ** error,
                   int         code)
@@ -929,7 +941,9 @@ tr_sys_file_lock (tr_sys_file_t    handle,
   if ((operation & TR_SYS_FILE_LOCK_UN) != 0)
     native_operation |= LOCK_UN;
 
-  ret = flock (handle, native_operation) != -1;
+/* ilyxa */
+//  ret = flock (handle, native_operation) != -1;
+   ret = fcntl (handle, native_operation) != -1;
 
   if (!ret)
     set_system_error (error, errno);
 

A lot of info about flock and fcntl is here : https://www.perkin.org.uk/posts/solaris-portability-flock.html .

Leave a Reply