View | Details | Raw Unified | Return to bug 128358
Collapse All | Expand All

(-)spread.new/Makefile (-39 / +38 lines)
Lines 6-12 Link Here
6
#
6
#
7
7
8
PORTNAME=	spread
8
PORTNAME=	spread
9
PORTVERSION=	3.17.4
9
PORTVERSION=	4.0.0
10
CATEGORIES=	net perl5
10
CATEGORIES=	net perl5
11
MASTER_SITES=	http://www.edu-linux.org/down/
11
MASTER_SITES=	http://www.edu-linux.org/down/
12
DISTNAME=	${PORTNAME}-src-${PORTVERSION}
12
DISTNAME=	${PORTNAME}-src-${PORTVERSION}
Lines 15-85 Link Here
15
COMMENT=	The Spread Group Communication System, a network toolkit
15
COMMENT=	The Spread Group Communication System, a network toolkit
16
16
17
GNU_CONFIGURE=	yes
17
GNU_CONFIGURE=	yes
18
USE_PERL5=	yes
18
USE_GMAKE=	yes
19
USE_RC_SUBR=	spread.sh
19
USE_RC_SUBR=	spread.sh
20
USE_LDCONFIG=	yes
20
USE_LDCONFIG=	yes
21
ALL_TARGET=	all
21
22
22
MAKE_ARGS+=	PTHREAD_CFLAGS=${PTHREAD_CFLAGS} PTHREAD_LIBS=${PTHREAD_LIBS}
23
RC_SCRIPTS_SUB=	PREFIX=${PREFIX} RC_SUBR=${RC_SUBR}
23
RC_SCRIPTS_SUB=	PREFIX=${PREFIX} RC_SUBR=${RC_SUBR}
24
WRKSRC=		${WRKDIR}/${PORTNAME}-src-${PORTVERSION}
24
WRKSRC=		${WRKDIR}/${PORTNAME}-src-${PORTVERSION}
25
25
26
PKGMESSAGE=	${WRKSRC}/license.txt
26
PKGMESSAGE=	${WRKSRC}/license.txt
27
PORTDOCS=	Readme.txt LICENSE
27
28
HEADERFILES=	sp_func.h sp_func.h sp_events.h
28
DOCFILES=	DynamicConfiguration.txt Flush_or_SpreadAPI.txt \
29
		MultithreadedClients.txt Short_Buffer_Handling.txt \
30
		TODO PORTING
29
MAN1=		spflooder.1 spmonitor.1 spread.1 sptuser.1 spuser.1
31
MAN1=		spflooder.1 spmonitor.1 spread.1 sptuser.1 spuser.1
30
MAN3=		libsp.3 SP_connect.3 SP_disconnect.3 SP_equal_group_ids.3 \
32
MAN3=		SP_connect.3 SP_disconnect.3 SP_equal_group_ids.3 \
31
		SP_error.3 SP_join.3 SP_leave.3 \
33
		SP_error.3 SP_get_memb_info.3 SP_get_vs_set_members.3 \
32
		SP_multicast.3 SP_multigroup_multicast.3 \
34
		SP_get_vs_sets_info.3 SP_join.3 SP_kill.3 \
35
		SP_leave.3 SP_multicast.3 SP_multigroup_multicast.3 \
33
		SP_multigroup_scat_multicast.3 SP_poll.3 SP_receive.3 \
36
		SP_multigroup_scat_multicast.3 SP_poll.3 SP_receive.3 \
34
		SP_scat_multicast.3 SP_scat_receive.3
37
		SP_scat_get_memb_info.3 SP_scat_get_vs_set_members.3 \
38
		SP_scat_get_vs_sets_info.3 SP_scat_multicast.3 \
39
		SP_scat_receive.3 SP_version.3 libspread.3
35
40
36
.include <bsd.port.pre.mk>
41
.include <bsd.port.pre.mk>
37
42
38
# bsd.port.mk doesn't allow us to use GNU_CONFIGURE and PERL_CONFIGURE together.
43
post-extract:
39
PERL_CONFIGURE_ARGS=	CC="${CC}" CCFLAGS="${CFLAGS}" PREFIX="${PREFIX}" \
44
		@${REINPLACE_CMD} -e 's|INSTALLSUBDIRS=daemon docs|INSTALLSUBDIRS=daemon|' \
40
			INSTALLPRIVLIB="${PREFIX}/lib" INSTALLARCHLIB="${PREFIX}/lib"
45
		${WRKSRC}/Makefile.in
41
42
_MANPAGES+=	${PREFIX}/lib/perl5/${PERL_VERSION}/man/man3/Spread.3
43
44
post-configure:
45
	@${REINPLACE_CMD} -e 's|%%PREFIX%%|${PREFIX}|g' \
46
		${WRKSRC}/docs/${PORTNAME}.1 ${WRKSRC}/docs/spmonitor.1
47
48
post-build:
49
	@cd ${WRKSRC}/perl/Spread && \
50
		${SETENV} ${CONFIGURE_ENV} ${PERL5} ./Makefile.PL ${PERL_CONFIGURE_ARGS}
51
	@cd ${WRKSRC}/perl/Spread && \
52
		${PERL5} -pi -e 's/ doc_(perl|site|\$$\(INSTALLDIRS\))_install$$//' Makefile
53
	@cd ${WRKSRC}/perl/Spread && ${MAKE}
54
46
55
pre-install:
47
pre-install:
56
	${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL
48
	${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL
57
49
58
post-install:
50
post-install:
59
.for f in ${HEADERFILES}
51
	${INSTALL_DATA} ${WRKSRC}/docs/sample.spread.conf \
60
	${INSTALL_DATA} ${WRKSRC}/${f} ${PREFIX}/include
61
.endfor
62
	${INSTALL_DATA} ${WRKSRC}/sample.spread.conf \
63
		${PREFIX}/etc/spread.conf.sample
52
		${PREFIX}/etc/spread.conf.sample
53
	${INSTALL_DATA} ${WRKSRC}/docs/sample.spread.access_ip \
54
		${PREFIX}/etc/spread.access_ip.sample
55
64
.if !exists(${PREFIX}/etc/${PORTNAME}.conf)
56
.if !exists(${PREFIX}/etc/${PORTNAME}.conf)
65
	${INSTALL_DATA} ${WRKSRC}/sample.spread.conf \
57
	${INSTALL_DATA} ${WRKSRC}/docs/sample.spread.conf \
66
		${PREFIX}/etc/${PORTNAME}.conf
58
		${PREFIX}/etc/${PORTNAME}.conf
67
.endif
59
.endif
68
	${INSTALL_DATA} ${WRKSRC}/sample.spread.access_ip \
60
69
		${PREFIX}/etc/spread.access_ip.sample
70
.if !exists(${PREFIX}/etc/spread.access_ip)
61
.if !exists(${PREFIX}/etc/spread.access_ip)
71
	${INSTALL_DATA} ${WRKSRC}/sample.spread.access_ip \
62
	${INSTALL_DATA} ${WRKSRC}/docs/sample.spread.access_ip \
72
		${PREFIX}/etc/spread.access_ip
63
		${PREFIX}/etc/spread.access_ip
73
.endif
64
.endif
74
	(cd ${WRKSRC}/perl/Spread && ${MAKE} install)
65
75
	${MKDIR} ${EXAMPLESDIR}
76
	${INSTALL_DATA} ${WRKSRC}/perl/Spread/test.pl ${EXAMPLESDIR}
77
.if !defined(NOPORTDOCS)
66
.if !defined(NOPORTDOCS)
78
	${MKDIR} ${DOCSDIR}
67
	${MKDIR} ${DOCSDIR}
79
	${INSTALL_DATA} ${WRKSRC}/Readme.txt ${DOCSDIR}
68
.for f in ${DOCFILES}
80
	${INSTALL_DATA} ${WRKSRC}/license.txt ${DOCSDIR}/LICENSE
69
	${INSTALL_DATA} ${WRKSRC}/docs/${f} ${DOCSDIR}
70
.endfor
81
.endif
71
.endif
72
73
.for f in ${MAN1}
74
	${INSTALL_MAN} ${WRKSRC}/docs/${f} ${LOCALBASE}/man/man1/
75
.endfor
76
77
.for f in ${MAN3}
78
	${INSTALL_MAN} ${WRKSRC}/docs/${f} ${LOCALBASE}/man/man3/
79
.endfor
80
82
	@${CAT} ${PKGMESSAGE}
81
	@${CAT} ${PKGMESSAGE}
83
	@${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
82
	${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
84
83
85
.include <bsd.port.post.mk>
84
.include <bsd.port.post.mk>
(-)spread.new/distinfo (-3 / +3 lines)
Lines 1-3 Link Here
1
MD5 (spread-src-3.17.4.tar.gz) = c32e9978b3a216f7955b5c43e955c966
1
MD5 (spread-src-4.0.0.tar.gz) = 8f7a8400ae3f7d50fc11f9c03017b058
2
SHA256 (spread-src-3.17.4.tar.gz) = 7ed2219c5aa64be40f1819577fc9393daa4ca297185fca38d9f4f3292906f324
2
SHA256 (spread-src-4.0.0.tar.gz) = a213e382a1d8957f46abb89e838802569bb57bcb5066fef54dd89560b413f6df
3
SIZE (spread-src-3.17.4.tar.gz) = 308271
3
SIZE (spread-src-4.0.0.tar.gz) = 609001
(-)spread.new/files/patch-Makefile.in (-105 lines)
Lines 1-105 Link Here
1
--- Makefile.in	Thu Sep 23 12:12:52 2004
2
+++ Makefile.in	Tue Oct  4 14:49:56 2005
3
@@ -26,7 +26,7 @@
4
 #Rules: major  -- inc for incompatible change
5
 #     : minor  -- inc for bugfix or forward compatible change
6
 
7
-LIBVERSION=1.0
8
+LIBVERSION=1
9
 
10
 PATHS= 
11
 
12
@@ -35,7 +35,7 @@
13
 CFLAGS=@CFLAGS@
14
 CPPFLAGS=-I. -I$(srcdir) @CPPFLAGS@ $(PATHS) @DEFS@
15
 LDFLAGS=@LDFLAGS@
16
-LIBS=@LIBS@
17
+LIBS=-L. @LIBS@
18
 THLDFLAGS=@THLDFLAGS@
19
 THLIBS=@THLIBS@
20
 AR=@AR@
21
@@ -52,8 +52,10 @@
22
 PERL=@PERL@
23
 ENT=@ENT@
24
 EXEEXT=@EXEEXT@
25
+SHLDSONAME=-Wl,-soname,libspread.so.$(LIBVERSION)
26
+TSHLDSONAME=-Wl,-soname,libtspread.so.$(LIBVERSION)
27
 
28
-TARGETS=spread$(EXEEXT) spuser$(EXEEXT) spflooder$(EXEEXT) spmonitor$(EXEEXT) sptuser${EXEEXT} @LIBSPSO@ @LIBTSPSO@
29
+TARGETS=spread$(EXEEXT) spuser$(EXEEXT) spflooder$(EXEEXT) spmonitor$(EXEEXT) sptuser${EXEEXT} @LIBSPSO@ @LIBTSPSO@ libspread.a libtspread.a
30
 
31
 LIBSP_OBJS= alarm.o events.o memory.o sp.o
32
 
33
@@ -127,8 +129,11 @@
34
 	$(INSTALL) -m 0755 libspread.$(LIBVERSION).dylib $(DESTDIR)$(libdir)/libspread.$(LIBVERSION).dylib
35
 	(cd $(DESTDIR)$(libdir); $(SOFTLINK) -f libspread.$(LIBVERSION).dylib libspread.dylib)
36
 
37
-libspread.so:	$(LIBSP_SHOBJS)
38
-	$(SHLD) -o $@ $(LIBSP_SHOBJS) $(SHLDFLAGS) $(SHLIBS)
39
+libspread.so:	$@.$(LIBVERSION)
40
+	$(SOFTLINK) $@.$(LIBVERSION) $@
41
+
42
+libspread.so.$(LIBVERSION):	$(LIBSP_SHOBJS)
43
+	$(SHLD) -o $@ $(LIBSP_SHOBJS) $(SHLDSONAME) $(SHLDFLAGS) $(SHLIBS)
44
 
45
 install-libspread.so:	libspread.so
46
 	$(INSTALL) -m 0755 libspread.so $(DESTDIR)$(libdir)/libspread.so.$(LIBVERSION)
47
@@ -146,8 +151,11 @@
48
 	$(INSTALL) -m 0755 libtspread.$(LIBVERSION).dylib $(DESTDIR)$(libdir)/libtspread.$(LIBVERSION).dylib
49
 	(cd $(DESTDIR)$(libdir); $(SOFTLINK) -f libtspread.$(LIBVERSION).dylib libtspread.dylib)
50
 
51
-libtspread.so:	$(LIBTSP_SHOBJS)
52
-	$(SHLD) -o $@ $(LIBTSP_SHOBJS) $(SHLDFLAGS) $(SHLIBS) $(THLIBS)
53
+libtspread.so:	$@.$(LIBVERSION)
54
+	$(SOFTLINK) $@.$(LIBVERSION) $@
55
+
56
+libtspread.so.$(LIBVERSION):	$(LIBTSP_SHOBJS)
57
+	$(SHLD) -o $@ $(LIBTSP_SHOBJS) $(TSHLDSONAME) $(SHLDFLAGS) $(SHLIBS) $(THLIBS)
58
 
59
 install-libtspread.so:	libtspread.so
60
 	$(INSTALL) -m 0755 libtspread.so $(DESTDIR)$(libdir)/libtspread.so.$(LIBVERSION)
61
@@ -156,11 +164,11 @@
62
 spread$(EXEEXT): $(SPREADOBJS)
63
 	$(LD) -o $@ $(SPREADOBJS) $(LDFLAGS) $(LIBS)
64
 
65
-spuser$(EXEEXT): libspread.a	user.o
66
-	$(LD) -o $@ user.o $(LDFLAGS) libspread.a $(LIBS)
67
+spuser$(EXEEXT): libspread.a user.o
68
+	$(LD) -o $@ user.o $(LDFLAGS) -lspread $(LIBS)
69
 
70
 spflooder$(EXEEXT): libspread.a flooder.o
71
-	$(LD) -o $@ flooder.o $(LDFLAGS) libspread.a $(LIBS)
72
+	$(LD) -o $@ flooder.o $(LDFLAGS) -lspread $(LIBS)
73
 
74
 spmonitor$(EXEEXT): $(MONITOR_OBJS)
75
 	$(LD) -o $@ $(MONITOR_OBJS) $(LDFLAGS) $(LIBS) 
76
@@ -169,7 +177,7 @@
77
 	$(LD) $(THLDFLAGS) -o $@ $(TMONITOR_OBJS) $(LDFLAGS) $(LIBS) $(THLIBS) 
78
 
79
 sptuser$(EXEEXT): user.to libtspread.a
80
-	$(LD) $(THLDFLAGS) -o $@ user.to libtspread.a $(LDFLAGS) $(LIBS) $(THLIBS)
81
+	$(LD) $(THLDFLAGS) -o $@ user.to -lspread $(LDFLAGS) $(LIBS) $(THLIBS)
82
 
83
 spsimple_user$(EXEEXT): simple_user.o libspread.a
84
 	$(LD) -o $@ simple_user.o $(LDFLAGS) libspread.a $(LIBS) 
85
@@ -198,7 +206,7 @@
86
 	fi
87
 
88
 clean:
89
-	rm -f *.lo *.tlo *.to *.o *.a *.dylib $(TARGETS) spsimple_user
90
+	rm -f *.lo *.tlo *.to *.o *.a *.dylib $(TARGETS) spsimple_user *.so.$(LIBVERSION)
91
 	rm -f config.cache config.log docs/*.out core
92
 	rm -rf autom4te.cache
93
 
94
@@ -254,11 +262,6 @@
95
 	done
96
 	if [ ! -d $(DESTDIR)$(sysconfdir) ]; then \
97
 		$(buildtoolsdir)/mkinstalldirs $(DESTDIR)$(sysconfdir); \
98
-	fi
99
-	if [ ! -f $(DESTDIR)$(sysconfdir)/spread.conf ]; then \
100
-		$(INSTALL) -m 644 $(srcdir)/sample.spread.conf $(DESTDIR)$(sysconfdir)/spread.conf; \
101
-	else \
102
-		echo "$(DESTDIR)$(sysconfdir)/spread.conf already exists, install will not overwrite"; \
103
 	fi
104
 
105
 uninstallall:	uninstall
(-)spread.new/files/patch-auth-ip.c (-17 lines)
Lines 1-17 Link Here
1
--- auth-ip.c	Fri Mar  5 11:32:46 2004
2
+++ auth-ip.c	Thu Jul 15 21:38:09 2004
3
@@ -90,12 +90,9 @@
4
     /* load spread.access_ip file */
5
     if (NULL != (fp = fopen(file_name,"r")) )
6
         Alarmp( SPLOG_INFO, ACM, "ip_init: using file: %s\n", file_name);
7
-    if (fp == NULL) 
8
-        if (NULL != (fp = fopen("./spread.access_ip", "r")) )
9
-            Alarmp( SPLOG_INFO, ACM, "ip_init: using file: ./spread.access_ip\n");
10
     if (fp == NULL)
11
-        if (NULL != (fp = fopen("/etc/spread.access_ip", "r")) )
12
-            Alarmp( SPLOG_INFO, ACM, "ip_init: using file: /etc/spread.access_ip\n");
13
+        if (NULL != (fp = fopen(SPREAD_ETCDIR "/spread.access_ip", "r")) )
14
+            Alarmp( SPLOG_INFO, ACM, "ip_init: using file: " SPREAD_ETCDIR "/spread.access_ip\n");
15
     if (fp == NULL)
16
     {
17
         Alarmp( SPLOG_ERROR, ACM, "ip_init: IP access control file not found.\nIf you are using IP based access controls, please make sure the file exists.\n");
(-)spread.new/files/patch-auth-pword.c (-17 lines)
Lines 1-17 Link Here
1
--- auth-pword.c	Fri Mar  5 11:32:46 2004
2
+++ auth-pword.c	Thu Jul 15 21:40:16 2004
3
@@ -118,12 +118,9 @@
4
     /* load spread.access_ip file */
5
     if (NULL != (fp = fopen(file_name,"r")) )
6
         Alarmp( SPLOG_INFO, ACM, "pword_init: using file: %s\n", file_name);
7
-    if (fp == NULL) 
8
-        if (NULL != (fp = fopen("./spread.access_pword", "r")) )
9
-            Alarmp( SPLOG_INFO,ACM, "pword_init: using file: ./spread.access_pword\n");
10
     if (fp == NULL)
11
-        if (NULL != (fp = fopen("/etc/spread.access_pword", "r")) )
12
-            Alarmp( SPLOG_INFO, ACM, "pword_init: using file: /etc/spread.access_pword\n");
13
+        if (NULL != (fp = fopen(SPREAD_ETCDIR "/spread.access_pword", "r")) )
14
+            Alarmp( SPLOG_INFO, ACM, "pword_init: using file: " SPREAD_ETCDIR "/spread.access_pword\n");
15
     if (fp == NULL)
16
         Alarmp( SPLOG_FATAL, ACM, "pword_init: error opening config file %s in any of the standard locations. Please make sure the file exists\n", file_name);
17
 
(-)spread.new/files/patch-configuration.c (-12 lines)
Lines 1-12 Link Here
1
--- configuration.c	Mon Sep 27 00:15:48 2004
2
+++ configuration.c	Tue Oct  4 14:40:51 2005
3
@@ -130,9 +130,6 @@
4
 
5
 	if (NULL != (yyin = fopen(file_name,"r")) )
6
                 Alarm( PRINT, "Conf_init: using file: %s\n", file_name);
7
-	if (yyin == NULL) 
8
-		if (NULL != (yyin = fopen("./spread.conf", "r")) )
9
-                        Alarm( PRINT, "Conf_init: using file: ./spread.conf\n");
10
 	if (yyin == NULL)
11
 		if (NULL != (yyin = fopen(configfile_location, "r")) )
12
                         Alarm( PRINT, "Conf_init: using file: %s\n", configfile_location);
(-)spread.new/files/patch-docs-sample.spread.conf (+18 lines)
Line 0 Link Here
1
--- docs/sample.spread.conf.orig	2008-10-24 06:06:33.000000000 +0800
2
+++ docs/sample.spread.conf	2008-10-24 06:07:28.000000000 +0800
3
@@ -63,6 +63,7 @@
4
 # "spreadlog_machine2.mydomain.com.log" respectively.
5
 
6
 #EventLogFile = testlog.out
7
+EventLogFile = /var/log/spread.log
8
 
9
 #Set whether to add a timestamp in front of all logged events or not.
10
 # Default is no timestamps. Default format is "[%a %d %b %Y %H:%M:%S]".
11
@@ -75,6 +76,7 @@
12
 #EventTimeStamp
13
 # or
14
 #EventTimeStamp = "[%a %d %b %Y %H:%M:%S]"
15
+EventTimeStamp = "[%a %d %b %Y %H:%M:%S]"
16
 
17
 #Set whether to allow dangerous monitor commands 
18
 # like "partition, flow_control, or kill"
(-)spread.new/files/patch-perl::Spread::Spread.pm (-13 lines)
Lines 1-13 Link Here
1
--- perl/Spread/Spread.pm	Mon Dec  8 21:12:18 2003
2
+++ perl/Spread/Spread.pm	Mon Dec  8 21:15:44 2003
3
@@ -177,8 +177,8 @@
4
 
5
   # Connect
6
   my($mailbox, $private_group) = Spread::connect(
7
-	spread_name => '4444@host.domain.com',
8
-	private_name => 'mrcool',
9
+	{ spread_name => '4803@host.domain.com',
10
+	private_name => 'mrcool', }
11
 	);
12
 
13
   # Join and leave groups
(-)spread.new/files/patch-sample.spread.conf (-20 lines)
Lines 1-20 Link Here
1
--- sample.spread.conf	Mon Dec  8 01:26:39 2003
2
+++ sample.spread.conf	Mon Dec  8 01:26:53 2003
3
@@ -50,7 +50,7 @@
4
 # cause the daemons to log to "spreadlog_machine1.mydomain.com.log" and
5
 # "spreadlog_machine2.mydomain.com.log" respectively.
6
 
7
-#EventLogFile = testlog.out
8
+EventLogFile = /var/log/spread.log
9
 
10
 #Set whether to add a timestamp in front of all logged events or not.
11
 # Default is no timestamps. Default format is "[%a %d %b %Y %H:%M:%S]".
12
@@ -62,7 +62,7 @@
13
 
14
 #EventTimeStamp
15
 # or
16
-#EventTimeStamp = "[%a %d %b %Y %H:%M:%S]"
17
+EventTimeStamp = "[%a %d %b %Y %H:%M:%S]"
18
 
19
 #Set whether to allow dangerous monitor commands 
20
 # like "partition, flow_control, or kill"
(-)spread.new/files/patch-session.c (-11 lines)
Lines 1-11 Link Here
1
--- session.c	Tue Aug  5 21:35:52 2003
2
+++ session.c	Tue Aug  5 21:31:30 2003
3
@@ -406,7 +406,7 @@
4
 	    Alarm( EXIT, "Sess_init: UNIX sock error\n" );
5
 
6
 	unix_addr.sun_family	= AF_UNIX;
7
-	sprintf( name, "/tmp/%d",My.port );
8
+	sprintf( name, "%s/spread.sock", _PATH_SPREAD_PIDDIR );
9
 	strcpy( unix_addr.sun_path, name ); 
10
 	unlink( name );
11
 
(-)spread.new/files/patch-sp.c (-11 lines)
Lines 1-11 Link Here
1
--- sp.c	Tue Oct  5 09:08:10 2004
2
+++ sp.c	Tue Oct  4 14:44:27 2005
3
@@ -591,7 +591,7 @@
4
                 set_large_socket_buffers(s);
5
 
6
 		unix_addr.sun_family = AF_UNIX;
7
-		sprintf( unix_addr.sun_path, "/tmp/%d", port );
8
+		sprintf( unix_addr.sun_path, "%s/spread.sock", _PATH_SPREAD_PIDDIR );
9
 		ret = connect_nointr_timeout( s, (struct sockaddr *)&unix_addr, sizeof(unix_addr), &time_out);
10
 #endif	/* !ARCH_PC_WIN95 */
11
 	}
(-)spread.new/files/patch-spread.c (-52 lines)
Lines 1-52 Link Here
1
--- spread.c	Thu Jun 19 00:31:23 2003
2
+++ spread.c	Mon Dec  8 20:55:41 2003
3
@@ -48,6 +48,8 @@
4
 #include <pwd.h>
5
 #include <unistd.h>
6
 #include <sys/types.h>
7
+#include <errno.h>
8
+#include <stdlib.h>
9
 #endif
10
 
11
 #ifdef	ARCH_PC_WIN95
12
@@ -65,6 +67,7 @@
13
 
14
 static	void	Invalid_privilege_decrease(char *user, char *group);
15
 static	void	Usage(int argc, char *argv[]);
16
+static	void	writepidfile();
17
 
18
 /* auth-null.c: */
19
 void null_init(void);
20
@@ -144,6 +147,11 @@
21
 
22
 #endif	/* ARCH_PC_WIN95 */
23
 
24
+	if (daemon(0,0) == -1)
25
+		Alarm( EXIT, "Spread: couldn't daemonise: %d", strerror(errno) );
26
+
27
+	writepidfile();
28
+
29
         /* initialize each valid authentication protocol */
30
         null_init();
31
         ip_init();
32
@@ -193,6 +201,20 @@
33
 	E_handle_events();
34
 
35
 	return 0;
36
+}
37
+
38
+static void
39
+writepidfile()
40
+{
41
+	char pidbuf[11];
42
+	int pidfd;
43
+
44
+	if ((pidfd = open(_PATH_SPREAD_PIDDIR "/spread.pid", O_RDWR | O_CREAT, 0644)) == -1)
45
+		Alarm( EXIT, "Spread: couldn't open pidfile for writing" );
46
+
47
+	snprintf(pidbuf, sizeof(pidbuf), "%ld\n", (long)getpid());
48
+	write(pidfd, pidbuf, strlen(pidbuf));
49
+	close(pidfd);
50
 }
51
 
52
 static  void    Print_help(void)
(-)spread.new/pkg-plist (-12 / +16 lines)
Lines 1-3 Link Here
1
bin/flush_user
1
bin/spflooder
2
bin/spflooder
2
bin/spmonitor
3
bin/spmonitor
3
bin/sptuser
4
bin/sptuser
Lines 8-28 Link Here
8
@unexec if cmp -s %D/etc/spread.conf.sample %D/etc/spread.conf; then rm -f %D/etc/spread.conf; fi
9
@unexec if cmp -s %D/etc/spread.conf.sample %D/etc/spread.conf; then rm -f %D/etc/spread.conf; fi
9
etc/spread.conf.sample
10
etc/spread.conf.sample
10
@exec if [ ! -f %D/etc/spread.conf ] ; then cp -p %D/%F %B/spread.conf; fi
11
@exec if [ ! -f %D/etc/spread.conf ] ; then cp -p %D/%F %B/spread.conf; fi
12
include/fl.h
11
include/sp.h
13
include/sp.h
12
include/sp_events.h
14
include/sp_events.h
13
include/sp_func.h
15
include/sp_func.h
14
lib/libspread.a
16
lib/libspread.a
17
lib/libspread-core.a
18
lib/libtspread-core.a
15
lib/libspread.so
19
lib/libspread.so
16
lib/libspread.so.1
20
lib/libspread.so.2.0
17
lib/libtspread.a
21
lib/libspread-core.so
18
lib/libtspread.so
22
lib/libspread-core.so.2.0
19
lib/libtspread.so.1
23
lib/libtspread-core.so
20
%%SITE_PERL%%/%%PERL_ARCH%%/Spread.pm
24
lib/libtspread-core.so.2.0
21
%%SITE_PERL%%/%%PERL_ARCH%%/auto/Spread/.packlist
22
%%SITE_PERL%%/%%PERL_ARCH%%/auto/Spread/Spread.bs
23
%%SITE_PERL%%/%%PERL_ARCH%%/auto/Spread/Spread.so
24
%%SITE_PERL%%/%%PERL_ARCH%%/auto/Spread/autosplit.ix
25
sbin/spread
25
sbin/spread
26
%%EXAMPLESDIR%%/test.pl
26
%%PORTDOCS%%%%DOCSDIR%%/DynamicConfiguration.txt
27
@dirrm %%EXAMPLESDIR%%
27
%%PORTDOCS%%%%DOCSDIR%%/Flush_or_SpreadAPI.txt
28
@dirrm %%SITE_PERL%%/%%PERL_ARCH%%/auto/Spread
28
%%PORTDOCS%%%%DOCSDIR%%/MultithreadedClients.txt
29
%%PORTDOCS%%%%DOCSDIR%%/Short_Buffer_Handling.txt
30
%%PORTDOCS%%%%DOCSDIR%%/TODO
31
%%PORTDOCS%%%%DOCSDIR%%/PORTING
32
%%PORTDOCS%%@dirrm %%DOCSDIR%%

Return to bug 128358