netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* iproute2: make arpd daemon write pid file on fork
       [not found] ` <20110811110029.023a5955@nehalam.ftrdhcpuser.net>
@ 2011-08-12  6:23   ` Alex Dubov
  2011-08-12 16:15     ` Stephen Hemminger
  0 siblings, 1 reply; 3+ messages in thread
From: Alex Dubov @ 2011-08-12  6:23 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev

Current version of arpd included with iproute2-2.6.37 will fork 
unconditionally on start-up (using daemon() library call). This causes 
problems with distro start-up scripts, as PID of the started daemon can not be 
reliably obtained, hampering orderly daemon shutdown process.

The included patch makes arpd write it's own pid file after fork, in a common 
LSB fashion, so as to better inter-operate with start up scripts. Removal of 
stale pid files is handled elsewhere.

--- misc/arpd.c.orig	2011-01-08 04:54:30.000000000 +1100
+++ misc/arpd.c	2011-08-12 16:04:51.098754397 +1000
@@ -41,6 +41,7 @@
 
 DB	*dbase;
 char	*dbname = "/var/lib/arpd/arpd.db";
+char	*pidfname = "/var/run/arpd.pid";
 
 int	ifnum;
 int	*ifvec;
@@ -780,6 +781,17 @@
 		goto do_abort;
 	}
 
+	do {
+		FILE *fp = fopen(pidfname, "w");
+		if (fp) {
+			fprintf(fp, "%ld\n", (long)getpid());
+			fclose(fp);
+		} else {
+			perror("arpd: pid fopen");
+			goto do_abort;
+		}
+	} while (0);
+
 	openlog("arpd", LOG_PID | LOG_CONS, LOG_DAEMON);
 	catch_signal(SIGINT, sig_exit);
 	catch_signal(SIGTERM, sig_exit);

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: iproute2: make arpd daemon write pid file on fork
  2011-08-12  6:23   ` iproute2: make arpd daemon write pid file on fork Alex Dubov
@ 2011-08-12 16:15     ` Stephen Hemminger
  2011-08-15  5:42       ` Alex Dubov
  0 siblings, 1 reply; 3+ messages in thread
From: Stephen Hemminger @ 2011-08-12 16:15 UTC (permalink / raw)
  To: Alex Dubov; +Cc: netdev

On Fri, 12 Aug 2011 16:23:24 +1000
Alex Dubov <oakad@yahoo.com> wrote:

> Current version of arpd included with iproute2-2.6.37 will fork 
> unconditionally on start-up (using daemon() library call). This causes 
> problems with distro start-up scripts, as PID of the started daemon can not be 
> reliably obtained, hampering orderly daemon shutdown process.
> 
> The included patch makes arpd write it's own pid file after fork, in a common 
> LSB fashion, so as to better inter-operate with start up scripts. Removal of 
> stale pid files is handled elsewhere.

I already checked in a version which has the -p pidfile option.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: iproute2: make arpd daemon write pid file on fork
  2011-08-12 16:15     ` Stephen Hemminger
@ 2011-08-15  5:42       ` Alex Dubov
  0 siblings, 0 replies; 3+ messages in thread
From: Alex Dubov @ 2011-08-15  5:42 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev

----- Original Message -----

> 
>>  The included patch makes arpd write it's own pid file after fork, in a 
> common 
>>  LSB fashion, so as to better inter-operate with start up scripts. Removal 
> of 
>>  stale pid files is handled elsewhere.
> 
> I already checked in a version which has the -p pidfile option.
>

Thanks for that.
It will be enough for arpd to fit with the rest of init scripts.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-08-15  5:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1313080925.3635.YahooMailNeo@web121018.mail.ne1.yahoo.com>
     [not found] ` <20110811110029.023a5955@nehalam.ftrdhcpuser.net>
2011-08-12  6:23   ` iproute2: make arpd daemon write pid file on fork Alex Dubov
2011-08-12 16:15     ` Stephen Hemminger
2011-08-15  5:42       ` Alex Dubov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).