Restore code to sysctl_free() the compat32 shadow tree

This commit is contained in:
pgoyette 2020-03-21 16:17:08 +00:00
parent 608bd4460c
commit 2c1f75181f
3 changed files with 51 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: netbsd32_mod.c,v 1.21 2020/03/15 14:15:12 pgoyette Exp $ */
/* $NetBSD: netbsd32_mod.c,v 1.22 2020/03/21 16:17:08 pgoyette Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@ -59,7 +59,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: netbsd32_mod.c,v 1.21 2020/03/15 14:15:12 pgoyette Exp $");
__KERNEL_RCSID(0, "$NetBSD: netbsd32_mod.c,v 1.22 2020/03/21 16:17:08 pgoyette Exp $");
#ifdef _KERNEL_OPT
#include "opt_execfmt.h"
@ -76,6 +76,7 @@ __KERNEL_RCSID(0, "$NetBSD: netbsd32_mod.c,v 1.21 2020/03/15 14:15:12 pgoyette E
#include <sys/module_hook.h>
#include <sys/compat_stub.h>
#include <compat/netbsd32/netbsd32_sysctl.h>
#include <compat/netbsd32/netbsd32_kern_proc.h>
#include <compat/netbsd32/netbsd32_exec.h>
@ -180,6 +181,7 @@ compat_netbsd32_modcmd(modcmd_t cmd, void *arg)
MODULE_HOOK_UNSET(amd64_oosyscall_hook);
#endif /* defined(__amd64__) */
netbsd32_machdep_md_fini();
netbsd32_sysctl_fini();
netbsd32_kern_proc_32_fini();
error = exec_remove(netbsd32_execsw,

View File

@ -1,4 +1,4 @@
/* $NetBSD: netbsd32_sysctl.c,v 1.43 2020/03/17 17:16:26 pgoyette Exp $ */
/* $NetBSD: netbsd32_sysctl.c,v 1.44 2020/03/21 16:17:08 pgoyette Exp $ */
/*
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: netbsd32_sysctl.c,v 1.43 2020/03/17 17:16:26 pgoyette Exp $");
__KERNEL_RCSID(0, "$NetBSD: netbsd32_sysctl.c,v 1.44 2020/03/21 16:17:08 pgoyette Exp $");
#if defined(_KERNEL_OPT)
#include "opt_ddb.h"
@ -57,6 +57,7 @@ __KERNEL_RCSID(0, "$NetBSD: netbsd32_sysctl.c,v 1.43 2020/03/17 17:16:26 pgoyett
#include <compat/netbsd32/netbsd32_syscall.h>
#include <compat/netbsd32/netbsd32_syscallargs.h>
#include <compat/netbsd32/netbsd32_conv.h>
#include <compat/netbsd32/netbsd32_sysctl.h>
#if defined(DDB)
#include <ddb/ddbvar.h>
@ -180,6 +181,13 @@ SYSCTL_SETUP(netbsd32_sysctl_emul_setup, "netbsd32 shadow tree")
CTL_HW, HW_MACHINE_ARCH, CTL_EOL);
}
void
netbsd32_sysctl_fini(void)
{
sysctl_free(&netbsd32_sysctl_root);
}
int
netbsd32___sysctl(struct lwp *l, const struct netbsd32___sysctl_args *uap, register_t *retval)
{

View File

@ -0,0 +1,37 @@
/* $NetBSD: netbsd32_sysctl.h,v 1.3 2020/03/21 16:17:08 pgoyette Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software developed for The NetBSD Foundation
* by Andrew Doran.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _NETBSD32_SYSCTL_H
#define _NETBSD32_SYSCTL_H
void netbsd32_sysctl_fini(void);
#endif /* !_NETBSD32_SYSCTL_H */