SOURCES: initng-plugin-lockfile.patch (NEW) - lockfile plugin, v0....
glen
glen at pld-linux.org
Wed Mar 22 22:18:44 CET 2006
Author: glen Date: Wed Mar 22 21:18:44 2006 GMT
Module: SOURCES Tag: HEAD
---- Log message:
- lockfile plugin, v0.0.0.1
---- Files affected:
SOURCES:
initng-plugin-lockfile.patch (NONE -> 1.1) (NEW)
---- Diffs:
================================================================
Index: SOURCES/initng-plugin-lockfile.patch
diff -u /dev/null SOURCES/initng-plugin-lockfile.patch:1.1
--- /dev/null Wed Mar 22 22:18:44 2006
+++ SOURCES/initng-plugin-lockfile.patch Wed Mar 22 22:18:39 2006
@@ -0,0 +1,100 @@
+diff -Nur /usr/share/empty/Makefile.am /home/glen/svn/initng-contrib/plugins/lockfile/Makefile.am
+--- /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 -Nur /usr/share/empty/initng_lockfile.c /home/glen/svn/initng-contrib/plugins/lockfile/initng_lockfile.c
+--- /usr/share/empty/initng_lockfile.c 1970-01-01 03:00:00.000000000 +0300
++++ /home/glen/svn/initng-contrib/plugins/lockfile/initng_lockfile.c 2006-03-22 22:55:11.000000000 +0200
+@@ -0,0 +1,74 @@
++/* 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)
++{
++char lockfile[sizeof(LOCKDIR) + strlen(service->name)];
++
++ sprintf(lockfile, "%s/%s", LOCKDIR, service->name);
++ if (IS_UP(service)) {
++ creat(lockfile, 0);
++ }
++
++ 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
================================================================
More information about the pld-cvs-commit
mailing list