Index: head/net-mgmt/ccnet/Makefile =================================================================== --- head/net-mgmt/ccnet/Makefile (revision 380213) +++ head/net-mgmt/ccnet/Makefile (revision 380214) @@ -1,67 +1,67 @@ # $FreeBSD$ PORTNAME= ccnet -PORTVERSION= 3.1.4 -PORTREVISION= 4 +PORTVERSION= 4.0.6 +PORTREVISION= 5 CATEGORIES= net-mgmt devel MAINTAINER= yan_jingfeng@yahoo.com COMMENT= Framework for writing networked applications LICENSE= GPLv3 BUILD_DEPENDS= valac:${PORTSDIR}/lang/vala LIB_DEPENDS= libsearpc.so:${PORTSDIR}/devel/libsearpc \ libglib-2.0.so:${PORTSDIR}/devel/glib20 \ libgobject-2.0.so:${PORTSDIR}/devel/glib20 \ libsqlite3.so:${PORTSDIR}/databases/sqlite3 \ libzdb.so:${PORTSDIR}/databases/libzdb \ libuuid.so:${PORTSDIR}/misc/e2fsprogs-libuuid \ libevent.so:${PORTSDIR}/devel/libevent2 \ libjansson.so:${PORTSDIR}/devel/jansson \ libldap.so:${PORTSDIR}/net/openldap24-client USE_GITHUB= yes GH_ACCOUNT= haiwen -GH_TAGNAME= v3.1.4 -GH_COMMIT= 6b55658 +GH_TAGNAME= v${PORTVERSION}-server +GH_COMMIT= 1e1aeae USES= autoreconf libtool pkgconfig pathfix python:2 PATHFIX_MAKEFILEIN= Makefile.am USE_LDCONFIG= yes CPPFLAGS+= -I${LOCALBASE}/include -I${LOCALBASE}/include/event2 LDFLAGS+= -L${LOCALBASE}/lib -L${LOCALBASE}/lib/event2 GNU_CONFIGURE= yes CONFIGURE_ARGS+=--enable-server --enable-ldap INSTALL_TARGET= install-strip WITH_OPENSSL_PORT= yes USE_OPENSSL= yes HAIWENDIR= www/haiwen SEAFILE_SERVER= ${HAIWENDIR}/seafile-server SEABIN= ${SEAFILE_SERVER}/seafile/bin SEALIB= ${SEAFILE_SERVER}/seafile/lib SEAFILE_USERNAME?= www SEAFILE_GROUPNAME?= ${SEAFILE_USERNAME} PLIST_SUB= SEAFILE_USERNAME=${SEAFILE_USERNAME} \ SEAFILE_GROUPNAME=${SEAFILE_GROUPNAME} \ SEAFILE_SERVER=${SEAFILE_SERVER} \ HAIWENDIR=${HAIWENDIR} post-install: @${MKDIR} ${STAGEDIR}${PREFIX}/${SEABIN} ${STAGEDIR}${PREFIX}/${SEALIB} ${INSTALL_PROGRAM} ${STAGEDIR}${PREFIX}/bin/ccnet-init ${STAGEDIR}${PREFIX}/${SEABIN} ${INSTALL_PROGRAM} ${STAGEDIR}${PREFIX}/bin/ccnet-server ${STAGEDIR}${PREFIX}/${SEABIN} ${INSTALL_PROGRAM} ${STAGEDIR}${PREFIX}/bin/ccnet-servtool ${STAGEDIR}${PREFIX}/${SEABIN} ${RM} ${STAGEDIR}${PREFIX}/bin/ccnet-init \ ${STAGEDIR}${PREFIX}/bin/ccnet-server \ ${STAGEDIR}${PREFIX}/bin/ccnet-servtool (cd ${STAGEDIR}${PREFIX}/lib && \ ${COPYTREE_SHARE} ${PYTHON_VERSION} ${STAGEDIR}${PREFIX}/${SEALIB}) @${RM} -rf ${STAGEDIR}${PREFIX}/lib/${PYTHON_VERSION} .include Index: head/net-mgmt/ccnet/distinfo =================================================================== --- head/net-mgmt/ccnet/distinfo (revision 380213) +++ head/net-mgmt/ccnet/distinfo (revision 380214) @@ -1,2 +1,2 @@ -SHA256 (ccnet-3.1.4.tar.gz) = 5838cff989fe1910aeda5a2801f331d479f76e7d2c00cb8d87f016a7e9b0ea8d -SIZE (ccnet-3.1.4.tar.gz) = 216920 +SHA256 (ccnet-4.0.6.tar.gz) = 4030d931c2aaad5d2d783c4afb2e2cda556a91307c26a378c91602540255b7eb +SIZE (ccnet-4.0.6.tar.gz) = 218569 Index: head/net-mgmt/ccnet/files/patch-net_common_processors_service-proxy-proc.c =================================================================== --- head/net-mgmt/ccnet/files/patch-net_common_processors_service-proxy-proc.c (revision 380213) +++ head/net-mgmt/ccnet/files/patch-net_common_processors_service-proxy-proc.c (nonexistent) @@ -1,11 +0,0 @@ ---- net/common/processors/service-proxy-proc.c.orig 2014-09-02 15:47:22.827928455 -0400 -+++ net/common/processors/service-proxy-proc.c 2014-09-02 15:47:36.619949159 -0400 -@@ -43,7 +43,7 @@ - { - ServiceProxyPriv *priv = GET_PRIV(processor); - if (priv->name) { -- free (priv->name); -+ g_free (priv->name); - priv->name = NULL; - } - Property changes on: head/net-mgmt/ccnet/files/patch-net_common_processors_service-proxy-proc.c ___________________________________________________________________ Deleted: fbsd:nokeywords ## -1 +0,0 ## -yes \ No newline at end of property Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: head/net-mgmt/ccnet/files/patch-net_common_processors_rcvcmd-proc.c =================================================================== --- head/net-mgmt/ccnet/files/patch-net_common_processors_rcvcmd-proc.c (revision 380213) +++ head/net-mgmt/ccnet/files/patch-net_common_processors_rcvcmd-proc.c (nonexistent) @@ -1,45 +0,0 @@ ---- net/common/processors/rcvcmd-proc.c.orig 2014-09-02 15:49:07.244090539 -0400 -+++ net/common/processors/rcvcmd-proc.c 2014-09-02 15:52:55.749963338 -0400 -@@ -221,7 +221,7 @@ - int i; - - commands = g_strsplit_set (line, " \t", 10); -- for (i=0, pcmd = commands; *pcmd; pcmd++) -+ for (i = 0, pcmd = commands; *pcmd; pcmd++) - i++; - - if (i == 0) { -@@ -234,7 +234,6 @@ - if (c == NULL) { - ccnet_processor_send_response (processor, SC_UNKNONW_CMD, - SS_UNKNONW_CMD, NULL, 0); -- return; - } else - c->handler (processor, i, commands); - -@@ -534,7 +533,7 @@ - ret = -1; - - out: -- g_free (addr); -+ g_free (addr_port); - g_free (role); - g_free (peer_id); - if (peer) g_object_unref (peer); -@@ -707,6 +706,7 @@ - if (addr_port) { - peer = ccnet_peer_manager_add_resolve_peer ( - processor->session->peer_mgr, addr, port); -+ g_free (peer->intend_role); - peer->intend_role = g_strdup(role); - ccnet_processor_send_response (processor, SC_OK, SS_OK, NULL, 0); - ret = 0; -@@ -736,7 +736,7 @@ - ret = -1; - - out: -- g_free (addr); -+ g_free (addr_port); - g_free (role); - g_free (peer_id); - if (peer) g_object_unref (peer); Property changes on: head/net-mgmt/ccnet/files/patch-net_common_processors_rcvcmd-proc.c ___________________________________________________________________ Deleted: fbsd:nokeywords ## -1 +0,0 ## -yes \ No newline at end of property Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: head/net-mgmt/ccnet/files/patch-makefile.am =================================================================== --- head/net-mgmt/ccnet/files/patch-makefile.am (revision 380213) +++ head/net-mgmt/ccnet/files/patch-makefile.am (nonexistent) @@ -1,17 +0,0 @@ ---- Makefile.am.orig 2014-07-21 07:24:46.000000000 -0400 -+++ Makefile.am 2014-07-21 07:25:02.000000000 -0400 -@@ -22,11 +22,7 @@ - ACLOCAL_AMFLAGS = -I m4 - - install-data-local: --if MACOS -- sed -i '' -e "s|(DESTDIR)|${DESTDIR}|g" $(pcfiles) --else -- sed -i "s|(DESTDIR)|${DESTDIR}|g" $(pcfiles) --endif -+ sed -i '' "s|(DESTDIR)|${PREFIX}|g" $(pcfiles) - - dist-hook: -- git log --format='%H' -1 > $(distdir)/latest_commit -\ No newline at end of file -+ git log --format='%H' -1 > $(distdir)/latest_commit Property changes on: head/net-mgmt/ccnet/files/patch-makefile.am ___________________________________________________________________ Deleted: fbsd:nokeywords ## -1 +0,0 ## -yes \ No newline at end of property Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: head/net-mgmt/ccnet/files/patch-net_common_session.c =================================================================== --- head/net-mgmt/ccnet/files/patch-net_common_session.c (revision 380213) +++ head/net-mgmt/ccnet/files/patch-net_common_session.c (nonexistent) @@ -1,10 +0,0 @@ ---- net/common/session.c.orig 2014-09-03 04:04:21.072122386 -0400 -+++ net/common/session.c 2014-09-03 04:04:58.071390609 -0400 -@@ -168,6 +168,7 @@ - g_free (name); - g_free (user_name); - g_free (port_str); -+ g_free (lport_str); - #ifdef CCNET_SERVER - g_free (service_url); - #endif Property changes on: head/net-mgmt/ccnet/files/patch-net_common_session.c ___________________________________________________________________ Deleted: fbsd:nokeywords ## -1 +0,0 ## -yes \ No newline at end of property Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: head/net-mgmt/ccnet/files/patch-Makefile.am =================================================================== --- head/net-mgmt/ccnet/files/patch-Makefile.am (nonexistent) +++ head/net-mgmt/ccnet/files/patch-Makefile.am (revision 380214) @@ -0,0 +1,18 @@ +--- Makefile.am.orig 2015-01-27 22:28:22.000000000 -0500 ++++ Makefile.am 2015-01-27 22:33:35.000000000 -0500 +@@ -24,9 +24,13 @@ + install-data-local: + if MACOS + sed -i '' -e "s|(DESTDIR)|${DESTDIR}|g" $(pcfiles) ++else ++if BSD ++ sed -i '' "s|(DESTDIR)|${PREFIX}|g" $(pcfiles) + else + ${SED} -i "s|(DESTDIR)|${DESTDIR}|g" $(pcfiles) + endif ++endif + + dist-hook: +- git log --format='%H' -1 > $(distdir)/latest_commit +\ No newline at end of file ++ git log --format='%H' -1 > $(distdir)/latest_commit Property changes on: head/net-mgmt/ccnet/files/patch-Makefile.am ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: head/net-mgmt/ccnet/files/patch-configure.ac =================================================================== --- head/net-mgmt/ccnet/files/patch-configure.ac (revision 380213) +++ head/net-mgmt/ccnet/files/patch-configure.ac (revision 380214) @@ -1,11 +1,78 @@ ---- configure.ac.orig 2014-06-10 04:41:45.000000000 -0400 -+++ configure.ac 2014-08-26 18:17:12.161128916 -0400 -@@ -218,7 +218,7 @@ - LIB_GDI32= - LIB_RT= +--- configure.ac.orig 2014-12-03 21:47:39.000000000 -0500 ++++ configure.ac 2015-01-27 23:56:25.000000000 -0500 +@@ -51,8 +51,16 @@ + AC_MSG_RESULT(no) + fi + ++AC_MSG_CHECKING(for BSD) ++if test `uname | grep -e BSD -e DragonFly | wc -l` = "1"; then ++ bbsd=true ++ AC_MSG_RESULT(compile in BSD) ++else ++ AC_MSG_RESULT(no) ++fi ++ + AC_MSG_CHECKING(for Linux) +-if test "$bmac" != "true" -a "$bwin32" != "true"; then ++if test "$bmac" != "true" -a "$bwin32" != "true" -a "$bbsd" != "true"; then + blinux=true + AC_MSG_RESULT(compile in linux) + else +@@ -154,6 +162,7 @@ + AM_CONDITIONAL([WIN32], [test "$bwin32" = "true"]) + AM_CONDITIONAL([MACOS], [test "$bmac" = "true"]) + AM_CONDITIONAL([LINUX], [test "$blinux" = "true"]) ++AM_CONDITIONAL([BSD], [test "$bbsd" = "true"]) + + + # check libraries +@@ -192,6 +201,7 @@ + LIBS= + LIB_RESOLV= + LIB_UUID=-lrpcrt4 ++ LIB_KVM= + LIB_IPHLPAPI=-liphlpapi + LIB_SHELL32=-lshell32 + LIB_PSAPI=-lpsapi +@@ -204,11 +214,25 @@ LIB_INTL= -- LIB_RESOLV=-lresolv + LIB_RESOLV=-lresolv + LIB_UUID= ++ LIB_KVM= + LIB_IPHLPAPI= + LIB_SHELL32= + LIB_PSAPI= + MSVC_CFLAGS= + LIB_DIRWATCH="-framework CoreServices" ++elif test "$bbsd" = true ; then ++ LIB_WS32= ++ LIB_GDI32= ++ LIB_RT= ++ LIB_INTL= + LIB_RESOLV= ++ LIB_UUID=-luuid ++ LIB_KVM=-lkvm ++ LIB_IPHLPAPI= ++ LIB_SHELL32= ++ LIB_PSAPI= ++ MSVC_CFLAGS= ++ LIB_DIRWATCH= + else + LIB_WS32= + LIB_GDI32= +@@ -216,6 +240,7 @@ + LIB_INTL= + LIB_RESOLV=-lresolv LIB_UUID=-luuid ++ LIB_KVM= LIB_IPHLPAPI= LIB_SHELL32= + LIB_PSAPI= +@@ -229,6 +254,7 @@ + AC_SUBST(LIB_INTL) + AC_SUBST(LIB_RESOLV) + AC_SUBST(LIB_UUID) ++AC_SUBST(LIB_KVM) + AC_SUBST(LIB_IPHLPAPI) + AC_SUBST(LIB_SHELL32) + AC_SUBST(LIB_PSAPI) Index: head/net-mgmt/ccnet/files/patch-lib_Makefile.am =================================================================== --- head/net-mgmt/ccnet/files/patch-lib_Makefile.am (revision 380213) +++ head/net-mgmt/ccnet/files/patch-lib_Makefile.am (revision 380214) @@ -1,55 +1,10 @@ ---- lib/Makefile.am.orig 2014-11-11 10:10:39.971972968 -0500 -+++ lib/Makefile.am 2014-11-11 10:37:36.712929368 -0500 -@@ -19,7 +19,6 @@ - peer-common.h \ - string-util.h \ - libccnet_utils.h \ -- ccnet-object.h \ - rpc-common.h \ - net.h \ - utils.h \ -@@ -60,12 +59,14 @@ - +--- lib/Makefile.am.orig 2015-01-27 22:48:22.000000000 -0500 ++++ lib/Makefile.am 2015-01-27 22:49:06.000000000 -0500 +@@ -61,6 +61,7 @@ libccnetd_la_LDFLAGS = -no-undefined libccnetd_la_LIBADD = @GLIB2_LIBS@ @GOBJECT_LIBS@ @SSL_LIBS@ @LIB_GDI32@ \ -- -lsqlite3 -levent @LIB_WS32@ @LIB_UUID@ \ -+ -lsqlite3 -levent @LIB_WS32@ @LIB_UUID@ -lkvm \ + -lsqlite3 @LIBEVENT_LIBS@ @LIB_WS32@ @LIB_UUID@ \ ++ @LIB_KVM@ \ @LIB_SHELL32@ @LIB_PSAPI@ @SEARPC_LIBS@ - ccnet_object_define = ccnetobj.vala - -+valac_gen = ccnetobj.c ccnet-object.h -+ - ccnet-client.c: ccnet-object.h - - ccnet-object.h: ${ccnet_object_define} -@@ -78,15 +79,23 @@ - - searpc_gen = searpc-signature.h searpc-marshal.h - --gensource: ${searpc_gen} -+gensource: ${searpc_gen} ${valac_gen} - --${searpc_gen}: $(top_srcdir)/lib/rpc_table.py -+rpc_table.stamp: ${top_srcdir}/lib/rpc_table.py -+ @rm -f rpc_table.tmp -+ @touch rpc_table.tmp - @echo "[libsearpc]: generating rpc header files" -- @PYTHON@ `which searpc-codegen.py` $(top_srcdir)/lib/rpc_table.py -+ @PYTHON@ `which searpc-codegen.py` ${top_srcdir}/lib/rpc_table.py - @echo "[libsearpc]: done" -+ @mv -f rpc_table.tmp $@ -+ -+${searpc_gen}: rpc_table.stamp - - clean-local: - rm -f ${searpc_gen} -- rm -f $(top_srcdir)/lib/rpc_table.pyc -+ rm -f rpc_table.pyc -+ rm -f rpc_table.stamp -+ rm -f rpc_table.tmp -+ rm -f ${valac_gen} - --CLEANFILES = ${searpc_gen} -+CLEANFILES = ${searpc_gen} ${valac_gen} Index: head/net-mgmt/ccnet/files/patch-lib_net.c =================================================================== --- head/net-mgmt/ccnet/files/patch-lib_net.c (revision 380213) +++ head/net-mgmt/ccnet/files/patch-lib_net.c (revision 380214) @@ -1,11 +1,14 @@ ---- lib/net.c.orig 2014-09-02 21:06:10.181095833 -0400 -+++ lib/net.c 2014-09-02 21:06:40.052390263 -0400 -@@ -154,7 +154,7 @@ +--- lib/net.c.orig 2015-01-27 23:18:59.000000000 -0500 ++++ lib/net.c 2015-01-27 23:23:04.000000000 -0500 +@@ -152,7 +152,11 @@ snprintf (buf, sizeof(buf), "%d", port); -- if ( (n = getaddrinfo(NULL, buf, &hints, &res) ) != 0) { ++#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__) || defined(__OpenBSD__) + if ( (n = getaddrinfo("0.0.0.0", buf, &hints, &res) ) != 0) { ++#else + if ( (n = getaddrinfo(NULL, buf, &hints, &res) ) != 0) { ++#endif ccnet_warning ("getaddrinfo fails: %s\n", gai_strerror(n)); return -1; } Index: head/net-mgmt/ccnet/files/patch-lib_utils.c =================================================================== --- head/net-mgmt/ccnet/files/patch-lib_utils.c (revision 380213) +++ head/net-mgmt/ccnet/files/patch-lib_utils.c (revision 380214) @@ -1,188 +1,189 @@ ---- lib/utils.c.orig 2014-07-31 06:20:28.000000000 -0400 -+++ lib/utils.c 2014-11-21 23:06:33.789257323 -0500 +--- lib/utils.c.orig 2015-01-27 23:13:50.000000000 -0500 ++++ lib/utils.c 2015-01-27 23:18:04.000000000 -0500 @@ -43,6 +43,16 @@ #include +#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__) || defined(__OpenBSD__) +#include +#include +#include +#include +#include +#include +#include +#endif + extern int inet_pton(int af, const char *src, void *dst); -@@ -1465,14 +1475,19 @@ +@@ -1465,14 +1475,20 @@ } #endif /* ifdef WIN32 */ -#ifdef __linux__ ++ /* read the link of /proc/123/exe and compare with `process_name' */ static int -find_process_in_dirent(struct dirent *dir, const char *process_name) +find_process_in_dirent_procfs(struct dirent *dir, const char *process_name) { char path[512]; /* fisrst construct a path like /proc/123/exe */ +#if defined(__linux__) if (sprintf (path, "/proc/%s/exe", dir->d_name) < 0) { +#elif defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__) + if (sprintf (path, "/proc/%s/file", dir->d_name) < 0) { +#else + if (1) { +#endif return -1; } -@@ -1496,7 +1511,8 @@ +@@ -1496,7 +1512,8 @@ } /* read the /proc fs to determine whether some process is running */ -gboolean process_is_running (const char *process_name) +static gboolean +process_is_running_procfs (const char *process_name) { DIR *proc_dir = opendir("/proc"); if (!proc_dir) { -@@ -1510,7 +1526,7 @@ +@@ -1510,7 +1527,7 @@ /* /proc/[1-9][0-9]* */ if (first > '9' || first < '1') continue; - int pid = find_process_in_dirent(subdir, process_name); + int pid = find_process_in_dirent_procfs(subdir, process_name); if (pid > 0) { closedir(proc_dir); return TRUE; -@@ -1520,6 +1536,18 @@ +@@ -1520,6 +1537,18 @@ closedir(proc_dir); return FALSE; } + +#ifdef __linux__ +static int +find_process_in_dirent(struct dirent *dir, const char *process_name) +{ + return find_process_in_dirent_procfs(dir, process_name); +} + +gboolean +process_is_running (const char *process_name) { + return process_is_running_procfs(process_name); +} #endif #ifdef __APPLE__ -@@ -1530,6 +1558,108 @@ +@@ -1530,6 +1559,108 @@ } #endif +#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__) || defined(__OpenBSD__) +#if defined(__FreeBSD__) +#define PSKIP(kp) ((kp)->ki_pid == mypid || \ + (!kthreads && ((kp)->ki_flag & P_KTHREAD) != 0)) +#define KVM_OPENFILES(exec, coref, buf) \ + kvm_openfiles(exec, coref, NULL, O_RDONLY, buf) +#define KVM_GETPROCS(kd, plist, nproc) \ + kvm_getprocs(kd, KERN_PROC_PROC, 0, &nproc) + +#elif defined(__DragonFly__) +#define PSKIP(kp) ((kp)->kp_pid == mypid || \ + (!kthreads && ((kp)->kp_flags & P_SYSTEM) != 0)) +#define KVM_OPENFILES(exec, coref, buf) \ + kvm_openfiles(exec, coref, NULL, O_RDONLY, buf) +#define KVM_GETPROCS(kd, plist, nproc) \ + kvm_getprocs(kd, KERN_PROC_ALL, 0, &nproc) + +#elif defined(__NetBSD__) +#define PSKIP(kp) ((kp)->kp_pid == mypid || \ + ((kp)->p_flag & P_SYSTEM) != 0) +#define KVM_OPENFILES(exec, coref, buf) \ + kvm_openfiles(exec, coref, NULL, KVM_NO_FILES, buf) +#define KVM_GETPROCS(kd, plist, nproc) \ + kvm_getprocs(kd, KERN_PROC_ALL, 0, sizeof(*plist), &nproc) + +#elif defined(__OpenBSD__) +#define PSKIP(kp) ((kp)->kp_pid == mypid || \ + ((kp)->p_flag & (P_SYSTEM | P_THREAD)) != 0) +#define KVM_OPENFILES(exec, coref, buf) \ + kvm_openfiles(exec, coref, NULL, KVM_NO_FILES, buf) +#define KVM_GETPROCS(kd, plist, nproc) \ + kvm_getprocs(kd, KERN_PROC_ALL, 0, sizeof(*plist), &nproc) + +#else +#define PSKIP(kp) 0 +#define KVM_OPENFILES(exec, coref, buf) 0 +#define KVM_GETPROCS(kd, plist, nproc) 0 +#endif + +#define WITH_PROC_FS g_file_test("/proc/curproc", G_FILE_TEST_EXISTS) + +static int +count_running_process_kvm(const char *process_name) { + + static kvm_t *kd; + static struct kinfo_proc *plist; + static int nproc; + static pid_t mypid; + static int kthreads; + + char buf[_POSIX2_LINE_MAX]; + const char * execf, *coref; + char **pargv; + int i, selected_nproc; + struct kinfo_proc *kp; + + selected_nproc = 0; + execf = NULL; + coref = _PATH_DEVNULL; + + mypid = getpid(); + kd = KVM_OPENFILES(execf, coref, buf); + if (kd == NULL) { + fprintf(stderr, "Error: Cannot open kernel files (%s)", buf); + exit(1); + } + + plist = KVM_GETPROCS(kd, plist, nproc); + if (plist == NULL) { + fprintf(stderr, "Error: Cannot get process list (%s)", kvm_geterr(kd)); + exit(1); + } + + for(i = 0, kp = plist; i < nproc; i++, kp++) { + if (PSKIP(kp)) { + continue; + } + if ((pargv = kvm_getargv(kd, kp, 0)) != NULL) { + if (strstr(pargv[0], process_name) != NULL) { + selected_nproc += 1; + } + } + } + kvm_close(kd); + kvm_close(kd); + + return selected_nproc; +} + +gboolean +process_is_running(const char * process_name) { + if (WITH_PROC_FS) { + return process_is_running_procfs(process_name); + } + if (count_running_process_kvm(process_name) > 0) { + return TRUE; + } else { + return FALSE; + } +} +#endif + char* ccnet_object_type_from_id (const char *object_id) { Index: head/net-mgmt/ccnet/files/patch-net_common_getgateway.c =================================================================== --- head/net-mgmt/ccnet/files/patch-net_common_getgateway.c (revision 380213) +++ head/net-mgmt/ccnet/files/patch-net_common_getgateway.c (revision 380214) @@ -1,11 +1,11 @@ ---- net/common/getgateway.c.orig 2014-07-28 14:30:13.000000000 -0400 -+++ net/common/getgateway.c 2014-07-28 14:30:29.000000000 -0400 +--- net/common/getgateway.c.orig 2015-01-27 23:26:41.000000000 -0500 ++++ net/common/getgateway.c 2015-01-27 23:27:58.000000000 -0500 @@ -34,7 +34,7 @@ #undef USE_SYSCTL_NET_ROUTE #endif -#ifdef BSD +#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__) || defined(__OpenBSD__) #undef USE_PROC_NET_ROUTE #define USE_SOCKET_ROUTE #undef USE_SYSCTL_NET_ROUTE