[GRINS]: Checkpointing some beginning work on solidification model I forgot to check in from home computer.

error: pathspec 'src/physics/include/axisym_mushy_zone_solidification.h' did not match any file(s) known to git

--- src/physics/include/axisym_mushy_zone_solidification.h
+++ src/physics/include/axisym_mushy_zone_solidification.h
@@ -0,0 +1,170 @@
+//-----------------------------------------------------------------------bl-
+//--------------------------------------------------------------------------
+//
+// GRINS - General Reacting Incompressible Navier-Stokes
+//
+// Copyright (C) 2010,2011 The PECOS Development Team
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the Version 2 GNU General
+// Public License as published by the Free Software Foundation.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; if not, write to the Free Software
+// Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA
+// 02110-1301 USA
+//
+//-----------------------------------------------------------------------el-
+//
+// $Id$
+//
+//--------------------------------------------------------------------------
+//--------------------------------------------------------------------------
+
+#ifndef AXISYM_MUSHY_ZONE_SOLIDIFICATION_H
+#define AXISYM_MUSHY_ZONE_SOLIDIFICATION_H
+
+#include "config.h"
+
+#include "libmesh.h"
+#include "boundary_info.h"
+#include "fe_base.h"
+#include "fe_interface.h"
+#include "mesh.h"
+#include "quadrature.h"
+#include "parameters.h"
+#include "string_to_enum.h"
+#include "fem_system.h"
+#include "fem_context.h"
+
+#include "physics.h"
+
+namespace GRINS
+{
+  //! Adds axisymmetric mushy zone solidification source term
+  /*!
+    This class implements the axisymmetric mushy zone solidification to model a phase change
+    from liquid to solid aimed at vacuum arc remelting (VAR) applications. The form is
+    \f$ \mathbf{F} = -\mu \left( \mathbf{u} - \mathbf{u}_{cast} \right)/K_{perm} \f$
+    where
+    \f$ \mu = \f$ viscosity,
+    \f$ \mathbf{u} = \f$ is the velocity
+    \f$ \mathbf{u}_{cast} = \f$ is the casting velocity
+    \f$ K_{perm} = \f$ is the permeability of the medium.
+    The permeability is an algebraic function of the liquid fraction, namely
+    \f$ K_{perm} = (1-\phi_l)^2 A_{perm}/\phi_l^3 \f$
+    where \f$A_{perm} is a constant dependent on the characteristics of the medium.
+    The scalar phase function \f$ \phi_l = f(T_{melt}, \Delta T) \f$ where
+    \f$ T_{melt} = \f$ the local melting temperature and
+    \f$ \Delta T = \f$ is the interface thickness.
+   */
+  class AxisymmetricMushyZoneSolidification : public Physics
+  {
+  public:
+
+    AxisymmetricMushyZoneSolidification()
+      : Physics()
+    {};
+
+    ~AxisymmetricMushyZoneSolidification()
+    {};
+
+    //! Read options from GetPot input file.
+    virtual void read_input_options( GetPot& input );
+
+    //! Initialization of AxisymmetricMushyZoneSolidification variables
+    /*!
+      There are actually no extra variables
+     */
+    /*! \todo Perhaps put a default method in the base class so we don't have
+      to overload with nothing? */
+    virtual void init_variables( libMesh::FEMSystem* system );
+
+    //! Register variables needed by AxisymmetricMushyZoneSolidification
+    /*! This will register the temperature and velocity variables from
+      the AxisymmetricIncompNavierStokes and AxisymmetricHeatTransfer classes.*/
+    virtual void register_variable_indices(GRINS::VariableMap &global_map);
+
+    // Context initialization
+    /*! Doesn't do anything for AxisymmetricMushyZoneSolidification since there
+      are no new variables created */
+    virtual void init_context( libMesh::DiffContext &context );
+
+    //! Source term contribution for AxisymmetricMushyZoneSolidification
+    /*! This is the main part of the class. This will add the source term to
+        the AxisymmetricIncompNavierStokes class.
+     */
+    virtual bool element_time_derivative( bool request_jacobian,
+					  libMesh::DiffContext& context,
+					  libMesh::FEMSystem* system );
+
+    //! No boundary terms for AxisymmetricMushyZoneSolidification.
+    virtual bool side_time_derivative( bool request_jacobian,
+				       libMesh::DiffContext& context,
+				       libMesh::FEMSystem* system );
+
+    //! No constraint terms for AxisymmetricMushyZoneSolidification.
+    virtual bool element_constraint( bool request_jacobian,
+				     libMesh::DiffContext& context,
+				     libMesh::FEMSystem* system );
+
+    //! No boundary terms for AxisymmetricMushyZoneSolidification.
+    virtual bool side_constraint( bool request_jacobian,
+				  libMesh::DiffContext& context,
+				  libMesh::FEMSystem* system );
+
+    //! No mass terms for AxisymmetricMushyZoneSolidification.
+    virtual bool mass_residual( bool request_jacobian,
+				libMesh::DiffContext& context,
+				libMesh::FEMSystem* system );
+
+    //! No new variables, so no local map
+    virtual void build_local_variable_map();
+
+  protected:
+
+    //! Physical dimension of problem
+    unsigned int _dim;
+
+    // Indices for each (registered/non-owned) variable;
+    //! Index for registered r-velocity field
+    RegtdVariableIndex _u_r_var;
+
+    //! Index for registered z-velocity field
+    RegtdVariableIndex _u_z_var;
+
+    //! Index for registered temperature field
+    RegtdVariableIndex _T_var;
+
+    // Names of each registered variable in the system
+
+    //! Name of registered r-velocity
+    std::string _u_r_var_name;
+
+    //! Name of registered z-velocity
+    std::string _u_z_var_name;
+
+    //! Name of registered temperature
+    std::string _T_var_name;
+
+    //! Function to compute liquid fraction \f$ \phi_l \f$
+    double compute_liquid_phi( const double T );
+
+    //! Function to compute \f$ \frac{ d \phi_l}{dT} \f$
+    double dphi_dT( const double T );
+
+    //! Function to compute permeability \f$ K_{perm} \f$
+    double compute_K_perm( const double T );
+
+    //! Function to compute \f$ \frac{dK_{perm}}{dT} \f$
+    double dKperm_dT( const double T );
+
+  }; // class AxisymmetricMushyZoneSolidification
+
+} // namespace GRINS
+#endif //AXISYM_MUSHY_ZONE_SOLIDIFICATION_H


Close session in better  way

Close session in better  way

--- src/server.c
+++ src/server.c
@@ -189,6 +189,10 @@

 static void
 server_ctx_close(rps_ctx_t *ctx) {
+    if (ctx == NULL) {
+        return;
+    }
+
     if (ctx->state & (c_closing | c_closed)) {
         return;
     }
@@ -206,13 +210,8 @@
 static void
 server_close(rps_sess_t *sess) {

-    if (sess->request != NULL) {
-        server_ctx_close(sess->request);
-    }
-
-    if (sess->forward != NULL) {
-        server_ctx_close(sess->forward);
-    }
+    server_ctx_close(sess->request);
+    server_ctx_close(sess->forward);
 }


nbd: proper handle on response, proper drain of request header

--- src/nbd/nbd.c
+++ src/nbd/nbd.c
@@ -143,7 +143,7 @@
 {
     uint32_t magic;
     uint32_t error;
-    uint32_t handle;
+    uint64_t handle;
 } __attribute__((packed));

 struct nbd_res_opt_header
@@ -394,7 +394,7 @@
                     err = __handle_read(peek, client);
                     if (err == -1)
                         return true;
-                    evbuffer_drain(in, sizeof(struct nbd_res_header));
+                    evbuffer_drain(in, sizeof(struct nbd_req_header));
                     __send_response(out, err, handle,
                                     client->buf, be32toh(peek->length));
                     return false;
@@ -410,12 +410,12 @@
                 case NBD_CMD_DISC:
                     fprintf(stderr, "got disconnect.\n");
                     client->state = NBD_DISCONNECTED;
-                    evbuffer_drain(in, sizeof(struct nbd_res_header));
+                    evbuffer_drain(in, sizeof(struct nbd_req_header));
                     evutil_closesocket(client->socket);
                     return false;
                 case NBD_CMD_FLUSH:
                     fprintf(stderr, "got flush.\n");
-                    evbuffer_drain(in, sizeof(struct nbd_res_header));
+                    evbuffer_drain(in, sizeof(struct nbd_req_header));
                     if (fsync(client->handle->fd))
                         __send_response(out, errno, handle, NULL, 0);
                     else
@@ -423,7 +423,7 @@
                     return false;
                 case NBD_CMD_TRIM:
                     fprintf(stderr, "got trim.\n");
-                    evbuffer_drain(in, sizeof(struct nbd_res_header));
+                    evbuffer_drain(in, sizeof(struct nbd_req_header));
                     if (fallocate(client->handle->fd,
                                   FALLOC_FL_PUNCH_HOLE |
                                   FALLOC_FL_KEEP_SIZE,
@@ -434,10 +434,10 @@
                         __send_response(out, 0, handle, NULL, 0);
                     return false;
                 default:
-                    test = evbuffer_pullup(in, sizeof(struct nbd_res_header) +
+                    test = evbuffer_pullup(in, sizeof(struct nbd_req_header) +
                                                be32toh(peek->length));
                     if (test)
-                        evbuffer_drain(in, sizeof(struct nbd_res_header) +
+                        evbuffer_drain(in, sizeof(struct nbd_req_header) +
                                        be32toh(peek->length));
                     fprintf(stderr, "unknown command!\n");
             };


init server.hz early to avoid div by 0 during config file loading

since the refactory of config.c, it was initialized from config_hz in initServer
but apparently that's too late since the config file loading creates objects
which call LRU_CLOCK

--- src/server.c
+++ src/server.c
@@ -2266,6 +2266,7 @@
 void initServerConfig(void) {
     int j;

+    server.hz = CONFIG_DEFAULT_HZ;
     updateCachedTime(1);
     getRandomHexChars(server.runid,CONFIG_RUN_ID_SIZE);
     server.runid[CONFIG_RUN_ID_SIZE] = '\0';


Modify seek code to allow it to be used for manually seeking to cluster locations

--- src/nestegg.c
+++ src/nestegg.c
@@ -1962,6 +1962,11 @@
   ne_ctx_push(ctx, ne_top_level_elements, ctx);
   ne_ctx_push(ctx, ne_segment_elements, &ctx->segment);

+  ctx->log(ctx, NESTEGG_LOG_DEBUG, "seek: parsing cluster elements");
+  r = ne_parse(ctx, NULL, -1);
+  if (r != 1)
+    return -1;
+
   return 0;
 }

@@ -1997,10 +2002,6 @@

   /* Seek and set up parser state for segment-level element (Cluster). */
   r = nestegg_offset_seek(ctx, ctx->segment_offset + seek_pos);
-  ctx->log(ctx, NESTEGG_LOG_DEBUG, "seek: parsing cluster elements");
-  r = ne_parse(ctx, NULL, -1);
-  if (r != 1)
-    return -1;

   if (!ne_is_suspend_element(ctx->last_id))
     return -1;


Run clang-format on new optional code

Run clang-format on new optional code

--- src/ehl/optional.h
+++ src/ehl/optional.h
@@ -12,7 +12,7 @@
 {
 	namespace detail
 	{
-		template<typename T>
+		template <typename T>
 		class optional_storage
 		{
 		private:
@@ -35,7 +35,7 @@
 			{
 				if (valid)
 				{
-					new(valueData) T{other.value()};
+					new (valueData) T{other.value()};
 				}
 			}

@@ -44,20 +44,20 @@
 			{
 				if (valid)
 				{
-					new(valueData) T{::ehl::as_rvalue(other.value())};
+					new (valueData) T{::ehl::as_rvalue(other.value())};
 				}
 			}

 			optional_storage(T const& object)
 				: valid{true}
 			{
-				new(valueData) T{object};
+				new (valueData) T{object};
 			}

 			optional_storage(T&& object)
 				: valid{true}
 			{
-				new(valueData) T{::ehl::as_rvalue(object)};
+				new (valueData) T{::ehl::as_rvalue(object)};
 			}

 			~optional_storage()
@@ -75,7 +75,7 @@
 					}
 					else
 					{
-						new(valueData) T{other.value()};
+						new (valueData) T{other.value()};
 					}
 				}
 				else
@@ -96,7 +96,7 @@
 					}
 					else
 					{
-						new(valueData) T{::ehl::as_rvalue(other.value())};
+						new (valueData) T{::ehl::as_rvalue(other.value())};
 					}
 				}
 				else
@@ -115,7 +115,7 @@
 				}
 				else
 				{
-					new(valueData) T{other};
+					new (valueData) T{other};
 					valid = true;
 				}
 				return *this;
@@ -139,11 +139,15 @@
 		};
 	}  // namespace detail

+	// clang-format off
 	template<typename T,
-		bool copyable = ::ehl::is_copy_constructible<T>::value && ::ehl::is_copy_assignable<T>::value,
-		bool movable = ::ehl::is_move_constructible<T>::value && ::ehl::is_move_assignable<T>::value
+		bool copyable = ::ehl::is_copy_constructible<T>::value &&
+			::ehl::is_copy_assignable<T>::value,
+		bool movable = ::ehl::is_move_constructible<T>::value &&
+			::ehl::is_move_assignable<T>::value
 	>
 	class optional;
+	// clang-format off

 	template<typename T>
 	class optional<T, true, false> : public detail::optional_storage<T>


add end method

add end method

--- src/server.c
+++ src/server.c
@@ -20,7 +20,7 @@
     int socket;
     char name[32];/*define macro*/
     struct othello_room_s * room;
-    pthread_mutex_t mutex;/*useless ? Must think about it. (read solve the problem)*/
+    pthread_mutex_t mutex;
     bool ready;
     enum othello_state_e state;
 };
@@ -157,6 +157,28 @@
     return 0;
 }

+void othello_end(othello_player_t * player) {
+    int i;
+
+    /*leave room*/
+    if(player->room != NULL) {
+        pthread_mutex_lock(&(player->room->mutex));
+        for(i = 0; i < 2; i++) {
+            if(player->room->players[i] == player) {
+                player->room->players[i] = NULL;
+                break;
+            }
+        }
+        pthread_mutex_unlock(&(player->room->mutex));
+    }
+    /*close socket*/
+    close(player->socket);
+    /*free memory*/
+    free(player);
+    /*exit thread*/
+    /*pthread_cancel(&(player->thread));*/
+}
+
 void * othello_start(void * player) {
     char query_code;

@@ -171,8 +193,7 @@
     }

     /*leave room if player in one*/
-    close(((othello_player_t*)player)->socket);
-    free(player);
+    othello_end((othello_player_t*) player);

     return NULL;
 }


Fixed DDB's "ps" output formatting.

Fixed DDB's "ps" output formatting.

--- sys/ddb/db_ps.c
+++ sys/ddb/db_ps.c
@@ -30,7 +30,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- *	$Id: db_ps.c,v 1.2 1994/09/27 20:35:55 phk Exp $
+ *	$Id: db_ps.c,v 1.3 1994/09/28 19:16:24 phk Exp $
  */
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -46,7 +46,7 @@
 	np = nprocs;
 	p = ap = allproc;

-	db_printf("  pid  proc    addr     uid     ppid  pgrp   flag stat comm         wchan\n");
+	db_printf("  pid   proc     addr    uid  ppid  pgrp  flag stat wmesg   wchan   cmd\n");
 	while (--np >= 0) {
 		/*
 		 * XXX just take 20 for now...
@@ -61,16 +61,10 @@
 		if (pp == 0)
 			pp = p;
 		if (p->p_stat) {
-		    db_printf("%5d %06x %06x %3d %5d %5d  %06x  %d  %s   ",
-			   p->p_pid, ap, p->p_addr, p->p_cred->p_ruid, pp->p_pid,
-			   p->p_pgrp->pg_id, p->p_flag, p->p_stat,
-			   p->p_comm);
-		    if (p->p_wchan) {
-			if (p->p_wmesg)
-			    db_printf("%s ", p->p_wmesg);
-			db_printf("%x", p->p_wchan);
-		    }
-		    db_printf("\n");
+			db_printf("%5d %06x %06x %4d %5d %5d %06x  %d  %6s %06x %s\n",
+			    p->p_pid, ap, p->p_addr, p->p_cred->p_ruid, pp->p_pid,
+			    p->p_pgrp->pg_id, p->p_flag, p->p_stat, p->p_wmesg ?
+			    p->p_wmesg : "", p->p_wchan, p->p_comm);
 		}
 		ap = p->p_next;
 		if (ap == 0 && np > 0)


ldns_pkt_all() clones RRs which need to be freed with ldns_rr_list_deep_free()

--- src/network.c
+++ src/network.c
@@ -958,7 +958,7 @@
             for (i = 0, n = ldns_rr_list_rr_count(rrs); i < n; i++) {
                 ldns_rr* rr = ldns_rr_list_rr(rrs, i);
                 if (!rr) {
-                    ldns_rr_list_free(rrs);
+                    ldns_rr_list_deep_free(rrs);
                     ldns_pkt_free(lpkt);
                     ldns_buffer_free(buf);
                     tcpstate_discard(tcpstate, "failed to get RR");
@@ -967,7 +967,7 @@

                 ldns_buffer_clear(buf);
                 if (ldns_rdf2buffer_str(buf, ldns_rr_owner(rr)) != LDNS_STATUS_OK) {
-                    ldns_rr_list_free(rrs);
+                    ldns_rr_list_deep_free(rrs);
                     ldns_pkt_free(lpkt);
                     ldns_buffer_free(buf);
                     tcpstate_discard(tcpstate, "failed to get RR");
@@ -1003,7 +1003,7 @@
                     }
                 }
             }
-            ldns_rr_list_free(rrs);
+            ldns_rr_list_deep_free(rrs);
             ldns_buffer_free(buf);

             /*
@@ -1623,7 +1623,7 @@
             for (i = 0, n = ldns_rr_list_rr_count(rrs); i < n; i++) {
                 ldns_rr* rr = ldns_rr_list_rr(rrs, i);
                 if (!rr) {
-                    ldns_rr_list_free(rrs);
+                    ldns_rr_list_deep_free(rrs);
                     ldns_buffer_free(buf);
                     tcpstate_discard(tcpstate, "failed to get RR");
                     goto network_pkt_end;
@@ -1631,7 +1631,7 @@

                 ldns_buffer_clear(buf);
                 if (ldns_rdf2buffer_str(buf, ldns_rr_owner(rr)) != LDNS_STATUS_OK) {
-                    ldns_rr_list_free(rrs);
+                    ldns_rr_list_deep_free(rrs);
                     ldns_buffer_free(buf);
                     tcpstate_discard(tcpstate, "failed to get RR");
                     goto network_pkt_end;
@@ -1666,7 +1666,7 @@
                     }
                 }
             }
-            ldns_rr_list_free(rrs);
+            ldns_rr_list_deep_free(rrs);
             ldns_buffer_free(buf);

             /*


[core] lighttpd -1 supports pipes (e.g. netcat)

lighttpd -1 (one-shot mode) now supports pipes (e.g. with netcat)

x-ref:
  "Is there anyway to run lighttpd in the command line?"
  https://redmine.lighttpd.net/boards/2/topics/9348

--- src/server.c
+++ src/server.c
@@ -90,6 +90,9 @@
 #endif

 static int oneshot_fd = 0;
+static int oneshot_fdout = -1;
+static fdnode *oneshot_fdn = NULL;
+static int (*oneshot_read_cq)(connection *con, chunkqueue *cq, off_t max_bytes);
 static volatile int pid_fd = -2;
 static server_socket_array graceful_sockets;
 static server_socket_array inherited_sockets;
@@ -261,7 +264,15 @@
 __attribute_cold__
 static void server_free(server *srv) {
 	if (oneshot_fd > 0) {
+		if (oneshot_fdn) {
+			fdevent_fdnode_event_del(srv->ev, oneshot_fdn);
+			fdevent_unregister(srv->ev, oneshot_fd);
+			oneshot_fdn = NULL;
+		}
 		close(oneshot_fd);
+	}
+	if (oneshot_fdout >= 0) {
+		close(oneshot_fdout);
 	}
 	if (srv->stdin_fd >= 0) {
 		close(srv->stdin_fd);
@@ -341,38 +352,152 @@
 }

+static int server_oneshot_read_cq(connection *con, chunkqueue *cq, off_t max_bytes) {
+    /* temporary set con->fd to oneshot_fd (fd input) rather than outshot_fdout
+     * (lighttpd generally assumes operation on sockets, so this is a kludge) */
+    int fd = con->fd;
+    con->fd = oneshot_fd;
+    int rc = oneshot_read_cq(con, cq, max_bytes);
+    con->fd = fd;
+
+    /* note: optimistic reads (elsewhere) may or may not be enough to re-enable
+     * read interest after FDEVENT_IN interest was paused for other reasons */
+
+    const int events = fdevent_fdnode_interest(oneshot_fdn);
+    int n = con->is_readable ? 0 : FDEVENT_IN;
+    if (events & FDEVENT_RDHUP)
+        n |= FDEVENT_RDHUP;
+    fdevent_fdnode_event_set(con->srv->ev, oneshot_fdn, n);
+    return rc;
+}
+
+
+static handler_t server_oneshot_handle_fdevent(void *context, int revents) {
+    connection *con = context;
+
+    /* note: not sync'd with con->fdn or connection_set_fdevent_interest() */
+    int rdhup = 0;
+    int n = fdevent_fdnode_interest(oneshot_fdn);
+    if (revents & FDEVENT_IN)
+        n &= ~FDEVENT_IN;
+    request_st * const r = &con->request;
+    if (r->state != CON_STATE_ERROR && (revents & (FDEVENT_HUP|FDEVENT_RDHUP))){
+        revents &= ~(FDEVENT_HUP|FDEVENT_RDHUP);
+        /* copied and modified from connection_handle_fdevent()
+         * fdevent_is_tcp_half_closed() will fail on pipe
+         * and, besides, read end of pipes should treat POLLHUP as POLLRDHUP */
+        n &= ~(FDEVENT_IN|FDEVENT_RDHUP);
+        rdhup = 1;
+    }
+    fdevent_fdnode_event_set(con->srv->ev, oneshot_fdn, n);
+
+    fdnode * const fdn = con->fdn; /* fdn->ctx == con */
+    handler_t rc = ((fdevent_handler)NULL != fdn->handler)
+      ? (*fdn->handler)(con, revents)
+      : HANDLER_FINISHED;
+
+    if (rdhup) {
+        r->conf.stream_request_body &=
+          ~(FDEVENT_STREAM_REQUEST_BUFMIN|FDEVENT_STREAM_REQUEST_POLLIN);
+        r->conf.stream_request_body |= FDEVENT_STREAM_REQUEST_POLLRDHUP;
+        r->conf.stream_request_body |= FDEVENT_STREAM_REQUEST_TCP_FIN;
+        con->is_readable = 1; /*(can read 0 for end-of-stream)*/
+        if (chunkqueue_is_empty(con->read_queue)) r->keep_alive = 0;
+        if (r->reqbody_length < -1) /*(transparent proxy mode; no more data)*/
+            r->reqbody_length = r->reqbody_queue->bytes_in;
+    }
+
+    return rc;
+}
+
+
+__attribute_cold__
+static int server_oneshot_init_pipe(server *srv, int fdin, int fdout) {
+    /* Note: attempt to work with netcat pipes though other code expects socket.
+     * netcat has different fds (pipes) for stdin and stdout.  To support
+     * netcat, need to avoid S_ISSOCK(), getsockname(), and getpeername(),
+     * reconstructing addresses from environment variables:
+     *   NCAT_LOCAL_ADDR   NCAT_LOCAL_PORT
+     *   NCAT_REMOTE_ADDR  NCAT_REMOTE_PORT
+     *   NCAT_PROTO (TCP, UDP, SCTP)
+     */
+    connection *con;
+    server_socket *srv_socket;
+    sock_addr cnt_addr;
+
+    /* detect if called from netcat or else fabricate localhost addrs */
+    const char * const ncat =
+             getenv("NCAT_LOCAL_ADDR");
+    const char * const ncat_local_addr  =
+      ncat ? ncat                       : "127.0.0.1"; /*(fabricated)*/
+    const char * const ncat_local_port  =
+      ncat ? getenv("NCAT_LOCAL_PORT")  : "80";        /*(fabricated)*/
+    const char * const ncat_remote_addr =
+      ncat ? getenv("NCAT_REMOTE_ADDR") : "127.0.0.1"; /*(fabricated)*/
+    const char * const ncat_remote_port =
+      ncat ? getenv("NCAT_REMOTE_PORT") : "48080";     /*(fabricated)*/
+    if (NULL == ncat_local_addr  || NULL == ncat_local_port)  return 0;
+    if (NULL == ncat_remote_addr || NULL == ncat_remote_port) return 0;
+
+    const int family = ncat && strchr(ncat_local_addr,':') ? AF_INET6 : AF_INET;
+    unsigned short port;
+
+    port = (unsigned short)strtol(ncat_local_port, NULL, 10);
+    if (1 != sock_addr_inet_pton(&cnt_addr, ncat_local_addr, family, port)) {
+        log_error(srv->errh, __FILE__, __LINE__, "invalid local addr");
+        return 0;
+    }
+
+    srv_socket = server_oneshot_getsock(srv, &cnt_addr);
+    if (NULL == srv_socket) return 0;
+
+    port = (unsigned short)strtol(ncat_remote_port, NULL, 10);
+    if (1 != sock_addr_inet_pton(&cnt_addr, ncat_remote_addr, family, port)) {
+        log_error(srv->errh, __FILE__, __LINE__, "invalid remote addr");
+        return 0;
+    }
+
+    /*(must set flags; fd did not pass through fdevent accept() logic)*/
+    if (-1 == fdevent_fcntl_set_nb_cloexec(fdin)) {
+        log_perror(srv->errh, __FILE__, __LINE__, "fcntl()");
+        return 0;
+    }
+    if (-1 == fdevent_fcntl_set_nb_cloexec(fdout)) {
+        log_perror(srv->errh, __FILE__, __LINE__, "fcntl()");
+        return 0;
+    }
+
+    con = connection_accepted(srv, srv_socket, &cnt_addr, fdout);
+    if (NULL == con) return 0;
+
+    /* note: existing routines assume socket, not pipe
+     * connections.c:connection_read_cq()
+     *   uses recv() ifdef __WIN32
+     *   passes S_IFSOCK to fdevent_ioctl_fionread()
+     *   (The routine could be copied and modified, if required)
+     * This is unlikely to work if TLS is used over pipe since the SSL_CTX
+     * is associated with the other end of the pipe.  However, if using
+     * pipes, using TLS is unexpected behavior.
+     */
+
+    /*assert(oneshot_fd == fdin);*/
+    oneshot_read_cq = con->network_read;
+    con->network_read = server_oneshot_read_cq;
+    oneshot_fdn =
+      fdevent_register(srv->ev, fdin, server_oneshot_handle_fdevent, con);
+    fdevent_fdnode_event_set(srv->ev, oneshot_fdn, FDEVENT_RDHUP);
+
+    connection_state_machine(con);
+    return 1;
+}
+
+
 __attribute_cold__
 static int server_oneshot_init(server *srv, int fd) {
-	/* Note: does not work with netcat due to requirement that fd be socket.
-	 * STDOUT_FILENO was not saved earlier in startup, and that is to where
-	 * netcat expects output to be sent.  Since lighttpd expects connections
-	 * to be sockets, con->fd is where output is sent; separate fds are not
-	 * stored for input and output, but netcat has different fds for stdin
-	 * and * stdout.  To support netcat, would additionally need to avoid
-	 * S_ISSOCK(), getsockname(), and getpeername() below, reconstructing
-	 * addresses from environment variables:
-	 *   NCAT_LOCAL_ADDR   NCAT_LOCAL_PORT
-	 *   NCAT_REMOTE_ADDR  NCAT_REMOTE_PORT
-	 *   NCAT_PROTO
-	 */
 	connection *con;
 	server_socket *srv_socket;
 	sock_addr cnt_addr;
 	socklen_t cnt_len;
-	struct stat st;
-
-	if (0 != fstat(fd, &st)) {
-		log_perror(srv->errh, __FILE__, __LINE__, "fstat()");
-		return 0;
-	}
-
-	if (!S_ISSOCK(st.st_mode)) {
-		/* require that fd is a socket
-		 * (modules might expect STDIN_FILENO and STDOUT_FILENO opened to /dev/null) */
-		log_error(srv->errh, __FILE__, __LINE__,
-		  "lighttpd -1 stdin is not a socket");
-		return 0;
-	}

 	cnt_len = sizeof(cnt_addr);
 	if (0 != getsockname(fd, (struct sockaddr *)&cnt_addr, &cnt_len)) {
@@ -855,6 +980,7 @@

 	/* initialize globals (including file-scoped static globals) */
 	oneshot_fd = 0;
+	oneshot_fdout = -1;
 	srv_shutdown = 0;
 	graceful_shutdown = 0;
 	handle_sig_alarm = 1;
@@ -963,6 +1089,27 @@
 			srv->srvconf.max_worker = 0;
 			log_error(srv->errh, __FILE__, __LINE__,
 			  "server one-shot command line option disables server.max-worker config file option.");
+		}
+
+		struct stat st;
+		if (0 != fstat(oneshot_fd, &st)) {
+			log_perror(srv->errh, __FILE__, __LINE__, "fstat()");
+			return -1;
+		}
+
+		if (S_ISFIFO(st.st_mode)) {
+			oneshot_fdout = dup(STDOUT_FILENO);
+			if (oneshot_fdout <= STDERR_FILENO) {
+				log_perror(srv->errh, __FILE__, __LINE__, "dup()");
+				return -1;
+			}
+		}
+		else if (!S_ISSOCK(st.st_mode)) {
+			/* require that fd is a socket
+			 * (modules might expect STDIN_FILENO and STDOUT_FILENO opened to /dev/null) */
+			log_error(srv->errh, __FILE__, __LINE__,
+			  "lighttpd -1 stdin is not a socket");
+			return -1;
 		}
 	}

@@ -1553,7 +1700,13 @@
 	if (HANDLER_GO_ON != plugins_call_worker_init(srv))
 		return -1;

-	if (oneshot_fd && server_oneshot_init(srv, oneshot_fd)) {
+	if (oneshot_fdout > 0) {
+		if (server_oneshot_init_pipe(srv, oneshot_fd, oneshot_fdout)) {
+			oneshot_fd = -1;
+			oneshot_fdout = -1;
+		}
+	}
+	else if (oneshot_fd && server_oneshot_init(srv, oneshot_fd)) {
 		oneshot_fd = -1;
 	}


Unused include: #include "fb.h"

Unused include: #include "fb.h"

--- sys/dev/fb/fb.c
+++ sys/dev/fb/fb.c
@@ -28,7 +28,6 @@
  * $FreeBSD$
  */

-#include "fb.h"
 #include "opt_fb.h"

 #include <sys/param.h>


add full paddle_analysis_config.h APIs.  (#23215)

--- paddle/fluid/inference/api/paddle_analysis_config.h
+++ paddle/fluid/inference/api/paddle_analysis_config.h
@@ -48,35 +48,35 @@
 struct MkldnnQuantizerConfig;

 ///
-/// \brief configuration manager for `AnalysisPredictor`.
+/// \brief configuration manager for AnalysisPredictor.
 /// \since 1.7.0
 ///
-/// `AnalysisConfig` manages configurations of `AnalysisPredictor`.
+/// AnalysisConfig manages configurations of AnalysisPredictor.
 /// During inference procedure, there are many parameters(model/params path,
 /// place of inference, etc.)
 /// to be specified, and various optimizations(subgraph fusion, memory
 /// optimazation, TensorRT engine, etc.)
 /// to be done. Users can manage these settings by creating and modifying an
-/// `AnalysisConfig`,
-/// and loading it into `AnalysisPredictor`.
+/// AnalysisConfig,
+/// and loading it into AnalysisPredictor.
 ///
 struct AnalysisConfig {
   AnalysisConfig() = default;
   ///
-  /// \brief Construct a new `AnalysisConfig` from another
-  /// `AnalysisConfig`.
-  ///
-  /// \param[in] other another `AnalysisConfig`
+  /// \brief Construct a new AnalysisConfig from another
+  /// AnalysisConfig.
+  ///
+  /// \param[in] other another AnalysisConfig
   ///
   explicit AnalysisConfig(const AnalysisConfig& other);
   ///
-  /// \brief Construct a new `AnalysisConfig` from a no-combined model.
+  /// \brief Construct a new AnalysisConfig from a no-combined model.
   ///
   /// \param[in] model_dir model directory of the no-combined model.
   ///
   explicit AnalysisConfig(const std::string& model_dir);
   ///
-  /// \brief Construct a new `AnalysisConfig` from a combined model.
+  /// \brief Construct a new AnalysisConfig from a combined model.
   ///
   /// \param[in] prog_file model file path of the combined model.
   /// \param[in] params_file params file path of the combined model.
@@ -129,233 +129,374 @@
   void SetOptimCacheDir(const std::string& opt_cache_dir) {
     opt_cache_dir_ = opt_cache_dir;
   }
-  /** Get the model directory path.
-   */
+  ///
+  /// \brief Get the model directory path.
+  ///
+  /// \return const std::string& The model directory path.
+  ///
   const std::string& model_dir() const { return model_dir_; }
-  /** Get the program file path.
-   */
+  ///
+  /// \brief Get the program file path.
+  ///
+  /// \return const std::string& The program file path.
+  ///
   const std::string& prog_file() const { return prog_file_; }
-  /** Get the composed parameters file.
-   */
+  ///
+  /// \brief Get the combined parameters file.
+  ///
+  /// \return const std::string& The combined parameters file.
+  ///
   const std::string& params_file() const { return params_file_; }

   // Padding related.
-  /** Turn off Padding.
- */
+
+  ///
+  /// \brief Turn off FC Padding.
+  ///
+  ///
   void DisableFCPadding();
-  /** A bool state telling whether padding is turned on.
-   */
+  ///
+  /// \brief A boolean state telling whether fc padding is used.
+  ///
+  /// \return bool Whether fc padding is used.
+  ///
   bool use_fc_padding() const { return use_fc_padding_; }

   // GPU related.

-  /**
-   * \brief Turn on GPU.
-   * @param memory_pool_init_size_mb initial size of the GPU memory pool in MB.
-   * @param device_id the GPU card to use (default is 0).
-   */
+  ///
+  /// \brief Turn on GPU.
+  ///
+  /// \param memory_pool_init_size_mb initial size of the GPU memory pool in MB.
+  /// \param device_id device_id the GPU card to use (default is 0).
+  ///
   void EnableUseGpu(uint64_t memory_pool_init_size_mb, int device_id = 0);
-  /** Turn off the GPU.
-   */
+  ///
+  /// \brief Turn off GPU.
+  ///
+  ///
   void DisableGpu();
-  /** A bool state telling whether the GPU is turned on.
-   */
+  ///
+  /// \brief A boolean state telling whether the GPU is turned on.
+  ///
+  /// \return bool Whether the GPU is turned on.
+  ///
   bool use_gpu() const { return use_gpu_; }
-  /** Get the GPU device id.
-   */
+  ///
+  /// \brief Get the GPU device id.
+  ///
+  /// \return int The GPU device id.
+  ///
   int gpu_device_id() const { return device_id_; }
-  /** Get the initial size in MB of the GPU memory pool.
-   */
+  ///
+  /// \brief Get the initial size in MB of the GPU memory pool.
+  ///
+  /// \return int The initial size in MB of the GPU memory pool.
+  ///
   int memory_pool_init_size_mb() const { return memory_pool_init_size_mb_; }
-  /** Get the proportion of the initial memory pool size compared to the device.
-   */
+  ///
+  /// \brief Get the proportion of the initial memory pool size compared to the
+  /// device.
+  ///
+  /// \return float The proportion of the initial memory pool size.
+  ///
   float fraction_of_gpu_memory_for_pool() const;

-  /** Turn on CUDNN
-   */
+  // CUDNN related.
+  ///
+  /// \brief Turn on CUDNN.
+  ///
+  ///
   void EnableCUDNN();
-  /** A boolean state telling whether to use cuDNN.
-   */
+  ///
+  /// \brief A boolean state telling whether to use CUDNN.
+  ///
+  /// \return bool Whether to use CUDNN.
+  ///
   bool cudnn_enabled() const { return use_cudnn_; }

-  /** \brief Control whether to perform IR graph optimization.
-   *
-   * If turned off, the AnalysisConfig will act just like a NativeConfig.
-   */
+  ///
+  /// \brief Control whether to perform IR graph optimization.
+  /// If turned off, the AnalysisConfig will act just like a NativeConfig.
+  ///
+  /// \param x Whether the ir graph optimization is actived.
+  ///
   void SwitchIrOptim(int x = true) { enable_ir_optim_ = x; }
-  /** A boolean state tell whether the ir graph optimization is actived.
-   */
+  ///
+  /// \brief A boolean state telling whether the ir graph optimization is
+  /// actived.
+  ///
+  /// \return bool Whether to use ir graph optimization.
+  ///
   bool ir_optim() const { return enable_ir_optim_; }

-  /** \brief INTERNAL Determine whether to use the feed and fetch operators.
-   * Just for internal development, not stable yet.
-   * When ZeroCopyTensor is used, this should turned off.
-   */
+  ///
+  /// \brief INTERNAL Determine whether to use the feed and fetch operators.
+  /// Just for internal development, not stable yet.
+  /// When ZeroCopyTensor is used, this should be turned off.
+  ///
+  /// \param x Whether to use the feed and fetch operators.
+  ///
   void SwitchUseFeedFetchOps(int x = true) { use_feed_fetch_ops_ = x; }
-  /** A boolean state telling whether to use the feed and fetch operators.
-   */
+  ///
+  /// \brief A boolean state telling whether to use the feed and fetch
+  /// operators.
+  ///
+  /// \return bool Whether to use the feed and fetch operators.
+  ///
   bool use_feed_fetch_ops_enabled() const { return use_feed_fetch_ops_; }

-  /** \brief Control whether to specify the inputs' names.
-   *
-   * The PaddleTensor type has a `name` member, assign it with the corresponding
-   * variable name. This is used only when the input PaddleTensors passed to the
-   * `PaddlePredictor.Run(...)` cannot follow the order in the training phase.
-   */
+  ///
+  /// \brief Control whether to specify the inputs' names.
+  /// The ZeroCopyTensor type has a name member, assign it with the
+  /// corresponding
+  /// variable name. This is used only when the input ZeroCopyTensors passed to
+  /// the
+  /// AnalysisPredictor.ZeroCopyRun() cannot follow the order in the training
+  /// phase.
+  ///
+  /// \param x Whether to specify the inputs' names.
+  ///
   void SwitchSpecifyInputNames(bool x = true) { specify_input_name_ = x; }
-
-  /** A boolean state tell whether the input PaddleTensor names specified should
-   * be used to reorder the inputs in `PaddlePredictor.Run(...)`.
-   */
+  ///
+  /// \brief A boolean state tell whether the input ZeroCopyTensor names
+  /// specified should
+  /// be used to reorder the inputs in AnalysisPredictor.ZeroCopyRun().
+  ///
+  /// \return bool Whether to specify the inputs' names.
+  ///
   bool specify_input_name() const { return specify_input_name_; }

-  /**
-   * \brief Turn on the TensorRT engine.
-   *
-   * The TensorRT engine will accelerate some subgraphes in the original Fluid
-   * computation graph. In some models such as TensorRT50, GoogleNet and so on,
-   * it gains significant performance acceleration.
-   *
-   * @param workspace_size the memory size(in byte) used for TensorRT workspace.
-   * @param max_batch_size the maximum batch size of this prediction task,
-   * better set as small as possible, or performance loss.
-   * @param min_subgrpah_size the minimum TensorRT subgraph size needed, if a
-   * subgraph is less than this, it will not transfer to TensorRT engine.
-   */
+  ///
+  /// \brief Turn on the TensorRT engine.
+  /// The TensorRT engine will accelerate some subgraphes in the original Fluid
+  /// computation graph. In some models such as resnet50, GoogleNet and so on,
+  /// it gains significant performance acceleration.
+  ///
+  /// \param workspace_size The memory size(in byte) used for TensorRT
+  /// workspace.
+  /// \param max_batch_size The maximum batch size of this prediction task,
+  /// better set as small as possible for less performance loss.
+  /// \param min_subgrpah_size The minimum TensorRT subgraph size needed, if a
+  /// subgraph is smaller than this, it will not be transferred to TensorRT
+  /// engine.
+  /// \param precision The precision used in TensorRT.
+  /// \param use_static Serialize optimization information to disk for reusing.
+  /// \param use_calib_mode Use TRT int8 calibration(post training
+  /// quantization).
+  ///
+  ///
   void EnableTensorRtEngine(int workspace_size = 1 << 20,
                             int max_batch_size = 1, int min_subgraph_size = 3,
                             Precision precision = Precision::kFloat32,
                             bool use_static = false,
                             bool use_calib_mode = true);
-
-  /** A boolean state telling whether the TensorRT engine is used.
-   */
+  ///
+  /// \brief A boolean state telling whether the TensorRT engine is used.
+  ///
+  /// \return bool Whether the TensorRT engine is used.
+  ///
   bool tensorrt_engine_enabled() const { return use_tensorrt_; }
-  /**
-   *  \brief Set min, max, opt shape for TensorRT Dynamic shape mode.
-   *  @param min_input_shape the min input shape of the subgraph input
-   *  @param max_input_shape the max input shape of the subgraph input
-   *  @param opt_input_shape the opt input shape of the subgraph input
-   *  @param disable_trt_plugin_fp16, setting this variable to true
-   *  means that TRT plugin will not run fp16
-   */
+  ///
+  /// \brief Set min, max, opt shape for TensorRT Dynamic shape mode.
+  /// \param min_input_shape The min input shape of the subgraph input.
+  /// \param max_input_shape The max input shape of the subgraph input.
+  /// \param opt_input_shape The opt input shape of the subgraph input.
+  /// \param disable_trt_plugin_fp16 Setting this parameter to true means that
+  /// TRT plugin will not run fp16.
+  ///
   void SetTRTDynamicShapeInfo(
       std::map<std::string, std::vector<int>> min_input_shape,
       std::map<std::string, std::vector<int>> max_input_shape,
       std::map<std::string, std::vector<int>> optim_input_shape,
       bool disable_trt_plugin_fp16 = false);
-
-  /**
-   *  \brief Turn on the usage of Lite sub-graph engine.
-   */
+  ///
+  /// \brief Turn on the usage of Lite sub-graph engine.
+  ///
+  /// \param precision_mode Precion used in Lite sub-graph engine.
+  /// \param passes_filter Set the passes used in Lite sub-graph engine.
+  /// \param ops_filter Operators not supported by Lite.
+  ///
   void EnableLiteEngine(
       AnalysisConfig::Precision precision_mode = Precision::kFloat32,
       const std::vector<std::string>& passes_filter = {},
       const std::vector<std::string>& ops_filter = {});

-  /** A boolean state indicating whether the Lite sub-graph engine is used.
-  */
+  ///
+  /// \brief A boolean state indicating whether the Lite sub-graph engine is
+  /// used.
+  ///
+  /// \return bool whether the Lite sub-graph engine is used.
+  ///
   bool lite_engine_enabled() const { return use_lite_; }

-  /** \brief Control whether to debug IR graph analysis phase.
-   *
-   * This will generate DOT files for visualizing the computation graph after
-   * each analysis pass applied.
-   */
+  ///
+  /// \brief Control whether to debug IR graph analysis phase.
+  /// This will generate DOT files for visualizing the computation graph after
+  /// each analysis pass applied.
+  ///
+  /// \param x whether to debug IR graph analysis phase.
+  ///
   void SwitchIrDebug(int x = true);

-  /** Turn on NGRAPH.
-   */
+  ///
+  /// \brief Turn on NGRAPH.
+  ///
+  ///
   void EnableNgraph();
-  /** A boolean state telling whether to use the NGRAPH.
-   */
+  ///
+  /// \brief A boolean state telling whether to use the NGRAPH.
+  ///
+  /// \return bool Whether to use the NGRAPH.
+  ///
   bool ngraph_enabled() const { return use_ngraph_; }

-  /** Turn on MKLDNN.
-   */
+  ///
+  /// \brief Turn on MKLDNN.
+  ///
+  ///
   void EnableMKLDNN();
-  /** set the cache capacity of different input shapes for MKLDNN.
-   *  Default 0 means don't cache any shape.
-   */
+  ///
+  /// \brief Set the cache capacity of different input shapes for MKLDNN.
+  /// Default value 0 means not caching any shape.
+  ///
+  /// \param capacity The cache capacity.
+  ///
   void SetMkldnnCacheCapacity(int capacity);
-  /** A boolean state telling whether to use the MKLDNN.
-   */
+  ///
+  /// \brief A boolean state telling whether to use the MKLDNN.
+  ///
+  /// \return bool Whether to use the MKLDNN.
+  ///
   bool mkldnn_enabled() const { return use_mkldnn_; }

-  /** Set and get the number of cpu math library threads.
-   */
+  ///
+  /// \brief Set the number of cpu math library threads.
+  ///
+  /// \param cpu_math_library_num_threads The number of cpu math library
+  /// threads.
+  ///
   void SetCpuMathLibraryNumThreads(int cpu_math_library_num_threads);
-  /** An int state telling how many threads are used in the CPU math library.
-   */
+  ///
+  /// \brief An int state telling how many threads are used in the CPU math
+  /// library.
+  ///
+  /// \return int The number of threads used in the CPU math library.
+  ///
   int cpu_math_library_num_threads() const {
     return cpu_math_library_num_threads_;
   }

-  /** Transform the AnalysisConfig to NativeConfig.
-   */
+  ///
+  /// \brief Transform the AnalysisConfig to NativeConfig.
+  ///
+  /// \return NativeConfig The NativeConfig transformed.
+  ///
   NativeConfig ToNativeConfig() const;
-  /** Specify the operator type list to use MKLDNN acceleration.
-   * @param op_list the operator type list.
-   */
+  ///
+  /// \brief Specify the operator type list to use MKLDNN acceleration.
+  ///
+  /// \param op_list The operator type list.
+  ///
   void SetMKLDNNOp(std::unordered_set<std::string> op_list) {
     mkldnn_enabled_op_types_ = op_list;
   }

-  /** Turn on quantization.
-   */
+  ///
+  /// \brief Turn on MKLDNN quantization.
+  ///
+  ///
   void EnableMkldnnQuantizer();

-  /** A boolean state telling whether the quantization is enabled.
-  */
+  ///
+  /// \brief A boolean state telling whether the MKLDNN quantization is enabled.
+  ///
+  /// \return bool Whether the MKLDNN quantization is enabled.
+  ///
   bool mkldnn_quantizer_enabled() const { return use_mkldnn_quantizer_; }

+  ///
+  /// \brief Get MKLDNN quantizer config.
+  ///
+  /// \return MkldnnQuantizerConfig* MKLDNN quantizer config.
+  ///
   MkldnnQuantizerConfig* mkldnn_quantizer_config() const;

-  /** Specify the memory buffer of program and parameter
-   * @param prog_buffer the memory buffer of program.
-   * @param prog_buffer_size the size of the data.
-   * @param params_buffer the memory buffer of the composed parameters file.
-   * @param params_buffer_size the size of the commposed parameters data.
-   */
+  ///
+  /// \brief Specify the memory buffer of program and parameter.
+  /// Used when model and params are loaded directly from memory.
+  ///
+  /// \param prog_buffer The memory buffer of program.
+  /// \param prog_buffer_size The size of the model data.
+  /// \param params_buffer The memory buffer of the combined parameters file.
+  /// \param params_buffer_size The size of the combined parameters data.
+  ///
   void SetModelBuffer(const char* prog_buffer, size_t prog_buffer_size,
                       const char* params_buffer, size_t params_buffer_size);
-  /** A boolean state telling whether the model is set from the CPU memory.
-   */
+  ///
+  /// \brief A boolean state telling whether the model is set from the CPU
+  /// memory.
+  ///
+  /// \return bool Whether model and params are loaded directly from memory.
+  ///
   bool model_from_memory() const { return model_from_memory_; }

-  /** Turn on memory optimize
-   * NOTE still in development, will release latter.
-   */
+  ///
+  /// \brief Turn on memory optimize
+  /// NOTE still in development.
+  ///
   void EnableMemoryOptim();
-  /** Tell whether the memory optimization is activated. */
+  ///
+  /// \brief A boolean state telling whether the memory optimization is
+  /// activated.
+  ///
+  /// \return bool Whether the memory optimization is activated.
+  ///
   bool enable_memory_optim() const;

-  /** \brief Turn on profiling report.
-   *
-   * If not turned on, no profiling report will be generateed.
-   */
+  ///
+  /// \brief Turn on profiling report.
+  /// If not turned on, no profiling report will be generated.
+  ///
   void EnableProfile();
-  /** A boolean state telling whether the profiler is activated.
-   */
+  ///
+  /// \brief A boolean state telling whether the profiler is activated.
+  ///
+  /// \return bool Whether the profiler is activated.
+  ///
   bool profile_enabled() const { return with_profile_; }

-  /** \brief Disable GLOG information output for security.
-   *
-   * If called, no LOG(INFO) logs will be generated.
-   */
+  ///
+  /// \brief Mute all logs in Paddle inference.
+  ///
   void DisableGlogInfo();
-  /** A boolean state telling whether the GLOG info is disabled.
-   */
+  ///
+  /// \brief A boolean state telling whether logs in Paddle inference are muted.
+  ///
+  /// \return bool Whether logs in Paddle inference are muted.
+  ///
   bool glog_info_disabled() const { return !with_glog_info_; }

+  ///
+  /// \brief Set the AnalysisConfig to be invalid.
+  /// This is to ensure that an AnalysisConfig can only be used in one
+  /// AnalysisPredictor.
+  ///
   void SetInValid() const { is_valid_ = false; }
+  ///
+  /// \brief A boolean state telling whether the AnalysisConfig is valid.
+  ///
+  /// \return bool Whether the AnalysisConfig is valid.
+  ///
   bool is_valid() const { return is_valid_; }

   friend class ::paddle::AnalysisPredictor;

-  /** NOTE just for developer, not an official API, easily to be broken.
-   * Get a pass builder for customize the passes in IR analysis phase.
-   */
+  ///
+  /// \brief Get a pass builder for customize the passes in IR analysis phase.
+  /// NOTE: Just for developer, not an official API, easy to be broken.
+  ///
+  ///
   PassStrategy* pass_builder() const;
   void PartiallyRelease();


Stop oml2-server EventLoop on SIGTERM or SIGINT

Signed-off-by: Olivier Mehani <9858fe98d2c7f5f35e0d2a08f134cfc58afd42d3@nicta.com.au>

--- server/main.c
+++ server/main.c
@@ -280,19 +280,22 @@
 #endif
 }

-/** Signal handler.
+/** Signal handler
  *
  * Captures the following signals, and handles them thusly.
- * * SIGTERM: cleanup open databases.
+ * * SIGTERM: instruct the EventLoop to stop.
+ *
+ * \see eventloop_stop()
  */
 static void sighandler(int signum)
 {
-  if(SIGTERM==signum) {
-    loginfo("Received SIGTERM, cleaning up and exiting\n");
-    /* FIXME: a client_cleanup would be better */
-    database_cleanup();
-    exit(0);
-  } else {
+  switch(signum) {
+  case SIGINT:
+  case SIGTERM:
+    loginfo("Received signal %d, cleaning up and exiting\n", signum);
+    eventloop_stop(signum);
+    break;
+  default:
     logwarn("Received unhandled signal %d\n", signum);
   }
 }
@@ -305,7 +308,7 @@
 {
   struct sigaction sa;

-  logdebug("Installing SIGTERM handler\n");
+  logdebug("Installing signal handlers\n");

   sa.sa_handler = sighandler;
   sigemptyset (&sa.sa_mask);
@@ -313,6 +316,8 @@

   if(sigaction(SIGTERM, &sa, NULL))
     logwarn("Unable to install SIGTERM handler: %s\n", strerror(errno));
+  if(sigaction(SIGINT, &sa, NULL))
+    logwarn("Unable to install SIGINT handler: %s\n", strerror(errno));
 }

 void


Implement C3 MRO

Implement C3 MRO

* Add some comments

git-svn-id: 6e74a02f85675cec270f5d931b0f6998666294a3@8651 d31e2699-5ff4-0310-a27c-f18f2fbe73fe

--- src/objects.c
+++ src/objects.c
@@ -707,10 +707,15 @@
 involved adding all the parent's parents, as well as all attributes of
 the parent classes that we're adding in.

-=cut
-
-*/
-
+The MRO (method resolution order) is the C3 algorithm used by Perl6
+and Python (>= 2.3). See also L<http://use.perl.org/~autrijus/journal/25768>.
+
+=cut
+
+*/
+
+
+/* create a list if non-empty lists */
 static PMC*
 not_empty(Interp* interpreter, PMC *seqs)
 {
@@ -725,6 +730,7 @@
     return nseqs;
 }

+/* merge the list if lists */
 static PMC*
 class_mro_merge(Interp* interpreter, PMC *seqs)
 {
@@ -739,6 +745,7 @@
         for (i = 0; i < VTABLE_elements(interpreter, nseqs); ++i) {
             seq = VTABLE_get_pmc_keyed_int(interpreter, nseqs, i);
             cand = VTABLE_get_pmc_keyed_int(interpreter, seq, 0);
+            /* check if candidate is valid */
             for (j = 0; j < VTABLE_elements(interpreter, nseqs); ++j) {
                 s = VTABLE_get_pmc_keyed_int(interpreter, nseqs, j);
                 for (k = 1; k < VTABLE_elements(interpreter, s); ++k)
@@ -753,7 +760,9 @@
         if (!cand)
             real_exception(interpreter, NULL, E_TypeError,
                     "inconsisten class hierarchy");
+        /* push candidate onto mro result */
         VTABLE_push_pmc(interpreter, res, cand);
+        /* remove candidate from head of lists */
         for (i = 0; i < VTABLE_elements(interpreter, nseqs); ++i) {
             seq = VTABLE_get_pmc_keyed_int(interpreter, nseqs, i);
             if (VTABLE_get_pmc_keyed_int(interpreter, seq, 0) == cand) {
@@ -764,12 +773,16 @@
     return res;
 }

+/* create C3 MRO */
 static PMC*
 create_class_mro(Interp* interpreter, PMC *class)
 {
     PMC *lall, *lc, *lmap, *lparents, *bases, *base;
     INTVAL i;

+    /* list of lists
+     * [ [class] [mro of bases] [bases] ]
+     */
     lall = pmc_new(interpreter, enum_class_ResizablePMCArray);

     lc = pmc_new(interpreter, enum_class_ResizablePMCArray);


From FreeBSD:

From FreeBSD:

  Fix a bug in sblock() that has existed since revision 1.1 from BSD:
  correctly return an error if M_NOWAIT is passed to sblock() and the
  operation might block.  This remarkably subtle macro bug appears to
  be responsible for quite a few undiagnosed socket buffer corruption
  and mbuf-related kernel panics.

"diff is correct" todd@, "should go in asap" markus@

--- sys/socketvar.h
+++ sys/socketvar.h
@@ -1,4 +1,4 @@
-/*	$OpenBSD: socketvar.h,v 1.39 2007/02/26 23:53:33 kurt Exp $	*/
+/*	$OpenBSD: socketvar.h,v 1.40 2007/07/05 09:04:04 dim Exp $	*/
 /*	$NetBSD: socketvar.h,v 1.18 1996/02/09 18:25:38 christos Exp $	*/

 /*-
@@ -204,7 +204,7 @@
  */
 #define sblock(sb, wf) ((sb)->sb_flags & SB_LOCK ? \
 		(((wf) == M_WAITOK) ? sb_lock(sb) : EWOULDBLOCK) : \
-		((sb)->sb_flags |= SB_LOCK), 0)
+		((sb)->sb_flags |= SB_LOCK, 0))

 /* release lock on sockbuf sb */
 #define	sbunlock(sb) { \


ext-dns: * [new] Updated file stats to include notes about internal    client resolution hostname cache getaddrinfo)

--- server/main.c
+++ server/main.c
@@ -45,6 +45,7 @@
 at <ext-dns@lists.aspl.es>."

 #include <ext-dnsd.h>
+#include <ext-dns-private.h>

 axl_bool verbose = axl_false;
 axl_bool forward_all_requests = axl_true;
@@ -1554,6 +1555,18 @@
 	}
 	axl_free (msg);

+	/* client resolution cache */
+	msg = axl_strdup_printf ("Client getaddrinfo hash: %d/%d (items/size)\n",
+				 axl_hash_items (ctx->hostname_hash),
+				 axl_hash_capacity (ctx->hostname_hash));
+	value = fwrite (msg, 1, ext_dns_strlen (msg), file);
+	if (value != ext_dns_strlen (msg)) {
+	        axl_free (msg);
+	        fclose (file);
+		return axl_false; /* do not remove the event */
+	}
+	axl_free (msg);
+
 	/* show command timeout */
 	if (command_timeout > 0)
 		msg = axl_strdup_printf ("Command timeout: %d secs\n", command_timeout);


esx: Remove dead store in esxUtil_ParseDatastorePath

The ++ on preliminaryFileName was a left over from a previous version
of this function that explicitly returned the filename and did a strdup
on preliminaryFileName afterwards.

As the filename isn't returned explicitly anymore remove the preliminary
variable for it and reuse the tmp variable instead.

Reported by Eric Blake, detected by clang.

--- src/esx/esx_util.c
+++ src/esx/esx_util.c
@@ -3,7 +3,7 @@
  * esx_util.c: utility functions for the VMware ESX driver
  *
  * Copyright (C) 2010 Red Hat, Inc.
- * Copyright (C) 2009 Matthias Bolte <matthias.bolte@googlemail.com>
+ * Copyright (C) 2009-2011 Matthias Bolte <matthias.bolte@googlemail.com>
  * Copyright (C) 2009 Maximilian Wilhelm <max@rfc2324.org>
  *
  * This library is free software; you can redistribute it and/or
@@ -284,7 +284,6 @@
     char *saveptr = NULL;
     char *preliminaryDatastoreName = NULL;
     char *preliminaryDirectoryAndFileName = NULL;
-    char *preliminaryFileName = NULL;

     if ((datastoreName != NULL && *datastoreName != NULL) ||
         (directoryName != NULL && *directoryName != NULL) ||
@@ -328,11 +327,11 @@
     }

     if (directoryName != NULL) {
-        /* Split <path> into <directory>/<file> */
-        preliminaryFileName = strrchr(preliminaryDirectoryAndFileName, '/');
-
-        if (preliminaryFileName != NULL) {
-            *preliminaryFileName++ = '\0';
+        /* Split <path> into <directory>/<file> and remove /<file> */
+        tmp = strrchr(preliminaryDirectoryAndFileName, '/');
+
+        if (tmp != NULL) {
+            *tmp = '\0';
         }

         if (esxVI_String_DeepCopyValue(directoryName,


Chop out debugging stuff

Chop out debugging stuff

git-svn-id: 6e74a02f85675cec270f5d931b0f6998666294a3@5390 d31e2699-5ff4-0310-a27c-f18f2fbe73fe

--- src/objects.c
+++ src/objects.c
@@ -424,7 +424,6 @@
                                                           current_class_array,
                                                           current_offset)) {
                     found = 1;
-                    puts("Found it");
                 }
             }
             /* We found it. Yay us. Add the parent class to the list */
@@ -437,7 +436,6 @@
                                           current_size + 1);
                 VTABLE_set_pmc_keyed_int(interpreter, current_class_array,
                                          current_size, potential);
-                puts("Adding it in");
             }
         }
     }


Add the constant definition needed by the implementation of the
openat() and the related syscalls.

Based on the submission by rdivacky,
	sponsored by Google Summer of Code 2007
Reviewed by:	rwatson, rdivacky
Tested by:	pho

--- sys/sys/fcntl.h
+++ sys/sys/fcntl.h
@@ -105,6 +105,23 @@
 #ifdef _KERNEL
 #define	FHASLOCK	0x4000		/* descriptor holds advisory lock */
 #endif
+/* Defined by POSIX Extended API Set Part 2 */
+#if __BSD_VISIBLE
+/*
+ * Magic value that specify the use of the current working directory
+ * to determine the target of relative file paths in the openat() and
+ * similar syscalls.
+ */
+#define	AT_FDCWD		-100
+
+/*
+ * Miscellaneous flags for the *at() syscalls.
+ */
+#define	AT_EACCESS		0x100	/* Check access using effective user and group ID */
+#define	AT_SYMLINK_NOFOLLOW	0x200   /* Do not follow symbolic links */
+#define	AT_SYMLINK_FOLLOW	0x400	/* Follow symbolic link */
+#define	AT_REMOVEDIR		0x800	/* Remove directory instead of file */
+#endif

 /* Defined by POSIX 1003.1; BSD default, but must be distinct from O_RDONLY. */
 #define	O_NOCTTY	0x8000		/* don't assign controlling terminal */
@@ -112,6 +129,15 @@
 #if __BSD_VISIBLE
 /* Attempt to bypass buffer cache */
 #define O_DIRECT	0x00010000
+#endif
+
+/* Defined by POSIX Extended API Set Part 2 */
+#if __BSD_VISIBLE
+#define	O_DIRECTORY	0x00020000	/* Fail if not directory */
+#define	O_EXEC		0x00040000	/* Open for execute only */
+#endif
+#ifdef	_KERNEL
+#define	FEXEC		O_EXEC
 #endif

 /*
@@ -124,7 +150,7 @@
 #define	OFLAGS(fflags)	((fflags) - 1)

 /* bits to save after open */
-#define	FMASK		(FREAD|FWRITE|FAPPEND|FASYNC|FFSYNC|FNONBLOCK|O_DIRECT)
+#define	FMASK	(FREAD|FWRITE|FAPPEND|FASYNC|FFSYNC|FNONBLOCK|O_DIRECT|FEXEC)
 /* bits settable by fcntl(F_SETFL, ...) */
 #define	FCNTLFLAGS	(FAPPEND|FASYNC|FFSYNC|FNONBLOCK|O_DIRECT)


Improve error msg when connections to server fail.

--- src/objects.c
+++ src/objects.c
@@ -509,7 +509,7 @@
 	cnt = pool_server_count(pool) - statlist_count(&pool->new_server_list);
 	if (cnt)
 		return true;
-	disconnect_client(client, true, "no working server connection");
+	disconnect_client(client, true, "pgbouncer cannot connect to server");

 	/* usual relaunch wont work, as there are no waiting clients */
 	launch_new_connection(pool);


better error reporting

better error reporting

--- src/signal.c
+++ src/signal.c
@@ -159,7 +159,7 @@
             sig = 0;
         }
         else {
-            lua_pushstring(L, "raise(): invalid signal name");
+            lua_pushfstring(L, "raise(): invalid signal name: %s", signame);
             lua_error(L);
         }
     }


Bump __FreeBSD_version after netatm and I4B removal. There should be no API changes but ports might rely on this.

--- sys/sys/param.h
+++ sys/sys/param.h
@@ -57,7 +57,7 @@
  *		is created, otherwise 1.
  */
 #undef __FreeBSD_version
-#define __FreeBSD_version 800037	/* Master, propagated to newvers */
+#define __FreeBSD_version 800038	/* Master, propagated to newvers */

 #ifndef LOCORE
 #include <sys/types.h>


remove @typedef. It is useless and makes doxygen crash

git-svn-id: f2d781e409b7e36a714fc884bb9b2fc5091ddd28@1499 0ce88b0d-b2fd-0310-8134-9614164e65ea

--- src/eventhandler.h
+++ src/eventhandler.h
@@ -24,7 +24,6 @@
 #endif

 	/**
-	 * @typedef
 	 * Define an exported public reader state structure so each
 	 * application gets instant notification of changes in state.
 	 */


Do not allow user-code to set signal property named value - redirect to msig_update() instead. Allow un-setting signal min and max properties through calls to msig_set_property() with 0 length argument.

--- src/signal.c
+++ src/signal.c
@@ -1052,14 +1052,18 @@

     if (strcmp(property, "min") == 0 ||
         strcmp(property, "minimum") == 0) {
-        if (length == sig->props.length && type == sig->props.type)
+        if (!length || !value)
+            msig_set_minimum(sig, 0);
+        else if (length == sig->props.length && type == sig->props.type)
             msig_set_minimum(sig, value);
         // TODO: if types differ need to cast entire vector
         return;
     }
     else if (strcmp(property, "max") == 0 ||
              strcmp(property, "maximum") == 0) {
-        if (length == sig->props.length && type == sig->props.type)
+        if (!length || !value)
+            msig_set_maximum(sig, 0);
+        else if (length == sig->props.length && type == sig->props.type)
             msig_set_maximum(sig, value);
         // TODO: if types differ need to cast entire vector
         return;
@@ -1078,6 +1082,13 @@
             sig->props.unit = realloc(sig->props.unit, strlen((char*)value)+1);
             strcpy(sig->props.unit, (char*)value);
         }
+        return;
+    }
+    else if (strcmp(property, "value") == 0) {
+        if (!length || !value)
+            msig_update(sig, 0, 0, MAPPER_NOW);
+        else if (length == sig->props.length || type == sig->props.type)
+            msig_update(sig, value, 1, MAPPER_NOW);
         return;
     }


Bump __FreeBSD_version for sendfile fix to properly send 'nbytes' of file when headers are supplied (version 1.104 of src/sys/kern/uipc_syscalls.c)

--- sys/sys/param.h
+++ sys/sys/param.h
@@ -52,7 +52,7 @@
  * there.
  */
 #undef __FreeBSD_version
-#define __FreeBSD_version 500028	/* Master, propagated to newvers */
+#define __FreeBSD_version 500029	/* Master, propagated to newvers */

 #ifndef NULL
 #define	NULL	0


Follow CRuby spec

Follow CRuby spec

--- src/signal.c
+++ src/signal.c
@@ -342,9 +342,9 @@

   if (mrb_nil_p(oldcmd)) {
     if (oldfunc == SIG_IGN)
-      oldcmd = mrb_str_new_cstr(mrb, "SIG_IGN");
+      oldcmd = mrb_str_new_cstr(mrb, "IGNORE");
     else if (oldfunc == SIG_DFL)
-      oldcmd = mrb_str_new_cstr(mrb, "SIG_DFL");
+      oldcmd = mrb_str_new_cstr(mrb, "DEFAULT");
     else
       oldcmd = mrb_nil_value();
   }


Use MIN() macro rather than ulmin() inline, and fix stray tab
that snuck in with my last commit.

Submitted by: green

--- sys/vm/vm_map.c
+++ sys/vm/vm_map.c
@@ -2360,12 +2360,12 @@
 		vm2->vm_ssize += btoc(entrysize);
 	} else if (entry->start >= (vm_offset_t)vm1->vm_daddr &&
 	    entry->start < (vm_offset_t)vm1->vm_daddr + ctob(vm1->vm_dsize)) {
-		newend = ulmin(entry->end,
+		newend = MIN(entry->end,
 		    (vm_offset_t)vm1->vm_daddr + ctob(vm1->vm_dsize));
-			vm2->vm_dsize += btoc(newend - entry->start);
+		vm2->vm_dsize += btoc(newend - entry->start);
 	} else if (entry->start >= (vm_offset_t)vm1->vm_taddr &&
 	    entry->start < (vm_offset_t)vm1->vm_taddr + ctob(vm1->vm_tsize)) {
-		newend = ulmin(entry->end,
+		newend = MIN(entry->end,
 		    (vm_offset_t)vm1->vm_taddr + ctob(vm1->vm_tsize));
 		vm2->vm_tsize += btoc(newend - entry->start);
 	}


MFC revision 1.389
  Correct an error in vm_map_sync(), nee vm_map_clean(), that has existed
  since revision 1.1.  Specifically, neither traversal of the vm map checks
  whether the end of the vm map has been reached.  Consequently, the first
  traversal can wrap around and bogusly return an error.

Approved by:	re (kensmith)

--- sys/vm/vm_map.c
+++ sys/vm/vm_map.c
@@ -2204,7 +2204,8 @@
 	/*
 	 * Make a first pass to check for user-wired memory and holes.
 	 */
-	for (current = entry; current->start < end; current = current->next) {
+	for (current = entry; current != &map->header && current->start < end;
+	    current = current->next) {
 		if (invalidate && (current->eflags & MAP_ENTRY_USER_WIRED)) {
 			vm_map_unlock_read(map);
 			return (KERN_INVALID_ARGUMENT);
@@ -2224,7 +2225,8 @@
 	 * Make a second pass, cleaning/uncaching pages from the indicated
 	 * objects as we go.
 	 */
-	for (current = entry; current->start < end; current = current->next) {
+	for (current = entry; current != &map->header && current->start < end;
+	    current = current->next) {
 		offset = current->offset + (start - current->start);
 		size = (end <= current->end ? end : current->end) - start;
 		if (current->eflags & MAP_ENTRY_IS_SUB_MAP) {


upstream: monitor idle keepalive connections for 'disconnections' (#1704)

Signed-off-by: Eduardo Silva <81f705dc2ce1a61a2621e0e4b442a9474e1d0c70@treasure-data.com>

--- src/flb_upstream.c
+++ src/flb_upstream.c
@@ -156,7 +156,7 @@
     u->n_connections++;

     if (conn->u->flags & FLB_IO_TCP_KA) {
-        flb_debug("[upstream] KA connection #%i to %s:%i created",
+        flb_debug("[upstream] KA connection #%i to %s:%i is connected",
                   conn->fd, u->tcp_host, u->tcp_port);
     }

@@ -252,6 +252,16 @@
         mk_list_add(&conn->_head, &u->busy_queue);
         flb_debug("[upstream] KA connection #%i to %s:%i has been assigned (recycled)",
                   conn->fd, u->tcp_host, u->tcp_port);
+
+        /*
+         * Note: since we are in a keepalive connection, the socket is already being
+         * monitored for possible disconnections while idle. Upon re-use by the caller
+         * when it try to send some data, the I/O interface (flb_io.c) will put the
+         * proper event mask and reuse, there is no need to remove the socket from
+         * the event loop and re-add it again.
+         *
+         * So... just return the connection context.
+         */
         return conn;
     }

@@ -263,9 +273,30 @@
     return conn;
 }

+/*
+ * An 'idle' and keepalive might be disconnected, if so, this callback will perform
+ * the proper connection cleanup.
+ */
+static int cb_upstream_conn_ka_dropped(void *data)
+{
+    struct flb_upstream_conn *conn;
+
+    conn = (struct flb_upstream_conn *) data;
+
+    flb_debug("[upstream] KA connection #%i to %s:%i has been disconnected "
+              "by the remote service",
+              conn->fd, conn->u->tcp_host, conn->u->tcp_port);
+    return destroy_conn(conn);
+}
+
 int flb_upstream_conn_release(struct flb_upstream_conn *conn)
 {
+    int ret;
     time_t ts;
+    struct flb_upstream *u;
+
+    /* Upstream context */
+    u = conn->u;

     /* If this is a valid KA connection just recycle */
     if (conn->u->flags & FLB_IO_TCP_KA) {
@@ -285,6 +316,26 @@
         mk_list_del(&conn->_head);
         mk_list_add(&conn->_head, &conn->u->av_queue);
         conn->ts_available = time(NULL);
+
+        /*
+         * The socket at this point is not longer monitored, so if we want to be
+         * notified if the 'available keepalive connection' gets disconnected by
+         * the remote endpoint we need to add it again.
+         */
+        conn->event.handler = cb_upstream_conn_ka_dropped;
+        conn->event.data    = &conn;
+
+        ret = mk_event_add(u->evl, conn->fd,
+                           FLB_ENGINE_EV_CUSTOM,
+                           MK_EVENT_CLOSE, &conn->event);
+        if (ret == -1) {
+            /* We failed the registration, for safety just destroy the connection */
+            flb_debug("[upstream] KA connection #%i to %s:%i could not be "
+                      "registered, closing.",
+                      conn->fd, conn->u->tcp_host, conn->u->tcp_port);
+            return destroy_conn(conn);
+        }
+
         flb_debug("[upstream] KA connection #%i to %s:%i is now available",
                   conn->fd, conn->u->tcp_host, conn->u->tcp_port);
         return 0;


Remove unnecessary  read system call.

Remove unnecessary  read system call.

--- src/socket.c
+++ src/socket.c
@@ -119,22 +119,16 @@
          was issued before we are called, we don't have to wait for data */
         if (S->type == SOCK_DGRAM)
                 timeout = 0;
-        /* Read as much as we can, but only block on the first read */
-        while (RBUFFER_SIZE > S->length) {
-                if (S->ssl) {
-                        n = recv_ssl_socket(S->ssl, S->buffer + S->length, RBUFFER_SIZE-S->length, timeout);
-                } else {
-                        n = (int)sock_read(S->socket, S->buffer + S->length,  RBUFFER_SIZE-S->length, timeout);
-                }
-                timeout = 0;
-                if (n > 0) {
-                        S->length += n;
-                        continue;
-                }  else if (n < 0) {
-                        if (errno == EAGAIN || errno == EWOULDBLOCK || S->type == SOCK_DGRAM) break;
+        if (S->ssl) {
+                n = recv_ssl_socket(S->ssl, S->buffer, RBUFFER_SIZE, timeout);
+        } else {
+                n = (int)sock_read(S->socket, S->buffer,  RBUFFER_SIZE, timeout);
+        }
+        if (n > 0) {
+                S->length += n;
+        }  else if (n < 0) {
+                if (errno == EAGAIN || errno == EWOULDBLOCK || S->type == SOCK_DGRAM)
                         return -1;
-                } else
-                        break;
         }
         return S->length;
 }


update openssl metatable names in socket.c (used the wrong file name last time)

--- src/socket.c
+++ src/socket.c
@@ -670,7 +670,7 @@

 static lso_nargs_t lso_starttls(lua_State *L) {
 	struct luasocket *S = lso_checkself(L, 1);
-	SSL_CTX **ctx = luaL_testudata(L, 2, "OpenSSL SSL Context");
+	SSL_CTX **ctx = luaL_testudata(L, 2, "SSL_CTX*");
 	int error;

 	so_clear(S->socket);
@@ -698,7 +698,7 @@
 	if (!(*ssl = so_checktls(S->socket)))
 		return 0;

-	luaL_getmetatable(L, "OpenSSL SSL");
+	luaL_getmetatable(L, "SSL*");

 	if (lua_isnil(L, -1))
 		return 0;


Fixing event callback to client mode

Fixing event callback to client mode

--- src/socket.c
+++ src/socket.c
@@ -56,7 +56,7 @@
         }
         close(fd);
         bufferevent_free(bev);
-    } else if ((conn->mode = SOCKET_MODE_CLIENT) && (events & BEV_EVENT_CONNECTED)) {
+    } else if ((conn->mode == SOCKET_MODE_CLIENT) && (events & BEV_EVENT_CONNECTED)) {
         /* We're connected to 127.0.0.1:8080.
          * Ordinarily we'd do something here, like start reading or writing. */
         if (conn->cb.on_connect) {


GabbleXmppErrors: fix needless < 0 comparisons on unsigned values

20061031130228-418b8-3373b1d97133edc2c54a091f85a8806b8edcee9b.gz

--- src/gabble-error.c
+++ src/gabble-error.c
@@ -261,7 +261,7 @@
 GError *
 gabble_xmpp_error_to_g_error (GabbleXmppError error)
 {
-  if (error < 0 || error >= NUM_XMPP_ERRORS)
+  if (error >= NUM_XMPP_ERRORS)
     return NULL;

   return g_error_new (GABBLE_XMPP_ERROR,
@@ -278,7 +278,7 @@
   LmMessageNode *error_node, *node;
   gchar str[6];

-  if (error < 0 || error >= NUM_XMPP_ERRORS)
+  if (error >= NUM_XMPP_ERRORS)
     return NULL;

   spec = &xmpp_errors[error];
@@ -305,7 +305,7 @@
 const gchar *
 gabble_xmpp_error_string (GabbleXmppError error)
 {
-  if (error >= 0 && error < NUM_XMPP_ERRORS)
+  if (error < NUM_XMPP_ERRORS)
     return xmpp_errors[error].name;
   else
     return NULL;
@@ -314,7 +314,7 @@
 const gchar *
 gabble_xmpp_error_description (GabbleXmppError error)
 {
-  if (error >= 0 && error < NUM_XMPP_ERRORS)
+  if (error < NUM_XMPP_ERRORS)
     return xmpp_errors[error].description;
   else
     return NULL;


Implement MidiKey2Freq

Implement MidiKey2Freq

--- src/gba/gba-bios.c
+++ src/gba/gba-bios.c
@@ -2,6 +2,8 @@

 #include "gba.h"
 #include "gba-memory.h"
+
+#include <math.h>

 static void _unLz77(struct GBAMemory* memory, uint32_t source, uint8_t* dest);

@@ -68,6 +70,11 @@
 	}
 }

+static void _MidiKey2Freq(struct GBA* gba) {
+	uint32_t key = GBALoad32(&gba->memory.d, gba->cpu.gprs[0] + 4);
+	gba->cpu.gprs[0] = key / pow(2, (180 - gba->cpu.gprs[1] - gba->cpu.gprs[2] / 256) / 12);
+}
+
 void GBASwi16(struct ARMBoard* board, int immediate) {
 	struct GBA* gba = ((struct GBABoard*) board)->p;
 	switch (immediate) {
@@ -85,6 +92,9 @@
 		break;
 	case 0x12:
 		_unLz77(&gba->memory, gba->cpu.gprs[0], &((uint8_t*) gba->video.renderer->vram)[(gba->cpu.gprs[1] & (SIZE_VRAM - 1))]);
+		break;
+	case 0x1F:
+		_MidiKey2Freq(gba);
 		break;
 	default:
 		GBALog(GBA_LOG_STUB, "Stub software interrupt: %02x", immediate);


Iterating over the literals of a rule requires setting up the literal list pointer from rule->d.

--- src/solver.c
+++ src/solver.c
@@ -1582,6 +1582,7 @@
 	    }
 	  queue_push(&solv->learnt_pool, why);
 	  c = solv->rules + why;
+	  dp = c->d ? pool->whatprovidesdata + c->d : 0;
 	  IF_POOLDEBUG (SAT_DEBUG_ANALYZE)
 	    printruleclass(solv, SAT_DEBUG_ANALYZE, c);
 	  for (i = -1; ; i++)


Fix compilation warnings.

Fix compilation warnings.

--- src/gl/MiniFB_GL.c
+++ src/gl/MiniFB_GL.c
@@ -150,7 +150,7 @@

     init_GL(window_data);

-    SwapIntervalEXT = (PFNGLXSWAPINTERVALEXTPROC) glXGetProcAddress("glXSwapIntervalEXT");
+    SwapIntervalEXT = (PFNGLXSWAPINTERVALEXTPROC) glXGetProcAddress((const GLubyte *)"glXSwapIntervalEXT");
     set_target_fps_aux();

     return true;
@@ -355,7 +355,7 @@

         SwapIntervalEXT(dpy, drawable, interval);
         glXQueryDrawable(dpy, drawable, kGLX_SWAP_INTERVAL_EXT, &currentInterval);
-        if (interval != currentInterval) {
+        if (interval != (int)currentInterval) {
             glXQueryDrawable(dpy, drawable, kGLX_MAX_SWAP_INTERVAL_EXT, &maxInterval);
             fprintf(stderr, "Cannot set target swap interval. Current swap interval is %d (max: %d)\n", currentInterval, maxInterval);
         }


nir: Allocate register fields out of the register itself.

The lifetime of each register's use/def/if_use sets needs to match the
register itself.  So, allocate them using the register itself as the
context.

Signed-off-by: Kenneth Graunke <bd2562f754ec92342f93f61c25d731e290a2ffa8@whitecape.org>
Reviewed-by: Jason Ekstrand <b186559eaedf698788888c8a2559b4efb4db10d6@intel.com>

--- src/glsl/nir/nir.c
+++ src/glsl/nir/nir.c
@@ -58,11 +58,11 @@
    nir_register *reg = ralloc(mem_ctx, nir_register);

    reg->parent_instr = NULL;
-   reg->uses = _mesa_set_create(mem_ctx, _mesa_hash_pointer,
+   reg->uses = _mesa_set_create(reg, _mesa_hash_pointer,
                                 _mesa_key_pointer_equal);
-   reg->defs = _mesa_set_create(mem_ctx, _mesa_hash_pointer,
+   reg->defs = _mesa_set_create(reg, _mesa_hash_pointer,
                                 _mesa_key_pointer_equal);
-   reg->if_uses = _mesa_set_create(mem_ctx, _mesa_hash_pointer,
+   reg->if_uses = _mesa_set_create(reg, _mesa_hash_pointer,
                                    _mesa_key_pointer_equal);

    reg->num_components = 0;


glx/dri3: handle NULL pointers in loader-to-DRI3 drawable conversion

With a subsequent patch, we might see NULL loaderPrivates, e.g. when
a DRIdrawable is flushed whose corresponding GLXDRIdrawable was destroyed.
This resulted in a crash, since the loader vs. DRI3 drawable structures
have a non-zero offset.

Fixes glx-visuals-{depth,stencil} -pixmap

Cc: 17.0 <59f39c0db42d4479a46b02d4d2bc11120e37bb44@lists.freedesktop.org>
Reviewed-by: Marek Olšák <8c7344a1abdb103e79ecfd488098373070c3c70e@amd.com>
Reviewed-by: Emil Velikov <f20878473f414da183da19ee25c8722cc1d711e4@collabora.com>

--- src/glx/dri3_glx.c
+++ src/glx/dri3_glx.c
@@ -81,6 +81,8 @@
 static struct dri3_drawable *
 loader_drawable_to_dri3_drawable(struct loader_dri3_drawable *draw) {
    size_t offset = offsetof(struct dri3_drawable, loader_drawable);
+   if (!draw)
+      return NULL;
    return (struct dri3_drawable *)(((void*) draw) - offset);
 }


Fix addressmode typo

Fix addressmode typo

--- src/opcodes.c
+++ src/opcodes.c
@@ -21,7 +21,7 @@
 }

 unsigned char opcode_bbb_set_addr_mode(unsigned char base, unsigned char addr_mode) {
-  addr_mode = addr_mode | 0x7;
+  addr_mode = addr_mode & 0x7;
   return base | (addr_mode << 2);
 }


Fix CBC_Mac code

Fix CBC_Mac code

--- src/openssl.c
+++ src/openssl.c
@@ -193,7 +193,7 @@
 	}
 	if (cbAuthData % 16 != 0) {
 		CHECK_CONDITION(EVP_EncryptUpdate(&ctx, rgbTag, &cbOut, pbAuthData + (i * 16), cbAuthData % 16), COSE_ERR_CRYPTO_FAIL);
-		CHECK_CONDITION(EVP_EncryptUpdate(&ctx, rgbTag, &cbOut, rgbIV, 15 - (cbAuthData % 16)), COSE_ERR_CRYPTO_FAIL);
+		CHECK_CONDITION(EVP_EncryptUpdate(&ctx, rgbTag, &cbOut, rgbIV, 16 - (cbAuthData % 16)), COSE_ERR_CRYPTO_FAIL);
 	}

 	cn_cbor * cn = _COSE_arrayget_int(&pcose->m_message, INDEX_MAC_TAG);


updated comments

updated comments

--- src/optloop.c
+++ src/optloop.c
@@ -4365,29 +4365,25 @@

 void FeedbackLoopInfo()
 /*=============================================================================
-NCACHES=N
-   LINESIZES: X1 X2 ... XN
 OPTLOOP=1
    MaxUnroll=0
    LoopNormalForm=1/0
+   NUMIFS=1
    NUMPATHS=2
-      MaxMinReducesToOnePath=1
-      MaxReducesToOnePath=0
-      MinReducesToOnePath=0
-      RedCompReducesToOnePath=1
+      MaxEliminatedIfs=1
+      MinEliminatedIfs=1
+      RedCompEliminatedIfs=1
    VECTORIZABLE=1
       MaxMinOK=0/1
-      MaxOK=0/1
-      MinOK=0/1
       RedCompOK=0/1
       SpeculationOK=1
          path-1Vect=1/0
          path-2Vect=1/0
    Moving FP Pointers: N
-      'X': type=s/d prefetch=1/0 sets=1/0 uses=1/0
+      'A': type=s/d prefetch=1/0 sets=2 uses=8 arr=2d ur=8 nr=4
       ... ... ...
    Scalars Used in Loop: N
-      'X': type=s/d sets=1/0 uses=1/0 ScalarExpandable=1/0
+      'x': type=s/d sets=1 uses=1 ReduceExpandable=1/0
       ... ... ...
  *============================================================================*/
 {


spork_10 condition

spork_10 condition

--- src/goldminenode.h
+++ src/goldminenode.h
@@ -332,8 +332,11 @@
         READWRITE(pubKeyGoldminenode);
         READWRITE(vchSig);
         READWRITE(sigTime);
-        if(nProtocolVersion == 70208) {
-        READWRITE(enableTime);
+		if(sporkManager.IsSporkActive(SPORK_10_GOLDMINENODE_PAY_UPDATED_NODES))
+		{
+			if(nProtocolVersion == 70208) {
+				READWRITE(enableTime);
+			}
         }
         READWRITE(nProtocolVersion);
         READWRITE(lastPing);


status: simplified the elapsed:total time parser

Use strtol() and its endptr to get the next token.

--- src/status.c
+++ src/status.c
@@ -174,13 +174,11 @@
 	else if (strcmp(pair->name, "songid") == 0)
 		status->song_id = atoi(pair->value);
 	else if (strcmp(pair->name, "time") == 0) {
-		char * tok = strchr(pair->value,':');
-		/* the second strchr below is a safety check */
-		if (tok && (strchr(tok,0) > (tok+1))) {
-			/* atoi stops at the first non-[0-9] char: */
-			status->elapsed_time = atoi(pair->value);
-			status->total_time = atoi(tok+1);
-		}
+		char *endptr;
+
+		status->elapsed_time = strtol(pair->value, &endptr, 10);
+		if (*endptr == ':')
+			status->total_time = strtol(endptr + 1, NULL, 10);
 	} else if (strcmp(pair->name, "error") == 0) {
 		if (status->error != NULL)
 			free(status->error);


Fixed up pointer of block

Fixed up pointer of block

--- src/optsimd.c
+++ src/optsimd.c
@@ -2663,6 +2663,7 @@
  */
       bp = NewBasicBlock(bp0, NULL);
       bp0->down = bp;
+      bp->up = bp0;
       bp0 = bp;
       sprintf(ln, "_S_%d_%d",i,j);
       cflag = STlabellookup(ln);


Got rid of another warning

Got rid of another warning

--- src/stdlib.c
+++ src/stdlib.c
@@ -204,7 +204,7 @@
 			nel = m;
 		else if(tmp > 0)
 		{
-			base = p + width;
+			base = (char *)p + width;
 			nel -= m + 1;
 		}
 		else


 r2092@chromobil:  stefan | 2008-02-26 17:08:48 +0100
 Fix #1347: memory leak on windows

git-svn-id: c4e9838fefcfae554524937a357000afc2bbf25b@2087 152afb58-edef-0310-8abb-c4023f1b3aa9

--- src/stream.c
+++ src/stream.c
@@ -64,6 +64,7 @@
 			NULL);

 	if (!mh) {
+/*
 		LPVOID lpMsgBuf;
 		FormatMessage(
 		        FORMAT_MESSAGE_ALLOCATE_BUFFER |
@@ -73,7 +74,7 @@
 		        MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
 		        (LPTSTR) &lpMsgBuf,
 		        0, NULL );
-
+*/
 		return -1;
 	}


syncReadLine(): actually enforce buffer size limits.


Replicate HINCRBYFLOAT as HSET.

Replicate HINCRBYFLOAT as HSET.

--- src/t_hash.c
+++ src/t_hash.c
@@ -135,7 +135,9 @@
 }

 /* Add an element, discard the old if the key already exists.
- * Return 0 on insert and 1 on update. */
+ * Return 0 on insert and 1 on update.
+ * This function will take care of incrementing the reference count of the
+ * retained fields and value objects. */
 int hashTypeSet(robj *o, robj *field, robj *value) {
     int update = 0;

@@ -168,30 +170,23 @@
             zl = ziplistPush(zl, field->ptr, sdslen(field->ptr), ZIPLIST_TAIL);
             zl = ziplistPush(zl, value->ptr, sdslen(value->ptr), ZIPLIST_TAIL);
         }
-
         o->ptr = zl;
-
         decrRefCount(field);
         decrRefCount(value);

         /* Check if the ziplist needs to be converted to a hash table */
-        if (hashTypeLength(o) > server.hash_max_ziplist_entries) {
+        if (hashTypeLength(o) > server.hash_max_ziplist_entries)
             hashTypeConvert(o, REDIS_ENCODING_HT);
-        }
-
     } else if (o->encoding == REDIS_ENCODING_HT) {
         if (dictReplace(o->ptr, field, value)) { /* Insert */
             incrRefCount(field);
         } else { /* Update */
             update = 1;
         }
-
         incrRefCount(value);
-
-    } else {
-        redisPanic("Unknown hash encoding");
-    }
-
+    } else {
+        redisPanic("Unknown hash encoding");
+    }
     return update;
 }

@@ -520,7 +515,7 @@

 void hincrbyfloatCommand(redisClient *c) {
     double long value, incr;
-    robj *o, *current, *new;
+    robj *o, *current, *new, *aux;

     if (getLongDoubleFromObjectOrReply(c,c->argv[3],&incr,NULL) != REDIS_OK) return;
     if ((o = hashTypeLookupWriteOrCreate(c,c->argv[1])) == NULL) return;
@@ -540,9 +535,17 @@
     hashTypeTryObjectEncoding(o,&c->argv[2],NULL);
     hashTypeSet(o,c->argv[2],new);
     addReplyBulk(c,new);
-    decrRefCount(new);
     signalModifiedKey(c->db,c->argv[1]);
     server.dirty++;
+
+    /* Always replicate HINCRBYFLOAT as an HSET command with the final value
+     * in order to make sure that differences in float pricision or formatting
+     * will not create differences in replicas or after an AOF restart. */
+    aux = createStringObject("HSET",4);
+    rewriteClientCommandArgument(c,0,aux);
+    decrRefCount(aux);
+    rewriteClientCommandArgument(c,3,new);
+    decrRefCount(new);
 }

 static void addHashFieldToReply(redisClient *c, robj *o, robj *field) {


Object encoding in hash function is done by a more specific function

--- src/t_hash.c
+++ src/t_hash.c
@@ -220,7 +220,6 @@
     robj *o;

     if ((o = hashTypeLookupWriteOrCreate(c,c->argv[1])) == NULL) return;
-    c->argv[3] = tryObjectEncoding(c->argv[3]);
     hashTypeTryConversion(o,c->argv,2,3);
     hashTypeTryObjectEncoding(o,&c->argv[2], &c->argv[3]);
     update = hashTypeSet(o,c->argv[2],c->argv[3]);
@@ -232,7 +231,6 @@
 void hsetnxCommand(redisClient *c) {
     robj *o;
     if ((o = hashTypeLookupWriteOrCreate(c,c->argv[1])) == NULL) return;
-    c->argv[3] = tryObjectEncoding(c->argv[3]);
     hashTypeTryConversion(o,c->argv,2,3);

     if (hashTypeExists(o, c->argv[2])) {
@@ -256,7 +254,6 @@
     }

     if ((o = hashTypeLookupWriteOrCreate(c,c->argv[1])) == NULL) return;
-    c->argv[c->argc-1] = tryObjectEncoding(c->argv[c->argc-1]);
     hashTypeTryConversion(o,c->argv,2,c->argc-1);
     for (i = 2; i < c->argc; i += 2) {
         hashTypeTryObjectEncoding(o,&c->argv[i], &c->argv[i+1]);
@@ -299,7 +296,6 @@
     if ((o = lookupKeyReadOrReply(c,c->argv[1],shared.nullbulk)) == NULL ||
         checkType(c,o,REDIS_HASH)) return;

-    c->argv[2] = tryObjectEncoding(c->argv[2]);
     if ((value = hashTypeGet(o,c->argv[2])) != NULL) {
         addReplyBulk(c,value);
         decrRefCount(value);
@@ -320,7 +316,6 @@
      * done because objects that cannot be found are considered to be
      * an empty hash. The reply should then be a series of NULLs. */
     addReplyMultiBulkLen(c,c->argc-2);
-    c->argv[c->argc-1] = tryObjectEncoding(c->argv[c->argc-1]);
     for (i = 2; i < c->argc; i++) {
         if (o != NULL && (value = hashTypeGet(o,c->argv[i])) != NULL) {
             addReplyBulk(c,value);
@@ -336,7 +331,6 @@
     if ((o = lookupKeyWriteOrReply(c,c->argv[1],shared.czero)) == NULL ||
         checkType(c,o,REDIS_HASH)) return;

-    c->argv[2] = tryObjectEncoding(c->argv[2]);
     if (hashTypeDelete(o,c->argv[2])) {
         if (hashTypeLength(o) == 0) dbDelete(c->db,c->argv[1]);
         addReply(c,shared.cone);
@@ -401,6 +395,5 @@
     if ((o = lookupKeyReadOrReply(c,c->argv[1],shared.czero)) == NULL ||
         checkType(c,o,REDIS_HASH)) return;

-    c->argv[2] = tryObjectEncoding(c->argv[2]);
     addReply(c, hashTypeExists(o,c->argv[2]) ? shared.cone : shared.czero);
 }


Reply with single null bulk for unsuccesful BRPOPLPUSH

--- src/t_list.c
+++ src/t_list.c
@@ -941,7 +941,7 @@

             /* Blocking against an empty list in a multi state
              * returns immediately. */
-            addReply(c, shared.nullmultibulk);
+            addReply(c, shared.nullbulk);
         } else {
             /* The list is empty and the client blocks. */
             blockForKeys(c, c->argv + 1, 1, timeout, c->argv[2]);


modified the BRPOPLPUSH target field cleanup strategy to fix it the proper way.

--- src/t_list.c
+++ src/t_list.c
@@ -870,6 +870,9 @@
         receiver = ln->value;
         dstkey = receiver->bpop.target;

+        /* Protect receiver->bpop.target, that will be freed by
+         * the next unblockClientWaitingData() call. */
+        if (dstkey) incrRefCount(dstkey);
         /* This should remove the first element of the "clients" list. */
         unblockClientWaitingData(receiver);

@@ -882,13 +885,12 @@
         } else {
             /* BRPOPLPUSH, note that receiver->db is always equal to c->db. */
             dstobj = lookupKeyWrite(receiver->db,dstkey);
-            if (dstobj && checkType(receiver,dstobj,REDIS_LIST)) {
-                decrRefCount(dstkey);
-            } else {
+            if (!(dstobj && checkType(receiver,dstobj,REDIS_LIST))) {
                 rpoplpushHandlePush(c,receiver,dstkey,dstobj,ele);
                 decrRefCount(dstkey);
                 return 1;
             }
+            decrRefCount(dstkey);
         }
     }


Prevent NaN scores in sorted sets resulting from calls to ZUNIONSTORE and ZINTERSTORE.

--- src/t_zset.c
+++ src/t_zset.c
@@ -1545,6 +1545,8 @@
                 double score, value;

                 score = src[0].weight * zval.score;
+                if (isnan(score)) score = 0;
+
                 for (j = 1; j < setnum; j++) {
                     /* It is not safe to access the zset we are
                      * iterating, so explicitly check for equal object. */
@@ -1587,6 +1589,7 @@

                 /* Initialize score */
                 score = src[i].weight * zval.score;
+                if (isnan(score)) score = 0;

                 /* Because the inputs are sorted by size, it's only possible
                  * for sets at larger indices to hold this element. */


Make zzlLength take a ziplist argument

Make zzlLength take a ziplist argument

--- src/t_zset.c
+++ src/t_zset.c
@@ -449,9 +449,7 @@
     return cmp;
 }

-unsigned int zzlLength(robj *zobj) {
-    unsigned char *zl = zobj->ptr;
-    redisAssert(zobj->encoding == REDIS_ENCODING_ZIPLIST);
+unsigned int zzlLength(unsigned char *zl) {
     return ziplistLen(zl)/2;
 }

@@ -720,7 +718,7 @@
 int zsLength(robj *zobj) {
     int length = -1;
     if (zobj->encoding == REDIS_ENCODING_ZIPLIST) {
-        length = zzlLength(zobj);
+        length = zzlLength(zobj->ptr);
     } else if (zobj->encoding == REDIS_ENCODING_RAW) {
         length = ((zset*)zobj->ptr)->zsl->length;
     } else {
@@ -874,7 +872,7 @@
             /* Optimize: check if the element is too large or the list becomes
              * too long *before* executing zzlInsert. */
             redisAssert(zzlInsert(zobj,ele,score) == REDIS_OK);
-            if (zzlLength(zobj) > server.zset_max_ziplist_entries)
+            if (zzlLength(zobj->ptr) > server.zset_max_ziplist_entries)
                 zsConvert(zobj,REDIS_ENCODING_RAW);
             if (sdslen(ele->ptr) > server.zset_max_ziplist_value)
                 zsConvert(zobj,REDIS_ENCODING_RAW);
@@ -965,7 +963,7 @@

         if ((eptr = zzlFind(zobj,ele,NULL)) != NULL) {
             redisAssert(zzlDelete(zobj,eptr) == REDIS_OK);
-            if (zzlLength(zobj) == 0) dbDelete(c->db,key);
+            if (zzlLength(zobj->ptr) == 0) dbDelete(c->db,key);
         } else {
             addReply(c,shared.czero);
             return;


From Dario Borriello <dario_bodj@hotmail.com>: bugfix: do not update LQ if not configured

--- src/tc_set.c
+++ src/tc_set.c
@@ -320,6 +320,14 @@
 void
 olsr_calc_tc_edge_entry_etx(struct tc_edge_entry *tc_edge)
 {
+
+  /*
+   * Some sanity check before recalculating the etx.
+   */
+  if (olsr_cnf->lq_level < 1) {
+    return;
+  }
+
   if (tc_edge->link_quality < MIN_LINK_QUALITY &&
       tc_edge->inverse_link_quality < MIN_LINK_QUALITY) {
     tc_edge->etx = INFINITE_ETX;
@@ -601,7 +609,14 @@
       if (tc->msg_hops <= olsr_cnf->lq_dlimit)
         edge_change = 1;
     }
-    tc_edge->link_quality = neigh_link_quality;
+
+    /*
+     * Update link quality if configured. For hop-count only mode link quality
+     * remains at 1.0.
+     */
+    if (olsr_cnf->lq_level > 0) {
+      tc_edge->link_quality = neigh_link_quality;
+    }

     if (olsr_etx_significant_change(tc_edge->inverse_link_quality,
                                     link_quality)) {
@@ -609,7 +624,14 @@
       if (tc->msg_hops <= olsr_cnf->lq_dlimit)
         edge_change = 1;
     }
-    tc_edge->inverse_link_quality = link_quality;
+
+    /*
+     * Update inverse link quality if configured. For hop-count only mode
+     * inverse link quality remains at 1.0.
+     */
+    if (olsr_cnf->lq_level > 0) {
+      tc_edge->inverse_link_quality = link_quality;
+    }

     /*
      * Update the etx.


Minor mods in error reporting on PAPI_stop

--- src/papi_hl.c
+++ src/papi_hl.c
@@ -276,9 +276,9 @@
     return(PAPI_EINVAL);

   retval = PAPI_stop(PAPI_EVENTSET_INUSE, values);
-  if (retval)
-    return(retval);
-
-  return(PAPI_cleanup_eventset(&PAPI_EVENTSET_INUSE));
-}
-
+  if (!retval)
+    retval = PAPI_cleanup_eventset(&PAPI_EVENTSET_INUSE);
+  DBG((stderr,"PAPI_stop_counters returns %d\n",retval));
+  return (retval);
+}
+


did not do a diff on premake.lua and instead used code from another download, In other words I messed it up.

--- src/host/premake.h
+++ src/host/premake.h
@@ -1,7 +1,7 @@
 /**
  * \file   premake.h
  * \brief  Program-wide constants and definitions.
- * \author Copyright (c) 2002-2008 Jason Perkins and the Premake project
+ * \author Copyright (c) 2002-2011 Jason Perkins and the Premake project
  */

 #define lua_c
@@ -24,6 +24,9 @@
 #elif defined(__sun__) && defined(__svr4__)
 #define PLATFORM_SOLARIS  (1)
 #define PLATFORM_STRING   "solaris"
+#elif defined(__HAIKU__)
+#define PLATFORM_HAIKU    (1)
+#define PLATFORM_STRING   "haiku"
 #else
 #define PLATFORM_WINDOWS  (1)
 #define PLATFORM_STRING   "windows"


Fix the issues with *id comparison operators.

--- src/hyperdex/ids.h
+++ src/hyperdex/ids.h
@@ -37,6 +37,9 @@
 namespace hyperdex
 {

+// Ideally I'd like these to be related via subclassing, but it screws up the
+// comparison operators when used with STL containers.
+
 class spaceid
 {
     public:
@@ -56,20 +59,20 @@
         uint32_t space;
 };

-class subspaceid : public spaceid
-{
-    public:
-        static const size_t SERIALIZEDSIZE = spaceid::SERIALIZEDSIZE + sizeof(uint16_t);
+class subspaceid
+{
+    public:
+        static const size_t SERIALIZEDSIZE = sizeof(uint32_t) + sizeof(uint16_t);

     public:
         subspaceid(uint32_t s = 0, uint16_t ss = 0)
-            : spaceid(s)
+            : space(s)
             , subspace(ss)
         {
         }

         subspaceid(spaceid s, uint16_t ss = 0)
-            : spaceid(s)
+            : space(s.space)
             , subspace(ss)
         {
         }
@@ -79,24 +82,34 @@
         }

     public:
+        spaceid get_space() const
+        {
+            return spaceid(space);
+        }
+
+    public:
+        uint32_t space;
         uint16_t subspace;
 };

-class regionid : public subspaceid
-{
-    public:
-        static const size_t SERIALIZEDSIZE = subspaceid::SERIALIZEDSIZE + sizeof(uint8_t) + sizeof(uint64_t);
+class regionid
+{
+    public:
+        static const size_t SERIALIZEDSIZE = sizeof(uint32_t) + sizeof(uint16_t)
+                                           + sizeof(uint8_t) + sizeof(uint64_t);

     public:
         regionid(uint32_t s = 0, uint16_t ss = 0, uint8_t p = 0, uint64_t m = 0)
-            : subspaceid(s, ss)
+            : space(s)
+            , subspace(ss)
             , prefix(p)
             , mask(m)
         {
         }

         regionid(subspaceid ss, uint8_t p = 0, uint64_t m = 0)
-            : subspaceid(ss)
+            : space(ss.space)
+            , subspace(ss.subspace)
             , prefix(p)
             , mask(m)
         {
@@ -107,25 +120,46 @@
         }

     public:
+        subspaceid get_subspace() const
+        {
+            return subspaceid(space, subspace);
+        }
+
+        spaceid get_space() const
+        {
+            return spaceid(space);
+        }
+
+    public:
+        uint32_t space;
+        uint16_t subspace;
         uint8_t prefix;
         uint64_t mask;
 };

-class entityid : public regionid
-{
-    public:
-        static const size_t SERIALIZEDSIZE = regionid::SERIALIZEDSIZE + sizeof(uint8_t);
+class entityid
+{
+    public:
+        static const size_t SERIALIZEDSIZE = sizeof(uint32_t) + sizeof(uint16_t)
+                                           + sizeof(uint8_t) + sizeof(uint64_t)
+                                           + sizeof(uint8_t);

     public:
         entityid(uint32_t s = 0, uint16_t ss = 0,
                  uint8_t p = 0, uint64_t m = 0, uint8_t n = 0)
-            : regionid(s, ss, p, m)
+            : space(s)
+            , subspace(ss)
+            , prefix(p)
+            , mask(m)
             , number(n)
         {
         }

         entityid(regionid r, uint8_t n = 0)
-            : regionid(r)
+            : space(r.space)
+            , subspace(r.subspace)
+            , prefix(r.prefix)
+            , mask(r.mask)
             , number(n)
         {
         }
@@ -135,6 +169,26 @@
         }

     public:
+        regionid get_region() const
+        {
+            return regionid(space, subspace, prefix, mask);
+        }
+
+        subspaceid get_subspace() const
+        {
+            return subspaceid(space, subspace);
+        }
+
+        spaceid get_space() const
+        {
+            return spaceid(space);
+        }
+
+    public:
+        uint32_t space;
+        uint16_t subspace;
+        uint8_t prefix;
+        uint64_t mask;
         uint8_t number;
 };

@@ -149,21 +203,21 @@
 inline e::buffer::packer&
 operator << (e::buffer::packer& lhs, const subspaceid& rhs)
 {
-    lhs << dynamic_cast<const spaceid&>(rhs) << rhs.subspace;
+    lhs << rhs.get_space() << rhs.subspace;
     return lhs;
 }

 inline e::buffer::packer&
 operator << (e::buffer::packer& lhs, const regionid& rhs)
 {
-    lhs << dynamic_cast<const subspaceid&>(rhs) << rhs.prefix << rhs.mask;
+    lhs << rhs.get_subspace() << rhs.prefix << rhs.mask;
     return lhs;
 }

 inline e::buffer::packer&
 operator << (e::buffer::packer& lhs, const entityid& rhs)
 {
-    lhs << dynamic_cast<const regionid&>(rhs) << rhs.number;
+    lhs << rhs.get_region() << rhs.number;
     return lhs;
 }

@@ -178,21 +232,21 @@
 inline e::buffer::unpacker&
 operator >> (e::buffer::unpacker& lhs, subspaceid& rhs)
 {
-    lhs >> dynamic_cast<spaceid&>(rhs) >> rhs.subspace;
+    lhs >> rhs.space >> rhs.subspace;
     return lhs;
 }

 inline e::buffer::unpacker&
 operator >> (e::buffer::unpacker& lhs, regionid& rhs)
 {
-    lhs >> dynamic_cast<subspaceid&>(rhs) >> rhs.prefix >> rhs.mask;
+    lhs >> rhs.space >> rhs.subspace >> rhs.prefix >> rhs.mask;
     return lhs;
 }

 inline e::buffer::unpacker&
 operator >> (e::buffer::unpacker& lhs, entityid& rhs)
 {
-    lhs >> dynamic_cast<regionid&>(rhs) >> rhs.number;
+    lhs >> rhs.space >> rhs.subspace >> rhs.prefix >> rhs.mask >> rhs.number;
     return lhs;
 }

@@ -200,26 +254,48 @@
 inline int
 compare(const spaceid& lhs, const spaceid& rhs)
 {
-    return lhs.space - rhs.space;
+    if (lhs.space < rhs.space)
+    {
+        return -1;
+    }
+    else if (lhs.space > rhs.space)
+    {
+        return 1;
+    }
+    else
+    {
+        return 0;
+    }
 }

 inline int
 compare(const subspaceid& lhs, const subspaceid& rhs)
 {
-    int super = compare(dynamic_cast<const spaceid&>(lhs), dynamic_cast<const spaceid&>(rhs));
+    int super = compare(lhs.get_space(), rhs.get_space());

     if (super)
     {
         return super;
     }

-    return lhs.subspace - rhs.subspace;
+    if (lhs.subspace < rhs.subspace)
+    {
+        return -1;
+    }
+    else if (lhs.subspace > rhs.subspace)
+    {
+        return 1;
+    }
+    else
+    {
+        return 0;
+    }
 }

 inline int
 compare(const regionid& lhs, const regionid& rhs)
 {
-    int super = compare(dynamic_cast<const subspaceid&>(lhs), dynamic_cast<const subspaceid&>(rhs));
+    int super = compare(lhs.get_subspace(), rhs.get_subspace());

     if (super)
     {
@@ -236,21 +312,43 @@
     }
     else
     {
-        return lhs.mask - rhs.mask;
+        if (lhs.mask < rhs.mask)
+        {
+            return -1;
+        }
+        else if (lhs.mask > rhs.mask)
+        {
+            return 1;
+        }
+        else
+        {
+            return 0;
+        }
     }
 }

 inline int
 compare(const entityid& lhs, const entityid& rhs)
 {
-    int super = compare(dynamic_cast<const regionid&>(lhs), dynamic_cast<const regionid&>(rhs));
+    int super = compare(lhs.get_region(), rhs.get_region());

     if (super)
     {
         return super;
     }

-    return lhs.number - rhs.number;
+    if (lhs.number < rhs.number)
+    {
+        return -1;
+    }
+    else if (lhs.number > rhs.number)
+    {
+        return 1;
+    }
+    else
+    {
+        return 0;
+    }
 }

 // Operators
@@ -324,7 +422,7 @@
     std::ios_base::fmtflags fl = lhs.flags();
     lhs << "region(space=" << rhs.space
         << ", subspace=" << rhs.subspace
-        << ", prefix=" << rhs.prefix
+        << ", prefix=" << (unsigned int) rhs.prefix
         << ", mask=" << rhs.mask
         << ")";
     lhs.flags(fl);
@@ -337,9 +435,9 @@
     std::ios_base::fmtflags fl = lhs.flags();
     lhs << "entity(space=" << rhs.space
         << ", subspace=" << rhs.subspace
-        << ", prefix=" << rhs.prefix
+        << ", prefix=" << (unsigned int) rhs.prefix
         << ", mask=" << rhs.mask
-        << ", number=" << rhs.number
+        << ", number=" << (unsigned int) rhs.number
         << ")";
     lhs.flags(fl);
     return lhs;


Don't include headers already included via unwind_i.h.

(Logical change 1.294)

--- src/ia64/Gparser.c
+++ src/ia64/Gparser.c
@@ -22,11 +22,6 @@
 LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
 OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.  */
-
-#include <assert.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>

 #include "unwind_i.h"