system-posix.cpp revision 26ce84897df60fed28f68a98b91ce82aed9f0ee7
/* $Id$ */
/** @file
* innotek Portable Runtime - System, POSIX.
*/
/*
* Copyright (C) 2006-2007 innotek GmbH
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License as published by the Free Software Foundation,
* in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
* distribution. VirtualBox OSE is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY of any kind.
*
* If you received this file as part of a commercial VirtualBox
* distribution, then only the terms of your commercial VirtualBox
* license agreement apply instead of the previous paragraph.
*/
/*******************************************************************************
* Header Files *
*******************************************************************************/
#include <unistd.h>
#if !defined(RT_OS_SOLARIS)
#endif
/**
* Gets the number of logical (not physical) processors in the system.
*
* @returns Number of logical processors in the system.
*/
RTR3DECL(unsigned) RTSystemProcessorGetCount(void)
{
/*
* The sysconf way (linux and others).
*/
#ifdef _SC_NPROCESSORS_ONLN
if (cCpus >= 1)
return cCpus;
#endif
/*
* The BSD 4.4 way.
*/
int aiMib[2];
cCpus = -1;
return cCpus;
#endif
return 1;
}
/**
* Gets the active logical processor mask.
*
* @returns Active logical processor mask. (bit 0 == logical cpu 0)
*/
{
int cCpus = RTSystemProcessorGetCount();
}