parent
20035210bd
commit
3a1262703f
@ -43,9 +43,6 @@ We don't support building a static OpenRC with PAM.
|
|||||||
|
|
||||||
You may need to use `PROGLDFLAGS=-Wl,-Bstatic` on glibc instead of just `-static`.
|
You may need to use `PROGLDFLAGS=-Wl,-Bstatic` on glibc instead of just `-static`.
|
||||||
|
|
||||||
If you debug memory under valgrind, add `-DDEBUG_MEMORY`
|
|
||||||
to your `CPPFLAGS` so that all malloc memory should be freed at exit.
|
|
||||||
|
|
||||||
If you are building OpenRC for a Gentoo Prefix installation, add `MKPREFIX=yes`.
|
If you are building OpenRC for a Gentoo Prefix installation, add `MKPREFIX=yes`.
|
||||||
|
|
||||||
`PKG_PREFIX` should be set to where packages install to by default.
|
`PKG_PREFIX` should be set to where packages install to by default.
|
||||||
|
@ -404,6 +404,12 @@ librc_hidden_def(rc_config_value)
|
|||||||
* each rc_conf_value call */
|
* each rc_conf_value call */
|
||||||
static RC_STRINGLIST *rc_conf = NULL;
|
static RC_STRINGLIST *rc_conf = NULL;
|
||||||
|
|
||||||
|
static void
|
||||||
|
_free_rc_conf(void)
|
||||||
|
{
|
||||||
|
rc_stringlist_free(rc_conf);
|
||||||
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
rc_conf_value(const char *setting)
|
rc_conf_value(const char *setting)
|
||||||
{
|
{
|
||||||
@ -413,17 +419,13 @@ rc_conf_value(const char *setting)
|
|||||||
|
|
||||||
if (! rc_conf) {
|
if (! rc_conf) {
|
||||||
rc_conf = rc_config_load(RC_CONF);
|
rc_conf = rc_config_load(RC_CONF);
|
||||||
#ifdef DEBUG_MEMORY
|
|
||||||
atexit(_free_rc_conf);
|
atexit(_free_rc_conf);
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Support old configs. */
|
/* Support old configs. */
|
||||||
if (exists(RC_CONF_OLD)) {
|
if (exists(RC_CONF_OLD)) {
|
||||||
old = rc_config_load(RC_CONF_OLD);
|
old = rc_config_load(RC_CONF_OLD);
|
||||||
TAILQ_CONCAT(rc_conf, old, entries);
|
TAILQ_CONCAT(rc_conf, old, entries);
|
||||||
#ifdef DEBUG_MEMORY
|
|
||||||
free(old);
|
free(old);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
rc_conf = rc_config_directory(rc_conf);
|
rc_conf = rc_config_directory(rc_conf);
|
||||||
@ -443,11 +445,3 @@ rc_conf_value(const char *setting)
|
|||||||
return rc_config_value(rc_conf, setting);
|
return rc_config_value(rc_conf, setting);
|
||||||
}
|
}
|
||||||
librc_hidden_def(rc_conf_value)
|
librc_hidden_def(rc_conf_value)
|
||||||
|
|
||||||
#ifdef DEBUG_MEMORY
|
|
||||||
static void
|
|
||||||
_free_rc_conf(void)
|
|
||||||
{
|
|
||||||
rc_stringlist_free(rc_conf);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
@ -247,7 +247,6 @@ cleanup(void)
|
|||||||
|
|
||||||
rc_plugin_unload();
|
rc_plugin_unload();
|
||||||
|
|
||||||
#ifdef DEBUG_MEMORY
|
|
||||||
rc_stringlist_free(deptypes_b);
|
rc_stringlist_free(deptypes_b);
|
||||||
rc_stringlist_free(deptypes_n);
|
rc_stringlist_free(deptypes_n);
|
||||||
rc_stringlist_free(deptypes_nw);
|
rc_stringlist_free(deptypes_nw);
|
||||||
@ -267,7 +266,6 @@ cleanup(void)
|
|||||||
free(service);
|
free(service);
|
||||||
free(prefix);
|
free(prefix);
|
||||||
free(runlevel);
|
free(runlevel);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Buffer and lock all output messages so that we get readable content */
|
/* Buffer and lock all output messages so that we get readable content */
|
||||||
@ -1097,9 +1095,7 @@ service_plugable(void)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef DEBUG_MEMORY
|
|
||||||
free(list);
|
free(list);
|
||||||
#endif
|
|
||||||
return allow;
|
return allow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,11 +110,9 @@ env_filter(void)
|
|||||||
setenv(env->value, e + 1, 1);
|
setenv(env->value, e + 1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_MEMORY
|
|
||||||
rc_stringlist_free(env_list);
|
rc_stringlist_free(env_list);
|
||||||
rc_stringlist_free(env_allow);
|
rc_stringlist_free(env_allow);
|
||||||
rc_stringlist_free(profile);
|
rc_stringlist_free(profile);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -76,9 +76,7 @@ int main(int argc, char **argv)
|
|||||||
case 'e':
|
case 'e':
|
||||||
service = rc_service_resolve(optarg);
|
service = rc_service_resolve(optarg);
|
||||||
opt = service ? EXIT_SUCCESS : EXIT_FAILURE;
|
opt = service ? EXIT_SUCCESS : EXIT_FAILURE;
|
||||||
#ifdef DEBUG_MEMORY
|
|
||||||
free(service);
|
free(service);
|
||||||
#endif
|
|
||||||
return opt;
|
return opt;
|
||||||
/* NOTREACHED */
|
/* NOTREACHED */
|
||||||
case 'i':
|
case 'i':
|
||||||
@ -97,9 +95,7 @@ int main(int argc, char **argv)
|
|||||||
rc_stringlist_sort(&list);
|
rc_stringlist_sort(&list);
|
||||||
TAILQ_FOREACH(s, list, entries)
|
TAILQ_FOREACH(s, list, entries)
|
||||||
printf("%s\n", s->value);
|
printf("%s\n", s->value);
|
||||||
#ifdef DEBUG_MEMORY
|
|
||||||
rc_stringlist_free(list);
|
rc_stringlist_free(list);
|
||||||
#endif
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
/* NOTREACHED */
|
/* NOTREACHED */
|
||||||
case 'r':
|
case 'r':
|
||||||
@ -107,9 +103,7 @@ int main(int argc, char **argv)
|
|||||||
if (service == NULL)
|
if (service == NULL)
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
printf("%s\n", service);
|
printf("%s\n", service);
|
||||||
#ifdef DEBUG_MEMORY
|
|
||||||
free(service);
|
free(service);
|
||||||
#endif
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
/* NOTREACHED */
|
/* NOTREACHED */
|
||||||
|
|
||||||
|
@ -331,7 +331,6 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
exit:
|
exit:
|
||||||
free(runlevel);
|
free(runlevel);
|
||||||
#ifdef DEBUG_MEMORY
|
|
||||||
rc_stringlist_free(alist);
|
rc_stringlist_free(alist);
|
||||||
rc_stringlist_free(needsme);
|
rc_stringlist_free(needsme);
|
||||||
rc_stringlist_free(sservices);
|
rc_stringlist_free(sservices);
|
||||||
@ -340,7 +339,6 @@ exit:
|
|||||||
rc_stringlist_free(types);
|
rc_stringlist_free(types);
|
||||||
rc_stringlist_free(levels);
|
rc_stringlist_free(levels);
|
||||||
rc_deptree_free(deptree);
|
rc_deptree_free(deptree);
|
||||||
#endif
|
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
16
src/rc/rc.c
16
src/rc/rc.c
@ -86,6 +86,12 @@ const char *usagestring = "" \
|
|||||||
#define DEVBOOT "/dev/.rcboot"
|
#define DEVBOOT "/dev/.rcboot"
|
||||||
|
|
||||||
const char *applet = NULL;
|
const char *applet = NULL;
|
||||||
|
static RC_STRINGLIST *hotplugged_services;
|
||||||
|
static RC_STRINGLIST *stop_services;
|
||||||
|
static RC_STRINGLIST *start_services;
|
||||||
|
static RC_STRINGLIST *types_nw;
|
||||||
|
static RC_STRINGLIST *types_nwua;
|
||||||
|
static RC_DEPTREE *deptree;
|
||||||
static char *runlevel;
|
static char *runlevel;
|
||||||
static RC_HOOK hook_out;
|
static RC_HOOK hook_out;
|
||||||
|
|
||||||
@ -127,10 +133,8 @@ clean_failed(void)
|
|||||||
static void
|
static void
|
||||||
cleanup(void)
|
cleanup(void)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_MEMORY
|
|
||||||
RC_PID *p1 = LIST_FIRST(&service_pids);
|
RC_PID *p1 = LIST_FIRST(&service_pids);
|
||||||
RC_PID *p2;
|
RC_PID *p2;
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!rc_in_logger && !rc_in_plugin &&
|
if (!rc_in_logger && !rc_in_plugin &&
|
||||||
applet && (strcmp(applet, "rc") == 0 || strcmp(applet, "openrc") == 0))
|
applet && (strcmp(applet, "rc") == 0 || strcmp(applet, "openrc") == 0))
|
||||||
@ -152,7 +156,6 @@ cleanup(void)
|
|||||||
rc_logger_close();
|
rc_logger_close();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_MEMORY
|
|
||||||
while (p1) {
|
while (p1) {
|
||||||
p2 = LIST_NEXT(p1, entries);
|
p2 = LIST_NEXT(p1, entries);
|
||||||
free(p1);
|
free(p1);
|
||||||
@ -166,7 +169,6 @@ cleanup(void)
|
|||||||
rc_stringlist_free(types_nwua);
|
rc_stringlist_free(types_nwua);
|
||||||
rc_deptree_free(deptree);
|
rc_deptree_free(deptree);
|
||||||
free(runlevel);
|
free(runlevel);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static char
|
static char
|
||||||
@ -735,12 +737,6 @@ int main(int argc, char **argv)
|
|||||||
const char *bootlevel = NULL;
|
const char *bootlevel = NULL;
|
||||||
char *newlevel = NULL;
|
char *newlevel = NULL;
|
||||||
const char *systype = NULL;
|
const char *systype = NULL;
|
||||||
static RC_STRINGLIST *hotplugged_services;
|
|
||||||
static RC_STRINGLIST *stop_services;
|
|
||||||
static RC_STRINGLIST *start_services;
|
|
||||||
static RC_STRINGLIST *types_nw;
|
|
||||||
static RC_STRINGLIST *types_nwua;
|
|
||||||
static RC_DEPTREE *deptree;
|
|
||||||
RC_STRINGLIST *deporder = NULL;
|
RC_STRINGLIST *deporder = NULL;
|
||||||
RC_STRINGLIST *tmplist;
|
RC_STRINGLIST *tmplist;
|
||||||
RC_STRING *service;
|
RC_STRING *service;
|
||||||
|
@ -177,7 +177,6 @@ free_schedulelist(void)
|
|||||||
TAILQ_INIT(&schedule);
|
TAILQ_INIT(&schedule);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_MEMORY
|
|
||||||
static void
|
static void
|
||||||
cleanup(void)
|
cleanup(void)
|
||||||
{
|
{
|
||||||
@ -185,7 +184,6 @@ cleanup(void)
|
|||||||
free(nav);
|
free(nav);
|
||||||
free_schedulelist();
|
free_schedulelist();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
parse_signal(const char *sig)
|
parse_signal(const char *sig)
|
||||||
@ -688,9 +686,7 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
applet = basename_c(argv[0]);
|
applet = basename_c(argv[0]);
|
||||||
TAILQ_INIT(&schedule);
|
TAILQ_INIT(&schedule);
|
||||||
#ifdef DEBUG_MEMORY
|
|
||||||
atexit(cleanup);
|
atexit(cleanup);
|
||||||
#endif
|
|
||||||
|
|
||||||
signal_setup(SIGINT, handle_signal);
|
signal_setup(SIGINT, handle_signal);
|
||||||
signal_setup(SIGQUIT, handle_signal);
|
signal_setup(SIGQUIT, handle_signal);
|
||||||
|
Loading…
Reference in New Issue
Block a user