ports/116441: net/boinc-client patch for daemon mode
Dmitry Morozovsky
marck at FreeBSD.org
Tue Sep 18 15:50:02 UTC 2007
>Number: 116441
>Category: ports
>Synopsis: net/boinc-client patch for daemon mode
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Tue Sep 18 15:50:01 GMT 2007
>Closed-Date:
>Last-Modified:
>Originator: Dmitry Morozovsky
>Release: FreeBSD 6-STABLE i386
>Organization:
Cronyx Plus LLC (RiNet ISP)
>Environment:
System: FreeBSD 6-STABLE
>Description:
net/boinc-client does not behave properly in daemon mode.
The patch attached should fix it.
>How-To-Repeat:
>Fix:
# $Id: FreeBSD/ports/boinc-client-daemon.patch,v 1.1 2007/09/18 15:33:32 marck Exp $
#
Index: Makefile
===================================================================
RCS file: /home/ncvs/ports/net/boinc-client/Makefile,v
retrieving revision 1.29
diff -u -r1.29 Makefile
--- Makefile 25 May 2007 11:43:40 -0000 1.29
+++ Makefile 18 Sep 2007 14:58:13 -0000
@@ -7,6 +7,7 @@
PORTNAME= boinc-client
PORTVERSION= 5.8.17
+PORTREVISION= 1
CATEGORIES= net
MASTER_SITES= ${MASTER_SITE_LOCAL}
MASTER_SITE_SUBDIR= pav
Index: files/boinc.sh.in
===================================================================
RCS file: /home/ncvs/ports/net/boinc-client/files/boinc.sh.in,v
retrieving revision 1.4
diff -u -r1.4 boinc.sh.in
--- files/boinc.sh.in 15 Mar 2006 10:44:46 -0000 1.4
+++ files/boinc.sh.in 18 Sep 2007 14:58:00 -0000
@@ -13,7 +13,7 @@
boinc_user=%%BOINC_USER%%
boinc_home=%%BOINC_HOME%%
-boinc_flags="-dir ${boinc_home}"
+boinc_flags="-dir ${boinc_home} -daemon"
program_file=boinc_client
program_path=%%PREFIX%%/bin/${program_file}
syslog_facility=daemon.err
Index: files/patch-client_main.C
===================================================================
RCS file: files/patch-client_main.C
diff -N files/patch-client_main.C
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ files/patch-client_main.C 18 Sep 2007 15:04:10 -0000
@@ -0,0 +1,48 @@
+
+$FreeBSD$
+
+--- client/main.C.orig
++++ client/main.C
+@@ -82,6 +82,8 @@
+ // the WM_ENDSESSION message handler and allow Windows to finish
+ // cleaning up.
+
++static bool daemonized = false;
++
+ // Display a message to the user.
+ // Depending on the priority, the message may be more or less obtrusive
+ //
+@@ -115,7 +117,12 @@
+
+ record_message(p, priority, (int)now, message);
+
+- printf("%s [%s] %s\n", time_string, x, message);
++ if (daemonized)
++#if !defined(WIN32)
++ syslog(LOG_DAEMON|LOG_INFO, "[%s] %s\n", x, message);
++#endif
++ else
++ printf("%s [%s] %s\n", time_string, x, message);
+ if (gstate.executing_as_daemon) {
+ #if defined(WIN32) && defined(_CONSOLE)
+ stprintf(event_message, TEXT("%s [%s] %s\n"), time_string, x, message);
+@@ -638,16 +645,18 @@
+ break;
+ }
+ }
+-#elif defined linux
++#elif defined linux || defined(__FreeBSD__)
+ int i;
+
+ for (i = 1; i < argc; i++) {
+ if (strcmp(argv[i], "-daemon") == 0 || strcmp(argv[i], "--daemon") == 0) {
++ openlog("boinc", LOG_PID, LOG_DAEMON);
+ syslog(LOG_DAEMON|LOG_INFO, "Starting Boinc-Daemon, listening on port %d.", GUI_RPC_PORT);
+ // from <unistd.h>:
+ // Detach from the controlling terminal and run in the background as system daemon.
+ // Don't change working directory to root ("/"), but redirect
+ // standard input, standard output and standard error to /dev/null.
++ daemonized = true;
+ daemon(1, 0);
+ break;
+ }
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list