summaryrefslogtreecommitdiff
path: root/src/birudaenv.c
blob: 1fafd41b07f6846f71ec14aaea322b1b62c6e2c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>

#include "system.h"

int main( int argc, char *argv[] )
{
	char hostname[100];
	system_hostname( hostname, sizeof( hostname ) );
	unsigned int nofCpus = system_available_cpus( );
	unsigned int nofPhysMem = system_phys_memory( );	
	char os_name[100];
	system_os( os_name, sizeof( os_name ) );
	char machine_arch[100];
	system_arch( machine_arch, sizeof( machine_arch ) );

	printf( 
		"{ "
			"\"arch\": \"%s\", "
			"\"os\": \"%s\", "
			"\"host\": \"%s\", "
			"\"cpus\": %d, "
			"\"physical_memory\": %d "
		"}\n",
		machine_arch,
		os_name,
		hostname,
		nofCpus,
		nofPhysMem
	);
	
	execvp( argv[1], &argv[1] );

	exit( EXIT_SUCCESS );
}