diff --git a/src/platform_freebsd.cc b/src/platform_freebsd.cc index 0a2c28bec9..77d1b18801 100644 --- a/src/platform_freebsd.cc +++ b/src/platform_freebsd.cc @@ -1,34 +1,41 @@ #include "node.h" #include "platform.h" +#include #include #include #include #include +#include #include #include #include namespace node { - +static char *process_title; char** OS::SetupArgs(int argc, char *argv[]) { + process_title = argc ? strdup(argv[0]) : NULL; return argv; } void OS::SetProcessTitle(char *title) { - ; + if (process_title) free(process_title); + process_title = strdup(title); + setproctitle(title); } - const char* OS::GetProcessTitle(int *len) { + if (process_title) { + *len = strlen(process_title); + return process_title; + } *len = 0; return NULL; } - int OS::GetMemory(size_t *rss, size_t *vsize) { kvm_t *kd = NULL; struct kinfo_proc *kinfo = NULL;