Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add freebsd's process.title support.

  • Loading branch information...
commit 49cd211dffebbc265594da9fd01799891a226ebd 1 parent b14dd49
Vanilla Hsu authored ry committed
Showing with 11 additions and 4 deletions.
  1. +11 −4 src/platform_freebsd.cc
View
15 src/platform_freebsd.cc
@@ -1,34 +1,41 @@
#include "node.h"
#include "platform.h"
+#include <stdlib.h>
#include <kvm.h>
#include <sys/param.h>
#include <sys/sysctl.h>
#include <sys/user.h>
+#include <string.h>
#include <paths.h>
#include <fcntl.h>
#include <unistd.h>
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;

0 comments on commit 49cd211

Please sign in to comment.
Something went wrong with that request. Please try again.