* [gentoo-commits] proj/openrc:master commit in: src/librc/, src/rc/
@ 2012-02-12 19:38 Christian Ruppert
0 siblings, 0 replies; 8+ messages in thread
From: Christian Ruppert @ 2012-02-12 19:38 UTC (permalink / raw
To: gentoo-commits
commit: 6913f1deb61b19ffa62614673794746caed443a7
Author: Christian Ruppert <idl0r <AT> gentoo <DOT> org>
AuthorDate: Sun Feb 12 19:37:05 2012 +0000
Commit: Christian Ruppert <idl0r <AT> gentoo <DOT> org>
CommitDate: Sun Feb 12 19:37:05 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=6913f1de
Fix some more warnings
---
src/librc/librc.c | 2 +-
src/rc/runscript.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/librc/librc.c b/src/librc/librc.c
index 13c1973..d82880f 100644
--- a/src/librc/librc.c
+++ b/src/librc/librc.c
@@ -492,7 +492,7 @@ rc_service_exists(const char *service)
{
char *file;
bool retval = false;
- int len;
+ size_t len;
struct stat buf;
if (!service) {
diff --git a/src/rc/runscript.c b/src/rc/runscript.c
index b0d8084..e504e4a 100644
--- a/src/rc/runscript.c
+++ b/src/rc/runscript.c
@@ -75,7 +75,7 @@
#define WARN_TIMEOUT 10 /* warn about this every N seconds */
static const char *applet;
-static char *service, *runlevel, *ibsave, *prefix;;
+static char *service, *runlevel, *ibsave, *prefix;
static RC_DEPTREE *deptree;
static RC_STRINGLIST *applet_list, *services, *tmplist;
static RC_STRINGLIST *restart_services, *need_services, *use_services;
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: src/librc/, src/rc/
@ 2012-03-26 20:17 William Hubbs
0 siblings, 0 replies; 8+ messages in thread
From: William Hubbs @ 2012-03-26 20:17 UTC (permalink / raw
To: gentoo-commits
commit: 300c03203dd5f9f525dc330d24bacc0e07f57766
Author: William Hubbs <williamh <AT> gentoo <DOT> org>
AuthorDate: Mon Mar 26 20:04:40 2012 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Mon Mar 26 20:04:40 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=300c0320
librc: Do not output error messages from within the library.
This fixes a compile issue. Also, it is cleaner to have the client
output error messages as opposed to having the library do this.
Reported-by: Ewoud Kohl van Wijngaarden <gentoo <AT> kohlvanwijngaarden.nl>
X-Gentoo-Bug: 409743
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=409743
---
src/librc/librc-misc.c | 12 +++---------
src/rc/rc.c | 7 +++++++
2 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/src/librc/librc-misc.c b/src/librc/librc-misc.c
index 06f97e7..b907c5c 100644
--- a/src/librc/librc-misc.c
+++ b/src/librc/librc-misc.c
@@ -29,7 +29,6 @@
*/
#include "librc.h"
-#include "einfo.h"
bool
rc_yesno(const char *value)
@@ -139,15 +138,13 @@ rc_proc_getent(const char *ent)
if (!exists("/proc/cmdline"))
return NULL;
- if (!(fp = fopen("/proc/cmdline", "r"))) {
- eerror("failed to open `/proc/cmdline': %s", strerror(errno));
+ if (!(fp = fopen("/proc/cmdline", "r")))
return NULL;
- }
proc = NULL;
i = 0;
if (rc_getline(&proc, &i, fp) == -1 || proc == NULL)
- eerror("rc_getline: %s", strerror(errno));
+ return NULL;
if (proc != NULL) {
len = strlen(ent);
@@ -394,13 +391,10 @@ rc_conf_value(const char *setting)
atexit(_free_rc_conf);
#endif
- /* Support old configs, but complain about it. */
+ /* Support old configs. */
if (exists(RC_CONF_OLD)) {
old = rc_config_load(RC_CONF_OLD);
TAILQ_CONCAT(rc_conf, old, entries);
- ewarn("Your system still has %s", RC_CONF_OLD);
- ewarn("Please migrate to the appropriate settings in %s", RC_CONF);
- ewarn("and delete %s.", RC_CONF_OLD);
#ifdef DEBUG_MEMORY
free(old);
#endif
diff --git a/src/rc/rc.c b/src/rc/rc.c
index 4cf0374..2590048 100644
--- a/src/rc/rc.c
+++ b/src/rc/rc.c
@@ -793,6 +793,13 @@ main(int argc, char **argv)
env_filter();
env_config();
+ /* complain about old configuration settings if they exist */
+ if (exists(RC_CONF_OLD)) {
+ ewarn("%s still exists on your system and should be removed.",
+ RC_CONF_OLD);
+ ewarn("Please migrate to the appropriate settings in %s", RC_CONF);
+ }
+
argc++;
argv--;
while ((opt = getopt_long(argc, argv, getoptstring,
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: src/librc/, src/rc/
@ 2013-09-20 20:00 William Hubbs
0 siblings, 0 replies; 8+ messages in thread
From: William Hubbs @ 2013-09-20 20:00 UTC (permalink / raw
To: gentoo-commits
commit: 7716bf31de5030b761613834e11e4e62f36403a5
Author: Alexander V Vershilov <qnikst <AT> gentoo <DOT> org>
AuthorDate: Wed Aug 7 07:03:51 2013 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Fri Sep 20 19:27:31 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=7716bf31
Fix stacked runlevel support
Patch was provided by Max Hacking <max.gentoo.bugzilla <AT> hacking.co.uk>
and slightly fixed by Alexander Vershilov <qnikst <AT> gentoo.org> and
William Hubbs <williamh <AT> gentoo.org>.
Fixes:
1). Rebase to newest OpenRC version.
2). Remove code style fixes. Port to currect code style.
3). Fix rc_runlevel_stack instead of introducing new function.
4). Make get_runlevel_chain a private function.
X-Gentoo-Bug: 467368
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=467368
---
src/librc/librc.c | 64 ++++++++++++++++++++++++-------------
src/rc/rc-status.c | 65 +++++++++++++++++++++----------------
src/rc/rc.c | 94 +++++++++++++++++++++++++++++++++++-------------------
3 files changed, 140 insertions(+), 83 deletions(-)
diff --git a/src/librc/librc.c b/src/librc/librc.c
index 40b975a..839fcd8 100644
--- a/src/librc/librc.c
+++ b/src/librc/librc.c
@@ -323,6 +323,42 @@ rc_parse_service_state(RC_SERVICE state)
return NULL;
}
+/* Returns a list of all the chained runlevels used by the
+ * specified runlevel in dependency order, including the
+ * specified runlevel. */
+static void
+get_runlevel_chain(const char *runlevel, RC_STRINGLIST *level_list)
+{
+ char path[PATH_MAX];
+ RC_STRINGLIST *dirs;
+ RC_STRING *d, *dn;
+
+ /*
+ * If we haven't been passed a runlevel or a level list, or
+ * if the passed runlevel doesn't exist then we're done already!
+ */
+ if (!runlevel || !level_list || !rc_runlevel_exists(runlevel))
+ return;
+
+ /*
+ * We want to add this runlevel to the list but if
+ * it is already in the list it needs to go at the
+ * end again.
+ */
+ if (rc_stringlist_find(level_list, runlevel))
+ rc_stringlist_delete(level_list, runlevel);
+ rc_stringlist_add(level_list, runlevel);
+
+ /*
+ * We can now do exactly the above procedure for our chained
+ * runlevels.
+ */
+ snprintf(path, sizeof(path), "%s/%s", RC_RUNLEVELDIR, runlevel);
+ dirs = ls_dir(path, LS_DIR);
+ TAILQ_FOREACH_SAFE(d, dirs, entries, dn)
+ get_runlevel_chain(d->value, level_list);
+}
+
bool
rc_runlevel_starting(void)
{
@@ -424,22 +460,10 @@ librc_hidden_def(rc_runlevel_unstack)
RC_STRINGLIST *
rc_runlevel_stacks(const char *runlevel)
{
- char path[PATH_MAX];
- RC_STRINGLIST *dirs;
- RC_STRING *d, *dn;
-
- if (!runlevel)
- return false;
- snprintf(path, sizeof(path), "%s/%s", RC_RUNLEVELDIR, runlevel);
- dirs = ls_dir(path, LS_DIR);
- TAILQ_FOREACH_SAFE(d, dirs, entries, dn) {
- if (!rc_runlevel_exists(d->value)) {
- TAILQ_REMOVE(dirs, d, entries);
- free(d->value);
- free(d);
- }
- }
- return dirs;
+ RC_STRINGLIST *stack;
+ stack = rc_stringlist_new();
+ get_runlevel_chain(runlevel, stack);
+ return stack;
}
librc_hidden_def(rc_runlevel_stacks)
@@ -903,17 +927,13 @@ rc_services_in_runlevel_stacked(const char *runlevel)
stacks = rc_runlevel_stacks(runlevel);
TAILQ_FOREACH(stack, stacks, entries) {
sl = rc_services_in_runlevel(stack->value);
- if (list != NULL) {
- TAILQ_CONCAT(list, sl, entries);
- free(sl);
- } else
- list = sl;
+ TAILQ_CONCAT(list, sl, entries);
+ free(sl);
}
return list;
}
librc_hidden_def(rc_services_in_runlevel_stacked)
-
RC_STRINGLIST *
rc_services_in_state(RC_SERVICE state)
{
diff --git a/src/rc/rc-status.c b/src/rc/rc-status.c
index d049216..d14dd63 100644
--- a/src/rc/rc-status.c
+++ b/src/rc/rc-status.c
@@ -171,6 +171,26 @@ print_services(const char *runlevel, RC_STRINGLIST *svcs)
rc_stringlist_free(l);
}
+static void
+print_stacked_services(const char *runlevel)
+{
+ RC_STRINGLIST *stackedlevels, *servicelist;
+ RC_STRING *stackedlevel;
+
+ stackedlevels = rc_runlevel_stacks(runlevel);
+ TAILQ_FOREACH(stackedlevel, stackedlevels, entries) {
+ if (rc_stringlist_find(levels, stackedlevel->value) != NULL)
+ continue;
+ print_level("Stacked", stackedlevel->value);
+ servicelist = rc_services_in_runlevel(stackedlevel->value);
+ print_services(stackedlevel->value, servicelist);
+ rc_stringlist_free(servicelist);
+ print_stacked_services(stackedlevel->value);
+ }
+ rc_stringlist_free(stackedlevels);
+ stackedlevels = NULL;
+}
+
#include "_usage.h"
#define usagestring "" \
"Usage: rc-status [options] <runlevel>...\n" \
@@ -199,7 +219,8 @@ static const char * const longopts_help[] = {
int
rc_status(int argc, char **argv)
{
- RC_STRING *s, *l, *t;
+ RC_STRING *s, *l, *t, *level;
+
char *p, *runlevel = NULL;
int opt, aflag = 0, retval = 0;
@@ -280,16 +301,7 @@ rc_status(int argc, char **argv)
print_level(NULL, l->value);
services = rc_services_in_runlevel(l->value);
print_services(l->value, services);
- nservices = rc_runlevel_stacks(l->value);
- TAILQ_FOREACH(s, nservices, entries) {
- if (rc_stringlist_find(levels, s->value) != NULL)
- continue;
- print_level("Stacked", s->value);
- sservices = rc_services_in_runlevel(s->value);
- print_services(s->value, sservices);
- rc_stringlist_free(sservices);
- }
- sservices = NULL;
+ print_stacked_services(l->value);
rc_stringlist_free(nservices);
nservices = NULL;
rc_stringlist_free(services);
@@ -317,16 +329,14 @@ rc_status(int argc, char **argv)
services = rc_services_in_runlevel(NULL);
sservices = rc_stringlist_new();
TAILQ_FOREACH(l, levels, entries) {
- nservices = rc_services_in_runlevel(l->value);
+ nservices = rc_services_in_runlevel_stacked(l->value);
TAILQ_CONCAT(sservices, nservices, entries);
free(nservices);
}
TAILQ_FOREACH_SAFE(s, services, entries, t) {
- if (rc_stringlist_find(sservices, s->value) ||
- rc_service_state(s->value) &
- (RC_SERVICE_STOPPED | RC_SERVICE_HOTPLUGGED))
- {
- TAILQ_REMOVE(services, s, entries);
+ if ((rc_stringlist_find(sservices, s->value) ||
+ (rc_service_state(s->value) & ( RC_SERVICE_STOPPED | RC_SERVICE_HOTPLUGGED)))) {
+ TAILQ_REMOVE(services, s, entries);
free(s->value);
free(s);
}
@@ -337,18 +347,17 @@ rc_status(int argc, char **argv)
alist = rc_stringlist_new();
l = rc_stringlist_add(alist, "");
p = l->value;
- if (!runlevel)
- runlevel = rc_runlevel_get();
- TAILQ_FOREACH_SAFE(s, services, entries, t) {
- l->value = s->value;
- unsetenv("RC_SVCNAME");
- setenv("RC_SVCNAME", l->value, 1);
- tmp = rc_deptree_depends(deptree, needsme, alist, runlevel, RC_DEP_TRACE);
- if (TAILQ_FIRST(tmp)) {
- TAILQ_REMOVE(services, s, entries);
- TAILQ_INSERT_TAIL(nservices, s, entries);
+ TAILQ_FOREACH(level, levels, entries) {
+ TAILQ_FOREACH_SAFE(s, services, entries, t) {
+ l->value = s->value;
+ setenv("RC_SVCNAME", l->value, 1);
+ tmp = rc_deptree_depends(deptree, needsme, alist, level->value, RC_DEP_TRACE);
+ if (TAILQ_FIRST(tmp)) {
+ TAILQ_REMOVE(services, s, entries);
+ TAILQ_INSERT_TAIL(nservices, s, entries);
+ }
+ rc_stringlist_free(tmp);
}
- rc_stringlist_free(tmp);
}
l->value = p;
/* we are unsetting RC_SVCNAME because last loaded service
diff --git a/src/rc/rc.c b/src/rc/rc.c
index 0e37182..0c98372 100644
--- a/src/rc/rc.c
+++ b/src/rc/rc.c
@@ -79,12 +79,6 @@ const char rc_copyright[] = "Copyright (c) 2007-2008 Roy Marples";
const char *applet = NULL;
static char *runlevel;
-static RC_STRINGLIST *hotplugged_services;
-static RC_STRINGLIST *stop_services;
-static RC_STRINGLIST *start_services;
-static RC_STRINGLIST *types_n;
-static RC_STRINGLIST *types_nua;
-static RC_DEPTREE *deptree;
static RC_HOOK hook_out;
struct termios *termios_orig = NULL;
@@ -524,7 +518,9 @@ runlevel_config(const char *service, const char *level)
}
static void
-do_stop_services(const char *newlevel, bool parallel, bool going_down)
+do_stop_services(const RC_STRINGLIST *types_n, const RC_STRINGLIST *start_services,
+ const RC_STRINGLIST *stop_services, const RC_DEPTREE *deptree,
+ const char *newlevel, bool parallel, bool going_down)
{
pid_t pid;
RC_STRING *service, *svc1, *svc2;
@@ -627,7 +623,7 @@ stop:
}
static void
-do_start_services(bool parallel)
+do_start_services(const RC_STRINGLIST *start_services, bool parallel)
{
RC_STRING *service;
pid_t pid;
@@ -754,6 +750,12 @@ main(int argc, char **argv)
{
const char *bootlevel = NULL;
char *newlevel = NULL;
+ static RC_STRINGLIST *hotplugged_services;
+ static RC_STRINGLIST *stop_services;
+ static RC_STRINGLIST *start_services;
+ static RC_STRINGLIST *types_n;
+ static RC_STRINGLIST *types_nua;
+ static RC_DEPTREE *deptree;
RC_STRINGLIST *deporder = NULL;
RC_STRINGLIST *tmplist;
RC_STRING *service;
@@ -868,7 +870,11 @@ main(int argc, char **argv)
snprintf(pidstr, sizeof(pidstr), "%d", getpid());
setenv("RC_PID", pidstr, 1);
- /* Load current runlevel */
+ /* Create a list of all services which should be started for the new or
+ * current runlevel including those in boot, sysinit and hotplugged
+ * runlevels. Clearly, some of these will already be started so we
+ * won't actually be starting them all.
+ */
bootlevel = getenv("RC_BOOTLEVEL");
runlevel = rc_runlevel_get();
@@ -972,8 +978,13 @@ main(int argc, char **argv)
applet, RC_STOPPING, strerror(errno));
}
- /* Build a list of all services to stop and then work out the
- * correct order for stopping them */
+ /* Create a list of all services which we could stop (assuming
+ * they won't be active in the new or current runlevel) including
+ * all those services which have been started, are inactive or
+ * are currently starting. Clearly, some of these will be listed
+ * in the new or current runlevel so we won't actually be stopping
+ * them all.
+ */
stop_services = rc_services_in_state(RC_SERVICE_STARTED);
tmplist = rc_services_in_state(RC_SERVICE_INACTIVE);
TAILQ_CONCAT(stop_services, tmplist, entries);
@@ -996,7 +1007,11 @@ main(int argc, char **argv)
stop_services = tmplist;
}
- /* Load our list of start services */
+ /* Create a list of all services which should be started for the new or
+ * current runlevel including those in boot, sysinit and hotplugged
+ * runlevels. Clearly, some of these will already be started so we
+ * won't actually be starting them all.
+ */
hotplugged_services = rc_services_in_state(RC_SERVICE_HOTPLUGGED);
start_services = rc_services_in_runlevel_stacked(newlevel ?
newlevel : runlevel);
@@ -1006,9 +1021,11 @@ main(int argc, char **argv)
tmplist = rc_services_in_runlevel(RC_LEVEL_SYSINIT);
TAILQ_CONCAT(start_services, tmplist, entries);
free(tmplist);
+ /* If we are NOT headed for the single-user runlevel... */
if (strcmp(newlevel ? newlevel : runlevel,
RC_LEVEL_SINGLE) != 0)
{
+ /* If we are NOT headed for the boot runlevel... */
if (strcmp(newlevel ? newlevel : runlevel,
bootlevel) != 0)
{
@@ -1029,7 +1046,7 @@ main(int argc, char **argv)
/* Now stop the services that shouldn't be running */
if (stop_services && !nostop)
- do_stop_services(newlevel, parallel, going_down);
+ do_stop_services(types_n, start_services, stop_services, deptree, newlevel, parallel, going_down);
/* Wait for our services to finish */
wait_for_services();
@@ -1065,18 +1082,10 @@ main(int argc, char **argv)
TAILQ_FOREACH(service, hotplugged_services, entries)
rc_service_mark(service->value, RC_SERVICE_HOTPLUGGED);
- /* Order the services to start */
- if (start_services) {
- rc_stringlist_sort(&start_services);
- deporder = rc_deptree_depends(deptree, types_nua,
- start_services, runlevel,
- depoptions | RC_DEP_START);
- rc_stringlist_free(start_services);
- start_services = deporder;
- }
-
#ifdef __linux__
- /* mark any services skipped as started */
+ /* If the "noinit" parameter was passed on the kernel command line then
+ * mark the specified services as started so they will not be started
+ * by us. */
proc = p = rc_proc_getent("noinit");
if (proc) {
while ((token = strsep(&p, ",")))
@@ -1085,19 +1094,38 @@ main(int argc, char **argv)
}
#endif
+ /* If we have a list of services to start then... */
if (start_services) {
- do_start_services(parallel);
- /* FIXME: If we skip the boot runlevel and go straight
- * to default from sysinit, we should now re-evaluate our
- * start services + hotplugged services and call
- * do_start_services a second time. */
-
- /* Wait for our services to finish */
- wait_for_services();
+ /* Get a list of the chained runlevels which compose the target runlevel */
+ RC_STRINGLIST *runlevel_chain = rc_runlevel_stacks(runlevel);
+
+ /* Loop through them in reverse order. */
+ RC_STRING *rlevel;
+ TAILQ_FOREACH_REVERSE(rlevel, runlevel_chain, rc_stringlist, entries)
+ {
+ /* Get a list of all the services in that runlevel */
+ RC_STRINGLIST *run_services = rc_services_in_runlevel(rlevel->value);
+
+ /* Start those services. */
+ rc_stringlist_sort(&run_services);
+ deporder = rc_deptree_depends(deptree, types_nua, run_services, rlevel->value, depoptions | RC_DEP_START);
+ rc_stringlist_free(run_services);
+ run_services = deporder;
+ do_start_services(run_services, parallel);
+
+ /* Wait for our services to finish */
+ wait_for_services();
+
+ /* Free the list of services, we're done with it. */
+ rc_stringlist_free(run_services);
+ }
+ rc_stringlist_free(runlevel_chain);
}
#ifdef __linux__
- /* mark any services skipped as stopped */
+ /* If the "noinit" parameter was passed on the kernel command line then
+ * mark the specified services as stopped so that our records reflect
+ * reality. */
proc = p = rc_proc_getent("noinit");
if (proc) {
while ((token = strsep(&p, ",")))
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: src/librc/, src/rc/
@ 2014-10-23 19:13 William Hubbs
0 siblings, 0 replies; 8+ messages in thread
From: William Hubbs @ 2014-10-23 19:13 UTC (permalink / raw
To: gentoo-commits
commit: 875f03e27c3475675f7b9572b071dd8c26257be7
Author: Svante Signell <svante.signell <AT> gmail <DOT> com>
AuthorDate: Wed Oct 22 19:59:01 2014 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Thu Oct 23 18:00:24 2014 +0000
URL: http://sources.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=875f03e2
fix defines for GNU/Hurd
---
src/librc/librc.h | 4 +++-
src/rc/mountinfo.c | 6 +++---
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/src/librc/librc.h b/src/librc/librc.h
index 54c9a1a..0824eba 100644
--- a/src/librc/librc.h
+++ b/src/librc/librc.h
@@ -57,11 +57,13 @@
#include <time.h>
#include <unistd.h>
-#ifdef BSD
+#if defined(BSD) && !defined(__GNU__)
#include <sys/param.h>
#include <sys/user.h>
#include <sys/sysctl.h>
#include <kvm.h>
+#else
+#include <sys/param.h>
#endif
#include "rc.h"
diff --git a/src/rc/mountinfo.c b/src/rc/mountinfo.c
index 7840987..c4515ae 100644
--- a/src/rc/mountinfo.c
+++ b/src/rc/mountinfo.c
@@ -35,11 +35,11 @@
# include <sys/ucred.h>
# include <sys/mount.h>
# define F_FLAGS f_flags
-#elif defined(BSD)
+#elif defined(BSD) && !defined(__GNU__)
# include <sys/statvfs.h>
# define statfs statvfs
# define F_FLAGS f_flag
-#elif defined (__linux__) || defined (__FreeBSD_kernel__)
+#elif defined (__linux__) || defined (__FreeBSD_kernel__) || defined(__GNU__)
# include <mntent.h>
#endif
@@ -168,7 +168,7 @@ process_mount(RC_STRINGLIST *list, struct args *args,
return -1;
}
-#ifdef BSD
+#if defined(BSD) && !defined(__GNU__)
/* Translate the mounted options to english
* This is taken directly from FreeBSD mount.c */
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: src/librc/, src/rc/
@ 2014-10-24 0:05 William Hubbs
0 siblings, 0 replies; 8+ messages in thread
From: William Hubbs @ 2014-10-24 0:05 UTC (permalink / raw
To: gentoo-commits
commit: ca6b86be44fc7ed618a7ab3bd021e208d38878b1
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Thu Oct 23 23:47:04 2014 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Thu Oct 23 23:47:24 2014 +0000
URL: http://sources.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=ca6b86be
Fix all tests for GNU/kFreeBSD
It is necessary to check for both the kernel and c library because
__FreeBSD_kernel is also defined on native FreeBSD [1].
[1] http://sourceforge.net/p/predef/wiki/OperatingSystems/
---
src/librc/librc-daemon.c | 2 +-
src/librc/rc.h.in | 3 ++-
src/rc/mountinfo.c | 6 ++++--
src/rc/rc-logger.c | 2 +-
src/rc/runscript.c | 3 ++-
5 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/src/librc/librc-daemon.c b/src/librc/librc-daemon.c
index 9970315..d19c3a3 100644
--- a/src/librc/librc-daemon.c
+++ b/src/librc/librc-daemon.c
@@ -30,7 +30,7 @@
#include "librc.h"
-#if defined(__linux__) || defined (__FreeBSD_kernel__)
+#if defined(__linux__) || (defined (__FreeBSD_kernel__) && defined(__GLIBC__))
static bool
pid_is_exec(pid_t pid, const char *exec)
{
diff --git a/src/librc/rc.h.in b/src/librc/rc.h.in
index 34f09f2..fca0dda 100644
--- a/src/librc/rc.h.in
+++ b/src/librc/rc.h.in
@@ -42,7 +42,8 @@ extern "C" {
#define RC_LIBEXECDIR "@LIBEXECDIR@"
#if defined(PREFIX)
#define RC_SVCDIR RC_LIBEXECDIR "/init.d"
-#elif defined(__linux__) || defined(__FreeBSD_kernel__) || defined(__GNU__)
+#elif defined(__linux__) || (defined(__FreeBSD_kernel__) && \
+ defined(__GLIBC__)) || defined(__GNU__)
#define RC_SVCDIR "/run/openrc"
#else
#define RC_SVCDIR RC_LIBEXECDIR "/init.d"
diff --git a/src/rc/mountinfo.c b/src/rc/mountinfo.c
index c4515ae..fbad6af 100644
--- a/src/rc/mountinfo.c
+++ b/src/rc/mountinfo.c
@@ -39,7 +39,8 @@
# include <sys/statvfs.h>
# define statfs statvfs
# define F_FLAGS f_flag
-#elif defined (__linux__) || defined (__FreeBSD_kernel__) || defined(__GNU__)
+#elif defined (__linux__) || (defined(__FreeBSD_kernel__) && \
+ defined(__GLIBC__)) || defined(__GNU__)
# include <mntent.h>
#endif
@@ -265,7 +266,8 @@ find_mounts(struct args *args)
return list;
}
-#elif defined (__linux__) || defined (__FreeBSD_kernel__)
+#elif defined (__linux__) || (defined (__FreeBSD_kernel__) && \
+ defined(__GLIBC__))
static struct mntent *
getmntfile(const char *file)
{
diff --git a/src/rc/rc-logger.c b/src/rc/rc-logger.c
index 50cf618..89eb84b 100644
--- a/src/rc/rc-logger.c
+++ b/src/rc/rc-logger.c
@@ -44,7 +44,7 @@
#include <time.h>
#include <unistd.h>
-#if defined(__linux__) || defined(__FreeBSD_kernel__)
+#if defined(__linux__) || (defined(__FreeBSD_kernel__) && defined(__GLIBC__))
# include <pty.h>
#elif defined(__NetBSD__) || defined(__OpenBSD__)
# include <util.h>
diff --git a/src/rc/runscript.c b/src/rc/runscript.c
index 96aa683..47ed23e 100644
--- a/src/rc/runscript.c
+++ b/src/rc/runscript.c
@@ -51,7 +51,8 @@
#include <time.h>
#include <unistd.h>
-#if defined(__linux__) || defined(__FreeBSD_kernel__)
+#if defined(__linux__) || (defined(__FreeBSD_kernel__) && \
+ defined(__GLIBC__))
# include <pty.h>
#elif defined(__NetBSD__) || defined(__OpenBSD__)
# include <util.h>
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: src/librc/, src/rc/
@ 2015-03-25 0:36 William Hubbs
0 siblings, 0 replies; 8+ messages in thread
From: William Hubbs @ 2015-03-25 0:36 UTC (permalink / raw
To: gentoo-commits
commit: f085ae400c60289f61d99e9e80ce037beedf38b4
Author: Doug Freed <dwfreed <AT> mtu <DOT> edu>
AuthorDate: Tue Mar 24 19:28:47 2015 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Wed Mar 25 00:08:29 2015 +0000
URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=f085ae40
Fix some compiler warnings
librc: Fix C90 warning (mixed declaration and code)
rc: Fix warning about discarding const qualifier
Fixes #45.
src/librc/librc-daemon.c | 6 ++++--
src/rc/rc.c | 2 +-
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/librc/librc-daemon.c b/src/librc/librc-daemon.c
index 76fdd7b..3811a04 100644
--- a/src/librc/librc-daemon.c
+++ b/src/librc/librc-daemon.c
@@ -510,6 +510,8 @@ rc_service_daemons_crashed(const char *service)
RC_STRINGLIST *list = NULL;
RC_STRING *s;
size_t i;
+ char *ch_root;
+ char *spidfile;
path += snprintf(dirpath, sizeof(dirpath), RC_SVCDIR "/daemons/%s",
basename_c(service));
@@ -554,8 +556,8 @@ rc_service_daemons_crashed(const char *service)
}
fclose(fp);
- char *ch_root = rc_service_value_get(basename_c(service), "chroot");
- char *spidfile = pidfile;
+ ch_root = rc_service_value_get(basename_c(service), "chroot");
+ spidfile = pidfile;
if (ch_root && pidfile) {
spidfile = xmalloc(strlen(ch_root) + strlen(pidfile) + 1);
strcpy(spidfile, ch_root);
diff --git a/src/rc/rc.c b/src/rc/rc.c
index e3301c6..dd35482 100644
--- a/src/rc/rc.c
+++ b/src/rc/rc.c
@@ -519,7 +519,7 @@ runlevel_config(const char *service, const char *level)
}
static void
-do_stop_services(const RC_STRINGLIST *types_n, const RC_STRINGLIST *start_services,
+do_stop_services(RC_STRINGLIST *types_n, RC_STRINGLIST *start_services,
const RC_STRINGLIST *stop_services, const RC_DEPTREE *deptree,
const char *newlevel, bool parallel, bool going_down)
{
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: src/librc/, src/rc/
@ 2015-11-11 19:45 William Hubbs
0 siblings, 0 replies; 8+ messages in thread
From: William Hubbs @ 2015-11-11 19:45 UTC (permalink / raw
To: gentoo-commits
commit: 085d77f17e3bedd23ffa96fe7e4eb8515ae8bfc6
Author: Benda Xu <heroxbd <AT> gentoo <DOT> org>
AuthorDate: Wed Nov 11 19:37:41 2015 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Wed Nov 11 19:37:41 2015 +0000
URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=085d77f1
Standardize macro tests for gnu hurd
This also fixes breakage of GNU/hurd builds introduced by commit 3f82edbeb92.
src/librc/librc-daemon.c | 3 ++-
src/rc/mountinfo.c | 8 ++++----
src/rc/openrc-run.c | 4 ++--
src/rc/rc-logger.c | 3 ++-
4 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/src/librc/librc-daemon.c b/src/librc/librc-daemon.c
index 4986f70..09b2ce3 100644
--- a/src/librc/librc-daemon.c
+++ b/src/librc/librc-daemon.c
@@ -31,7 +31,8 @@
#include "queue.h"
#include "librc.h"
-#if defined(__linux__) || (defined (__FreeBSD_kernel__) && defined(__GLIBC__))
+#if defined(__linux__) || (defined (__FreeBSD_kernel__) && defined(__GLIBC__)) \
+ || defined(__GNU__)
static bool
pid_is_exec(pid_t pid, const char *exec)
{
diff --git a/src/rc/mountinfo.c b/src/rc/mountinfo.c
index 3f1dfb6..8951c5a 100644
--- a/src/rc/mountinfo.c
+++ b/src/rc/mountinfo.c
@@ -39,8 +39,8 @@
# include <sys/statvfs.h>
# define statfs statvfs
# define F_FLAGS f_flag
-#elif defined (__linux__) || (defined(__FreeBSD_kernel__) && \
- defined(__GLIBC__)) || defined(__GNU__)
+#elif defined(__linux__) || (defined(__FreeBSD_kernel__) && \
+ defined(__GLIBC__)) || defined(__GNU__)
# include <mntent.h>
#endif
@@ -267,8 +267,8 @@ find_mounts(struct args *args)
return list;
}
-#elif defined (__linux__) || (defined (__FreeBSD_kernel__) && \
- defined(__GLIBC__))
+#elif defined(__linux__) || (defined(__FreeBSD_kernel__) && \
+ defined(__GLIBC__)) || defined(__GNU__)
static struct mntent *
getmntfile(const char *file)
{
diff --git a/src/rc/openrc-run.c b/src/rc/openrc-run.c
index f3a009e..2af95ec 100644
--- a/src/rc/openrc-run.c
+++ b/src/rc/openrc-run.c
@@ -51,8 +51,8 @@
#include <time.h>
#include <unistd.h>
-#if defined(__linux__) || (defined(__FreeBSD_kernel__) && \
- defined(__GLIBC__))
+#if defined(__linux__) || (defined(__FreeBSD_kernel__) && defined(__GLIBC__)) \
+ || defined(__GNU__)
# include <pty.h>
#elif defined(__NetBSD__) || defined(__OpenBSD__)
# include <util.h>
diff --git a/src/rc/rc-logger.c b/src/rc/rc-logger.c
index e72f181..894912f 100644
--- a/src/rc/rc-logger.c
+++ b/src/rc/rc-logger.c
@@ -44,7 +44,8 @@
#include <time.h>
#include <unistd.h>
-#if defined(__linux__) || (defined(__FreeBSD_kernel__) && defined(__GLIBC__))
+#if defined(__linux__) || (defined(__FreeBSD_kernel__) && defined(__GLIBC__)) \
+ || defined(__GNU__)
# include <pty.h>
#elif defined(__NetBSD__) || defined(__OpenBSD__)
# include <util.h>
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: src/librc/, src/rc/
@ 2015-12-08 18:43 William Hubbs
0 siblings, 0 replies; 8+ messages in thread
From: William Hubbs @ 2015-12-08 18:43 UTC (permalink / raw
To: gentoo-commits
commit: 9f6e05671d6d48faa7b83aec05a637bcdfcb3f82
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Mon Dec 7 23:56:02 2015 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Tue Dec 8 18:09:33 2015 +0000
URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=9f6e0567
Convert rc_sys() calls to detect_container() and detect_vm()
src/librc/librc-depend.c | 5 ++++-
src/rc/_usage.c | 5 ++++-
src/rc/rc-misc.c | 6 ++++--
src/rc/rc.c | 20 ++++++++++++++++----
4 files changed, 28 insertions(+), 8 deletions(-)
diff --git a/src/librc/librc-depend.c b/src/librc/librc-depend.c
index c9c06ad..14cf297 100644
--- a/src/librc/librc-depend.c
+++ b/src/librc/librc-depend.c
@@ -753,7 +753,7 @@ rc_deptree_update(void)
char *depend, *depends, *service, *type, *nosys, *onosys;
size_t i, k, l;
bool retval = true;
- const char *sys = rc_sys();
+ const char *sys = NULL;
struct utsname uts;
/* Some init scripts need RC_LIBEXECDIR to source stuff
@@ -860,6 +860,9 @@ rc_deptree_update(void)
/* Phase 2 - if we're a special system, remove services that don't
* work for them. This doesn't stop them from being run directly. */
+ sys = detect_container();
+ if (!sys)
+ sys = detect_vm();
if (sys) {
len = strlen(sys);
nosys = xmalloc(len + 2);
diff --git a/src/rc/_usage.c b/src/rc/_usage.c
index 2ab0fa6..a6bad4d 100644
--- a/src/rc/_usage.c
+++ b/src/rc/_usage.c
@@ -56,7 +56,10 @@ show_version(void)
const char *systype = NULL;
printf("%s (OpenRC", applet);
- if ((systype = rc_sys()))
+ systype = detect_container();
+ if (!systype)
+ systype = detect_vm();
+ if (systype)
printf(" [%s]", systype);
printf(") %s", VERSION);
#ifdef BRANDING
diff --git a/src/rc/rc-misc.c b/src/rc/rc-misc.c
index 1e2af0a..263c0ed 100644
--- a/src/rc/rc-misc.c
+++ b/src/rc/rc-misc.c
@@ -139,7 +139,7 @@ env_config(void)
char *np;
char *npp;
char *tok;
- const char *sys = rc_sys();
+ const char *sys = NULL;
char buffer[PATH_MAX];
/* Ensure our PATH is prefixed with the system locations first
@@ -190,7 +190,9 @@ env_config(void)
} else
setenv("RC_DEFAULTLEVEL", RC_LEVEL_DEFAULT, 1);
- if (sys)
+ sys = detect_container();
+ if (!sys)
+ sys = detect_vm();
setenv("RC_SYS", sys, 1);
#ifdef PREFIX
diff --git a/src/rc/rc.c b/src/rc/rc.c
index 8f69333..ddc3c78 100644
--- a/src/rc/rc.c
+++ b/src/rc/rc.c
@@ -274,7 +274,11 @@ open_shell(void)
struct passwd *pw;
#ifdef __linux__
- const char *sys = rc_sys();
+ const char *sys = NULL;
+
+ sys = detect_container();
+ if (!sys)
+ sys = detect_vm();
/* VSERVER and OPENVZ systems cannot really drop to shells */
if (sys &&
@@ -480,7 +484,10 @@ do_sysinit()
uts.machine);
#endif
- if ((sys = rc_sys()))
+ sys = detect_container();
+ if (!sys)
+ sys = detect_vm();
+ if (sys)
printf(" [%s]", sys);
printf("%s\n\n", ecolor(ECOLOR_NORMAL));
@@ -495,7 +502,10 @@ do_sysinit()
/* init may have mounted /proc so we can now detect or real
* sys */
- if ((sys = rc_sys()))
+ sys = detect_container();
+ if (!sys)
+ sys = detect_vm();
+ if (sys)
setenv("RC_SYS", sys, 1);
}
@@ -846,7 +856,9 @@ main(int argc, char **argv)
eerrorx("%s: %s", applet, strerror(errno));
/* NOTREACHED */
case 'S':
- systype = rc_sys();
+ systype = detect_container();
+ if (!systype)
+ systype = detect_vm();
if (systype)
printf("%s\n", systype);
exit(EXIT_SUCCESS);
^ permalink raw reply related [flat|nested] 8+ messages in thread
end of thread, other threads:[~2015-12-08 18:44 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-11 19:45 [gentoo-commits] proj/openrc:master commit in: src/librc/, src/rc/ William Hubbs
-- strict thread matches above, loose matches on Subject: below --
2015-12-08 18:43 William Hubbs
2015-03-25 0:36 William Hubbs
2014-10-24 0:05 William Hubbs
2014-10-23 19:13 William Hubbs
2013-09-20 20:00 William Hubbs
2012-03-26 20:17 William Hubbs
2012-02-12 19:38 Christian Ruppert
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox