2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-09-10 11:35:24 +00:00
Files
bind/lib/isc/win32/os.c

38 lines
774 B
C
Raw Normal View History

2001-07-06 05:36:13 +00:00
/*
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
2001-07-06 05:36:13 +00:00
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* See the COPYRIGHT file distributed with this work for additional
* information regarding copyright ownership.
2001-07-06 05:36:13 +00:00
*/
#include <windows.h>
#include <isc/os.h>
2001-07-06 05:36:13 +00:00
static BOOL bInit = FALSE;
static SYSTEM_INFO SystemInfo;
static void
initialize_action(void) {
2001-07-08 05:09:35 +00:00
if (bInit)
2001-07-06 05:36:13 +00:00
return;
2013-03-23 23:46:06 +00:00
2001-07-08 05:09:35 +00:00
GetSystemInfo(&SystemInfo);
2001-07-06 05:36:13 +00:00
bInit = TRUE;
}
unsigned int
isc_os_ncpus(void) {
long ncpus;
2001-07-06 05:36:13 +00:00
initialize_action();
ncpus = SystemInfo.dwNumberOfProcessors;
if (ncpus <= 0)
ncpus = 1;
return ((unsigned int)ncpus);
}