os.c revision 9c3531d72aeaad6c5f01efe6a1c82023e1379e4d
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews/*
cfd262045c23cadb8415f0111f56995258f17361Evan Hunt * Copyright (C) 2000 Internet Software Consortium.
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews *
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * Permission to use, copy, modify, and distribute this software for any
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * purpose with or without fee is hereby granted, provided that the above
cfd262045c23cadb8415f0111f56995258f17361Evan Hunt * copyright notice and this permission notice appear in all copies.
cfd262045c23cadb8415f0111f56995258f17361Evan Hunt *
cfd262045c23cadb8415f0111f56995258f17361Evan Hunt * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
428dd5c588cfe0dc1519af728e6e75c10aeb4439Curtis Blackburn * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
cfd262045c23cadb8415f0111f56995258f17361Evan Hunt * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
cfd262045c23cadb8415f0111f56995258f17361Evan Hunt * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
cfd262045c23cadb8415f0111f56995258f17361Evan Hunt * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
cfd262045c23cadb8415f0111f56995258f17361Evan Hunt * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
cfd262045c23cadb8415f0111f56995258f17361Evan Hunt * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
cfd262045c23cadb8415f0111f56995258f17361Evan Hunt * SOFTWARE.
cfd262045c23cadb8415f0111f56995258f17361Evan Hunt */
cfd262045c23cadb8415f0111f56995258f17361Evan Hunt
cfd262045c23cadb8415f0111f56995258f17361Evan Hunt/* $Id: os.c,v 1.3 2000/06/22 21:58:44 tale Exp $ */
cfd262045c23cadb8415f0111f56995258f17361Evan Hunt
cfd262045c23cadb8415f0111f56995258f17361Evan Hunt#include <config.h>
cfd262045c23cadb8415f0111f56995258f17361Evan Hunt
cfd262045c23cadb8415f0111f56995258f17361Evan Hunt#include <unistd.h>
cfd262045c23cadb8415f0111f56995258f17361Evan Hunt
#include <isc/os.h>
unsigned int
isc_os_ncpus(void) {
long ncpus = 1;
#if defined(HAVE_SYSCONF) && defined(_SC_NPROCESSORS_ONLN)
ncpus = sysconf(_SC_NPROCESSORS_ONLN);
if (ncpus <= 0)
ncpus = 1;
#endif
return ((unsigned int)ncpus);
}