Home » Extra libraries, Code snippets, applications etc. » OS Problems etc., Win32, POSIX, MacOS, FreeBSD, X11 etc » BSDs: Is there  "int get_nprocs (void)" 
	| 
		
 |  
	| 
		
 |  
	| 
		
 |  
	| 
		
 |  
	
		
		
			| Re: BSDs: Is there  "int get_nprocs (void)" [message #10878 is a reply to message #10865] | 
			Thu, 02 August 2007 11:02    | 
		 
		
			
				
				
				
					
						  
						masu
						 Messages: 378 Registered: February 2006 
						
					 | 
					Senior Member  | 
					 | 
		 
		 
	 | 
 
	
		On Net-, Open-, DragonflyBSD one must use sysctl system call like that: 
 
int mib[2], maxproc;
size_t len;
mib[0] = CTL_HW;
mib[1] = HW_NCPU;
len = sizeof(maxproc);
sysctl(mib, 2, &maxproc, &len, NULL, 0);
  
 
But then the kernel sources have to be installed and the following files have to be included: 
<sys/systctl.h> and <sys/param.h> on Net-, OpenBSD and <sys/types.h> on DragonflyBSD. 
 
Matthias
		
		
		[Updated on: Thu, 02 August 2007 11:27] Report message to a moderator  
 |  
	| 
		
	 | 
 
 
 |  
	| 
		
 |  
	| 
		
 |   
Goto Forum:
 
 Current Time: Tue Nov 04 17:27:52 CET 2025 
 Total time taken to generate the page: 0.06295 seconds 
 |