FreeBSD Bugzilla – Attachment 149424 Details for
Bug 195024
[maintainer-update] net-mgmt/seafile: remove requirements of /proc
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
svn diff
seafile.diff (text/plain), 8.22 KB, created by
Jingfeng Yan
on 2014-11-15 02:00:18 UTC
(
hide
)
Description:
svn diff
Filename:
MIME Type:
Creator:
Jingfeng Yan
Created:
2014-11-15 02:00:18 UTC
Size:
8.22 KB
patch
obsolete
>Index: Makefile >=================================================================== >--- Makefile (revision 372583) >+++ Makefile (working copy) >@@ -2,6 +2,7 @@ > > PORTNAME= seafile > PORTVERSION= 3.1.4 >+PORTREVISION= 1 > CATEGORIES= net-mgmt devel > > MAINTAINER= yan_jingfeng@yahoo.com >Index: files/patch-controller_seafile-controller.c >=================================================================== >--- files/patch-controller_seafile-controller.c (revision 372583) >+++ files/patch-controller_seafile-controller.c (working copy) >@@ -1,17 +1,20 @@ > --- controller/seafile-controller.c.orig 2014-08-05 01:28:35.000000000 -0400 >-+++ controller/seafile-controller.c 2014-08-30 09:11:34.868400091 -0400 >-@@ -18,6 +18,10 @@ >++++ controller/seafile-controller.c 2014-11-11 19:29:27.352982983 -0500 >+@@ -18,6 +18,13 @@ > #include "log.h" > #include "seafile-controller.h" > > +#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__) || defined(__OpenBSD__) > +#include <sys/sysctl.h> >++#include <sys/types.h> >++#include <sys/user.h> >++#include <limits.h> > +#endif > + > #define CHECK_PROCESS_INTERVAL 10 /* every 10 seconds */ > > SeafileController *ctl; >-@@ -273,7 +277,11 @@ >+@@ -273,7 +280,19 @@ > init_seafile_path () > { > GError *error = NULL; >@@ -18,8 +21,58 @@ > +#if defined(__linux__) > char *executable = g_file_read_link ("/proc/self/exe", &error); > +#elif defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__) || defined(__OpenBSD__) >-+ char *executable = g_file_read_link ("/proc/curproc/file", &error); >++ char executable[_POSIX_PATH_MAX]; >++ int mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, 0}; >++ size_t len = _POSIX_PATH_MAX ; >++ mib[3] = (int)getpid(); >++ memset(executable, _POSIX_PATH_MAX, 0); >++ if (sysctl(mib, sizeof(mib)/sizeof(mib[0]), executable, &len, NULL, 0) == -1) { >++ seaf_warning ("Error: failed to get process entry\n"); >++ return; >++ } > +#endif > char *tmp = NULL; > if (error != NULL) { > seaf_warning ("failed to readlink: %s\n", error->message); >+@@ -287,7 +306,9 @@ >+ >+ topdir = g_path_get_dirname (installpath); >+ >++#if defined(__linux__) >+ g_free (executable); >++#endif >+ g_free (tmp); >+ } >+ >+@@ -426,6 +447,7 @@ >+ seaf_warning ("failed to read pidfile %s: %s\n", ctl->pidfile[which], strerror(errno)); >+ return FALSE; >+ } else { >++#ifdef __linux__ >+ char buf[256]; >+ snprintf (buf, sizeof(buf), "/proc/%d", pid); >+ if (g_file_test (buf, G_FILE_TEST_IS_DIR)) { >+@@ -433,7 +455,22 @@ >+ } else { >+ return TRUE; >+ } >+- } >++#endif >++#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__) || defined(__OpenBSD__) >++#ifdef __OpenBSD__ >++ int min[6] = {CTL_KERN, KERN_PROC, KERN_PROC_PID, pid, sizeof(struct kinfo_proc), 1}; >++#else >++ int mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_PID, pid}; >++#endif >++ size_t len = sizeof(struct kinfo_proc); >++ struct kinfo_proc kp; >++ if (sysctl(mib, sizeof(mib)/sizeof(mib[0]), &kp, &len, NULL, 0) == -1) { >++ return FALSE; >++ } else { >++ return TRUE; >++ } >++ } >++#endif >+ } >+ >+ static gboolean >Index: files/patch-lib_Makfile.am >=================================================================== >--- files/patch-lib_Makfile.am (revision 372583) >+++ files/patch-lib_Makfile.am (working copy) >@@ -1,5 +1,14 @@ >---- lib/Makefile.am.orig 2014-08-30 02:00:00.097346044 -0400 >-+++ lib/Makefile.am 2014-08-30 02:00:10.951213463 -0400 >+--- lib/Makefile.am.orig 2014-11-11 10:47:33.631976054 -0500 >++++ lib/Makefile.am 2014-11-11 11:40:14.030311321 -0500 >+@@ -55,7 +55,7 @@ >+ libseafile_common_la_LDFLAGS = -no-undefined >+ libseafile_common_la_LIBADD = @GLIB2_LIBS@ @GOBJECT_LIBS@ -lssl -lcrypto @LIB_GDI32@ \ >+ @LIB_UUID@ @LIB_WS32@ @LIB_PSAPI@ -lsqlite3 \ >+- -levent @SEARPC_LIBS@ @LIB_SHELL32@ \ >++ -levent -lkvm @SEARPC_LIBS@ @LIB_SHELL32@ \ >+ @ZLIB_LIBS@ >+ >+ searpc_gen = searpc-signature.h searpc-marshal.h > @@ -72,8 +72,4 @@ > rm -f $(top_srcdir)/lib/rpc_table.pyc > >Index: files/patch-lib_utils.c >=================================================================== >--- files/patch-lib_utils.c (revision 372583) >+++ files/patch-lib_utils.c (working copy) >@@ -1,23 +1,95 @@ >---- lib/utils.c.orig 2014-06-05 02:25:50.000000000 -0400 >-+++ lib/utils.c 2014-07-30 22:56:37.000000000 -0400 >-@@ -1756,14 +1756,19 @@ >+--- lib/utils.c.orig 2014-08-05 01:28:35.000000000 -0400 >++++ lib/utils.c 2014-11-11 12:13:18.496411804 -0500 >+@@ -46,6 +46,15 @@ > >- #endif /* ifdef WIN32 */ >+ #include <zlib.h> > >--#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 */ >-+#ifdef __linux__ >- if (sprintf (path, "/proc/%s/exe", dir->d_name) < 0) { >++#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__) || defined(__OpenBSD__) >++#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); >+ >+ >+@@ -1846,6 +1855,76 @@ >+ } >+ #endif >+ > +#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__) || defined(__OpenBSD__) >-+ if (sprintf (path, "/proc/%s/file", dir->d_name) < 0) { >++ >++#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 count_running_process(process_name); >++} >++ >++gboolean >++process_is_running(const char * process_name) { >++ if (count_running_process(process_name) > 0) { >++ return TRUE; >++ } else { >++ return FALSE; >++ } >++} > +#endif >- return -1; >- } >- >++ >++ >+ char* >+ ccnet_object_type_from_id (const char *object_id) >+ { >Index: files/patch-lib_utils.h >=================================================================== >--- files/patch-lib_utils.h (revision 372583) >+++ files/patch-lib_utils.h (working copy) >@@ -1,5 +1,5 @@ >---- lib/utils.h.orig 2014-06-05 02:25:50.000000000 -0400 >-+++ lib/utils.h 2014-07-27 01:48:52.000000000 -0400 >+--- lib/utils.h.orig 2014-08-05 01:28:35.000000000 -0400 >++++ lib/utils.h 2014-11-11 11:30:51.843637061 -0500 > @@ -3,6 +3,9 @@ > #ifndef CCNET_UTILS_H > #define CCNET_UTILS_H >@@ -10,3 +10,14 @@ > #include <sys/time.h> > #include <time.h> > #include <stdint.h> >+@@ -13,7 +16,9 @@ >+ #include <stdlib.h> >+ #include <sys/stat.h> >+ >+-#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) >++#if defined(__FreeBSD__) || defined(__DragonFly__) >++#include <evutil.h> >++#elif (__NetBSD__) || defined(__OpenBSD__) >+ #include <event2/util.h> >+ #else >+ #include <evutil.h>
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 195024
:
149424
|
149425
|
149520
|
149740
|
149741
|
149742
|
149744