bind9/lib/isc/win32/os.c

40 lines
828 B
C
Raw Normal View History

2001-07-06 01:36:13 -04:00
/*
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
2001-07-06 01:36:13 -04: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 01:36:13 -04:00
*/
2007-06-19 19:47:24 -04:00
/* $Id: os.c,v 1.8 2007/06/19 23:47:19 tbox Exp $ */
2001-07-06 01:36:13 -04:00
#include <windows.h>
#include <isc/os.h>
2001-07-06 01:36:13 -04:00
static BOOL bInit = FALSE;
static SYSTEM_INFO SystemInfo;
static void
initialize_action(void) {
2001-07-08 01:09:35 -04:00
if (bInit)
2001-07-06 01:36:13 -04:00
return;
2013-03-23 19:46:06 -04:00
2001-07-08 01:09:35 -04:00
GetSystemInfo(&SystemInfo);
2001-07-06 01:36:13 -04:00
bInit = TRUE;
}
unsigned int
isc_os_ncpus(void) {
long ncpus;
2001-07-06 01:36:13 -04:00
initialize_action();
ncpus = SystemInfo.dwNumberOfProcessors;
if (ncpus <= 0)
ncpus = 1;
return ((unsigned int)ncpus);
}