[rusers] add rusers-0.17-sdnotify.patch

Honza Horak hhorak at fedoraproject.org
Tue Sep 25 10:46:34 UTC 2012


commit 963294520ef34cdc288fae9704d5c1e2f16724f8
Author: Honza HorĂ¡k <hhorak at redhat.com>
Date:   Tue Sep 25 12:46:27 2012 +0200

    add rusers-0.17-sdnotify.patch

 rusers-0.17-sdnotify.patch |   75 ++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 75 insertions(+), 0 deletions(-)
---
diff --git a/rusers-0.17-sdnotify.patch b/rusers-0.17-sdnotify.patch
new file mode 100644
index 0000000..f736583
--- /dev/null
+++ b/rusers-0.17-sdnotify.patch
@@ -0,0 +1,75 @@
+diff -up netkit-rusers-0.17/rpc.rstatd/rstatd.c.sdnotify netkit-rusers-0.17/rpc.rstatd/rstatd.c
+--- netkit-rusers-0.17/rpc.rstatd/rstatd.c.sdnotify	2012-09-24 15:57:11.080034637 +0200
++++ netkit-rusers-0.17/rpc.rstatd/rstatd.c	2012-09-24 15:57:11.131034735 +0200
+@@ -42,6 +42,7 @@ static char rcsid[] = "$Id: rstatd.c,v 1
+ #include <rpcsvc/rstat.h>
+ #include <sys/socket.h>
+ #include <unistd.h>
++#include <systemd/sd-daemon.h>
+ 
+ extern void rstat_service();
+ 
+@@ -113,6 +114,26 @@ main(int argc, char *argv[])
+ 		exit(1);
+ 	}
+ 
++        /* If we use systemd as an init system, we may want to give it 
++           a message, that this daemon is ready to accept connections.
++           At this time, sockets for receiving connections are already 
++           created, so we can say we're ready now. It is a nop if we 
++           don't use systemd. */
++        {
++                int result;
++
++                result = sd_notifyf(0, "READY=1\n"
++                        "STATUS=Processing requests...\n"
++                        "MAINPID=%lu", (unsigned long) getpid());
++
++                /* Return code from sd_notifyf can be ignored, as per sd_notifyf(3).
++                   However, if we use systemd's native unit file, we need to send 
++                   this message to let systemd know that daemon is ready.
++                   Thus, we want to know that the call had some issues. */
++                if (result < 0)
++                        syslog(LOG_ERR, "sd_notifyf failed: %s\n", strerror(-result));
++        }
++
+ 	svc_run();
+ 	syslog(LOG_ERR, "svc_run returned");
+ 	exit(1);
+diff -up netkit-rusers-0.17/rpc.rusersd/rusersd.c.sdnotify netkit-rusers-0.17/rpc.rusersd/rusersd.c
+--- netkit-rusers-0.17/rpc.rusersd/rusersd.c.sdnotify	2012-09-24 15:57:11.123034720 +0200
++++ netkit-rusers-0.17/rpc.rusersd/rusersd.c	2012-09-24 15:57:11.133034738 +0200
+@@ -38,6 +38,7 @@ char rusersd_rcsid[] =
+ #include <rpc/pmap_clnt.h>
+ #include <unistd.h>
+ #include <grp.h>
++#include <systemd/sd-daemon.h>
+ #ifdef __GLIBC__
+ 	#include <rpcsvc/rusers.h>
+ #else
+@@ -128,6 +129,25 @@ main(void)
+ 		}
+ 	}
+  
++        /* If we use systemd as an init system, we may want to give it 
++           a message, that this daemon is ready to accept connections.
++           At this time, sockets for receiving connections are already 
++           created, so we can say we're ready now. It is a nop if we 
++           don't use systemd. */
++        {
++                int result;
++
++                result = sd_notifyf(0, "READY=1\n"
++                        "STATUS=Processing requests...\n"
++                        "MAINPID=%lu", (unsigned long) getpid());
++
++                /* Return code from sd_notifyf can be ignored, as per sd_notifyf(3).
++                   However, if we use systemd's native unit file, we need to send 
++                   this message to let systemd know that daemon is ready.
++                   Thus, we want to know that the call had some issues. */
++                if (result < 0)
++                        syslog(LOG_ERR, "sd_notifyf failed: %s\n", strerror(-result));
++        }
+ 
+ 	svc_run();
+ 	syslog(LOG_ERR, "svc_run returned");


More information about the scm-commits mailing list