SOURCES: initng-plugin-lockfile.patch - update to 0.6.1RC1

glen glen at pld-linux.org
Thu Apr 20 11:36:02 CEST 2006


Author: glen                         Date: Thu Apr 20 09:36:02 2006 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- update to 0.6.1RC1

---- Files affected:
SOURCES:
   initng-plugin-lockfile.patch (1.5 -> 1.6) 

---- Diffs:

================================================================
Index: SOURCES/initng-plugin-lockfile.patch
diff -u SOURCES/initng-plugin-lockfile.patch:1.5 SOURCES/initng-plugin-lockfile.patch:1.6
--- SOURCES/initng-plugin-lockfile.patch:1.5	Tue Mar 28 19:16:50 2006
+++ SOURCES/initng-plugin-lockfile.patch	Thu Apr 20 11:35:57 2006
@@ -1,126 +1,17 @@
---- /usr/share/empty/Makefile.am	1970-01-01 03:00:00.000000000 +0300
-+++ initng-contrib/plugins/lockfile/Makefile.am	2006-03-22 22:55:33.000000000 +0200
-@@ -0,0 +1,9 @@
-+AM_CPPFLAGS = @PLUGIN_CPPFLAGS@
-+
-+plugin_LTLIBRARIES = liblockfile.la
-+
-+liblockfile_la_SOURCES = \
-+	initng_lockfile.c
-+
-+liblockfile_la_LDFLAGS = @PLUGIN_LDFLAGS@
-+liblockfile_la_LIBADD = @PLUGIN_LIBS@
-diff -u initng-0.6.0RC1.plugin/plugins/lockfile/initng_lockfile.c initng-0.6.0/plugins/lockfile/initng_lockfile.c
---- initng-0.6.0RC1.plugin/plugins/lockfile/initng_lockfile.c	2006-03-23 00:10:50.000000000 +0200
-+++ initng-0.6.0/plugins/lockfile/initng_lockfile.c	2006-03-28 20:15:08.000000000 +0300
-@@ -0,0 +1,91 @@
-+/* Initng, a next generation sysvinit replacement.
-+ * Copyright (C) 2006 Elan Ruusamäe <glen at pld-linux.org>
-+ *
-+ * This program is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU Lesser General Public
-+ * License as published by the Free Software Foundation; either
-+ * version 2 of the License, or (at your option) any later version.
-+ *
-+ * This program is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-+ * Lesser General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Lesser General
-+ * Public License along with this library; if not, write to the
-+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-+ * Boston, MA  02110-1301, USA.
-+ */
-+
-+#include <initng.h>
-+
-+#include <sys/types.h>
-+#include <sys/stat.h>
-+#include <fcntl.h>
-+#include <string.h>
-+
-+#include <initng_handler.h>
-+#include <initng_global.h>
-+#include <initng_plugin_hook.h>
-+#include <initng_common.h>
-+#include <initng_depend.h>
-+#include <initng_toolbox.h>
-+#include <initng_static_data_id.h>
-+#include <initng_static_states.h>
-+#include <initng_static_service_types.h>
-+
-+s_entry LOCKFILE = { "lockfile", SET, NULL,
-+    "If this option is set, plugin will create /var/lock/subsys/$NAME lockfile."
-+};
-+
-+#define LOCKDIR "/var/lock/subsys/"
-+
-+static int status_change(active_db_h * service)
-+{
-+	D_("status change [%s]\n", service->name);
-+
-+	// are we under influence of lockfile?
-+	if (initng_active_db_is(&LOCKFILE, service)) {
-+		char *p = strrchr(service->name, '/') + 1;
-+		char lockfile[sizeof(LOCKDIR) + strlen(p)];
-+		strcpy(mempcpy(lockfile, LOCKDIR, sizeof(LOCKDIR) - 1), p);
-+
-+		D_("lockfile path [%s]\n", lockfile);
-+		// service states from initng_is.h
-+		if (IS_UP(service)) {
+--- ./plugins/lockfile/initng_lockfile.c~	2006-04-13 01:19:43.000000000 +0300
++++ ./plugins/lockfile/initng_lockfile.c	2006-04-20 12:33:26.187989468 +0300
+@@ -56,9 +56,12 @@
+ 		// service states from initng_is.h
+ 		if (IS_UP(service))
+ 		{
 +			int fd;
-+			D_("service got up\n");
+ 			D_("service got up\n");
+-			creat(lockfile, S_IREAD);
+-
 +			fd = creat(lockfile, 0640);
 +			if (fd != -1) {
 +				close(fd);
 +			}
-+
-+		} else if (IS_DOWN(service)) {
-+			D_("service went down\n");
-+			unlink(lockfile);
-+		}
-+	}
-+
-+	return(TRUE);
-+}
-+
-+int module_init(int api_version)
-+{
-+    D_("module_init();\n");
-+    if (api_version != API_VERSION)
-+    {
-+        F_("This module is compiled for api_version %i version and initng is compiled on %i version, won't load this module!\n", INITNG_VERSION, api_version);
-+        return (FALSE);
-+    }
-+
-+    initng_service_data_types_add(&LOCKFILE);
-+    initng_plugin_hook_add(&g.IS_CHANGE, 50, &status_change);
-+    return (TRUE);
-+}
-+
-+void module_unload(void)
-+{
-+    D_("module_unload();\n");
-+    initng_service_data_types_del(&LOCKFILE);
-+    initng_plugin_hook_del(&g.IS_CHANGE, &status_change);
-+}
---- initng-0.6.0RC1/plugins/Makefile.am~	2006-03-22 14:29:42.000000000 +0200
-+++ initng-0.6.0RC1/plugins/Makefile.am	2006-03-22 23:16:34.000000000 +0200
-@@ -1,5 +1,5 @@
- 
--SUBDIRS=service daemon runlevel
-+SUBDIRS=service daemon runlevel lockfile
- 
- if BUILD_ALSO
-     SUBDIRS+=also
---- initng-0.6.0/configure.ac~	2006-03-27 18:33:46.000000000 +0300
-+++ initng-0.6.0/configure.ac	2006-03-27 18:34:19.000000000 +0300
-@@ -399,6 +399,7 @@
- 	  plugins/also/Makefile \
- 	  plugins/netprobe/Makefile \
- 	  plugins/idleprobe/Makefile \
-+	  plugins/lockfile/Makefile \
- 	  doc/Makefile \
- 	  tools/Makefile
- 	  ])
+ 		}
+ 		else if (IS_DOWN(service))
+ 		{
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/SOURCES/initng-plugin-lockfile.patch?r1=1.5&r2=1.6&f=u



More information about the pld-cvs-commit mailing list