---
bsd/porting/netport.h | 9 ++++++++-
bsd/sys/net/if.cc | 4 ++--
bsd/sys/net/netisr.cc | 20 ++++++++++----------
bsd/sys/netinet/tcp_timer.cc | 2 +-
bsd/sys/sys/systm.h | 4 +---
5 files changed, 22 insertions(+), 17 deletions(-)
diff --git a/bsd/porting/netport.h b/bsd/porting/netport.h
index 2604a4a..a433370 100644
--- a/bsd/porting/netport.h
+++ b/bsd/porting/netport.h
@@ -191,7 +191,14 @@ size_t strlcpy(char *dst, const char *src, size_t siz);
#define NULL (0)
#endif
-#define KASSERT(exp,msg) assert(exp)
+#define KASSERT_PRINT(...) tprintf_e("bsd-kassert", __VA_ARGS__)
+#define KASSERT(exp, msg) \
+ do { \
+ if (!(exp)) { \
+ KASSERT_PRINT msg ; \
+ assert(exp); \
+ } \
+ } while(0)
#define bsd_min(a, b) ((a) < (b) ? (a) : (b))
#define bsd_max(a, b) ((a) > (b) ? (a) : (b))
diff --git a/bsd/sys/net/if.cc b/bsd/sys/net/if.cc
index 2673d13..2f2e4cb 100644
--- a/bsd/sys/net/if.cc
+++ b/bsd/sys/net/if.cc
@@ -551,8 +551,8 @@ if_attach_internal(struct ifnet *ifp, int vmove)
KASSERT(!(ifp->if_capenable & IFCAP_HWSTATS) ||
(ifp->if_getinfo != NULL),
- "get_if_info should be initialized if HW/SW support
internal "
- "statistics handling");
+ ("get_if_info should be initialized if HW/SW support
internal "
+ "statistics handling"));
if (ifp->if_getinfo == NULL)
ifp->if_getinfo = if_getinfo;
diff --git a/bsd/sys/net/netisr.cc b/bsd/sys/net/netisr.cc
index b5d831c..2948e5f 100644
--- a/bsd/sys/net/netisr.cc
+++ b/bsd/sys/net/netisr.cc
@@ -345,12 +345,12 @@ netisr_clearqdrops(const struct netisr_handler *nhp)
proto = nhp->nh_proto;
KASSERT(proto < NETISR_MAXPROT,
- ("%s(%u): protocol too big for %s", __func__, proto, name));
+ ("%s(%u): protocol too big for %s", __func__, proto, nhp->nh_name));
NETISR_WLOCK();
KASSERT(netisr_proto[proto].np_handler != NULL,
("%s(%u): protocol not registered for %s", __func__, proto,
- name));
+ nhp->nh_name));
npwp = &main_nws.nws_work[proto];
npwp->nw_qdrops = 0;
@@ -369,12 +369,12 @@ netisr_getqdrops(const struct netisr_handler *nhp,
u_int64_t *qdropp)
*qdropp = 0;
proto = nhp->nh_proto;
KASSERT(proto < NETISR_MAXPROT,
- ("%s(%u): protocol too big for %s", __func__, proto, name));
+ ("%s(%u): protocol too big for %s", __func__, proto, nhp->nh_name));
NETISR_RLOCK(&tracker);
KASSERT(netisr_proto[proto].np_handler != NULL,
("%s(%u): protocol not registered for %s", __func__, proto,
- name));
+ nhp->nh_name));
npwp = &main_nws.nws_work[proto];
*qdropp += npwp->nw_qdrops;
@@ -391,12 +391,12 @@ netisr_getqlimit(const struct netisr_handler *nhp, u_int
*qlimitp)
proto = nhp->nh_proto;
KASSERT(proto < NETISR_MAXPROT,
- ("%s(%u): protocol too big for %s", __func__, proto, name));
+ ("%s(%u): protocol too big for %s", __func__, proto, nhp->nh_name));
NETISR_RLOCK(&tracker);
KASSERT(netisr_proto[proto].np_handler != NULL,
("%s(%u): protocol not registered for %s", __func__, proto,
- name));
+ nhp->nh_name));
*qlimitp = netisr_proto[proto].np_qlimit;
NETISR_RUNLOCK(&tracker);
}
@@ -417,12 +417,12 @@ netisr_setqlimit(const struct netisr_handler *nhp, u_int
qlimit)
proto = nhp->nh_proto;
KASSERT(proto < NETISR_MAXPROT,
- ("%s(%u): protocol too big for %s", __func__, proto, name));
+ ("%s(%u): protocol too big for %s", __func__, proto, nhp->nh_name));
NETISR_WLOCK();
KASSERT(netisr_proto[proto].np_handler != NULL,
("%s(%u): protocol not registered for %s", __func__, proto,
- name));
+ nhp->nh_name));
netisr_proto[proto].np_qlimit = qlimit;
npwp = &main_nws.nws_work[proto];
@@ -468,12 +468,12 @@ netisr_unregister(const struct netisr_handler *nhp)
proto = nhp->nh_proto;
KASSERT(proto < NETISR_MAXPROT,
- ("%s(%u): protocol too big for %s", __func__, proto, name));
+ ("%s(%u): protocol too big for %s", __func__, proto, nhp->nh_name));
NETISR_WLOCK();
KASSERT(netisr_proto[proto].np_handler != NULL,
("%s(%u): protocol not registered for %s", __func__, proto,
- name));
+ nhp->nh_name));
netisr_proto[proto].np_name = NULL;
netisr_proto[proto].np_handler = NULL;
diff --git a/bsd/sys/netinet/tcp_timer.cc b/bsd/sys/netinet/tcp_timer.cc
index 2819181..6f3f7c7 100644
--- a/bsd/sys/netinet/tcp_timer.cc
+++ b/bsd/sys/netinet/tcp_timer.cc
@@ -435,7 +435,7 @@ tcp_timer_tso_flush(serial_timer_task& timer, struct tcpcb
*tp)
KASSERT(inp != NULL, ("tcp_timer_tso_flush: inp == NULL"));
- KASSERT(tp->t_flags & TF_TSO, "tcp_timer_tso_flush: TSO disabled");
+ KASSERT(tp->t_flags & TF_TSO, ("tcp_timer_tso_flush: TSO disabled"));
INP_LOCK(inp);
// Re-check the TF_TSO_PENDING flag under the lock
diff --git a/bsd/sys/sys/systm.h b/bsd/sys/sys/systm.h
index f68414a..f363204 100644
--- a/bsd/sys/sys/systm.h
+++ b/bsd/sys/sys/systm.h
@@ -1,8 +1,6 @@
#ifndef _OSV_BSD_SYSTM_H
#define _OSV_BSD_SYSTM_H
-#include <assert.h>
-
-#define KASSERT(exp, msg) assert(exp)
+/* Nothing defined here, but lots of files include this header */
#endif
--
2.7.4
--
You received this message because you are subscribed to the Google Groups "OSv
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.