You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by ge...@apache.org on 2010/01/22 20:17:33 UTC

svn commit: r902234 [1/2] - in /incubator/trafficserver/traffic/branches/dev: ./ iocore/cache/ iocore/cluster/ iocore/eventsystem/ iocore/hostdb/ iocore/net/ libinktomi++/ proxy/ proxy/http2/ proxy/logging/ proxy/mgmt2/ proxy/mgmt2/api2/include/ proxy/...

Author: georgep
Date: Fri Jan 22 19:17:30 2010
New Revision: 902234

URL: http://svn.apache.org/viewvc?rev=902234&view=rev
Log:
TS-11: OpenSolaris_x86 (0906,5.11) port. This port supports both the 'libev' (level-triggered) and a native 'portfs' (edge-triggered) implementation. The code changes reflect patch TS11_osol_patch1.diff with suggestions from John P.
Review: John Plevyak
Tested: OpenSolaris(amd64,0906,5.11,gcc-dev-4/4.3.2,BerkeleyDB4.7), Ubuntu(x86_64,9.04), OSX (x86,10.5) and FreeBSD(amd64,7.2) with and without 'libev'

Modified:
    incubator/trafficserver/traffic/branches/dev/configure.ac
    incubator/trafficserver/traffic/branches/dev/iocore/cache/Store.cc
    incubator/trafficserver/traffic/branches/dev/iocore/cluster/ClusterProcessor.cc
    incubator/trafficserver/traffic/branches/dev/iocore/eventsystem/I_SocketManager.h
    incubator/trafficserver/traffic/branches/dev/iocore/eventsystem/P_UnixSocketManager.h
    incubator/trafficserver/traffic/branches/dev/iocore/eventsystem/SocketManager.cc
    incubator/trafficserver/traffic/branches/dev/iocore/hostdb/HostDB.cc
    incubator/trafficserver/traffic/branches/dev/iocore/net/I_NetConfig.h
    incubator/trafficserver/traffic/branches/dev/iocore/net/I_NetVConnection.h
    incubator/trafficserver/traffic/branches/dev/iocore/net/NetConfig.cc
    incubator/trafficserver/traffic/branches/dev/iocore/net/P_LibBulkIO.h
    incubator/trafficserver/traffic/branches/dev/iocore/net/P_Net.h
    incubator/trafficserver/traffic/branches/dev/iocore/net/P_UnixNet.h
    incubator/trafficserver/traffic/branches/dev/iocore/net/P_UnixNetVConnection.h
    incubator/trafficserver/traffic/branches/dev/iocore/net/P_UnixPollDescriptor.h
    incubator/trafficserver/traffic/branches/dev/iocore/net/UnixNet.cc
    incubator/trafficserver/traffic/branches/dev/iocore/net/UnixNetAccept.cc
    incubator/trafficserver/traffic/branches/dev/iocore/net/UnixNetProcessor.cc
    incubator/trafficserver/traffic/branches/dev/iocore/net/UnixNetVConnection.cc
    incubator/trafficserver/traffic/branches/dev/iocore/net/UnixUDPNet.cc
    incubator/trafficserver/traffic/branches/dev/libinktomi++/Compatability.h
    incubator/trafficserver/traffic/branches/dev/libinktomi++/Makefile.am
    incubator/trafficserver/traffic/branches/dev/libinktomi++/ink_bool.h
    incubator/trafficserver/traffic/branches/dev/libinktomi++/ink_memory.cc
    incubator/trafficserver/traffic/branches/dev/libinktomi++/ink_mutex.h
    incubator/trafficserver/traffic/branches/dev/libinktomi++/ink_platform.h
    incubator/trafficserver/traffic/branches/dev/libinktomi++/ink_port.h
    incubator/trafficserver/traffic/branches/dev/libinktomi++/ink_queue.h
    incubator/trafficserver/traffic/branches/dev/libinktomi++/ink_regex-3.6.h
    incubator/trafficserver/traffic/branches/dev/libinktomi++/ink_string.cc
    incubator/trafficserver/traffic/branches/dev/libinktomi++/lockfile.cc
    incubator/trafficserver/traffic/branches/dev/libinktomi++/ptrdef.h
    incubator/trafficserver/traffic/branches/dev/proxy/CoreUtils.cc
    incubator/trafficserver/traffic/branches/dev/proxy/CoreUtils.h
    incubator/trafficserver/traffic/branches/dev/proxy/ICP.cc
    incubator/trafficserver/traffic/branches/dev/proxy/Main.cc
    incubator/trafficserver/traffic/branches/dev/proxy/http2/HttpConfig.h
    incubator/trafficserver/traffic/branches/dev/proxy/logging/LogConfig.cc
    incubator/trafficserver/traffic/branches/dev/proxy/logging/LogStandalone.cc
    incubator/trafficserver/traffic/branches/dev/proxy/logging/LogUtils.cc
    incubator/trafficserver/traffic/branches/dev/proxy/logstats.cc
    incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/Alarms.cc
    incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/LocalManager.cc
    incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/Main.cc
    incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/api2/include/INKMgmtAPI.h
    incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cli2/ConfigCmd.cc
    incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cli2/ConfigCmd.h
    incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cli2/cli_scriptpaths.h
    incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cluster/ClusterCom.cc
    incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cluster/VMap.cc
    incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cop/TrafficCop.cc
    incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/html2/tune/navigation_tree.xmlcpp
    incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/tools/ConfigAPI.cc
    incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/tools/ConfigAPI.h
    incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/tools/NetConfig.cc
    incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/tools/SysAPI.cc
    incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/tools/SysAPI.h
    incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/tools/VIPConfig.cc
    incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/utils/MgmtUtils.cc
    incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/web2/WebCompatibility.h
    incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/web2/WebHttp.cc
    incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/web2/WebHttpRender.cc
    incubator/trafficserver/traffic/branches/dev/proxy/signals.cc

Modified: incubator/trafficserver/traffic/branches/dev/configure.ac
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/configure.ac?rev=902234&r1=902233&r2=902234&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/configure.ac (original)
+++ incubator/trafficserver/traffic/branches/dev/configure.ac Fri Jan 22 19:17:30 2010
@@ -36,16 +36,22 @@
   freebsd*)
     AC_DEFINE_UNQUOTED([HOST_OS],[freebsd])
     AC_DEFINE_UNQUOTED([freebsd],[1])
-    LDFLAGS="${LDFLAGS} -L/usr/local/lib"
     ;;
-  *)         AC_DEFINE_UNQUOTED([HOST_OS],[unknown]) ;;
+  solaris*)
+    AC_DEFINE_UNQUOTED([HOST_OS],[solaris])
+    AC_DEFINE_UNQUOTED([solaris],[1])
+    ;;
+  *)         
+    AC_DEFINE_UNQUOTED([HOST_OS],[unknown]) 
+    ;;
 esac
 
 #
 # Build environment
 #
 
-build_person="`whoami`"
+build_person="`id -nu`"
+build_group="`id -ng`"
 build_machine="`uname -n`"
 AC_DEFINE_UNQUOTED(BUILD_PERSON, "$build_person")
 AC_DEFINE_UNQUOTED(BUILD_MACHINE, "$build_machine")
@@ -64,7 +70,7 @@
   [
   with_group="$withval"
   ],[
-  with_group="$with_user"
+  with_group="$build_group"
   ]
 )
 AC_SUBST([pkgsysuser],[$with_user])
@@ -257,7 +263,19 @@
 )
 AS_IF([test "x$with_architecture" = "xyes"], [echo "--with-architecture needs an argument"; AS_EXIT()]
 )
-          
+
+# Berkeley DB (bdb)
+AC_ARG_WITH([bdb],
+   [AC_HELP_STRING([--with-bdb=DIR],[Berkeley DB installation directory])],
+   [with_bdb=$withval],
+   [with_bdb=no]   
+)
+
+if test "x$with_bdb" != "xno" ; then
+   PATH_BDB_INC="$with_bdb/include"
+   PATH_BDB_LIB="$with_bdb/lib"
+fi
+
 #
 # Installation directories
 #
@@ -289,42 +307,31 @@
 # 4) (in first kludge mode block...) obtain any further CFLAG-type additions.
 # 5) Test compilers with all flags set.
 
-# These are shortcuts used in combination for the compiler options below
-common_opt="-pipe -Wall -Werror -Wno-char-subscripts -Wno-write-strings"
-debug_opt="-ggdb3 $common_opt"
-release_opt="-g $common_opt -O3 -feliminate-unused-debug-symbols -fno-strict-aliasing"
-cxx_opt="-Wno-invalid-offsetof"
-
-cc_oflag_opt=$release_opt
-cc_oflag_dbg=$debug_opt
-cxx_oflag_opt="$release_opt $cxx_opt"
-cxx_oflag_dbg="$debug_opt $cxx_opt"
-
-CC=gcc
-CXX=g++
-
-SHARED_CFLAGS=-fPIC
-SHARED_LDFLAGS=-shared
-SHARED_CXXFLAGS=-fPIC
-SHARED_CXXLINKFLAGS=-shared
-
 # AC_PROG can sometimes mangle CFLAGS etc.
 # in particular, on Linux they insert -g -O2, here we preserve any user CFLAGS
 
+#CC=gcc
+#CXX=g++
+
 REAL_CFLAGS="${CFLAGS}"
 REAL_CXXFLAGS="${CXXFLAGS}"
 REAL_CCASFLAGS="${CCASFLAGS}"
 
+AC_CHECK_PROG([CCACHE],[ccache],[ccache],[])
+AC_PROG_CC
+AC_PROG_CXX
+if test "x${CCACHE}" = "xccache" ;then
+ CC="$CCACHE $CC"
+ CXX="$CCACHE $CXX"
+fi
+AC_PROG_CPP
+AC_PROG_CXXCPP
 AM_PROG_AS
 AC_PROG_AWK
 AC_PROG_LN_S
 AC_PROG_INSTALL
 AC_PROG_LIBTOOL
 
-CFLAGS="${REAL_CFLAGS}"
-CXXFLAGS="${REAL_CXXFLAGS}"
-CCASFLAGS="${REAL_CCASFLAGS}"
-
 AC_PATH_PROG([DOXYGEN], [doxygen]) # needed for Doxygen
 AC_PATH_PROG([PERL],[perl],[not found])
 AS_IF([test "x$PERL" = "xnot found"],
@@ -333,7 +340,64 @@
 AC_ARG_VAR([DOXYGEN], [full path of Doxygen executable])
 AC_ARG_VAR([PERL], [full path of Perl executable])
 
-AC_CHECK_PROG([CCACHE],[ccache],[ccache],[])
+CFLAGS="${REAL_CFLAGS}"
+CXXFLAGS="${REAL_CXXFLAGS}"
+CCASFLAGS="${REAL_CCASFLAGS}"
+
+base_cc=`basename $CC`
+# These are shortcuts used in combination for the compiler options below
+case $host_os in
+  linux*)
+    common_opt="-pipe -Wall -Werror -Wno-char-subscripts -Wno-write-strings"
+    debug_opt="-ggdb3 $common_opt"
+    release_opt="-g $common_opt -O3 -feliminate-unused-debug-symbols -fno-strict-aliasing"
+    cxx_opt="-Wno-invalid-offsetof"
+    ;;
+  darwin*)
+    common_opt="-pipe -Wall -Werror -Wno-char-subscripts -Wno-write-strings"
+    debug_opt="-ggdb3 $common_opt"
+    release_opt="-g $common_opt -O3 -feliminate-unused-debug-symbols -fno-strict-aliasing"
+    cxx_opt="-Wno-invalid-offsetof"
+    ;;
+  freebsd*)
+    common_opt="-pipe -Wall -Werror -Wno-char-subscripts -Wno-write-strings"
+    debug_opt="-ggdb3 $common_opt"
+    release_opt="-g $common_opt -O3 -feliminate-unused-debug-symbols -fno-strict-aliasing"
+    cxx_opt="-Wno-invalid-offsetof"
+    LDFLAGS="${LDFLAGS} -L/usr/local/lib"
+    ;;
+  solaris*)
+    if test "x${base_cc}" = "xcc" ;then
+      common_opt="-mt -m32 -D__WORDSIZE=32" # FIXME: This should be detected
+      debug_opt="-g $common_opt"
+      release_opt="-g $common_opt -xO3"
+      cxx_opt="-library=stlport4 -erroff"    
+    else # gcc
+      common_opt="-pipe -Wall -Werror -Wno-char-subscripts -Wno-write-strings"
+      debug_opt="-ggdb3 $common_opt"
+      release_opt="-g $common_opt -O3 -feliminate-unused-debug-symbols -fno-strict-aliasing"
+      cxx_opt="-Wno-invalid-offsetof"
+    fi
+    LDFLAGS="${LDFLAGS} -L/lib -L/usr/local/lib"
+    ;;
+  *)         
+    common_opt="-pipe -Wall -Werror -Wno-char-subscripts -Wno-write-strings"
+    debug_opt="-ggdb3 $common_opt"
+    release_opt="-g $common_opt -O3 -feliminate-unused-debug-symbols -fno-strict-aliasing"
+    cxx_opt="-Wno-invalid-offsetof"
+    ;;
+esac
+
+cc_oflag_opt=$release_opt
+cc_oflag_dbg=$debug_opt
+cxx_oflag_opt="$release_opt $cxx_opt"
+cxx_oflag_dbg="$debug_opt $cxx_opt"
+
+SHARED_CFLAGS=-fPIC
+SHARED_LDFLAGS=-shared
+SHARED_CXXFLAGS=-fPIC
+SHARED_CXXLINKFLAGS=-shared
+
 
 #
 # Here are all the extra linux-specific C(XX)FLAGS additions and
@@ -350,18 +414,21 @@
 AC_CHECK_SIZEOF(int *) # test for 64-bit pointers, this permits CFLAGS=-m32 for 32-bit compiles on 64-bit systems
 
 # add a default march if there is not one set
-if test "${ac_cv_sizeof_int_p}" = "4"; then
-    case $CFLAGS in
-  *\-march=*) : ;;
-  *) CFLAGS="$CFLAGS -march=i586" ;;
-esac
-
-    case $CXXFLAGS in
-  *\-march=*) : ;;
-  *) CXXFLAGS="$CXXFLAGS -march=i586" ;;
-esac
+if test "x${GCC}" = "xyes"; then
+ if test "${ac_cv_sizeof_int_p}" = "4"; then
+  case $CFLAGS in
+    *\-march=*) : ;;
+    *) CFLAGS="$CFLAGS -march=i586" ;;
+  esac
+
+  case $CXXFLAGS in
+    *\-march=*) : ;;
+    *) CXXFLAGS="$CXXFLAGS -march=i586" ;;
+  esac
+ fi
 fi
 
+# GCC atomics
 AC_CACHE_CHECK([for gcc atomic builtins],[support_cv_atomic],
 [AC_LINK_IFELSE([AC_LANG_PROGRAM([],[[
 int i, x =0;
@@ -388,6 +455,8 @@
     ;;
   darwin*)
     ;;
+  solaris*)
+    ;;	
   *)         
     EXTRA_CXX_LDFLAGS="-rdynamic"
    ;;
@@ -412,13 +481,6 @@
     # Note:  This macro may set certain parameters when run.
     #
 
-AC_PROG_CC
-AC_PROG_CXX
-CC="$CCACHE $CC"
-CXX="$CCACHE $CXX"
-
-AC_PROG_CPP
-AC_PROG_CXXCPP
 
 # -----------------------------------------------------------------------------
 # 4. CHECK FOR LIBRARIES
@@ -445,7 +507,7 @@
    AC_DEFINE([HAVE_LIBSSL],[1],[Define if you have libssl])
   ],
   [AC_MSG_FAILURE([check for libssl failed. Have you installed openssl-devel?])],
-  [-lcrypto -lgcc]
+  [-lcrypto]
 )
 
 #
@@ -461,7 +523,7 @@
 # expect tclConfig.sh to populate TCL_LIB_FLAG and TCL_INCLUDE_SPEC
 case $host_os in
   darwin*)
-    TCL_LIB_FLAG="-ltcl"
+    TCL_LIB_FLAG="-ltcl" # OSX fails to populate this variable
     ;;
   *)         
    ;;
@@ -472,6 +534,9 @@
   freebsd*)
     CPPFLAGS="$CPPFLAGS -I/usr/local/include $TCL_INCLUDE_SPEC"
     ;;
+  solaris*)
+    CPPFLAGS="$CPPFLAGS -I/usr/local/include $TCL_INCLUDE_SPEC"
+    ;;
   *)         
    CPPFLAGS="$CPPFLAGS $TCL_INCLUDE_SPEC"
    ;;
@@ -483,7 +548,36 @@
   [$LIBTHREAD]
 )
 
+# Berkeley DB check: 
+# TODO: Better checking for versions/directories similar to TCL
 ts_have_db=0
+save_LDFLAGS="$LDFLAGS"
+save_CPPFLAGS="$CPPFLAGS"
+if test "x$with_bdb" != "xno" ; then
+  case $host_os in
+    solaris*)
+      LDFLAGS="$LDFLAGS -L$PATH_BDB_LIB -R$PATH_BDB_LIB" 
+      CPPFLAGS="$CPPFLAGS -I$PATH_BDB_INC"
+      ;;
+    *)         
+      LDFLAGS="$LDFLAGS -L$PATH_BDB_LIB" 
+      CPPFLAGS="$CPPFLAGS -I$PATH_BDB_INC"
+      ;;
+  esac
+fi
+
+AC_CHECK_LIB([db],[__db_open],
+  [LIBDB="-ldb"
+
+   ts_have_db=1
+  ],
+   [AC_MSG_WARN([check for libdb failed. Have you installed Berkeley DB e.g. BerkeleyDB.4.7?])
+   LDFLAGS="$save_LDFLAGS"
+   CPPFLAGS="$save_CPPFLAGS"
+  ]
+)
+
+
 AC_CHECK_LIB([db],[__db185_open],
   [LIBDB="-ldb"
    ts_have_db=1
@@ -491,6 +585,13 @@
    [AC_MSG_WARN([check for libdb failed. Have you installed db4-devel?])]
 )
 
+AC_CHECK_LIB([db],[__db_open],
+  [LIBDB="-ldb"
+   ts_have_db=1
+  ],
+   [AC_MSG_WARN([check for libdb failed. Have you installed Berkeley DB devel pkg?])]
+)
+
 AC_CHECK_LIB([c],[dbopen],
   [LIBDB=""
   ts_have_db=1
@@ -498,10 +599,10 @@
 AC_SUBST([LIBDB])
  
 if test "$ts_have_db" = "0"; then
-    AC_MSG_FAILURE([No DB interface found])
+    AC_MSG_FAILURE([No DB interface found, try specifying --with-bdb=<Berkeley DB DIR>])
 fi
 
-AC_CHECK_FUNCS([clock_gettime kqueue epoll_ctl posix_memalign lrand48_r srand48_r eventfd])
+AC_CHECK_FUNCS([clock_gettime kqueue epoll_ctl posix_memalign lrand48_r srand48_r eventfd port_create])
 
 if test "x$enable_libev" = "xyes"; then
    AC_DEFINE([USE_LIBEV])
@@ -509,9 +610,15 @@
 elif test "$ac_cv_func_epoll_ctl" = "yes"; then
    AC_DEFINE([USE_EPOLL])
    have_good_poller=1
+   AC_MSG_NOTICE([Using epoll event interface])
 elif test "$ac_cv_func_kqueue" = "yes"; then
    AC_DEFINE([USE_KQUEUE])
    have_good_poller=1
+   AC_MSG_NOTICE([Using kqueue event interface])
+elif test "$ac_cv_func_port_create" = "yes"; then
+   AC_DEFINE([USE_PORT])
+   have_good_poller=1
+   AC_MSG_NOTICE([Using port event interface])
 else
    AC_MSG_FAILURE([No suitable polling interface found])
 fi
@@ -552,6 +659,18 @@
 fi
 
 
+AC_MSG_NOTICE([Build using CC=$CC])
+AC_MSG_NOTICE([Build using CXX=$CXX])
+AC_MSG_NOTICE([Build using CPP=$CPP])
+AC_MSG_NOTICE([Build using CCAS=$CCAS])
+AC_MSG_NOTICE([Build using CFLAGS=$CFLAGS])
+AC_MSG_NOTICE([Build using CXXFLAGS=$CXXFLAGS])
+AC_MSG_NOTICE([Build using CPPFLAGS=$CPPFLAGS])
+AC_MSG_NOTICE([Build using CCASFLAGS=$CCASFLAGS])
+AC_MSG_NOTICE([Build using LDFLAGS=$LDFLAGS])
+AC_MSG_NOTICE([Build using EXTRA_CC_LDFLAGS=$EXTRA_CC_LDFLAGS])
+AC_MSG_NOTICE([Build using EXTRA_CXX_LDFLAGS=$EXTRA_CXX_LDFLAGS])
+
 # -----------------------------------------------------------------------------
 # 5. CHECK FOR HEADER FILES
 

Modified: incubator/trafficserver/traffic/branches/dev/iocore/cache/Store.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/iocore/cache/Store.cc?rev=902234&r1=902233&r2=902234&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/iocore/cache/Store.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/iocore/cache/Store.cc Fri Jan 22 19:17:30 2010
@@ -429,7 +429,7 @@
 
 
 
-#if (HOST_OS == freebsd) || (HOST_OS == darwin)
+#if (HOST_OS == freebsd) || (HOST_OS == darwin) || (HOST_OS == solaris)
 #include <ctype.h>
 #include <sys/types.h>
 #include <sys/param.h>
@@ -440,6 +440,9 @@
 #elif (HOST_OS == darwin)
 #include <sys/disk.h>
 #include <sys/statvfs.h>
+#elif (HOST_OS == solaris)
+#include <sys/statfs.h>
+#include <sys/statvfs.h>
 #endif
 #include <string.h>
 
@@ -491,12 +494,21 @@
     return "unable to open";
   }
 
+#if (HOST_OS == solaris)
+  struct statvfs fs;
+  if ((ret = fstatvfs(fd, &fs)) < 0) {
+    Warning("unable to statvfs '%s': %d %d, %s", n, ret, errno, strerror(errno));
+    socketManager.close(fd);
+    return "unable to statvfs";
+  }
+#else
   struct statfs fs;
   if ((ret = fstatfs(fd, &fs)) < 0) {
     Warning("unable to statfs '%s': %d %d, %s", n, ret, errno, strerror(errno));
     socketManager.close(fd);
     return "unable to statfs";
   }
+#endif
 
   disk_block_size = fs.f_bsize;
   ink64 fsize = (ink64) fs.f_blocks * (ink64) fs.f_bsize;
@@ -505,7 +517,7 @@
 
   case S_IFBLK:{
   case S_IFCHR:
-#ifdef HAVE_RAW_DISK_SUPPORT // FIXME:
+#ifdef HAVE_RAW_DISK_SUPPORT // FIXME: darwin, freebsd, solaris
       struct disklabel dl;
       struct diskslices ds;
       if (ioctl(fd, DIOCGDINFO, &dl) < 0) {

Modified: incubator/trafficserver/traffic/branches/dev/iocore/cluster/ClusterProcessor.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/iocore/cluster/ClusterProcessor.cc?rev=902234&r1=902233&r2=902234&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/iocore/cluster/ClusterProcessor.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/iocore/cluster/ClusterProcessor.cc Fri Jan 22 19:17:30 2010
@@ -365,8 +365,8 @@
 ////////////////////////////////////////////////////////////////////////////
 // Simplify debug access to stats
 ////////////////////////////////////////////////////////////////////////////
-#define GS RecRawStat
 #if 0
+#define GS RecRawStat// FIXME: GS conflicts with define in /usr/include/sys/regset.h
 GS *p_CLUSTER_CONNECTIONS_OPEN_STAT = RecGetGlobalRawStatPtr(cluster_rsb, CLUSTER_CONNECTIONS_OPEN_STAT);
 GS *p_CLUSTER_CONNECTIONS_OPENNED_STAT = RecGetGlobalRawStatPtr(cluster_rsb, CLUSTER_CONNECTIONS_OPENNED_STAT);
 GS *p_CLUSTER_CON_TOTAL_TIME_STAT = RecGetGlobalRawStatPtr(cluster_rsb, CLUSTER_CON_TOTAL_TIME_STAT);

Modified: incubator/trafficserver/traffic/branches/dev/iocore/eventsystem/I_SocketManager.h
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/iocore/eventsystem/I_SocketManager.h?rev=902234&r1=902233&r2=902234&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/iocore/eventsystem/I_SocketManager.h (original)
+++ incubator/trafficserver/traffic/branches/dev/iocore/eventsystem/I_SocketManager.h Fri Jan 22 19:17:30 2010
@@ -94,6 +94,13 @@
   int kevent(int kq, const struct kevent *changelist, int nchanges,
              struct kevent *eventlist, int nevents,
              const struct timespec *timeout);
+#elif defined(USE_PORT)
+  int port_create();
+  int port_associate(int port, int fd, uintptr_t obj, 
+		     int events, void *user);
+  int port_dissociate(int port, int fd, uintptr_t obj);
+  int port_getn(int port, port_event_t *list, uint_t max, 
+		uint_t *nget, timespec_t *timeout);
 #endif
   int shutdown(int s, int how);
   int dup(int s);

Modified: incubator/trafficserver/traffic/branches/dev/iocore/eventsystem/P_UnixSocketManager.h
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/iocore/eventsystem/P_UnixSocketManager.h?rev=902234&r1=902233&r2=902234&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/iocore/eventsystem/P_UnixSocketManager.h (original)
+++ incubator/trafficserver/traffic/branches/dev/iocore/eventsystem/P_UnixSocketManager.h Fri Jan 22 19:17:30 2010
@@ -503,8 +503,47 @@
 
   return r;
 }
+#elif defined(USE_PORT)
+inline int
+SocketManager::port_create() 
+{
+  return ::port_create();
+}
 
-#endif
+inline int
+SocketManager::port_associate(int port, int source, uintptr_t obj,
+                              int events, void *user) 
+{
+  int r;
+  r =::port_associate(port, source, obj, events, user);
+  if(r < 0) 
+    r = -errno;
+  return r;
+}
+
+inline int
+SocketManager::port_dissociate(int port, int source, uintptr_t obj) 
+{
+  int r;
+  r =::port_dissociate(port, source, obj);
+  if(r < 0) 
+    r = -errno;
+  return r;
+}
+
+inline int
+SocketManager::port_getn(int port, port_event_t *list, uint_t max,
+                         uint_t *nget, timespec_t *timeout) 
+{
+  int r;
+  do {
+    if ((r =::port_getn(port, list, max, nget, timeout)) >= 0)
+      break;
+    r = -errno;
+  } while (errno == -EINTR); //TODO: possible EAGAIN(undocumented)
+  return r;
+}
+#endif /* USE_PORT */
 
 
 inline int

Modified: incubator/trafficserver/traffic/branches/dev/iocore/eventsystem/SocketManager.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/iocore/eventsystem/SocketManager.cc?rev=902234&r1=902233&r2=902234&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/iocore/eventsystem/SocketManager.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/iocore/eventsystem/SocketManager.cc Fri Jan 22 19:17:30 2010
@@ -31,6 +31,12 @@
 #include <sys/filio.h>
 #endif
 
+#if (HOST_OS == solaris)
+#include <sys/types.h>
+#include <sys/mman.h>
+extern "C" int madvise(caddr_t, size_t, int); // FIXME: why is this not being found
+#endif
+
 #include "P_EventSystem.h"
 
 

Modified: incubator/trafficserver/traffic/branches/dev/iocore/hostdb/HostDB.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/iocore/hostdb/HostDB.cc?rev=902234&r1=902233&r2=902234&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/iocore/hostdb/HostDB.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/iocore/hostdb/HostDB.cc Fri Jan 22 19:17:30 2010
@@ -330,7 +330,7 @@
       szPath[i] = '\\';
     i++;
   }
-  strcpy(storage_path, system_root_dir);
+  ink_strncpy(storage_path, system_root_dir, PATH_NAME_MAX);
   strcat(storage_path, DIR_SEP);
   strcat(storage_path, szPath);
 #else

Modified: incubator/trafficserver/traffic/branches/dev/iocore/net/I_NetConfig.h
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/iocore/net/I_NetConfig.h?rev=902234&r1=902233&r2=902234&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/iocore/net/I_NetConfig.h (original)
+++ incubator/trafficserver/traffic/branches/dev/iocore/net/I_NetConfig.h Fri Jan 22 19:17:30 2010
@@ -29,7 +29,13 @@
  * net sub system.
  * For the default values look at NetConfig.cc
  */
+#if (HOST_OS == solaris)
+#define DEFAULT_POLL_TIMEOUT                      30  /* mseconds */
+#else
+#define DEFAULT_POLL_TIMEOUT                      10  /* mseconds */
+#endif
 
+extern int net_config_poll_timeout;
 extern int net_config_max_poll_delay;
 extern int net_config_fds_throttle;
 extern int net_config_listen_backlog;

Modified: incubator/trafficserver/traffic/branches/dev/iocore/net/I_NetVConnection.h
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/iocore/net/I_NetVConnection.h?rev=902234&r1=902233&r2=902234&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/iocore/net/I_NetVConnection.h (original)
+++ incubator/trafficserver/traffic/branches/dev/iocore/net/I_NetVConnection.h Fri Jan 22 19:17:30 2010
@@ -428,6 +428,7 @@
   {
     if (logging != NULL) {
       logging->add(message);
+      logging->print();
     }
   }
   void printLogs() const

Modified: incubator/trafficserver/traffic/branches/dev/iocore/net/NetConfig.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/iocore/net/NetConfig.cc?rev=902234&r1=902233&r2=902234&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/iocore/net/NetConfig.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/iocore/net/NetConfig.cc Fri Jan 22 19:17:30 2010
@@ -22,8 +22,10 @@
  */
 
 #include "I_NetConfig.h"
+
 #define NULL 0
 
+int net_config_poll_timeout = DEFAULT_POLL_TIMEOUT;
 int net_config_fds_throttle = 8000;
 int net_config_max_poll_delay = 0;
 int net_config_listen_backlog = 1024;

Modified: incubator/trafficserver/traffic/branches/dev/iocore/net/P_LibBulkIO.h
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/iocore/net/P_LibBulkIO.h?rev=902234&r1=902233&r2=902234&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/iocore/net/P_LibBulkIO.h (original)
+++ incubator/trafficserver/traffic/branches/dev/iocore/net/P_LibBulkIO.h Fri Jan 22 19:17:30 2010
@@ -25,7 +25,7 @@
 #ifndef _LIB_BULK_IO_H
 #define _LIB_BULK_IO_H
 
-#if (HOST_OS == sunos)
+#if (HOST_OS == solaris)
 #include <stdio.h>
 #include <errno.h>
 #include <sys/types.h>

Modified: incubator/trafficserver/traffic/branches/dev/iocore/net/P_Net.h
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/iocore/net/P_Net.h?rev=902234&r1=902233&r2=902234&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/iocore/net/P_Net.h (original)
+++ incubator/trafficserver/traffic/branches/dev/iocore/net/P_Net.h Fri Jan 22 19:17:30 2010
@@ -124,5 +124,11 @@
                                        NET_SYSTEM_MODULE_MAJOR_VERSION, \
                                        NET_SYSTEM_MODULE_MINOR_VERSION, \
                                        PRIVATE_MODULE_HEADER)
+// libev backend flags
+#if (HOST_OS == solaris)
+#define LIBEV_BACKEND_LIST (EVBACKEND_POLL | EVBACKEND_SELECT) // Level-Triggered
+#else
+  #define LIBEV_BACKEND_LIST 0 /* auto */
+#endif
 
 #endif

Modified: incubator/trafficserver/traffic/branches/dev/iocore/net/P_UnixNet.h
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/iocore/net/P_UnixNet.h?rev=902234&r1=902233&r2=902234&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/iocore/net/P_UnixNet.h (original)
+++ incubator/trafficserver/traffic/branches/dev/iocore/net/P_UnixNet.h Fri Jan 22 19:17:30 2010
@@ -29,6 +29,49 @@
 
 #define USE_EDGE_TRIGGER_EPOLL  1
 #define USE_EDGE_TRIGGER_KQUEUE  1
+#define USE_EDGE_TRIGGER_PORT  1
+
+
+#define EVENTIO_NETACCEPT               1
+#define EVENTIO_READWRITE_VC		2
+#define EVENTIO_DNS_CONNECTION		3
+#define EVENTIO_UDP_CONNECTION		4
+#define EVENTIO_ASYNC_SIGNAL		5
+
+#if defined(USE_LIBEV)
+#define EVENTIO_READ EV_READ
+#define EVENTIO_WRITE EV_WRITE
+#define EVENTIO_ERROR EV_ERROR
+#elif defined(USE_EPOLL)
+#ifdef USE_EDGE_TRIGGER_EPOLL
+#define USE_EDGE_TRIGGER 1
+#define EVENTIO_READ (EPOLLIN|EPOLLET)
+#define EVENTIO_WRITE (EPOLLOUT|EPOLLET)
+#else
+#define EVENTIO_READ EPOLLIN
+#define EVENTIO_WRITE EPOLLOUT
+#endif
+#define EVENTIO_ERROR (EPOLLERR|EPOLLPRI|EPOLLHUP)
+#elif defined(USE_KQUEUE)
+#ifdef USE_EDGE_TRIGGER_KQUEUE
+#define USE_EDGE_TRIGGER 1
+#define INK_EV_EDGE_TRIGGER EV_CLEAR
+#else
+#define INK_EV_EDGE_TRIGGER 0
+#endif
+#define EVENTIO_READ INK_EVP_IN
+#define EVENTIO_WRITE INK_EVP_OUT
+#define EVENTIO_ERROR (0x010|0x002|0x020) // ERR PRI HUP
+#elif defined(USE_PORT)
+#ifdef USE_EDGE_TRIGGER_PORT
+#define USE_EDGE_TRIGGER 1
+#endif
+#define EVENTIO_READ  POLLIN
+#define EVENTIO_WRITE POLLOUT
+#define EVENTIO_ERROR (POLLERR|POLLPRI|POLLHUP)
+#else
+#error port me
+#endif
 
 #ifdef USE_LIBEV
 #define EV_MINPRI 0
@@ -53,7 +96,7 @@
 #undef VAR
 };
 extern "C" void fd_change(struct ev_loop *, int fd, int flags);
-#endif
+#endif /* USE_LIBEV */
 
 class PollDescriptor;
 typedef PollDescriptor *EventLoop;
@@ -66,10 +109,12 @@
 {
 #ifdef USE_LIBEV
   ev_io eio;
+#define evio_get_port(e) ((e)->eio.fd)
 #else
   int fd;
+#define evio_get_port(e) ((e)->fd)
 #endif
-#if defined(USE_KQUEUE) || (defined(USE_EPOLL) && !defined(USE_EDGE_TRIGGER))
+#if defined(USE_KQUEUE) || (defined(USE_EPOLL) && !defined(USE_EDGE_TRIGGER)) || defined(USE_PORT)
   int events;
 #endif
   EventLoop event_loop;
@@ -110,39 +155,6 @@
 #include "P_UnixUDPConnection.h"
 #include "P_UnixPollDescriptor.h"
 
-#define EVENTIO_NETACCEPT               1
-#define EVENTIO_READWRITE_VC		2
-#define EVENTIO_DNS_CONNECTION		3
-#define EVENTIO_UDP_CONNECTION		4
-#define EVENTIO_ASYNC_SIGNAL		5
-
-#if defined(USE_LIBEV)
-#define EVENTIO_READ EV_READ
-#define EVENTIO_WRITE EV_WRITE
-#define EVENTIO_ERROR EV_ERROR
-#elif defined(USE_EPOLL)
-#ifdef USE_EDGE_TRIGGER_EPOLL
-#define USE_EDGE_TRIGGER 1
-#define EVENTIO_READ (EPOLLIN|EPOLLET)
-#define EVENTIO_WRITE (EPOLLOUT|EPOLLET)
-#else
-#define EVENTIO_READ EPOLLIN
-#define EVENTIO_WRITE EPOLLOUT
-#endif
-#define EVENTIO_ERROR (EPOLLERR|EPOLLPRI|EPOLLHUP)
-#elif defined(USE_KQUEUE)
-#ifdef USE_EDGE_TRIGGER_KQUEUE
-#define USE_EDGE_TRIGGER 1
-#define INK_EV_EDGE_TRIGGER EV_CLEAR
-#else
-#define INK_EV_EDGE_TRIGGER 0
-#endif
-#define EVENTIO_READ INK_EVP_IN
-#define EVENTIO_WRITE INK_EVP_OUT
-#define EVENTIO_ERROR (0x010|0x002|0x020) // ERR PRI HUP
-#else
-#error port me
-#endif
 
 struct UnixNetVConnection;
 struct NetHandler;
@@ -193,8 +205,7 @@
 #define MAX_NET_BUCKETS                           256
 #define MAX_EPOLL_ARRAY_SIZE                      (1024*16)
 #define MAX_EPOLL_TIMEOUT                         50    /* mseconds */
-#define DEFAULT_POLL_TIMEOUT                      10    /* mseconds */
-
+/* NOTE: moved DEFAULT_POLL_TIMEOUT to I_NetConfig.h */
 #define NET_THROTTLE_DELAY                        50    /* mseconds */
 #define INK_MIN_PRIORITY                          0
 
@@ -211,12 +222,13 @@
   PollDescriptor *nextPollDescriptor;
   int poll_timeout;
 
-  PollCont(ProxyMutex * m);
-  PollCont(ProxyMutex * m, NetHandler * nh);
+  PollCont(ProxyMutex * m, int pt = net_config_poll_timeout);
+  PollCont(ProxyMutex * m, NetHandler * nh, int pt = net_config_poll_timeout);
   ~PollCont();
   int pollEvent(int event, Event * e);
 };
 
+
 //
 // NetHandler
 //
@@ -493,7 +505,7 @@
 inline int EventIO::close() {
   stop();
   switch (type) {
-    default: assert(!"case");
+    default: ink_assert(!"case");
     case EVENTIO_DNS_CONNECTION: return data.dnscon->close(); break;
     case EVENTIO_NETACCEPT: return data.na->server.close(); break;
     case EVENTIO_READWRITE_VC: return data.vc->con.close(); break;
@@ -538,7 +550,7 @@
   return 0;
 }
 
-#else
+#else /* !USE_LIBEV */
 
 inline int EventIO::start(EventLoop l, int afd, Continuation *c, int e) {
   data.c = c;
@@ -562,6 +574,11 @@
   if (e & EVENTIO_WRITE)
     EV_SET(&ev[n++], fd, EVFILT_WRITE, EV_ADD|INK_EV_EDGE_TRIGGER, 0, 0, this);
   return kevent(l->kqueue_fd, &ev[0], n, NULL, 0, NULL);
+#elif defined(USE_PORT)
+  events = e; 
+  int retval = port_associate(event_loop->port_fd, PORT_SOURCE_FD, fd, events, this); 
+  NetDebug("iocore_eventio", "[EventIO::start] e(%d), events(%d), %d[%s]=port_associate(%d,%d,%d,%d,%p)", e, events, retval, retval<0? strerror(errno) : "ok", event_loop->port_fd, PORT_SOURCE_FD, fd, events, this);
+  return retval;
 #else
 #error port me
 #endif
@@ -607,6 +624,33 @@
     return kevent(event_loop->kqueue_fd, &ev[0], n, NULL, 0, NULL);
   else
     return 0;
+#elif defined(USE_PORT)
+  int n = 0;
+  int ne = e;
+  if (e < 0) {
+    if (((-e) & events)) {
+      ne = ~(-e) & events;
+      if ((-e) & EVENTIO_READ)
+	n++;
+      if ((-e) & EVENTIO_WRITE)
+	n++;
+    } 
+  } else {
+    if (!(e & events)) {
+      ne = events | e;
+      if (e & EVENTIO_READ)
+	n++;
+      if (e & EVENTIO_WRITE)
+	n++;
+    } 
+  }
+  if (n && ne && event_loop) {
+    events = ne;
+    int retval = port_associate(event_loop->port_fd, PORT_SOURCE_FD, fd, events, this); 
+    NetDebug("iocore_eventio", "[EventIO::modify] e(%d), ne(%d), events(%d), %d[%s]=port_associate(%d,%d,%d,%d,%p)", e, ne, events, retval, retval<0? strerror(errno) : "ok", event_loop->port_fd, PORT_SOURCE_FD, fd, events, this);
+    return retval;
+  }
+  return 0;
 #else
   return 0;
 #endif
@@ -625,6 +669,23 @@
     return kevent(event_loop->kqueue_fd, &ev[0], n, NULL, 0, NULL);
   else
     return 0;
+#elif defined(USE_PORT)
+  int n = 0;
+  int ne = e;
+  if ((e & events)) {
+    ne = events | e;
+    if (e & EVENTIO_READ)
+      n++;
+    if (e & EVENTIO_WRITE)
+      n++;
+    if (n && ne && event_loop) {
+      events = ne;
+      int retval = port_associate(event_loop->port_fd, PORT_SOURCE_FD, fd, events, this); 
+      NetDebug("iocore_eventio", "[EventIO::refresh] e(%d), ne(%d), events(%d), %d[%s]=port_associate(%d,%d,%d,%d,%p)", e, ne, events, retval, retval<0? strerror(errno) : "ok", event_loop->port_fd, PORT_SOURCE_FD, fd, events, this);
+      return retval;
+    } 
+  } 
+  return 0;
 #else
   return 0;
 #endif
@@ -650,6 +711,10 @@
       EV_SET(&ev[n++], fd, EVFILT_WRITE, EV_DELETE, 0, 0, this);
     return kevent(event_loop->kqueue_fd, &ev[0], n, NULL, 0, NULL);
 #endif
+#elif defined(USE_PORT)
+    int retval = port_dissociate(event_loop->port_fd, PORT_SOURCE_FD, fd);
+    NetDebug("iocore_eventio", "[EventIO::stop] %d[%s]=port_dissociate(%d,%d,%d)", retval, retval<0? strerror(errno) : "ok", event_loop->port_fd, PORT_SOURCE_FD, fd);
+    return retval;
 #else
 #error port me
 #endif
@@ -658,6 +723,6 @@
   return 0;
 }
 
-#endif
+#endif /* !USE_LIBEV */
 
 #endif

Modified: incubator/trafficserver/traffic/branches/dev/iocore/net/P_UnixNetVConnection.h
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/iocore/net/P_UnixNetVConnection.h?rev=902234&r1=902233&r2=902234&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/iocore/net/P_UnixNetVConnection.h (original)
+++ incubator/trafficserver/traffic/branches/dev/iocore/net/P_UnixNetVConnection.h Fri Jan 22 19:17:30 2010
@@ -185,6 +185,7 @@
   int readSignalDone(int event, NetHandler * nh);
   int readSignalAndUpdate(int event);
   void readReschedule(NetHandler * nh);
+  void writeReschedule(NetHandler * nh);
   void netActivity(EThread * lthread);
 
   Action *action()

Modified: incubator/trafficserver/traffic/branches/dev/iocore/net/P_UnixPollDescriptor.h
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/iocore/net/P_UnixPollDescriptor.h?rev=902234&r1=902233&r2=902234&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/iocore/net/P_UnixPollDescriptor.h (original)
+++ incubator/trafficserver/traffic/branches/dev/iocore/net/P_UnixPollDescriptor.h Fri Jan 22 19:17:30 2010
@@ -58,25 +58,30 @@
   struct epoll_event ePoll_Triggered_Events[POLL_DESCRIPTOR_SIZE];
 #elif defined(USE_KQUEUE)
   int kqueue_fd;
+#elif defined(USE_PORT)
+  int port_fd;
 #else
 #error port me
 #endif
 
 #if defined(USE_LIBEV)
+#define get_ev_port(a) ((a)->eio->backend_fd)
 #define get_ev_events(a,x) (a->eio->pendings[0] + a->eio->pendingcnt[0] - 1)->events
 #define get_ev_data(a,x) ((EventIO*)(a->eio->pendings[0] + a->eio->pendingcnt[0] - 1)->w->cb)
-#define ev_next_event(x) do { \
-    (x->eio->pendings[0] + x->eio->pendingcnt[0] - 1)->w->pending = 0; \
-    x->eio->pendingcnt[0]--;                               \
+#define ev_next_event(a,x) do {					       \
+    (a->eio->pendings[0] + a->eio->pendingcnt[0] - 1)->w->pending = 0; \
+    a->eio->pendingcnt[0]--;                               \
   } while (0)
 #elif defined(USE_EPOLL)
+#define get_ev_port(a) ((a)->epoll_fd)
 #define get_ev_events(a,x) ((a)->ePoll_Triggered_Events[(x)].events)
 #define get_ev_data(a,x) ((a)->ePoll_Triggered_Events[(x)].data.ptr)
-#define ev_next_event(x)
+#define ev_next_event(a,x)
 #elif defined(USE_KQUEUE)
   struct kevent kq_Triggered_Events[POLL_DESCRIPTOR_SIZE];
   /* we define these here as numbers, because for kqueue mapping them to a combination of 
  * filters / flags is hard to do. */
+#define get_ev_port(a) ((a)->kqueue_fd)
 #define get_ev_events(a,x) ((a)->kq_event_convert((a)->kq_Triggered_Events[(x)].filter, (a)->kq_Triggered_Events[(x)].flags))
 #define get_ev_data(a,x) ((a)->kq_Triggered_Events[(x)].udata)
   int kq_event_convert(int16_t event, uint16_t flags)
@@ -95,7 +100,14 @@
     }
     return r;
   }
-#define ev_next_event(x)
+#define ev_next_event(a,x)
+#elif defined(USE_PORT)
+  port_event_t Port_Triggered_Events[POLL_DESCRIPTOR_SIZE];
+#define get_ev_port(a) ((a)->port_fd)
+#define get_ev_events(a,x) ((a)->Port_Triggered_Events[(x)].portev_events)
+#define get_ev_data(a,x) ((a)->Port_Triggered_Events[(x)].portev_user)
+#define get_ev_odata(a,x) ((a)->Port_Triggered_Events[(x)].portev_object)
+#define ev_next_event(a,x)
 #else
 #error port to your os
 #endif
@@ -122,6 +134,9 @@
 #elif defined(USE_KQUEUE)
     kqueue_fd = kqueue();
     memset(kq_Triggered_Events, 0, sizeof(kq_Triggered_Events));
+#elif defined(USE_PORT)
+    port_fd = port_create();
+    memset(Port_Triggered_Events, 0, sizeof(Port_Triggered_Events));
 #else
 #error port to your os
 #endif

Modified: incubator/trafficserver/traffic/branches/dev/iocore/net/UnixNet.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/iocore/net/UnixNet.cc?rev=902234&r1=902233&r2=902234&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/iocore/net/UnixNet.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/iocore/net/UnixNet.cc Fri Jan 22 19:17:30 2010
@@ -52,9 +52,9 @@
     UnixNetVConnection *vc = nh->open_list.head, *vc_next = 0;
     while (vc) {
       vc_next = (UnixNetVConnection*)vc->link.next;
-      if (vc->inactivity_timeout_in && vc->next_inactivity_timeout_at && vc->next_inactivity_timeout_at < now)
+      if (vc->inactivity_timeout_in && vc->next_inactivity_timeout_at && vc->next_inactivity_timeout_at < now){
         vc->handleEvent(EVENT_IMMEDIATE, e);
-      else
+      } else
         if (vc->closed)
           close_UnixNetVConnection(vc, e->ethread);
       vc = vc_next;
@@ -64,15 +64,15 @@
 };
 #endif
 
-PollCont::PollCont(ProxyMutex *m):Continuation(m), net_handler(NULL), poll_timeout(DEFAULT_POLL_TIMEOUT)
+PollCont::PollCont(ProxyMutex *m, int pt):Continuation(m), net_handler(NULL), poll_timeout(pt)
 {
   pollDescriptor = NEW(new PollDescriptor);
   pollDescriptor->init();
   SET_HANDLER(&PollCont::pollEvent);
 }
 
-PollCont::PollCont(ProxyMutex *m, NetHandler *nh):Continuation(m), net_handler(nh),
-poll_timeout(DEFAULT_POLL_TIMEOUT)
+PollCont::PollCont(ProxyMutex *m, NetHandler *nh, int pt):Continuation(m), net_handler(nh),
+poll_timeout(pt)
 {
   pollDescriptor = NEW(new PollDescriptor);
   pollDescriptor->init();
@@ -100,26 +100,27 @@
     if (likely
         (!net_handler->read_ready_list.empty() || !net_handler->read_ready_list.empty() ||
          !net_handler->read_enable_list.empty() || !net_handler->write_enable_list.empty())) {
-      NetDebug("epoll", "rrq: %d, wrq: %d, rel: %d, wel: %d", net_handler->read_ready_list.empty(),
+      NetDebug("iocore_net_poll", "rrq: %d, wrq: %d, rel: %d, wel: %d", net_handler->read_ready_list.empty(),
             net_handler->write_ready_list.empty(), net_handler->read_enable_list.empty(),
             net_handler->write_enable_list.empty());
       poll_timeout = 0;         //poll immediately returns -- we have triggered stuff to process right now
     } else {
-      poll_timeout = DEFAULT_POLL_TIMEOUT;
+      poll_timeout = net_config_poll_timeout;
     }
   }
   // wait for fd's to tigger, or don't wait if timeout is 0
 #if defined(USE_LIBEV)
   struct ev_loop *eio = pollDescriptor->eio;
+  double pt = (double)poll_timeout/1000.0;
   fd_reify(eio);
-  eio->backend_poll(eio, (double)poll_timeout/1000.0);
+  eio->backend_poll(eio, pt);
   pollDescriptor->result = eio->pendingcnt[0];
+  NetDebug("iocore_net_poll", "[PollCont::pollEvent] backend_poll(%d,%f), result=%d", eio->backend_fd,pt,pollDescriptor->result);
 #elif defined(USE_EPOLL)
   pollDescriptor->result = epoll_wait(pollDescriptor->epoll_fd,
                                       pollDescriptor->ePoll_Triggered_Events, POLL_DESCRIPTOR_SIZE, poll_timeout);
-  NetDebug("epoll", "[PollCont::pollEvent] epoll_fd: %d, timeout: %d, results: %d", pollDescriptor->epoll_fd, poll_timeout,
+  NetDebug("iocore_net_poll", "[PollCont::pollEvent] epoll_fd: %d, timeout: %d, results: %d", pollDescriptor->epoll_fd, poll_timeout,
         pollDescriptor->result);
-  NetDebug("iocore_net", "pollEvent : Epoll fd %d active\n", pollDescriptor->epoll_fd);
 #elif defined(USE_KQUEUE)
   struct timespec tv;
   tv.tv_sec = poll_timeout / 1000;
@@ -128,9 +129,37 @@
                                   pollDescriptor->kq_Triggered_Events,
                                   POLL_DESCRIPTOR_SIZE,
                                   &tv);
-  NetDebug("kqueue", "[PollCont::pollEvent] kueue_fd: %d, timeout: %d, results: %d", pollDescriptor->kqueue_fd, poll_timeout,
+  NetDebug("iocore_net_poll", "[PollCont::pollEvent] kueue_fd: %d, timeout: %d, results: %d", pollDescriptor->kqueue_fd, poll_timeout,
         pollDescriptor->result);
-  NetDebug("iocore_net", "pollEvent : KQueue fd %d active\n", pollDescriptor->kqueue_fd);
+#elif defined(USE_PORT)
+  int retval;
+  timespec_t ptimeout;
+  ptimeout.tv_sec = poll_timeout / 1000;
+  ptimeout.tv_nsec = 1000000 * (poll_timeout % 1000);
+  unsigned nget = 1;
+  if((retval = port_getn(pollDescriptor->port_fd, 
+			pollDescriptor->Port_Triggered_Events,
+			POLL_DESCRIPTOR_SIZE, &nget, &ptimeout)) < 0) {
+    pollDescriptor->result = 0;
+    switch(errno) {
+    case EINTR:
+    case EAGAIN:
+    case ETIME:
+      if (nget > 0) {
+	pollDescriptor->result = (int)nget;
+      }
+      break;
+    default:
+      ink_assert(!"unhandled port_getn() case:");
+      break;
+    }
+  } else {
+    pollDescriptor->result = (int)nget;
+  }
+  NetDebug("iocore_net_poll", "[PollCont::pollEvent] %d[%s]=port_getn(%d,%p,%d,%d,%d),results(%d)", 
+	   retval,retval < 0 ? strerror(errno) : "ok", 
+	   pollDescriptor->port_fd, pollDescriptor->Port_Triggered_Events,
+	   POLL_DESCRIPTOR_SIZE, nget, poll_timeout, pollDescriptor->result);
 #else
 #error port me
 #endif
@@ -180,9 +209,9 @@
   PollDescriptor *pd = pc->pollDescriptor;
 #if defined(USE_LIBEV)
   if (!thread_index)
-    pd->eio = ev_default_loop(0);
+    pd->eio = ev_default_loop(LIBEV_BACKEND_LIST);
   else
-    pd->eio = ev_loop_new(0);
+    pd->eio = ev_loop_new(LIBEV_BACKEND_LIST);
 #endif
   thread->schedule_imm(get_NetHandler(thread));
 
@@ -233,6 +262,7 @@
   SList(UnixNetVConnection, read.enable_link) rq(nh->read_enable_list.popall());
   while ((vc = rq.pop())) {
     vc->ep.modify(EVENTIO_READ);
+    vc->ep.refresh(EVENTIO_READ);
     vc->read.in_enabled_list = 0;
     if ((vc->read.enabled && vc->read.triggered) || vc->closed)
       nh->read_ready_list.in_or_enqueue(vc);
@@ -241,6 +271,7 @@
   SList(UnixNetVConnection, write.enable_link) wq(nh->write_enable_list.popall());
   while ((vc = wq.pop())) {
     vc->ep.modify(EVENTIO_WRITE);
+    vc->ep.refresh(EVENTIO_WRITE);
     vc->write.in_enabled_list = 0;
     if ((vc->write.enabled && vc->write.triggered) || vc->closed)
       nh->write_ready_list.in_or_enqueue(vc);
@@ -260,7 +291,7 @@
   (void) event;
   (void) e;
   EventIO *epd = NULL;
-  int poll_timeout = DEFAULT_POLL_TIMEOUT;
+  int poll_timeout = net_config_poll_timeout;
 
   NET_INCREMENT_DYN_STAT(net_handler_run_stat);
 
@@ -269,17 +300,20 @@
              !read_enable_list.empty() || !write_enable_list.empty()))
     poll_timeout = 0; // poll immediately returns -- we have triggered stuff to process right now
   else
-    poll_timeout = DEFAULT_POLL_TIMEOUT;
+    poll_timeout = net_config_poll_timeout;
 
   PollDescriptor *pd = get_PollDescriptor(trigger_event->ethread);
   UnixNetVConnection *vc = NULL;
 #if defined(USE_LIBEV)
   struct ev_loop *eio = pd->eio;
+  double pt = (double)poll_timeout/1000.0;
   fd_reify(eio);
-  eio->backend_poll(eio, (double)poll_timeout/1000.0);
+  eio->backend_poll(eio, pt);
   pd->result = eio->pendingcnt[0];
+  NetDebug("iocore_net_main_poll", "[NetHandler::mainNetEvent] backend_poll(%d,%f), result=%d", eio->backend_fd,pt,pd->result);
 #elif defined(USE_EPOLL)
   pd->result = epoll_wait(pd->epoll_fd, pd->ePoll_Triggered_Events, POLL_DESCRIPTOR_SIZE, poll_timeout);
+  NetDebug("iocore_net_main_poll", "[NetHandler::mainNetEvent] epoll_wait(%d,%f), result=%d", pd->epoll_fd,poll_timeout,pd->result);
 #elif defined(USE_KQUEUE)
   struct timespec tv;
   tv.tv_sec = poll_timeout / 1000;
@@ -287,7 +321,35 @@
   pd->result = kevent(pd->kqueue_fd, NULL, 0,
                       pd->kq_Triggered_Events, POLL_DESCRIPTOR_SIZE,
                       &tv);
-
+  NetDebug("iocore_net_main_poll", "[NetHandler::mainNetEvent] kevent(%d,%f), result=%d", pd->kqueue_fd,poll_timeout,pd->result);
+#elif defined(USE_PORT)
+  int retval;
+  timespec_t ptimeout;
+  ptimeout.tv_sec = poll_timeout / 1000;
+  ptimeout.tv_nsec = 1000000 * (poll_timeout % 1000);
+  unsigned nget = 1;
+  if((retval = port_getn(pd->port_fd, pd->Port_Triggered_Events, 
+			POLL_DESCRIPTOR_SIZE, &nget, &ptimeout)) < 0) {
+    pd->result = 0;
+    switch(errno) {
+    case EINTR:
+    case EAGAIN:
+    case ETIME:
+      if (nget > 0) {
+	pd->result = (int)nget;
+      }
+      break;
+    default:
+      ink_assert(!"unhandled port_getn() case:");
+      break;
+    }
+  } else {
+    pd->result = (int)nget;
+  }
+  NetDebug("iocore_net_main_poll", "[NetHandler::mainNetEvent] %d[%s]=port_getn(%d,%p,%d,%d,%d),results(%d)", 
+	   retval,retval < 0 ? strerror(errno) : "ok", 
+	   pd->port_fd, pd->Port_Triggered_Events,
+	   POLL_DESCRIPTOR_SIZE, nget, poll_timeout, pd->result);
 #else
 #error port me
 #endif
@@ -304,7 +366,7 @@
           read_ready_list.enqueue(vc);
         else if (get_ev_events(pd,x) & EVENTIO_ERROR) {
           // check for unhandled epoll events that should be handled
-          NetDebug("epoll_miss", "Unhandled epoll event on read: 0x%04x read.enabled=%d closed=%d read.netready_queue=%d",
+          NetDebug("iocore_net_main", "Unhandled epoll event on read: 0x%04x read.enabled=%d closed=%d read.netready_queue=%d",
                 get_ev_events(pd,x), vc->read.enabled, vc->closed, read_ready_list.in(vc));
         }
       }
@@ -316,19 +378,24 @@
           write_ready_list.enqueue(vc);
         else if (get_ev_events(pd,x) & EVENTIO_ERROR) {
           // check for unhandled epoll events that should be handled
-          NetDebug("epoll_miss",
+          NetDebug("iocore_net_main",
                 "Unhandled epoll event on write: 0x%04x write.enabled=%d closed=%d write.netready_queue=%d",
                 get_ev_events(pd,x), vc->write.enabled, vc->closed, write_ready_list.in(vc));
         }
       } else if (!get_ev_events(pd,x) & EVENTIO_ERROR) {
-        NetDebug("epoll_miss", "Unhandled epoll event: 0x%04x", get_ev_events(pd,x));
+        NetDebug("iocore_net_main", "Unhandled epoll event: 0x%04x", get_ev_events(pd,x));
       }
     } else if (epd->type == EVENTIO_DNS_CONNECTION) {
-      if (epd->data.dnscon != NULL)
-        dnsqueue.enqueue(epd->data.dnscon);
-    } else if (epd->type == EVENTIO_ASYNC_SIGNAL)
+      if (epd->data.dnscon != NULL) {
+	dnsqueue.enqueue(epd->data.dnscon);
+#if defined(USE_EDGE_TRIGGER)
+	epd->refresh(EVENTIO_READ);
+#endif
+      }
+    } else if (epd->type == EVENTIO_ASYNC_SIGNAL){
       net_signal_hook_callback(trigger_event->ethread);
-    ev_next_event(pd);
+    }
+    ev_next_event(pd,x);
   }
 
   pd->result = 0;
@@ -338,50 +405,60 @@
   vc = read_ready_list.head;
   while (vc) {
     next_vc = vc->read.ready_link.next;
-#else
-  while ((vc = read_ready_list.dequeue())) {
-#endif
     if (vc->closed)
       close_UnixNetVConnection(vc, trigger_event->ethread);
     else if (vc->read.enabled && vc->read.triggered)
       vc->net_read_io(this, trigger_event->ethread);
-    else if (!vc->read.enabled)
-#if defined(USE_EDGE_TRIGGER)
+    else if (!vc->read.enabled) {
       read_ready_list.remove(vc);
-#else
-      vc->ep.modify(-EVENTIO_READ);
+#if (HOST_OS == solaris)
+      if (vc->read.triggered && vc->write.enabled) {
+	vc->ep.modify(-EVENTIO_READ);
+	vc->ep.refresh(EVENTIO_WRITE);
+	vc->writeReschedule(this);
+      }
 #endif
-#if defined(USE_EDGE_TRIGGER)
+    }
     vc = next_vc;
   }
-#else
-  }
-#endif
-
-#if defined(USE_EDGE_TRIGGER)
   next_vc = NULL;
   vc = write_ready_list.head;
   while (vc) {
     next_vc = vc->write.ready_link.next;
-#else
-  while ((vc = write_ready_list.dequeue())) {
-#endif
     if (vc->closed)
       close_UnixNetVConnection(vc, trigger_event->ethread);
     else if (vc->write.enabled && vc->write.triggered)
       write_to_net(this, vc, pd, trigger_event->ethread);
-    else if (!vc->write.enabled)
-#if defined(USE_EDGE_TRIGGER)
+    else if (!vc->write.enabled) {
       write_ready_list.remove(vc);
-#else
-      vc->ep.modify(-EVENTIO_WRITE);
+#if (HOST_OS == solaris)
+      if (vc->write.triggered && vc->read.enabled) {
+	vc->ep.modify(-EVENTIO_WRITE);
+	vc->ep.refresh(EVENTIO_READ);
+	vc->readReschedule(this);
+      }
 #endif
-#if defined(USE_EDGE_TRIGGER)
+    }
     vc = next_vc;
   }
-#else
+#else /* !USE_EDGE_TRIGGER */
+  while ((vc = read_ready_list.dequeue())) {
+    if (vc->closed)
+      close_UnixNetVConnection(vc, trigger_event->ethread);
+    else if (vc->read.enabled && vc->read.triggered)
+      vc->net_read_io(this, trigger_event->ethread);
+    else if (!vc->read.enabled)
+      vc->ep.modify(-EVENTIO_READ);
   }
-#endif
+  while ((vc = write_ready_list.dequeue())) {
+    if (vc->closed)
+      close_UnixNetVConnection(vc, trigger_event->ethread);
+    else if (vc->write.enabled && vc->write.triggered)
+      write_to_net(this, vc, pd, trigger_event->ethread);
+    else if (!vc->write.enabled)
+      vc->ep.modify(-EVENTIO_WRITE);
+  }
+#endif /* !USE_EDGE_TRIGGER */
 
   return EVENT_CONT;
 }

Modified: incubator/trafficserver/traffic/branches/dev/iocore/net/UnixNetAccept.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/iocore/net/UnixNetAccept.cc?rev=902234&r1=902233&r2=902234&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/iocore/net/UnixNetAccept.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/iocore/net/UnixNetAccept.cc Fri Jan 22 19:17:30 2010
@@ -248,7 +248,7 @@
     EThread *t = eventProcessor.eventthread[ET_NET][i];
     PollDescriptor *pd = get_PollDescriptor(t);
     if (a->ep.start(pd, a, EVENTIO_READ) < 0)
-      NetDebug("iocore_net", "error starting EventIO");
+      Warning("[NetAccept::init_accept_per_thread]:error starting EventIO");
     a->mutex = get_NetHandler(t)->mutex;
     t->schedule_every(a, period, etype);
   }
@@ -411,7 +411,7 @@
     if (likely(fd >= 0)) {
       vc->addLogMessage("accepting the connection");
 
-      NetDebug("epoll", "accepted a new socket: %d", fd);
+      NetDebug("iocore_net", "accepted a new socket: %d", fd);
       if (send_bufsize > 0) {
         if (unlikely(socketManager.set_sndbuf_size(fd, send_bufsize))) {
           bufsz = ROUNDUP(send_bufsize, 1024);
@@ -483,7 +483,7 @@
     SET_CONTINUATION_HANDLER(vc, (NetVConnHandler) & UnixNetVConnection::mainEvent);
 
     if (vc->ep.start(pd, vc, EVENTIO_READ|EVENTIO_WRITE) < 0) {
-      NetDebug("iocore_net", "acceptFastEvent : Error in inserting fd[%d] in kevent\n", vc->con.fd);
+      Warning("[NetAccept::acceptFastEvent]: Error in inserting fd[%d] in kevent\n", vc->con.fd);
       close_UnixNetVConnection(vc, e->ethread);
       return EVENT_DONE;
     }

Modified: incubator/trafficserver/traffic/branches/dev/iocore/net/UnixNetProcessor.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/iocore/net/UnixNetProcessor.cc?rev=902234&r1=902233&r2=902234&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/iocore/net/UnixNetProcessor.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/iocore/net/UnixNetProcessor.cc Fri Jan 22 19:17:30 2010
@@ -62,7 +62,7 @@
   (void) accept_only;           // NT only
   (void) bound_sockaddr;        // NT only
   (void) bound_sockaddr_size;   // NT only
-  NetDebug("net_processor", "NetProcessor::accept - port %d,recv_bufsize %d, send_bufsize %d, sockopt 0x%0lX",
+  NetDebug("iocore_net_processor", "NetProcessor::accept - port %d,recv_bufsize %d, send_bufsize %d, sockopt 0x%0lX",
         port, recv_bufsize, send_bufsize, sockopt_flags);
   return ((UnixNetProcessor *) this)->accept_internal(cont, NO_FD, port,
                                                       bound_sockaddr,
@@ -81,7 +81,7 @@
                           EventType etype, bool callback_on_open)
 {
   (void) accept_only;           // NT only
-  NetDebug("net_processor", "NetProcessor::main_accept - port %d,recv_bufsize %d, send_bufsize %d, sockopt 0x%0lX",
+  NetDebug("iocore_net_processor", "NetProcessor::main_accept - port %d,recv_bufsize %d, send_bufsize %d, sockopt 0x%0lX",
         port, recv_bufsize, send_bufsize, sockopt_flags);
   return ((UnixNetProcessor *) this)->accept_internal(cont, fd, port,
                                                       bound_sockaddr,
@@ -346,7 +346,7 @@
     switch (event) {
     case NET_EVENT_OPEN:
       vc = (UnixNetVConnection *) e;
-      NetDebug("connect", "connect Net open");
+      NetDebug("iocore_net_connect", "connect Net open");
       vc->do_io_write(this, 10, /* some non-zero number just to get the poll going */
                       reader);
       /* dont wait for more than timeout secs */
@@ -354,7 +354,8 @@
       return EVENT_CONT;
       break;
 
-      case NET_EVENT_OPEN_FAILED:NetDebug("connect", "connect Net open failed");
+      case NET_EVENT_OPEN_FAILED:
+	NetDebug("iocore_net_connect", "connect Net open failed");
       if (!action_.cancelled)
         action_.continuation->handleEvent(NET_EVENT_OPEN_FAILED, (void *) e);
       break;
@@ -367,7 +368,7 @@
           ret = getsockopt(vc->con.fd, SOL_SOCKET, SO_ERROR, (char *) &sl, &sz);
         if (!ret && sl == 0)
         {
-          NetDebug("connect", "connection established");
+          NetDebug("iocore_net_connect", "connection established");
           /* disable write on vc */
           vc->write.enabled = 0;
           vc->cancel_inactivity_timeout();
@@ -388,7 +389,7 @@
         action_.continuation->handleEvent(NET_EVENT_OPEN_FAILED, (void *) -ENET_CONNECT_FAILED);
       break;
     case VC_EVENT_INACTIVITY_TIMEOUT:
-      NetDebug("connect", "connect timed out");
+      NetDebug("iocore_net_connect", "connect timed out");
       vc->do_io_close();
       if (!action_.cancelled)
         action_.continuation->handleEvent(NET_EVENT_OPEN_FAILED, (void *) -ENET_CONNECT_TIMEOUT);
@@ -437,7 +438,7 @@
 NetProcessor::connect_s(Continuation * cont, unsigned int ip,
                         int port, unsigned int _interface, int timeout, NetVCOptions * opt)
 {
-  NetDebug("connect", "NetProcessor::connect_s called");
+  NetDebug("iocore_net_connect", "NetProcessor::connect_s called");
   CheckConnect *c = NEW(new CheckConnect(cont->mutex));
   return c->connect_s(cont, ip, port, _interface, timeout, opt);
 }

Modified: incubator/trafficserver/traffic/branches/dev/iocore/net/UnixNetVConnection.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/iocore/net/UnixNetVConnection.cc?rev=902234&r1=902233&r2=902234&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/iocore/net/UnixNetVConnection.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/iocore/net/UnixNetVConnection.cc Fri Jan 22 19:17:30 2010
@@ -227,6 +227,7 @@
 
   if (!lock || lock.m.m_ptr != s->vio.mutex.m_ptr) {
     vc->addLogMessage("can't get lock");
+    read_reschedule(nh, vc);
     return;
   }
   // if it is not enabled.  
@@ -320,7 +321,7 @@
     buf.writer()->fill(r);
 #ifdef DEBUG
     if (buf.writer()->write_avail() <= 0)
-      NetDebug("ssl", "read_from_net, read buffer full");
+      NetDebug("iocore_net", "read_from_net, read buffer full");
 #endif
     s->vio.ndone += r;
     net_activity(vc, thread);
@@ -333,7 +334,7 @@
     ink_assert(ntodo >= 0);
     if (s->vio.ntodo() <= 0) {
       read_signal_done(VC_EVENT_READ_COMPLETE, nh, vc);
-      NetDebug("ssl", "read_from_net, read finished - signal done");
+      NetDebug("iocore_net", "read_from_net, read finished - signal done");
       return;
     } else {
       if (read_signal_and_update(VC_EVENT_READ_READY, vc) != EVENT_CONT)
@@ -381,8 +382,11 @@
 
   MUTEX_TRY_LOCK_FOR(lock, s->vio.mutex, thread, s->vio._cont);
 
-  if (!lock || lock.m.m_ptr != s->vio.mutex.m_ptr)
+  if (!lock || lock.m.m_ptr != s->vio.mutex.m_ptr) {
+    vc->addLogMessage("can't get lock");
+    write_reschedule(nh, vc);
     return;
+  }
 
   // This function will always return true unless
   // vc is an SSLNetVConnection.
@@ -525,6 +529,7 @@
 VIO *
 UnixNetVConnection::do_io_read(Continuation *c, ink64 nbytes, MIOBuffer *buf)
 {
+  addLogMessage("do_io_read");
   ink_assert(!closed);
   if (buf)
     read.vio.buffer.writer_for(buf);
@@ -906,6 +911,12 @@
 }
 
 void
+UnixNetVConnection::writeReschedule(NetHandler *nh)
+{
+  write_reschedule(nh, this);
+}
+
+void
 UnixNetVConnection::netActivity(EThread *lthread)
 {
   net_activity(this, lthread);

Modified: incubator/trafficserver/traffic/branches/dev/iocore/net/UnixUDPNet.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/iocore/net/UnixUDPNet.cc?rev=902234&r1=902233&r2=902234&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/iocore/net/UnixUDPNet.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/iocore/net/UnixUDPNet.cc Fri Jan 22 19:17:30 2010
@@ -77,7 +77,7 @@
 #if defined(USE_LIBEV)
   PollCont *pc = get_UDPPollCont(thread);
   PollDescriptor *pd = pc->pollDescriptor;
-  pd->eio = ev_loop_new(0);
+  pd->eio = ev_loop_new(LIBEV_BACKEND_LIST);
 #endif
   // These are hidden variables that control the amount of memory used by UDP
   // packets.  As usual, defaults are in RecordsConfig.cc

Modified: incubator/trafficserver/traffic/branches/dev/libinktomi++/Compatability.h
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/libinktomi%2B%2B/Compatability.h?rev=902234&r1=902233&r2=902234&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/libinktomi++/Compatability.h (original)
+++ incubator/trafficserver/traffic/branches/dev/libinktomi++/Compatability.h Fri Jan 22 19:17:30 2010
@@ -82,6 +82,11 @@
 typedef unsigned int in_addr_t;
 #endif
 
+#if (HOST_OS == solaris)
+#include <sys/types.h> /* paddr_t should be defined here*/
+typedef uint64_t  paddr_t;
+#endif
+
 #define NEED_HRTIME
 
 #include <stdio.h>
@@ -115,10 +120,10 @@
 #include <sys/syscall.h>
 
 // Some ugliness around pread() vs SYS_pread64 syscall
-#if defined (SYS_pread64)
+#if !defined(SYS_pread) && defined (SYS_pread64)
 #  define SYS_pread SYS_pread64
 #endif
-#if defined (SYS_pwrite64)
+#if !defined(SYS_pwrite) && defined (SYS_pwrite64)
 #  define SYS_pwrite SYS_pwrite64
 #endif
 
@@ -245,7 +250,7 @@
 #define ink_mmap       mmap
 #define ink_sleep      sleep
 
-#if (HOST_OS == darwin)
+#if (__GNUC__ >= 3) && ((HOST_OS == darwin) || (HOST_OS == solaris))
 #define ink_offsetof(TYPE, MEMBER) (__builtin_offsetof (TYPE, MEMBER))
 #else
 #define ink_offsetof offsetof

Modified: incubator/trafficserver/traffic/branches/dev/libinktomi++/Makefile.am
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/libinktomi%2B%2B/Makefile.am?rev=902234&r1=902233&r2=902234&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/libinktomi++/Makefile.am (original)
+++ incubator/trafficserver/traffic/branches/dev/libinktomi++/Makefile.am Fri Jan 22 19:17:30 2010
@@ -7,7 +7,8 @@
 TESTS = $(check_PROGRAMS)
 noinst_LIBRARIES = libinktomi++.a
 
-libinktomi___a_CCASFLAGS = -Wa,--32
+#libinktomi___a_CCASFLAGS = -Wa,--32
+libinktomi___a_CCASFLAGS = -Wa,-32
 libinktomi___a_SOURCES = \
   Allocator.cc \
   Allocator.h \

Modified: incubator/trafficserver/traffic/branches/dev/libinktomi++/ink_bool.h
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/libinktomi%2B%2B/ink_bool.h?rev=902234&r1=902233&r2=902234&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/libinktomi++/ink_bool.h (original)
+++ incubator/trafficserver/traffic/branches/dev/libinktomi++/ink_bool.h Fri Jan 22 19:17:30 2010
@@ -46,7 +46,7 @@
  * bool, true, and false already declared in C++
  */
 #if !defined (bool)
-#if (HOST_OS != freebsd)
+#if (HOST_OS != freebsd) && (HOST_OS != solaris)
 #define bool int
 #endif
 #endif

Modified: incubator/trafficserver/traffic/branches/dev/libinktomi++/ink_memory.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/libinktomi%2B%2B/ink_memory.cc?rev=902234&r1=902233&r2=902234&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/libinktomi++/ink_memory.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/libinktomi++/ink_memory.cc Fri Jan 22 19:17:30 2010
@@ -262,7 +262,11 @@
   void *ptr;
 
 #ifdef HAVE_POSIX_MEMALIGN
+#if (HOST_OS == solaris)
+  if (alignment <= 8)
+#else
   if (alignment <= 16)
+#endif
     return ink_malloc(size);
 
   if (size == (1024 * 1024)) {

Modified: incubator/trafficserver/traffic/branches/dev/libinktomi++/ink_mutex.h
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/libinktomi%2B%2B/ink_mutex.h?rev=902234&r1=902233&r2=902234&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/libinktomi++/ink_mutex.h (original)
+++ incubator/trafficserver/traffic/branches/dev/libinktomi++/ink_mutex.h Fri Jan 22 19:17:30 2010
@@ -71,13 +71,15 @@
 {
   (void) name;
 
+#if (HOST_OS == solaris)
+  if ( pthread_mutex_init(m, NULL) != 0 ) {
+    abort();
+  }
+#else
   if (pthread_mutex_init(m, &_g_mattr.attr) != 0) {
     abort();
   }
-//  if ( pthread_mutex_init(m, NULL) != 0 ) {
-//    abort();
-//  }
-
+#endif
   return 0;
 }
 

Modified: incubator/trafficserver/traffic/branches/dev/libinktomi++/ink_platform.h
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/libinktomi%2B%2B/ink_platform.h?rev=902234&r1=902233&r2=902234&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/libinktomi++/ink_platform.h (original)
+++ incubator/trafficserver/traffic/branches/dev/libinktomi++/ink_platform.h Fri Jan 22 19:17:30 2010
@@ -81,6 +81,8 @@
 #include <sys/epoll.h>
 #elif defined(USE_KQUEUE)
 #include <sys/event.h>
+#elif defined(USE_PORT)
+#include <port.h>
 #endif
 
 

Modified: incubator/trafficserver/traffic/branches/dev/libinktomi++/ink_port.h
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/libinktomi%2B%2B/ink_port.h?rev=902234&r1=902233&r2=902234&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/libinktomi++/ink_port.h (original)
+++ incubator/trafficserver/traffic/branches/dev/libinktomi++/ink_port.h Fri Jan 22 19:17:30 2010
@@ -64,7 +64,7 @@
 #define _CRTIMP
 #define HAVE_64_BIT
 
-#if (HOST_OS == linux) || (HOST_OS == freebsd) || (HOST_OS == darwin)
+#if (HOST_OS == linux) || (HOST_OS == freebsd) || (HOST_OS == darwin) || (HOST_OS == solaris)
 #define POSIX_THREAD
 #define POSIX_THREAD_10031c
 #else

Modified: incubator/trafficserver/traffic/branches/dev/libinktomi++/ink_queue.h
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/libinktomi%2B%2B/ink_queue.h?rev=902234&r1=902233&r2=902234&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/libinktomi++/ink_queue.h (original)
+++ incubator/trafficserver/traffic/branches/dev/libinktomi++/ink_queue.h Fri Jan 22 19:17:30 2010
@@ -101,7 +101,7 @@
 #define TO_PTR(_x) ((void*)(_x))
 #endif
 
-#if defined(__i386__)
+#if defined(__i386__) || defined(__i386)
 #define FREELIST_POINTER(_x) (_x).s.pointer
 #define FREELIST_VERSION(_x) (_x).s.version
 #define SET_FREELIST_POINTER_VERSION(_x,_p,_v) \

Modified: incubator/trafficserver/traffic/branches/dev/libinktomi++/ink_regex-3.6.h
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/libinktomi%2B%2B/ink_regex-3.6.h?rev=902234&r1=902233&r2=902234&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/libinktomi++/ink_regex-3.6.h (original)
+++ incubator/trafficserver/traffic/branches/dev/libinktomi++/ink_regex-3.6.h Fri Jan 22 19:17:30 2010
@@ -21,7 +21,7 @@
   limitations under the License.
  */
 
-#if (HOST_OS != linux) && (HOST_OS != freebsd) && (HOST_OS != darwin) && (HOST_OS != sunos)
+#if (HOST_OS != linux) && (HOST_OS != freebsd) && (HOST_OS != darwin) && (HOST_OS != solaris)
 #ifndef _INK_REGEX_H_
 #define	_INK_REGEX_H_               /* never again */
 /* ========= begin header generated by ./mkh ========= */
@@ -99,6 +99,6 @@
 #endif
 /* ========= end header generated by ./mkh ========= */
 #endif                          /* #ifndef _INK_REGEX_H_ */
-#else /* linux || freebsd || darwin || sunos */
+#else /* linux || freebsd || darwin || solaris */
 #include "regex.h"
-#endif  /* (HOST_OS != linux) && (HOST_OS != freebsd) && (HOST_OS != darwin) && (HOST_OS != sunos) */
+#endif  /* (HOST_OS != linux) && (HOST_OS != freebsd) && (HOST_OS != darwin) && (HOST_OS != solaris) */

Modified: incubator/trafficserver/traffic/branches/dev/libinktomi++/ink_string.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/libinktomi%2B%2B/ink_string.cc?rev=902234&r1=902233&r2=902234&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/libinktomi++/ink_string.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/libinktomi++/ink_string.cc Fri Jan 22 19:17:30 2010
@@ -424,7 +424,7 @@
 
   inbytesleft = inlen;
   outbytesleft = *outlen;
-#if (HOST_OS == freebsd)
+#if (HOST_OS == freebsd) || (HOST_OS == solaris)
   if (iconv(ic, &in, &inbytesleft, &out, &outbytesleft) == (size_t) - 1) 
 #else
   if (iconv(ic, (char **) &in, &inbytesleft, &out, &outbytesleft) == (size_t) - 1) 

Modified: incubator/trafficserver/traffic/branches/dev/libinktomi++/lockfile.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/libinktomi%2B%2B/lockfile.cc?rev=902234&r1=902233&r2=902234&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/libinktomi++/lockfile.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/libinktomi++/lockfile.cc Fri Jan 22 19:17:30 2010
@@ -93,7 +93,7 @@
     *t = '\0';
 
     // coverity[secure_coding]
-    if (sscanf(buf, "%d\n", &val) != 1) {
+    if (sscanf(buf, "%d\n", (int*)&val) != 1) {
       *holding_pid = 0;
     } else {
       *holding_pid = val;

Modified: incubator/trafficserver/traffic/branches/dev/libinktomi++/ptrdef.h
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/libinktomi%2B%2B/ptrdef.h?rev=902234&r1=902233&r2=902234&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/libinktomi++/ptrdef.h (original)
+++ incubator/trafficserver/traffic/branches/dev/libinktomi++/ptrdef.h Fri Jan 22 19:17:30 2010
@@ -35,19 +35,23 @@
 #if (__WORDSIZE == 64)
 typedef long long int_pointer;
 
-#else   /*  */
+#else   /*  (__WORDSIZE == 32) */
 typedef unsigned long int_pointer;
 
 #endif  /* #if (__WORDSIZE == 64) */
-#else   /*  */
+#else   /*  (__WORDSIZE != 64) && (__WORDSIZE != 32) */
 #error "Invalid __WORDSIZE!"
 #endif  /* #if (__WORDSIZE == 64) || (__WORDSIZE == 32) */
-#else   /*  */
+#else   /*  !__WORDSIZE */
 #ifdef _LP64
- typedef long long int_pointer;
-#else
+typedef long long int_pointer;
+#else /* !_LP64 */
+#if defined(__PTRDIFF_TYPE__)
+typedef unsigned  __PTRDIFF_TYPE__ int_pointer;
+#else /* !__PTRDIFF_TYPE__ */
 #error "__WORDSIZE not defined!"
-#endif
+#endif /* __PTRDIFF_TYPE__ */
+#endif /* _LP64 */
 #endif  /* #ifdef __WORDSIZE  */
   
 #endif  /* #ifndef H_PTRDEF_H */

Modified: incubator/trafficserver/traffic/branches/dev/proxy/CoreUtils.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/CoreUtils.cc?rev=902234&r1=902233&r2=902234&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/CoreUtils.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/CoreUtils.cc Fri Jan 22 19:17:30 2010
@@ -130,14 +130,14 @@
 int program_counter = 0;
 #endif  // linux check
 
-#if (HOST_OS == darwin) || (HOST_OS == freebsd)
+#if (HOST_OS == darwin) || (HOST_OS == freebsd) || (HOST_OS == solaris) // FIXME: solaris x86
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdint.h>
 #include <math.h>
 #include "inktomi++.h"
 #include "CoreUtils.h"
-#endif
+#endif /* darwin || freebsd || solaris */
 
 #ifdef READ_CORE_WMT
 #include "WMT-Debug.h"

Modified: incubator/trafficserver/traffic/branches/dev/proxy/CoreUtils.h
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/CoreUtils.h?rev=902234&r1=902233&r2=902234&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/CoreUtils.h (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/CoreUtils.h Fri Jan 22 19:17:30 2010
@@ -82,7 +82,7 @@
 };
 #endif  // linux check
 
-#if (HOST_OS == darwin) || (HOST_OS == freebsd)
+#if (HOST_OS == darwin) || (HOST_OS == freebsd) || (HOST_OS == solaris) // FIXME: solaris x86
 #include <stdio.h>
 #include <unistd.h>
 #include <stdlib.h>
@@ -100,7 +100,7 @@
   intptr_t pc;
   intptr_t arg[NO_OF_ARGS];
 };
-#endif  
+#endif  /* darwin || freebsd || solaris */
 
 // to be sorted by virtual address
 struct memTable
@@ -187,6 +187,7 @@
   * inputs: none
   * outputs: returns the active lwp id
   **********************************************************************/
+
 #if defined(sparc)
   static intptr_t get_active_thread_Id();
 #endif
@@ -199,6 +200,7 @@
 #if (HOST_OS == linux)
   static void get_base_frame(intptr_t framep, core_stack_state * coress);
 #endif
+
 #if defined(sparc)
   static void get_base_frame(intptr_t threadId, core_stack_state * coress);
 #endif

Modified: incubator/trafficserver/traffic/branches/dev/proxy/ICP.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/ICP.cc?rev=902234&r1=902233&r2=902234&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/ICP.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/ICP.cc Fri Jan 22 19:17:30 2010
@@ -1753,7 +1753,7 @@
 
   mhdr->msg_name = (caddr_t) 0;
   mhdr->msg_namelen = 0;
-#if (HOST_OS != linux) && (HOST_OS != freebsd) && (HOST_OS != darwin)
+#if (HOST_OS != linux) && (HOST_OS != freebsd) && (HOST_OS != darwin) && (HOST_OS != solaris)
   mhdr->msg_accrights = (caddr_t) 0;
   mhdr->msg_accrightslen = 0;
 #else

Modified: incubator/trafficserver/traffic/branches/dev/proxy/Main.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/Main.cc?rev=902234&r1=902233&r2=902234&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/Main.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/Main.cc Fri Jan 22 19:17:30 2010
@@ -46,7 +46,7 @@
 #include <sys/filio.h>
 #endif
 #include <syslog.h>
-#if (HOST_OS != darwin) && (HOST_OS != freebsd)
+#if (HOST_OS != darwin) && (HOST_OS != freebsd) && (HOST_OS != solaris)
 #include <mcheck.h>
 #endif
 
@@ -300,6 +300,8 @@
 
   {"accept_mss", ' ', "MSS for client connections", "I", &accept_mss,
    NULL, NULL},
+  {"poll_timeout", 't', "poll timeout in milliseconds", "I", &net_config_poll_timeout,
+   NULL, NULL},
   {"help", 'h', "HELP!", NULL, NULL, NULL, usage},
 };
 int n_argument_descriptions = SIZE(argument_descriptions);
@@ -400,7 +402,11 @@
     fprintf(stderr, "WARNING: Can't acquire lockfile '%s'", lockfile);
 
     if ((err == 0) && (holding_pid != -1)) {
+#if (HOST_OS == solaris)
+      fprintf(stderr, " (Lock file held by process ID %d)\n", (int)holding_pid);
+#else
       fprintf(stderr, " (Lock file held by process ID %d)\n", holding_pid);
+#endif
     } else if ((err == 0) && (holding_pid == -1)) {
       fprintf(stderr, " (Lock file exists, but can't read process ID)\n");
     } else if (reason) {

Modified: incubator/trafficserver/traffic/branches/dev/proxy/http2/HttpConfig.h
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/http2/HttpConfig.h?rev=902234&r1=902233&r2=902234&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/http2/HttpConfig.h (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/http2/HttpConfig.h Fri Jan 22 19:17:30 2010
@@ -38,8 +38,12 @@
 #include <stdio.h>
 
 #ifdef HAVE_REGEX_H
+#if (HOST_OS == solaris)
+#include <regex.h>
+#else
 #include "/usr/include/regex.h"
 #endif
+#endif
 
 #ifdef HAVE_CTYPE_H
 #include <ctype.h>

Modified: incubator/trafficserver/traffic/branches/dev/proxy/logging/LogConfig.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/logging/LogConfig.cc?rev=902234&r1=902233&r2=902234&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/logging/LogConfig.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/logging/LogConfig.cc Fri Jan 22 19:17:30 2010
@@ -43,11 +43,12 @@
 
 #if (HOST_OS == linux)
 #include <sys/statfs.h>
-#else  // linux check
-#if (HOST_OS != freebsd)
+#elif (HOST_OS == solaris)
+#include <sys/statfs.h>
+#include <sys/statvfs.h>
+#elif (HOST_OS != freebsd)
 #include <sys/statvfs.h>
-#endif  // not freebsd check
-#endif  // linux check
+#endif  // linux 
 
 #include "ink_platform.h"
 
@@ -1783,12 +1784,19 @@
   // Now check the partition to see if there is enough *actual* space.
   //
   partition_space_left = m_partition_space_left;
+#if (HOST_OS == solaris)
+  struct statvfs fs;
+  ::memset(&fs, 0, sizeof(fs));
+  int ret =::statvfs(logfile_dir, &fs);
+#else
   struct statfs fs;
   ::memset(&fs, 0, sizeof(fs));
   int ret =::statfs(logfile_dir, &fs);
+#endif
   if (ret >= 0) {
     partition_space_left = (ink64) fs.f_bavail * (ink64) fs.f_bsize;
   }
+
   //
   // Update the config variables for space used/left
   //

Modified: incubator/trafficserver/traffic/branches/dev/proxy/logging/LogStandalone.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/logging/LogStandalone.cc?rev=902234&r1=902233&r2=902234&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/logging/LogStandalone.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/logging/LogStandalone.cc Fri Jan 22 19:17:30 2010
@@ -212,7 +212,11 @@
     fprintf(stderr, "FATAL: Can't acquire lockfile '%s'", lockfile);
 
     if ((err == 0) && (holding_pid != -1)) {
+#if (HOST_OS == solaris)
+      fprintf(stderr, " (Lock file held by process ID %d)\n", (int)holding_pid);
+#else
       fprintf(stderr, " (Lock file held by process ID %d)\n", holding_pid);
+#endif
     } else if ((err == 0) && (holding_pid == -1)) {
       fprintf(stderr, " (Lock file exists, but can't read process ID)\n");
     } else if (reason) {

Modified: incubator/trafficserver/traffic/branches/dev/proxy/logging/LogUtils.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/logging/LogUtils.cc?rev=902234&r1=902233&r2=902234&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/logging/LogUtils.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/logging/LogUtils.cc Fri Jan 22 19:17:30 2010
@@ -45,8 +45,11 @@
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
-// need following instead of <netdb.h>
-#include "/usr/include/netdb.h"
+#if (HOST_OS == solaris)
+#include <netdb.h>
+#else
+#include "/usr/include/netdb.h" // need following instead of <netdb.h>
+#endif
 
 
 #include "P_RecProcess.h"

Modified: incubator/trafficserver/traffic/branches/dev/proxy/logstats.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/logstats.cc?rev=902234&r1=902233&r2=902234&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/logstats.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/logstats.cc Fri Jan 22 19:17:30 2010
@@ -31,6 +31,10 @@
 
 #include <math.h>
 #include <sys/utsname.h>
+#if (HOST_OS == solaris)
+#include <sys/types.h>
+#include <unistd.h>
+#endif
 
 #include <iostream>
 #include <fstream>
@@ -1760,6 +1764,7 @@
   int res, cnt;
   int main_fd;
   unsigned max_age;
+  struct flock lck;
 
   // build the application information structure
   appVersionInfo.setup(PROGRAM_NAME, PROGRAM_VERSION, __DATE__, __TIME__, BUILD_MACHINE, BUILD_PERSON, "");
@@ -1899,8 +1904,14 @@
       my_exit(YMON_CRITICAL, ymon_notice);
     }
     // Get an exclusive lock, if possible. Try for up to 20 seconds.
+    // Use more portable & standard fcntl() over flock()
+    lck.l_type = F_WRLCK;
+    lck.l_whence = 0; /* offset l_start from beginning of file*/
+    lck.l_start = (off_t)0;
+    lck.l_len = (off_t)0; /* till end of file*/
     cnt = 10;
-    while (((res = flock(state_fd, LOCK_EX | LOCK_NB)) < 0) && --cnt) {
+    // while (((res = flock(state_fd, LOCK_EX | LOCK_NB)) < 0) && --cnt) {
+    while (((res = fcntl(state_fd, F_SETLK, &lck)) < 0) && --cnt) {
       switch (errno) {
       case EWOULDBLOCK:
       case EINTR:
@@ -2033,7 +2044,9 @@
           ymon_status = YMON_WARNING;
       }
     }
-    flock(state_fd, LOCK_UN);
+    //flock(state_fd, LOCK_UN);
+    lck.l_type = F_UNLCK;
+    fcntl(state_fd, F_SETLK, &lck);
     close(main_fd);
     close(state_fd);
   } else {

Modified: incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/Alarms.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/Alarms.cc?rev=902234&r1=902233&r2=902234&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/Alarms.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/Alarms.cc Fri Jan 22 19:17:30 2010
@@ -635,13 +635,13 @@
   } else {
     int res;
     if (alarm_email_from_name && alarm_email_from_addr && alarm_email_to_addr) {
-#if (HOST_OS == freebsd)
+#if (HOST_OS == freebsd) || (HOST_OS == solaris)
       res = execl(cmd_line, alarm_bin, desc, alarm_email_from_name, alarm_email_from_addr, alarm_email_to_addr, (char *)0);
 #else
       res = execl(cmd_line, alarm_bin, desc, alarm_email_from_name, alarm_email_from_addr, alarm_email_to_addr, NULL);
 #endif
     } else {
-#if (HOST_OS == freebsd)
+#if (HOST_OS == freebsd) || (HOST_OS == solaris)
       res = execl(cmd_line, alarm_bin, desc, (char *)0);
 #else
       res = execl(cmd_line, alarm_bin, desc, NULL);

Modified: incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/LocalManager.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/LocalManager.cc?rev=902234&r1=902233&r2=902234&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/LocalManager.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/LocalManager.cc Fri Jan 22 19:17:30 2010
@@ -1147,7 +1147,7 @@
           Debug("lm-filter", "[LocalManager::startProxy] " "%s execution completed\n", absolute_convert_binary);
         }
       } else {                  // invoke the converter script - no args
-#if (HOST_OS == freebsd)
+#if (HOST_OS == freebsd) || (HOST_OS == solaris)
         int res = execl(absolute_convert_binary, convert_bin, NULL, (char *)0);
 #else
         int res = execl(absolute_convert_binary, convert_bin, NULL, NULL);
@@ -1216,7 +1216,7 @@
       char env_prep_bin[1024];
 
       snprintf(env_prep_bin, sizeof(env_prep_bin), "%s/%s", bin_path, env_prep);
-#if (HOST_OS == freebsd)
+#if (HOST_OS == freebsd) || (HOST_OS == solaris)
       res = execl(env_prep_bin, env_prep, (char *)0);
 #else
       res = execl(env_prep_bin, env_prep, NULL);

Modified: incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/Main.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/Main.cc?rev=902234&r1=902233&r2=902234&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/Main.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/Main.cc Fri Jan 22 19:17:30 2010
@@ -76,7 +76,7 @@
 #endif
 
 
-#if (HOST_OS != linux) && (HOST_OS != darwin) && (HOST_OS != freebsd)
+#if (HOST_OS != linux) && (HOST_OS != darwin) && (HOST_OS != freebsd) && (HOST_OS != solaris)
 extern "C"
 {
   int gethostname(char *name, int namelen);
@@ -155,7 +155,11 @@
   } else {
     char *reason = strerror(-err);
     if (err == 0) {
+#if (HOST_OS == solaris)
+      fprintf(stderr, "FATAL: Lockfile '%s' says server already running as PID %d\n", lockfile, (int)holding_pid);
+#else
       fprintf(stderr, "FATAL: Lockfile '%s' says server already running as PID %d\n", lockfile, holding_pid);
+#endif
       mgmt_elog(stderr, "FATAL: Lockfile '%s' says server already running as PID %d\n", lockfile, holding_pid);
     } else {
       fprintf(stderr, "FATAL: Can't open server lockfile '%s' (%s)\n", lockfile, (reason ? reason : "Unknown Reason"));
@@ -176,7 +180,11 @@
     fprintf(stderr, "FATAL: Can't acquire manager lockfile '%s'", lockfile);
     mgmt_elog(stderr, "FATAL: Can't acquire manager lockfile '%s'", lockfile);
     if (err == 0) {
+#if (HOST_OS == solaris)
+      fprintf(stderr, " (Lock file held by process ID %d)\n", (int)holding_pid);
+#else
       fprintf(stderr, " (Lock file held by process ID %d)\n", holding_pid);
+#endif
       mgmt_elog(stderr, " (Lock file held by process ID %d)\n", holding_pid);
     } else if (reason) {
       fprintf(stderr, " (%s)\n", reason);
@@ -1041,7 +1049,11 @@
 #if (HOST_OS != linux) && (HOST_OS != freebsd)
   if (t) {
     if (t->si_code <= 0) {
+#if (HOST_OS == solaris)
+      fprintf(stderr, "[TrafficManager] ==> User Alarm from pid: %d uid: %d\n", (int)t->si_pid, t->si_uid);
+#else
       fprintf(stderr, "[TrafficManager] ==> User Alarm from pid: %d uid: %d\n", t->si_pid, t->si_uid);
+#endif
       mgmt_elog(stderr, "[TrafficManager] ==> User Alarm from pid: %d uid: %d\n", t->si_pid, t->si_uid);
     } else {
       fprintf(stderr, "[TrafficManager] ==> Kernel Alarm Reason: %d\n", t->si_code);
@@ -1068,7 +1080,11 @@
 #if (HOST_OS != linux) && (HOST_OS != freebsd)
   if (t) {
     if (t->si_code <= 0) {
+#if (HOST_OS == solaris)
+      fprintf(stderr, "[TrafficManager] ==> User Sig %d from pid: %d uid: %d\n", sig, (int)t->si_pid, t->si_uid);
+#else
       fprintf(stderr, "[TrafficManager] ==> User Sig %d from pid: %d uid: %d\n", sig, t->si_pid, t->si_uid);
+#endif
       mgmt_elog(stderr, "[TrafficManager] ==> User Sig %d from pid: %d uid: %d\n", sig, t->si_pid, t->si_uid);
     } else {
       fprintf(stderr, "[TrafficManager] ==> Kernel Sig %d; Reason: %d\n", sig, t->si_code);

Modified: incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/api2/include/INKMgmtAPI.h
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/api2/include/INKMgmtAPI.h?rev=902234&r1=902233&r2=902234&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/api2/include/INKMgmtAPI.h (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/api2/include/INKMgmtAPI.h Fri Jan 22 19:17:30 2010
@@ -58,7 +58,7 @@
 #if defined (__SUNPRO_CC) || (defined (__GNUC__) || ! defined(__cplusplus))
 
 #if !defined (bool)
-#if (HOST_OS != darwin) && (HOST_OS != freebsd)
+#if (HOST_OS != darwin) && (HOST_OS != freebsd) && (HOST_OS != solaris)
 #define bool int
 #endif
 #endif

Modified: incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cli2/ConfigCmd.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cli2/ConfigCmd.cc?rev=902234&r1=902233&r2=902234&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cli2/ConfigCmd.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cli2/ConfigCmd.cc Fri Jan 22 19:17:30 2010
@@ -5139,6 +5139,15 @@
 
 }
 
+#if (HOST_OS == solaris)
+/*
+ * NOTE: This routine is found in libnsl (-lnsl). No prototype was found in
+ * any of the header files in /usr/include. Define a prototype here to keep the 
+ * compiler happy.
+ */
+extern int getdomainname(char *, int);
+#endif
+
 int
 setnameserver(char *nameserver)
 {
@@ -5146,18 +5155,18 @@
   if ((fstr = fopen(NAMESERVER_PATH, "wb")) == NULL) {
     return -1;
   } else {
+#if (HOST_OS == linux) || (HOST_OS == darwin) || (HOST_OS == freebsd) //FIXME: solaris
     char domain[256];
     char resolventry[256];
 
-#if (HOST_OS == linux) || (HOST_OS == darwin) || (HOST_OS == freebsd)
     if (getdomainname(domain, 256) == -1)
       return CLI_ERROR;
     snprintf((char *) &resolventry, sizeof(resolventry), "domain %s\nnameserver %s\n", domain, nameserver);
-#endif
 
     fputs((char *) &resolventry, fstr);
     fputs("\n", fstr);
     fclose(fstr);
+#endif
     return CLI_OK;
   }
   return CLI_OK;
@@ -5181,7 +5190,7 @@
 getrouter(char *router, int len)
 {
   FILE *fstr;
-#if (HOST_OS == linux) || (HOST_OS == darwin) || (HOST_OS == freebsd)
+#if (HOST_OS == linux) || (HOST_OS == darwin) || (HOST_OS == freebsd) || (HOST_OS == solaris)
   char buff[256];
   char *p;
 
@@ -5232,6 +5241,8 @@
 #define interface_name "en0"
 #elif (HOST_OS == freebsd)
 #define interface_name "eth0"
+#elif (HOST_OS == solaris)
+#define interface_name "e1000g0" // FIXME: better way to get interface names
 #endif
 
   FILE *ifconfig_data;
@@ -6327,7 +6338,7 @@
   int find = 0;
   int counter = 0;
 
-#if (HOST_OS == linux) || (HOST_OS == darwin) || (HOST_OS == freebsd)
+#if (HOST_OS == linux) || (HOST_OS == darwin) || (HOST_OS == freebsd) || (HOST_OS == solaris)
   ink_strncpy(value, "", value_len);
   // coverity[fs_check_call]
   if (access(pathname, R_OK)) {

Modified: incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cli2/ConfigCmd.h
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cli2/ConfigCmd.h?rev=902234&r1=902233&r2=902234&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cli2/ConfigCmd.h (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cli2/ConfigCmd.h Fri Jan 22 19:17:30 2010
@@ -912,7 +912,7 @@
 int IsValidDomainname(char *str);
 int IsValidIpAddress(char *str);
 int getnetparms(char *ipaddr, char *netmask);
-#if (HOST_OS == sunos)
+#if (HOST_OS == solaris)
 int getnetmask(char *mask);
 #endif
 char *pos_after_string(char const *haystack, char const *needle);