[systemd-commits] 3 commits - TODO src/core src/shared
Lennart Poettering
lennart at kemper.freedesktop.org
Tue Mar 4 17:31:16 PST 2014
TODO | 5 +++++
src/core/dbus-execute.c | 11 ++++++++---
src/core/execute.c | 2 +-
src/core/execute.h | 3 ++-
src/core/main.c | 2 +-
src/core/manager.c | 4 ++--
src/core/manager.h | 2 +-
src/core/unit.c | 2 +-
src/shared/missing.h | 3 +++
src/shared/util.c | 3 ++-
10 files changed, 26 insertions(+), 11 deletions(-)
New commits:
commit efc141b8ffbfa1e449da40ce27fccaa81428f779
Author: Lennart Poettering <lennart at poettering.net>
Date: Wed Mar 5 02:30:47 2014 +0100
update TODO
diff --git a/TODO b/TODO
index 3c950d6..07fd738 100644
--- a/TODO
+++ b/TODO
@@ -27,6 +27,11 @@ External:
Features:
+* improve journalctl performance by loading journal files
+ lazily. Encode just enough information in the file name, so that we
+ don't have to open it to know that it is not interesting for us, for
+ the most common operations.
+
* support transient mount units
* Imply DevicePolicy=closed when PrivateDevices= is used
commit 517d56b1d0f67dcf76710bc1e17b05518b8cabe6
Author: Lennart Poettering <lennart at poettering.net>
Date: Wed Mar 5 02:29:58 2014 +0100
missing: if RLIMIT_RTTIME is not defined by the libc, then we need a new define for the max number of rlimits, too
diff --git a/src/core/execute.c b/src/core/execute.c
index fec4b3b..ca807dc 100644
--- a/src/core/execute.c
+++ b/src/core/execute.c
@@ -1676,7 +1676,7 @@ int exec_spawn(ExecCommand *command,
if (apply_permissions) {
- for (i = 0; i < RLIMIT_NLIMITS; i++) {
+ for (i = 0; i < _RLIMIT_MAX; i++) {
if (!context->rlimit[i])
continue;
diff --git a/src/core/execute.h b/src/core/execute.h
index 2c5d8bb..a333657 100644
--- a/src/core/execute.h
+++ b/src/core/execute.h
@@ -38,6 +38,7 @@ typedef struct ExecRuntime ExecRuntime;
#include "util.h"
#include "set.h"
#include "fdset.h"
+#include "missing.h"
typedef enum ExecInput {
EXEC_INPUT_NULL,
@@ -93,7 +94,7 @@ struct ExecContext {
char **environment;
char **environment_files;
- struct rlimit *rlimit[RLIMIT_NLIMITS];
+ struct rlimit *rlimit[_RLIMIT_MAX];
char *working_directory, *root_directory;
mode_t umask;
diff --git a/src/core/main.c b/src/core/main.c
index 4ca847c..25ddafe 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -105,7 +105,7 @@ static unsigned arg_default_start_limit_burst = DEFAULT_START_LIMIT_BURST;
static usec_t arg_runtime_watchdog = 0;
static usec_t arg_shutdown_watchdog = 10 * USEC_PER_MINUTE;
static char **arg_default_environment = NULL;
-static struct rlimit *arg_default_rlimit[RLIMIT_NLIMITS] = {};
+static struct rlimit *arg_default_rlimit[_RLIMIT_MAX] = {};
static uint64_t arg_capability_bounding_set_drop = 0;
static nsec_t arg_timer_slack_nsec = (nsec_t) -1;
static Set* arg_syscall_archs = NULL;
diff --git a/src/core/manager.c b/src/core/manager.c
index 822c7cc..e4d0368 100644
--- a/src/core/manager.c
+++ b/src/core/manager.c
@@ -810,7 +810,7 @@ void manager_free(Manager *m) {
free(m->switch_root);
free(m->switch_root_init);
- for (i = 0; i < RLIMIT_NLIMITS; i++)
+ for (i = 0; i < _RLIMIT_MAX; i++)
free(m->rlimit[i]);
assert(hashmap_isempty(m->units_requiring_mounts_for));
@@ -2728,7 +2728,7 @@ int manager_set_default_rlimits(Manager *m, struct rlimit **default_rlimit) {
assert(m);
- for (i = 0; i < RLIMIT_NLIMITS; i++) {
+ for (i = 0; i < _RLIMIT_MAX; i++) {
if (!default_rlimit[i])
continue;
diff --git a/src/core/manager.h b/src/core/manager.h
index 92985ca..e014abd 100644
--- a/src/core/manager.h
+++ b/src/core/manager.h
@@ -228,7 +228,7 @@ struct Manager {
bool default_memory_accounting;
bool default_blockio_accounting;
- struct rlimit *rlimit[RLIMIT_NLIMITS];
+ struct rlimit *rlimit[_RLIMIT_MAX];
/* non-zero if we are reloading or reexecuting, */
int n_reloading;
diff --git a/src/core/unit.c b/src/core/unit.c
index d0e9159..2437ee3 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -2803,7 +2803,7 @@ int unit_exec_context_patch_defaults(Unit *u, ExecContext *c) {
* _after_ the rest of the settings have been initialized */
/* This only copies in the ones that need memory */
- for (i = 0; i < RLIMIT_NLIMITS; i++)
+ for (i = 0; i < _RLIMIT_MAX; i++)
if (u->manager->rlimit[i] && !c->rlimit[i]) {
c->rlimit[i] = newdup(struct rlimit, u->manager->rlimit[i], 1);
if (!c->rlimit[i])
diff --git a/src/shared/missing.h b/src/shared/missing.h
index 06c69da..4e63fb9 100644
--- a/src/shared/missing.h
+++ b/src/shared/missing.h
@@ -47,6 +47,9 @@
#define RLIMIT_RTTIME 15
#endif
+/* If RLIMIT_RTTIME is not defined, then we cannot use RLIMIT_NLIMITS as is */
+#define _RLIMIT_MAX (RLIMIT_RTTIME+1 > RLIMIT_NLIMITS ? RLIMIT_RTTIME+1 : RLIMIT_NLIMITS)
+
#ifndef F_LINUX_SPECIFIC_BASE
#define F_LINUX_SPECIFIC_BASE 1024
#endif
diff --git a/src/shared/util.c b/src/shared/util.c
index 10daff3..8c7cfbd 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -83,6 +83,7 @@
#include "gunicode.h"
#include "virt.h"
#include "def.h"
+#include "missing.h"
int saved_argc = 0;
char **saved_argv = NULL;
@@ -4713,7 +4714,7 @@ static const char* const sched_policy_table[] = {
DEFINE_STRING_TABLE_LOOKUP_WITH_FALLBACK(sched_policy, int, INT_MAX);
-static const char* const rlimit_table[] = {
+static const char* const rlimit_table[_RLIMIT_MAX] = {
[RLIMIT_CPU] = "LimitCPU",
[RLIMIT_FSIZE] = "LimitFSIZE",
[RLIMIT_DATA] = "LimitDATA",
commit a049d1a9723b6608e45bf8f1a64dab5761dee555
Author: Lennart Poettering <lennart at poettering.net>
Date: Wed Mar 5 02:27:37 2014 +0100
core: when passing resource limit values to client, map RLIM_INFINITY into portable value (uint64_t) -1
diff --git a/src/core/dbus-execute.c b/src/core/dbus-execute.c
index 3a05303..4c3ad65 100644
--- a/src/core/dbus-execute.c
+++ b/src/core/dbus-execute.c
@@ -87,6 +87,7 @@ static int property_get_rlimit(
struct rlimit *rl;
uint64_t u;
+ rlim_t x;
assert(bus);
assert(reply);
@@ -94,7 +95,7 @@ static int property_get_rlimit(
rl = *(struct rlimit**) userdata;
if (rl)
- u = (uint64_t) rl->rlim_max;
+ x = rl->rlim_max;
else {
struct rlimit buf = {};
int z;
@@ -103,10 +104,14 @@ static int property_get_rlimit(
assert(z >= 0);
getrlimit(z, &buf);
-
- u = (uint64_t) buf.rlim_max;
+ x = buf.rlim_max;
}
+ /* rlim_t might have different sizes, let's map
+ * RLIMIT_INFINITY to (uint64_t) -1, so that it is the same on
+ * all archs */
+ u = x == RLIM_INFINITY ? (uint64_t) -1 : (uint64_t) x;
+
return sd_bus_message_append(reply, "t", u);
}
More information about the systemd-commits
mailing list