Browse Source

[FreeBSD] use /dev/null instead /dev/mem

Without this patch, Node needs to setgid kmem when run as normal user.
v0.7.4-release
Vanilla Hsu 15 years ago
committed by Ryan Dahl
parent
commit
25adb2eb55
  1. 3
      src/node.cc

3
src/node.cc

@ -673,6 +673,7 @@ int getmem(size_t *rss, size_t *vsize) {
#include <sys/param.h> #include <sys/param.h>
#include <sys/sysctl.h> #include <sys/sysctl.h>
#include <sys/user.h> #include <sys/user.h>
#include <paths.h>
#include <fcntl.h> #include <fcntl.h>
#include <unistd.h> #include <unistd.h>
@ -685,7 +686,7 @@ int getmem(size_t *rss, size_t *vsize) {
pid = getpid(); pid = getpid();
kd = kvm_open(NULL, NULL, NULL, O_RDONLY, "kvm_open"); kd = kvm_open(NULL, _PATH_DEVNULL, NULL, O_RDONLY, "kvm_open");
if (kd == NULL) goto error; if (kd == NULL) goto error;
kinfo = kvm_getprocs(kd, KERN_PROC_PID, pid, &nprocs); kinfo = kvm_getprocs(kd, KERN_PROC_PID, pid, &nprocs);

Loading…
Cancel
Save