I have been trying to build tmux-1.5 on Solaris 8, Solaris 9 and
Solaris 10 using SunStudio 11 and SunStudio 12 and have run into a
number of issues:

1) Neither SunStudio 11 nor SunStudio 12 support __inline
   The following patch changes them back to "inline":
--- compat/tree.h~      2011-07-09 19:42:38.000000000 +1000
+++ compat/tree.h       2011-08-11 10:16:24.000000000 +1000
@@ -119,7 +119,7 @@
 struct type *name##_SPLAY_REMOVE(struct name *, struct type *);                
\
                                                                        \
 /* Finds the node with the same key as elm */                          \
-static __inline struct type *                                          \
+static inline struct type *                                            \
 name##_SPLAY_FIND(struct name *head, struct type *elm)                 \
 {                                                                      \
        if (SPLAY_EMPTY(head))                                          \
@@ -130,7 +130,7 @@
        return (NULL);                                                  \
 }                                                                      \
                                                                        \
-static __inline struct type *                                          \
+static inline struct type *                                            \
 name##_SPLAY_NEXT(struct name *head, struct type *elm)                 \
 {                                                                      \
        name##_SPLAY(head, elm);                                        \
@@ -144,7 +144,7 @@
        return (elm);                                                   \
 }                                                                      \
                                                                        \
-static __inline struct type *                                          \
+static inline struct type *                                            \
 name##_SPLAY_MIN_MAX(struct name *head, int val)                       \
 {                                                                      \
        name##_SPLAY_MINMAX(head, val);                                 \

2) All versions of Solaris need '-lsocket -lnsl' to resolve symbol
   references.  I added "LIBS='-lsocket -lnsl'" to the configure
   environment but it would be nicer if this was automatic.


3) "INFINITY" is not found on Solaris 8 or Solaris 9
   Since if just needs a large number, I used the following patch:
--- colour.c~   2011-07-09 19:42:38.000000000 +1000
+++ colour.c    2011-08-11 10:27:56.000000000 +1000
@@ -113,7 +113,7 @@
                colour_rgb_generate256();
 
        colour = 16;
-       lowest = INFINITY;
+       lowest = 1e308;
        for (i = 0; i < 240; i++) {
                distance = colour_rgb_distance(&colour_rgb_256[i], rgb);
                if (distance < lowest) {

4) On Solaris 8, there is no closefrom() or dirfd(), requiring the
   following patch (this should be wrapped in #if/#endif):
--- compat/closefrom.c~ 2011-07-09 19:42:38.000000000 +1000
+++ compat/closefrom.c  2011-09-16 14:50:46.000000000 +1000
@@ -52,6 +52,7 @@
 #ifndef OPEN_MAX
 # define OPEN_MAX      256
 #endif
+#define dirfd(d) ((d)->d_fd)
 
 #if 0
 __unused static const char rcsid[] = "$Sudo: closefrom.c,v 1.11 2006/08/17 
15:26:54 millert Exp $";

5) Prior to Solaris 10, passing a size of 0 to [v]snprintf() resulted
   in -1 being returned with errno unaffected (this is documented in
   Solaris 10).  This breaks the asprintf() in compat/asprintf.c (which
   is used on Solaris 8 but not Solaris 9), causing tmux to just exit
   with nothing being reported (since all error messages pass through
   that code).  The fix is to pass a non-zero size (and I've verified
   that this gives the correct results using a separate test tool):
--- compat/asprintf.c~  2011-07-09 19:42:38.000000000 +1000
+++ compat/asprintf.c   2011-09-19 11:20:50.000000000 +1000
@@ -44,8 +44,9 @@
 vasprintf(char **ret, const char *fmt, va_list ap)
 {
        int      n;
+       char     buf[4];
 
-       if ((n = vsnprintf(NULL, 0, fmt, ap)) < 0)
+       if ((n = vsnprintf(buf, sizeof(buf), fmt, ap)) < 0)
                goto error;
 
        *ret = xmalloc(n + 1);

The above fixes are sufficient to get tmux running on all 3 versions
but I haven't done any stress testing.

-- 
Peter Jeremy

Attachment: pgp2G9uPA0Xbl.pgp
Description: PGP signature

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users

Reply via email to