mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 18:40:43 +03:00
libspl: move physmem to sys/systm.h; initialise at libspl_init()
Sponsored-by: https://despairlabs.com/sponsor/ Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Rob Norris <robn@despairlabs.com> Closes #17861
This commit is contained in:
committed by
Brian Behlendorf
parent
d02ea5170a
commit
6cf6f091cf
@@ -59,6 +59,7 @@ libspl_sys_HEADERS = \
|
||||
%D%/sys/string.h \
|
||||
%D%/sys/sunddi.h \
|
||||
%D%/sys/systeminfo.h \
|
||||
%D%/sys/systm.h \
|
||||
%D%/sys/thread.h \
|
||||
%D%/sys/taskq.h \
|
||||
%D%/sys/time.h \
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
// 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_SYSTM_H
|
||||
#define _LIBSPL_SYS_SYSTM_H
|
||||
|
||||
extern uint64_t physmem;
|
||||
|
||||
#endif
|
||||
@@ -20,14 +20,22 @@
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2018 by Delphix. All rights reserved.
|
||||
* Copyright (c) 2016 Actifio, Inc. All rights reserved.
|
||||
* Copyright (c) 2025, Klara, Inc.
|
||||
* Copyright (c) 2025, Rob Norris <robn@despairlabs.com>
|
||||
*/
|
||||
|
||||
#include <libspl.h>
|
||||
#include <unistd.h>
|
||||
|
||||
uint64_t physmem;
|
||||
|
||||
void
|
||||
libspl_init(void)
|
||||
{
|
||||
physmem = sysconf(_SC_PHYS_PAGES);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -60,7 +60,6 @@
|
||||
* Emulation of kernel services in userland.
|
||||
*/
|
||||
|
||||
uint64_t physmem;
|
||||
uint32_t hostid;
|
||||
struct utsname hw_utsname;
|
||||
|
||||
@@ -509,8 +508,6 @@ kernel_init(int mode)
|
||||
|
||||
umem_nofail_callback(umem_out_of_memory);
|
||||
|
||||
physmem = sysconf(_SC_PHYS_PAGES);
|
||||
|
||||
dprintf("physmem = %llu pages (%.2f GB)\n", (u_longlong_t)physmem,
|
||||
(double)physmem * sysconf(_SC_PAGE_SIZE) / (1ULL << 30));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user