From 608a68fba0caee7cb803c034957830d980a870c7 Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Tue, 16 Jun 2015 20:35:24 +0200 Subject: started a small worker helper named 'birudaenv' doing a environemnt guessing and the executing it's arguments (something docker does). Will do a lot more in the future. --- src/birudaenv.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 src/birudaenv.c (limited to 'src/birudaenv.c') 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 +#include +#include + +#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 ); +} -- cgit v1.2.3-54-g00ecf