FreeBSD Bugzilla – Attachment 117788 Details for
Bug 159914
[MAINTAINER] net-mgmt/ramond: daemonising support
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
ramond-0.5_1.patch
ramond-0.5_1.patch (text/plain), 3.24 KB, created by
Janos Mohacsi
on 2011-08-19 16:20:06 UTC
(
hide
)
Description:
ramond-0.5_1.patch
Filename:
MIME Type:
Creator:
Janos Mohacsi
Created:
2011-08-19 16:20:06 UTC
Size:
3.24 KB
patch
obsolete
>diff -ruN --exclude=CVS /usr/ports/net-mgmt/ramond.orig/Makefile /usr/ports/net-mgmt/ramond/Makefile >--- /usr/ports/net-mgmt/ramond.orig/Makefile 2011-07-01 08:38:25.000000000 +0200 >+++ /usr/ports/net-mgmt/ramond/Makefile 2011-08-19 17:11:52.000000000 +0200 >@@ -7,6 +7,7 @@ > > PORTNAME= ramond > PORTVERSION= 0.5 >+PORTREVISION= 1 > CATEGORIES= net-mgmt ipv6 > MASTER_SITES= SF/${PORTNAME}/${PORTNAME}/_${PORTVERSION}/ > >diff -ruN --exclude=CVS /usr/ports/net-mgmt/ramond.orig/files/patch-src_main.c /usr/ports/net-mgmt/ramond/files/patch-src_main.c >--- /usr/ports/net-mgmt/ramond.orig/files/patch-src_main.c 1970-01-01 01:00:00.000000000 +0100 >+++ /usr/ports/net-mgmt/ramond/files/patch-src_main.c 2011-08-19 17:09:14.000000000 +0200 >@@ -0,0 +1,113 @@ >+ >+$FreeBSD$ >+ >+--- src/main.c.orig >++++ src/main.c >+@@ -1,6 +1,5 @@ >+ #include "main.h" >+ #include "log.h" >+- >+ apr_pool_t *masterPool; >+ struct configuration *config; >+ >+@@ -14,8 +13,9 @@ >+ >+ void usage(char *prog_name) >+ { >+- fprintf(stderr, "%s [-h] [-c /etc/ramond.conf]\n", prog_name); >++ fprintf(stderr, "%s [-h] [-d] [-c /etc/ramond.conf]\n", prog_name); >+ fprintf(stderr, " -h : print this help.\n"); >++ fprintf(stderr, " -d : do not daemonize.\n"); >+ fprintf(stderr, " -c : path to config file.\n"); >+ } >+ >+@@ -824,11 +824,68 @@ >+ pcap_close(fd); >+ } >+ >++/** >++ * daemonize ramond. >++ */ >++void daemonize(void) >++{ >++ pid_t pid, sid; >++ int i, pidfile; >++ >++ char pidstr[32]; >++ >++ pid = fork(); >++ >++ if(pid < 0) >++ exit(EXIT_FAILURE); >++ else if(pid > 0) >++ exit(EXIT_SUCCESS); >++ >++ umask(027); >++ if((chdir("/")) < 0) >++ exit(EXIT_FAILURE); >++ >++ sid = setsid(); >++ if(sid < 0) >++ exit(EXIT_FAILURE); >++ >++ pid = fork(); >++ >++ if(pid < 0) >++ exit(EXIT_FAILURE); >++ else if(pid > 0) >++ exit(EXIT_SUCCESS); >++ >++ /* Cleanup open FDs */ >++ for(i = getdtablesize(); i>=0; --i) >++ close(i); >++ >++ i = open("/dev/null", O_RDWR); /* (re)open stdin */ >++ dup(i); /* stdout */ >++ dup(i); /* stderr */ >++ >++ pidfile = open("/var/run/ramond.pid", O_RDWR|O_CREAT, 0640); >++ if(pidfile < 0) >++ exit(EXIT_FAILURE); >++ if(flock(pidfile, F_TLOCK) < 0) >++ exit(EXIT_SUCCESS); >++ >++ sprintf(pidstr, "%d\n", getpid()); >++ write(pidfile, pidstr, strlen(pidstr)); >++ >++ signal(SIGTSTP,SIG_IGN); /* ignore tty signals */ >++ signal(SIGTTOU,SIG_IGN); >++ signal(SIGTTIN,SIG_IGN); >++} >++ >+ int main(int argc, char *argv[]) >+ { >+ int socket; >+ struct ra_info data; >+ >++ int debug = 0; >++ int i = 0; >++ >+ if(argc > 6) >+ { >+ usage(argv[0]); >+@@ -842,6 +899,20 @@ >+ >+ signal(SIGCHLD, sigchld_handler); >+ >++ for(i = 0; i < argc; i++) >++ { >++ if(!strcmp(argv[i], "-d")) >++ { >++ debug = 1; >++ break; >++ } >++ } >++ >++ if(!debug) >++ { >++ daemonize(); >++ } >++ >+ /* Find the config file */ >+ if(!parseConfigFile(argc,argv)) >+ { >diff -ruN --exclude=CVS /usr/ports/net-mgmt/ramond.orig/files/patch-src_main.h /usr/ports/net-mgmt/ramond/files/patch-src_main.h >--- /usr/ports/net-mgmt/ramond.orig/files/patch-src_main.h 1970-01-01 01:00:00.000000000 +0100 >+++ /usr/ports/net-mgmt/ramond/files/patch-src_main.h 2011-08-19 17:09:18.000000000 +0200 >@@ -0,0 +1,12 @@ >+ >+$FreeBSD$ >+ >+--- src/main.h.orig >++++ src/main.h >+@@ -1,5 +1,6 @@ >+ #include <stdlib.h> >+ #include <stdio.h> >++#include <fcntl.h> >+ #include <errno.h> >+ #include <unistd.h> >+ #include <time.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 159914
: 117788