Revert "Pull if_drain routine out of m_reclaim"

The commit broke dlopen()'d rumpnet on platforms where ld.so does not
override weak aliases (e.g. musl, Solaris, potentially OS X, ...).

Requested by pooka@.
This commit is contained in:
ozaki-r 2014-12-02 04:43:35 +00:00
parent 66504f18c9
commit 087b8cc474
4 changed files with 12 additions and 22 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: uipc_mbuf.c,v 1.159 2014/11/27 03:15:51 ozaki-r Exp $ */
/* $NetBSD: uipc_mbuf.c,v 1.160 2014/12/02 04:43:35 ozaki-r Exp $ */
/*-
* Copyright (c) 1999, 2001 The NetBSD Foundation, Inc.
@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.159 2014/11/27 03:15:51 ozaki-r Exp $");
__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.160 2014/12/02 04:43:35 ozaki-r Exp $");
#include "opt_mbuftrace.h"
#include "opt_nmbclusters.h"
@ -543,6 +543,7 @@ m_reclaim(void *arg, int flags)
{
struct domain *dp;
const struct protosw *pr;
struct ifnet *ifp;
int s;
KERNEL_LOCK(1, NULL);
@ -553,7 +554,10 @@ m_reclaim(void *arg, int flags)
if (pr->pr_drain)
(*pr->pr_drain)();
}
if_drain_all();
IFNET_FOREACH(ifp) {
if (ifp->if_drain)
(*ifp->if_drain)(ifp);
}
splx(s);
mbstat.m_drain++;
KERNEL_UNLOCK_ONE(NULL);

View File

@ -1,4 +1,4 @@
/* $NetBSD: if.c,v 1.302 2014/12/01 07:15:42 ozaki-r Exp $ */
/* $NetBSD: if.c,v 1.303 2014/12/02 04:43:35 ozaki-r Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc.
@ -90,7 +90,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.302 2014/12/01 07:15:42 ozaki-r Exp $");
__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.303 2014/12/02 04:43:35 ozaki-r Exp $");
#include "opt_inet.h"
@ -2329,17 +2329,6 @@ if_mcast_op(ifnet_t *ifp, const unsigned long cmd, const struct sockaddr *sa)
return rc;
}
void
if_drain_all(void)
{
struct ifnet *ifp;
IFNET_FOREACH(ifp) {
if (ifp->if_drain)
(*ifp->if_drain)(ifp);
}
}
static void
sysctl_sndq_setup(struct sysctllog **clog, const char *ifname,
struct ifaltq *ifq)

View File

@ -1,4 +1,4 @@
/* $NetBSD: if.h,v 1.182 2014/12/01 07:15:42 ozaki-r Exp $ */
/* $NetBSD: if.h,v 1.183 2014/12/02 04:43:35 ozaki-r Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc.
@ -962,7 +962,6 @@ extern struct ifnet_head ifnet_list;
extern struct ifnet *lo0ifp;
ifnet_t * if_byindex(u_int);
void if_drain_all(void);
/*
* ifq sysctl support

View File

@ -1,4 +1,4 @@
/* $NetBSD: net_stub.c,v 1.19 2014/11/27 03:15:51 ozaki-r Exp $ */
/* $NetBSD: net_stub.c,v 1.20 2014/12/02 04:43:35 ozaki-r Exp $ */
/*
* Copyright (c) 2008 Antti Kantee. All Rights Reserved.
@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: net_stub.c,v 1.19 2014/11/27 03:15:51 ozaki-r Exp $");
__KERNEL_RCSID(0, "$NetBSD: net_stub.c,v 1.20 2014/12/02 04:43:35 ozaki-r Exp $");
#include <sys/param.h>
#include <sys/protosw.h>
@ -61,9 +61,7 @@ __weak_alias(agr_input,rumpnet_stub);
__weak_alias(ieee8023ad_lacp_input,rumpnet_stub);
__weak_alias(ieee8023ad_marker_input,rumpnet_stub);
/* if */
struct ifnet_head ifnet_list;
__weak_alias(if_drain_all,rumpnet_stub);
int
compat_ifconf(u_long cmd, void *data)