summaryrefslogtreecommitdiff
path: root/src/birudaenv.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/birudaenv.c')
-rw-r--r--src/birudaenv.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/birudaenv.c b/src/birudaenv.c
new file mode 100644
index 0000000..1fafd41
--- /dev/null
+++ b/src/birudaenv.c
@@ -0,0 +1,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 );
+}