STAILQ -> TAILQ
This commit is contained in:
parent
7a6112d3b0
commit
53401cd35f
@ -57,9 +57,9 @@ typedef struct plugin
|
||||
char *name;
|
||||
void *handle;
|
||||
int (*hook)(RC_HOOK, const char *);
|
||||
STAILQ_ENTRY(plugin) entries;
|
||||
TAILQ_ENTRY(plugin) entries;
|
||||
} PLUGIN;
|
||||
STAILQ_HEAD(, plugin) plugins;
|
||||
TAILQ_HEAD(, plugin) plugins;
|
||||
|
||||
#ifndef __FreeBSD__
|
||||
dlfunc_t dlfunc(void * __restrict handle, const char * __restrict symbol)
|
||||
@ -87,7 +87,7 @@ void rc_plugin_load(void)
|
||||
if (rc_in_plugin)
|
||||
return;
|
||||
|
||||
STAILQ_INIT(&plugins);
|
||||
TAILQ_INIT(&plugins);
|
||||
|
||||
if (! (dp = opendir(RC_PLUGINDIR)))
|
||||
return;
|
||||
@ -112,7 +112,7 @@ void rc_plugin_load(void)
|
||||
plugin->name = xstrdup(d->d_name);
|
||||
plugin->handle = h;
|
||||
plugin->hook = fptr;
|
||||
STAILQ_INSERT_TAIL(&plugins, plugin, entries);
|
||||
TAILQ_INSERT_TAIL(&plugins, plugin, entries);
|
||||
}
|
||||
}
|
||||
closedir(dp);
|
||||
@ -159,7 +159,7 @@ void rc_plugin_run(RC_HOOK hook, const char *value)
|
||||
sigemptyset(&empty);
|
||||
sigfillset(&full);
|
||||
|
||||
STAILQ_FOREACH(plugin, &plugins, entries) {
|
||||
TAILQ_FOREACH(plugin, &plugins, entries) {
|
||||
/* We create a pipe so that plugins can affect our environment
|
||||
* vars, which in turn influence our scripts. */
|
||||
if (pipe(pfd) == -1) {
|
||||
@ -236,15 +236,15 @@ void rc_plugin_run(RC_HOOK hook, const char *value)
|
||||
|
||||
void rc_plugin_unload(void)
|
||||
{
|
||||
PLUGIN *plugin = STAILQ_FIRST(&plugins);
|
||||
PLUGIN *plugin = TAILQ_FIRST(&plugins);
|
||||
PLUGIN *next;
|
||||
|
||||
while (plugin) {
|
||||
next = STAILQ_NEXT(plugin, entries);
|
||||
next = TAILQ_NEXT(plugin, entries);
|
||||
dlclose(plugin->handle);
|
||||
free(plugin->name);
|
||||
free(plugin);
|
||||
plugin = next;
|
||||
}
|
||||
STAILQ_INIT(&plugins);
|
||||
TAILQ_INIT(&plugins);
|
||||
}
|
||||
|
@ -94,9 +94,9 @@ typedef struct scheduleitem
|
||||
} type;
|
||||
int value;
|
||||
struct scheduleitem *gotoitem;
|
||||
STAILQ_ENTRY(scheduleitem) entries;
|
||||
TAILQ_ENTRY(scheduleitem) entries;
|
||||
} SCHEDULEITEM;
|
||||
STAILQ_HEAD(, scheduleitem) schedule;
|
||||
TAILQ_HEAD(, scheduleitem) schedule;
|
||||
|
||||
extern const char *applet;
|
||||
static char *changeuser;
|
||||
@ -105,15 +105,15 @@ extern char **environ;
|
||||
|
||||
static void free_schedulelist(void)
|
||||
{
|
||||
SCHEDULEITEM *s1 = STAILQ_FIRST(&schedule);
|
||||
SCHEDULEITEM *s1 = TAILQ_FIRST(&schedule);
|
||||
SCHEDULEITEM *s2;
|
||||
|
||||
while (s1) {
|
||||
s2 = STAILQ_NEXT(s1, entries);
|
||||
s2 = TAILQ_NEXT(s1, entries);
|
||||
free(s1);
|
||||
s1 = s2;
|
||||
}
|
||||
STAILQ_INIT(&schedule);
|
||||
TAILQ_INIT(&schedule);
|
||||
}
|
||||
|
||||
static void cleanup(void)
|
||||
@ -229,12 +229,12 @@ static void parse_schedule(const char *string, int timeout)
|
||||
item->type = SC_SIGNAL;
|
||||
item->value = timeout;
|
||||
item->gotoitem = NULL;
|
||||
STAILQ_INSERT_TAIL(&schedule, item, entries);
|
||||
TAILQ_INSERT_TAIL(&schedule, item, entries);
|
||||
|
||||
item = xmalloc(sizeof(*item));
|
||||
item->type = SC_TIMEOUT;
|
||||
item->gotoitem = NULL;
|
||||
STAILQ_INSERT_TAIL(&schedule, item, entries);
|
||||
TAILQ_INSERT_TAIL(&schedule, item, entries);
|
||||
if (string) {
|
||||
if (sscanf(string, "%d", &item->value) != 1)
|
||||
eerrorx("%s: invalid timeout value in schedule", applet);
|
||||
@ -258,7 +258,7 @@ static void parse_schedule(const char *string, int timeout)
|
||||
string = slash ? slash + 1 : NULL;
|
||||
|
||||
item = parse_schedule_item(buffer);
|
||||
STAILQ_INSERT_TAIL(&schedule, item, entries);
|
||||
TAILQ_INSERT_TAIL(&schedule, item, entries);
|
||||
if (item->type == SC_FOREVER) {
|
||||
if (repeatat)
|
||||
eerrorx("%s: invalid schedule, `forever' "
|
||||
@ -274,7 +274,7 @@ static void parse_schedule(const char *string, int timeout)
|
||||
item->type = SC_GOTO;
|
||||
item->value = 0;
|
||||
item->gotoitem = repeatat;
|
||||
STAILQ_INSERT_TAIL(&schedule, item, entries);
|
||||
TAILQ_INSERT_TAIL(&schedule, item, entries);
|
||||
}
|
||||
|
||||
return;
|
||||
@ -360,7 +360,7 @@ static int run_stop_schedule(const char *const *argv, const char *cmd,
|
||||
const char *pidfile, uid_t uid,
|
||||
bool quiet, bool verbose, bool test)
|
||||
{
|
||||
SCHEDULEITEM *item = STAILQ_FIRST(&schedule);
|
||||
SCHEDULEITEM *item = TAILQ_FIRST(&schedule);
|
||||
int nkilled = 0;
|
||||
int tkilled = 0;
|
||||
int nrunning = 0;
|
||||
@ -442,7 +442,7 @@ static int run_stop_schedule(const char *const *argv, const char *cmd,
|
||||
}
|
||||
|
||||
if (item)
|
||||
item = STAILQ_NEXT(item, entries);
|
||||
item = TAILQ_NEXT(item, entries);
|
||||
}
|
||||
|
||||
if (test || (tkilled > 0 && nrunning == 0))
|
||||
@ -602,7 +602,7 @@ int start_stop_daemon(int argc, char **argv)
|
||||
FILE *fp;
|
||||
size_t len;
|
||||
|
||||
STAILQ_INIT(&schedule);
|
||||
TAILQ_INIT(&schedule);
|
||||
atexit(cleanup);
|
||||
|
||||
signal_setup(SIGINT, handle_signal);
|
||||
@ -824,7 +824,7 @@ int start_stop_daemon(int argc, char **argv)
|
||||
if (stop) {
|
||||
int result;
|
||||
|
||||
if (! STAILQ_FIRST(&schedule)) {
|
||||
if (! TAILQ_FIRST(&schedule)) {
|
||||
if (test || oknodo)
|
||||
parse_schedule("0", sig);
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user