patch for clean NetBSD and OpenBSD builds from v krishnakumar

This commit is contained in:
Alex Shinn 2012-07-26 09:55:00 +09:00
parent cc1821a61e
commit f0dd9c9ddb
2 changed files with 20 additions and 1 deletions

View file

@ -10,6 +10,12 @@ else
ifeq ($(shell uname),FreeBSD) ifeq ($(shell uname),FreeBSD)
PLATFORM=bsd PLATFORM=bsd
else else
ifeq ($(shell uname),NetBSD)
PLATFORM=bsd
else
ifeq ($(shell uname),OpenBSD)
PLATFORM=bsd
else
ifeq ($(shell uname),DragonFly) ifeq ($(shell uname),DragonFly)
PLATFORM=bsd PLATFORM=bsd
else else
@ -33,6 +39,8 @@ endif
endif endif
endif endif
endif endif
endif
endif
######################################################################## ########################################################################
# Set default variables for the platform. # Set default variables for the platform.
@ -45,6 +53,12 @@ EXE =
CLIBFLAGS = -dynamiclib CLIBFLAGS = -dynamiclib
STATICFLAGS = -static-libgcc -DSEXP_USE_DL=0 STATICFLAGS = -static-libgcc -DSEXP_USE_DL=0
else else
ifeq ($(PLATFORM),bsd)
SO = .so
EXE =
CLIBFLAGS = -fPIC -shared
LIBDL =
else
ifeq ($(PLATFORM),mingw) ifeq ($(PLATFORM),mingw)
SO = .dll SO = .dll
EXE = .exe EXE = .exe
@ -75,6 +89,7 @@ endif
endif endif
endif endif
endif endif
endif
ifeq ($(PLATFORM),unix) ifeq ($(PLATFORM),unix)
#RLDFLAGS=-rpath $(LIBDIR) #RLDFLAGS=-rpath $(LIBDIR)

View file

@ -62,6 +62,8 @@ static sexp sexp_set_signal_action (sexp ctx, sexp self, sexp signum, sexp newac
#include <sys/time.h> #include <sys/time.h>
#ifndef __DragonFly__ #ifndef __DragonFly__
#include <sys/param.h>
#include <sys/sysctl.h>
#include <sys/proc.h> #include <sys/proc.h>
#endif #endif
#include <sys/sysctl.h> #include <sys/sysctl.h>
@ -72,8 +74,10 @@ static sexp sexp_pid_cmdline (sexp ctx, int pid) {
struct kinfo_proc res; struct kinfo_proc res;
int name[4] = {CTL_KERN, KERN_PROC, KERN_PROC_PID, pid}; int name[4] = {CTL_KERN, KERN_PROC, KERN_PROC_PID, pid};
if (sysctl(name, 4, &res, &reslen, NULL, 0) >= 0) { if (sysctl(name, 4, &res, &reslen, NULL, 0) >= 0) {
#ifdef __APPLE__ #if defined(__APPLE__) || defined(__NetBSD__)
return sexp_c_string(ctx, res.kp_proc.p_comm, -1); return sexp_c_string(ctx, res.kp_proc.p_comm, -1);
#elif __OpenBSD__
return sexp_c_string(ctx, res.p_comm, -1);
#elif __DragonFly__ #elif __DragonFly__
return sexp_c_string(ctx, res.kp_comm, -1); return sexp_c_string(ctx, res.kp_comm, -1);
#else #else