plugin hook function is now rc_plugin_hook instead of a name based
on the name of the plugin.
This commit is contained in:
parent
726e754fff
commit
5248fb52fa
@ -1,6 +1,11 @@
|
|||||||
# ChangeLog for Gentoo System Intialization ("rc") scripts
|
# ChangeLog for Gentoo System Intialization ("rc") scripts
|
||||||
# Copyright 1999-2007 Gentoo Foundation; Distributed under the GPLv2
|
# Copyright 1999-2007 Gentoo Foundation; Distributed under the GPLv2
|
||||||
|
|
||||||
|
19 Sep 2007; Roy Marples <uberlord@gentoo.org>:
|
||||||
|
|
||||||
|
plugin hook function is now rc_plugin_hook instead of a name based
|
||||||
|
on the name of the plugin.
|
||||||
|
|
||||||
18 Sep 2007; Roy Marples <uberlord@gentoo.org>:
|
18 Sep 2007; Roy Marples <uberlord@gentoo.org>:
|
||||||
|
|
||||||
Only mount /sys if it's not mounted, #192436.
|
Only mount /sys if it's not mounted, #192436.
|
||||||
|
@ -11,31 +11,31 @@
|
|||||||
# define LIB "lib"
|
# define LIB "lib"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define RC_LEVEL_BOOT "boot"
|
#define RC_LEVEL_BOOT "boot"
|
||||||
#define RC_LEVEL_DEFAULT "default"
|
#define RC_LEVEL_DEFAULT "default"
|
||||||
|
|
||||||
#define RC_LIBDIR "/" LIB "/rcscripts"
|
#define RC_LIBDIR "/" LIB "/rcscripts"
|
||||||
#define RC_SVCDIR RC_LIBDIR "/init.d"
|
#define RC_SVCDIR RC_LIBDIR "/init.d"
|
||||||
#define RC_DEPTREE RC_SVCDIR "/deptree"
|
#define RC_DEPTREE RC_SVCDIR "/deptree"
|
||||||
#define RC_RUNLEVELDIR "/etc/runlevels"
|
#define RC_RUNLEVELDIR "/etc/runlevels"
|
||||||
#define RC_INITDIR "/etc/init.d"
|
#define RC_INITDIR "/etc/init.d"
|
||||||
#define RC_CONFDIR "/etc/conf.d"
|
#define RC_CONFDIR "/etc/conf.d"
|
||||||
|
|
||||||
#define RC_KSOFTLEVEL RC_SVCDIR "/ksoftlevel"
|
#define RC_KSOFTLEVEL RC_SVCDIR "/ksoftlevel"
|
||||||
#define RC_STARTING RC_SVCDIR "/softscripts.new"
|
#define RC_STARTING RC_SVCDIR "/softscripts.new"
|
||||||
#define RC_STOPPING RC_SVCDIR "/softscripts.old"
|
#define RC_STOPPING RC_SVCDIR "/softscripts.old"
|
||||||
|
|
||||||
#define RC_SVCDIR_STARTING RC_SVCDIR "/starting"
|
#define RC_SVCDIR_STARTING RC_SVCDIR "/starting"
|
||||||
#define RC_SVCDIR_INACTIVE RC_SVCDIR "/inactive"
|
#define RC_SVCDIR_INACTIVE RC_SVCDIR "/inactive"
|
||||||
#define RC_SVCDIR_STARTED RC_SVCDIR "/started"
|
#define RC_SVCDIR_STARTED RC_SVCDIR "/started"
|
||||||
#define RC_SVCDIR_COLDPLUGGED RC_SVCDIR "/coldplugged"
|
#define RC_SVCDIR_COLDPLUGGED RC_SVCDIR "/coldplugged"
|
||||||
|
|
||||||
#define RC_PLUGINDIR RC_LIBDIR "/plugins"
|
#define RC_PLUGINDIR RC_LIBDIR "/plugins"
|
||||||
|
|
||||||
/* Max buffer to read a line from a file */
|
/* Max buffer to read a line from a file */
|
||||||
#define RC_LINEBUFFER 4096
|
#define RC_LINEBUFFER 4096
|
||||||
|
|
||||||
/* Good defaults just incase user has none set */
|
/* Good defaults just incase user has none set */
|
||||||
#define RC_NET_FS_LIST_DEFAULT "afs cifs coda davfs fuse gfs ncpfs nfs nfs4 ocfs2 shfs smbfs"
|
#define RC_NET_FS_LIST_DEFAULT "afs cifs coda davfs fuse gfs ncpfs nfs nfs4 ocfs2 shfs smbfs"
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -20,6 +20,8 @@
|
|||||||
#include "rc-plugin.h"
|
#include "rc-plugin.h"
|
||||||
#include "strlist.h"
|
#include "strlist.h"
|
||||||
|
|
||||||
|
#define RC_PLUGIN_HOOK "rc_plugin_hook"
|
||||||
|
|
||||||
bool rc_in_plugin = false;
|
bool rc_in_plugin = false;
|
||||||
|
|
||||||
typedef struct plugin
|
typedef struct plugin
|
||||||
@ -66,9 +68,7 @@ void rc_plugin_load (void)
|
|||||||
STRLIST_FOREACH (files, file, i) {
|
STRLIST_FOREACH (files, file, i) {
|
||||||
char *p = rc_strcatpaths (RC_PLUGINDIR, file, NULL);
|
char *p = rc_strcatpaths (RC_PLUGINDIR, file, NULL);
|
||||||
void *h = dlopen (p, RTLD_LAZY);
|
void *h = dlopen (p, RTLD_LAZY);
|
||||||
char *func;
|
|
||||||
int (*fptr) (rc_hook_t, const char *);
|
int (*fptr) (rc_hook_t, const char *);
|
||||||
int len;
|
|
||||||
|
|
||||||
free (p);
|
free (p);
|
||||||
if (! h) {
|
if (! h) {
|
||||||
@ -76,15 +76,9 @@ void rc_plugin_load (void)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
func = file;
|
fptr = (int (*)(rc_hook_t, const char*)) dlfunc (h, RC_PLUGIN_HOOK);
|
||||||
file = strsep (&func, ".");
|
|
||||||
len = strlen (file) + 7;
|
|
||||||
func = rc_xmalloc (sizeof (char *) * len);
|
|
||||||
snprintf (func, len, "_%s_hook", file);
|
|
||||||
|
|
||||||
fptr = (int (*)(rc_hook_t, const char*)) dlfunc (h, func);
|
|
||||||
if (! fptr) {
|
if (! fptr) {
|
||||||
eerror ("`%s' does not expose the symbol `%s'", p, func);
|
eerror ("%s: cannot find symbol `%s'", file, RC_PLUGIN_HOOK);
|
||||||
dlclose (h);
|
dlclose (h);
|
||||||
} else {
|
} else {
|
||||||
if (plugin) {
|
if (plugin) {
|
||||||
@ -98,8 +92,6 @@ void rc_plugin_load (void)
|
|||||||
plugin->handle = h;
|
plugin->handle = h;
|
||||||
plugin->hook = fptr;
|
plugin->hook = fptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
free (func);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
rc_strlist_free (files);
|
rc_strlist_free (files);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user