diff --git a/include/sys/zfs_context.h b/include/sys/zfs_context.h index d9eb64b1c..d1cf0bde0 100644 --- a/include/sys/zfs_context.h +++ b/include/sys/zfs_context.h @@ -113,7 +113,6 @@ extern "C" { #include #include #include -#include #include #include @@ -131,6 +130,7 @@ extern "C" { #include #include #include +#include #include @@ -267,9 +267,6 @@ extern uint32_t zone_get_hostid(void *zonep); extern int ddi_strtoull(const char *str, char **nptr, int base, u_longlong_t *result); -typedef struct utsname utsname_t; -extern utsname_t *utsname(void); - /* ZFS Boot Related stuff. */ struct _buf { diff --git a/lib/libspl/include/Makefile.am b/lib/libspl/include/Makefile.am index 8c5bb7b72..dece09145 100644 --- a/lib/libspl/include/Makefile.am +++ b/lib/libspl/include/Makefile.am @@ -43,6 +43,7 @@ libspl_sys_HEADERS = \ %D%/sys/kstat.h \ %D%/sys/list.h \ %D%/sys/list_impl.h \ + %D%/sys/misc.h \ %D%/sys/mhd.h \ %D%/sys/mkdev.h \ %D%/sys/mod.h \ diff --git a/lib/libspl/include/sys/misc.h b/lib/libspl/include/sys/misc.h new file mode 100644 index 000000000..171bbc1de --- /dev/null +++ b/lib/libspl/include/sys/misc.h @@ -0,0 +1,40 @@ +// SPDX-License-Identifier: CDDL-1.0 +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or https://opensource.org/licenses/CDDL-1.0. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright 2011 Nexenta Systems, Inc. All rights reserved. + * Copyright (c) 2012, 2018 by Delphix. All rights reserved. + * Copyright (c) 2012, Joyent, Inc. All rights reserved. + */ + +#ifndef _LIBSPL_SYS_MISC_H +#define _LIBSPL_SYS_MISC_H + +#include + +/* + * Hostname information + */ +typedef struct utsname utsname_t; +extern utsname_t *utsname(void); + +#endif diff --git a/lib/libspl/libspl.c b/lib/libspl/libspl.c index d189357a1..84e44ef51 100644 --- a/lib/libspl/libspl.c +++ b/lib/libspl/libspl.c @@ -28,14 +28,26 @@ */ #include +#include #include +#include +#include uint64_t physmem; +struct utsname hw_utsname; + +utsname_t * +utsname(void) +{ + return (&hw_utsname); +} void libspl_init(void) { physmem = sysconf(_SC_PHYS_PAGES); + + VERIFY0(uname(&hw_utsname)); } void diff --git a/lib/libzpool/kernel.c b/lib/libzpool/kernel.c index 25663882b..0d658be13 100644 --- a/lib/libzpool/kernel.c +++ b/lib/libzpool/kernel.c @@ -44,7 +44,6 @@ #include #include #include -#include #include #include @@ -61,7 +60,6 @@ */ uint32_t hostid; -struct utsname hw_utsname; /* If set, all blocks read will be copied to the specified directory. */ char *vn_dumpdir = NULL; @@ -405,12 +403,6 @@ ddi_strtoull(const char *str, char **nptr, int base, u_longlong_t *result) return (0); } -utsname_t * -utsname(void) -{ - return (&hw_utsname); -} - /* * ========================================================================= * kernel emulation setup & teardown @@ -515,8 +507,6 @@ kernel_init(int mode) random_init(); - VERIFY0(uname(&hw_utsname)); - system_taskq_init(); icp_init();