FreeBSD Bugzilla – Attachment 149422 Details for
Bug 195023
[maintainer-update] net-mgmt/ccnet: remove requirements of /proc
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
svn diff
ccnet.diff (text/plain), 4.94 KB, created by
Jingfeng Yan
on 2014-11-15 01:50:35 UTC
(
hide
)
Description:
svn diff
Filename:
MIME Type:
Creator:
Jingfeng Yan
Created:
2014-11-15 01:50:35 UTC
Size:
4.94 KB
patch
obsolete
>Index: Makefile >=================================================================== >--- Makefile (revision 372583) >+++ Makefile (working copy) >@@ -2,7 +2,7 @@ > > PORTNAME= ccnet > PORTVERSION= 3.1.4 >-PORTREVISION= 1 >+PORTREVISION= 2 > CATEGORIES= net-mgmt devel > > MAINTAINER= yan_jingfeng@yahoo.com >Index: files/patch-lib_Makefile.am >=================================================================== >--- files/patch-lib_Makefile.am (revision 372583) >+++ files/patch-lib_Makefile.am (working copy) >@@ -1,5 +1,5 @@ >---- lib/Makefile.am.orig 2014-07-31 06:20:28.000000000 -0400 >-+++ lib/Makefile.am 2014-09-02 13:48:35.659991963 -0400 >+--- 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 \ >@@ -8,8 +8,15 @@ > rpc-common.h \ > net.h \ > utils.h \ >-@@ -66,6 +65,8 @@ >+@@ -60,12 +59,14 @@ > >+ 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 \ >+ @LIB_SHELL32@ @LIB_PSAPI@ @SEARPC_LIBS@ >+ >+ > ccnet_object_define = ccnetobj.vala > > +valac_gen = ccnetobj.c ccnet-object.h >Index: files/patch-lib_utils.c >=================================================================== >--- files/patch-lib_utils.c (revision 372583) >+++ files/patch-lib_utils.c (working copy) >@@ -1,56 +1,89 @@ >---- lib/utils.c.orig 2014-06-10 04:41:45.000000000 -0400 >-+++ lib/utils.c 2014-07-28 14:32:24.000000000 -0400 >-@@ -41,6 +41,10 @@ >- #include <glib/gstdio.h> >- #include <searpc-utils.h> >+--- lib/utils.c.orig 2014-07-31 06:20:28.000000000 -0400 >++++ lib/utils.c 2014-11-11 10:35:22.144758616 -0500 >+@@ -43,6 +43,16 @@ > >-+#ifdef __FreeBSD__ >+ #include <event2/util.h> >+ >++#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__) || defined(__OpenBSD__) > +#include <netinet/in.h> >++#include <stdlib.h> >++#include <kvm.h> >++#include <paths.h> >++#include <sys/param.h> >++#include <sys/sysctl.h> >++#include <sys/user.h> > +#endif > + > extern int inet_pton(int af, const char *src, void *dst); > > >-@@ -1463,14 +1467,19 @@ >+@@ -1530,6 +1540,70 @@ > } >- #endif /* ifdef WIN32 */ >- >--#ifdef __linux__ >-+#if defined(__linux__) || defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__) || defined(__OpenBSD__) >- /* 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) >- { >- char path[512]; >- /* fisrst construct a path like /proc/123/exe */ >-+#if defined(__linux__) >- if (sprintf (path, "/proc/%s/exe", dir->d_name) < 0) { >-+#endif >-+#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__) || defined(__OpenBSD__) >-+ if (sprintf (path, "/proc/%s/file", dir->d_name) < 0) { >-+#endif >- return -1; >- } >- >-@@ -1528,6 +1537,22 @@ >- } > #endif > >-+/* >-+ * Finally, we should not enforce to use /proc > +#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__) || defined(__OpenBSD__) >-+gboolean process_is_running (const char *process_name) >-+{ >-+ //TODO >-+ return FALSE; >++ >++#define PSKIP(kp) ((kp)->ki_pid == mypid || \ >++ (!kthreads && ((kp)->ki_flag & P_KTHREAD) != 0)) >++ >++static int >++count_running_process(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, NULL, O_RDONLY, buf); >++ kd = kvm_openfiles(execf, coref, NULL, O_RDONLY, buf); >++ if (kd == NULL) { >++ fprintf(stderr, "Error: Cannot open kernel files (%s)", buf); >++ exit(1); >++ } >++ >++ plist = kvm_getprocs(kd, KERN_PROC_PROC, 0, &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; > +} > + >-+int count_process(const char *process_name) >-+{ >-+ return 0; >++gboolean >++process_is_running(const char * process_name) { >++ if (count_running_process(process_name) > 0) { >++ return TRUE; >++ } else { >++ return FALSE; >++ } > +} > +#endif >-+*/ > + > char* > ccnet_object_type_from_id (const char *object_id)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 195023
:
149422
|
149423
|
149519
|
149736
|
149737