[systemd-commits] 14 commits - man/systemd.unit.xml src/journal src/nspawn.c src/virt.c TODO
Lennart Poettering
lennart at kemper.freedesktop.org
Wed Mar 14 19:01:41 PDT 2012
TODO | 10 ++
man/systemd.unit.xml | 3
src/journal/journal-file.c | 155 ++++++++++++++++++++++++++++++++++-----------
src/journal/journal-file.h | 2
src/journal/journalctl.c | 2
src/journal/journald.c | 44 ++++++++----
src/nspawn.c | 10 ++
src/virt.c | 29 --------
8 files changed, 174 insertions(+), 81 deletions(-)
New commits:
commit 27d1ae066c31e01a2eaea82759f1ad71e86e0bac
Author: Lennart Poettering <lennart at poettering.net>
Date: Thu Mar 15 03:00:54 2012 +0100
journald: don't try to roatet corrupted files when we open read-only anyway
diff --git a/src/journal/journald.c b/src/journal/journald.c
index 93cdec6..74a58b0 100644
--- a/src/journal/journald.c
+++ b/src/journal/journald.c
@@ -1918,7 +1918,7 @@ static int system_journal_open(Server *s) {
* if it already exists, so that we can flush
* it into the system journal */
- r = journal_file_open_reliably(fn, O_RDWR, 0640, NULL, &s->runtime_journal);
+ r = journal_file_open(fn, O_RDWR, 0640, NULL, &s->runtime_journal);
free(fn);
if (r < 0) {
commit 5e62067d08d989ab98b12497a9b27a877de8515b
Author: Lennart Poettering <lennart at poettering.net>
Date: Thu Mar 15 03:00:31 2012 +0100
journald: adjust permissions for rotated files
diff --git a/src/journal/journald.c b/src/journal/journald.c
index e5bcc26..93cdec6 100644
--- a/src/journal/journald.c
+++ b/src/journal/journald.c
@@ -334,20 +334,26 @@ static void server_rotate(Server *s) {
r = journal_file_rotate(&s->runtime_journal);
if (r < 0)
log_error("Failed to rotate %s: %s", s->runtime_journal->path, strerror(-r));
+ else
+ server_fix_perms(s, s->runtime_journal, 0);
}
if (s->system_journal) {
r = journal_file_rotate(&s->system_journal);
if (r < 0)
log_error("Failed to rotate %s: %s", s->system_journal->path, strerror(-r));
+ else
+ server_fix_perms(s, s->system_journal, 0);
}
HASHMAP_FOREACH_KEY(f, k, s->user_journals, i) {
r = journal_file_rotate(&f);
if (r < 0)
log_error("Failed to rotate %s: %s", f->path, strerror(-r));
- else
+ else {
hashmap_replace(s->user_journals, k, f);
+ server_fix_perms(s, s->system_journal, PTR_TO_UINT32(k));
+ }
}
}
commit c042179388f329fb1e45b00e1a533a0dc27fb9ae
Author: Lennart Poettering <lennart at poettering.net>
Date: Thu Mar 15 03:00:11 2012 +0100
journald: take corrupted files into account when calculating disk space
diff --git a/src/journal/journald.c b/src/journal/journald.c
index ee270e7..e5bcc26 100644
--- a/src/journal/journald.c
+++ b/src/journal/journald.c
@@ -165,7 +165,8 @@ static uint64_t available_space(Server *s) {
if (!de)
break;
- if (!dirent_is_file_with_suffix(de, ".journal"))
+ if (!endswith(de->d_name, ".journal") &&
+ !endswith(de->d_name, ".journal~"))
continue;
if (fstatat(dirfd(d), de->d_name, &st, AT_SYMLINK_NOFOLLOW) < 0)
commit e7bf07b3d444dddf67503df56acfbdbbe3e5261a
Author: Lennart Poettering <lennart at poettering.net>
Date: Thu Mar 15 02:59:43 2012 +0100
journald: be a bit more verbose
diff --git a/src/journal/journal-file.c b/src/journal/journal-file.c
index 41430f3..4e082f3 100644
--- a/src/journal/journal-file.c
+++ b/src/journal/journal-file.c
@@ -2094,7 +2094,7 @@ int journal_directory_vacuum(const char *directory, uint64_t max_use, uint64_t m
break;
if (unlinkat(dirfd(d), list[i].filename, 0) >= 0) {
- log_debug("Deleted archived journal %s/%s.", directory, list[i].filename);
+ log_info("Deleted archived journal %s/%s.", directory, list[i].filename);
sum -= list[i].usage;
} else if (errno != ENOENT)
log_warning("Failed to delete %s/%s: %m", directory, list[i].filename);
@@ -2262,9 +2262,9 @@ void journal_default_metrics(JournalMetrics *m, int fd) {
m->keep_free = DEFAULT_KEEP_FREE;
}
- log_debug("Fixed max_use=%s max_size=%s min_size=%s keep_free=%s",
- format_bytes(a, sizeof(a), m->max_use),
- format_bytes(b, sizeof(b), m->max_size),
- format_bytes(c, sizeof(c), m->min_size),
- format_bytes(d, sizeof(d), m->keep_free));
+ log_info("Fixed max_use=%s max_size=%s min_size=%s keep_free=%s",
+ format_bytes(a, sizeof(a), m->max_use),
+ format_bytes(b, sizeof(b), m->max_size),
+ format_bytes(c, sizeof(c), m->min_size),
+ format_bytes(d, sizeof(d), m->keep_free));
}
commit a3a52c0fd0c2597bf8233730c3ed3408affe0c9f
Author: Lennart Poettering <lennart at poettering.net>
Date: Thu Mar 15 02:59:10 2012 +0100
journald: fix calculation of disk space
diff --git a/src/journal/journal-file.c b/src/journal/journal-file.c
index a784a33..41430f3 100644
--- a/src/journal/journal-file.c
+++ b/src/journal/journal-file.c
@@ -2068,7 +2068,7 @@ int journal_directory_vacuum(const char *directory, uint64_t max_use, uint64_t m
}
list[n_list].filename = p;
- list[n_list].usage = (uint64_t) st.st_blksize * (uint64_t) st.st_blocks;
+ list[n_list].usage = 512UL * (uint64_t) st.st_blocks;
list[n_list].seqnum = seqnum;
list[n_list].realtime = realtime;
list[n_list].seqnum_id = seqnum_id;
diff --git a/src/journal/journald.c b/src/journal/journald.c
index fb298be..ee270e7 100644
--- a/src/journal/journald.c
+++ b/src/journal/journald.c
@@ -171,7 +171,10 @@ static uint64_t available_space(Server *s) {
if (fstatat(dirfd(d), de->d_name, &st, AT_SYMLINK_NOFOLLOW) < 0)
continue;
- sum += (uint64_t) st.st_blocks * (uint64_t) st.st_blksize;
+ if (!S_ISREG(st.st_mode))
+ continue;
+
+ sum += (uint64_t) st.st_blocks * 512UL;
}
avail = sum >= m->max_use ? 0 : m->max_use - sum;
commit 15944db87130f9b58565023c46c22bd73b0b71be
Author: Lennart Poettering <lennart at poettering.net>
Date: Thu Mar 15 02:58:27 2012 +0100
journald: copy metrics/compression state from template when rotating
diff --git a/src/journal/journal-file.c b/src/journal/journal-file.c
index 7f5d7c2..a784a33 100644
--- a/src/journal/journal-file.c
+++ b/src/journal/journal-file.c
@@ -1740,6 +1740,11 @@ int journal_file_open(
f->writable = (flags & O_ACCMODE) != O_RDONLY;
f->prot = prot_from_flags(flags);
+ if (template) {
+ f->metrics = template->metrics;
+ f->compress = template->compress;
+ }
+
f->path = strdup(fname);
if (!f->path) {
r = -ENOMEM;
diff --git a/src/journal/journald.c b/src/journal/journald.c
index e9ac897..fb298be 100644
--- a/src/journal/journald.c
+++ b/src/journal/journald.c
@@ -308,8 +308,6 @@ static JournalFile* find_journal(Server *s, uid_t uid) {
return s->system_journal;
server_fix_perms(s, f, uid);
- f->metrics = s->system_metrics;
- f->compress = s->compress;
r = hashmap_put(s->user_journals, UINT32_TO_PTR(uid), f);
if (r < 0) {
commit 71100051c5d351daac20610f3a4b8c14901088d8
Author: Lennart Poettering <lennart at poettering.net>
Date: Thu Mar 15 02:57:39 2012 +0100
journald: increase max file size to 128MB
diff --git a/TODO b/TODO
index 4936fde..60760d9 100644
--- a/TODO
+++ b/TODO
@@ -18,6 +18,8 @@ Bugfixes:
Features:
+* journald: make configurable "store-on-var", "store-on-run", "dont-store", "auto"
+
* Add ConditionReadWriteFileSystem= so that systemd-sysctl doesn't get executed when /proc/sys is read-only
* unset container= and container_uuid= for child processes
diff --git a/src/journal/journal-file.c b/src/journal/journal-file.c
index c3b56dd..7f5d7c2 100644
--- a/src/journal/journal-file.c
+++ b/src/journal/journal-file.c
@@ -48,7 +48,7 @@
#define DEFAULT_MAX_USE_UPPER (4ULL*1024ULL*1024ULL*1024ULL) /* 4 GiB */
/* This is the upper bound if we deduce max_size from max_use */
-#define DEFAULT_MAX_SIZE_UPPER (16ULL*1024ULL*1024ULL) /* 16 MiB */
+#define DEFAULT_MAX_SIZE_UPPER (128ULL*1024ULL*1024ULL) /* 128 MiB */
/* This is the upper bound if we deduce the keep_free value from the
* file system size */
commit 5c70eab445bd1af346fea4e05f1249956223b45c
Author: Lennart Poettering <lennart at poettering.net>
Date: Thu Mar 15 01:35:03 2012 +0100
journal: vacuum corrupted files, too
diff --git a/src/journal/journal-file.c b/src/journal/journal-file.c
index 1e6d78c..c3b56dd 100644
--- a/src/journal/journal-file.c
+++ b/src/journal/journal-file.c
@@ -1891,6 +1891,8 @@ int journal_file_open_reliably(
if (!(flags & O_CREAT))
return r;
+ /* The file is corrupted. Rotate it away and try it again (but only once) */
+
l = strlen(fname);
if (asprintf(&p, "%.*s@%016llx-%016llx.journal~",
(int) (l-8), fname,
@@ -1915,6 +1917,8 @@ struct vacuum_info {
uint64_t realtime;
sd_id128_t seqnum_id;
uint64_t seqnum;
+
+ bool have_seqnum;
};
static int vacuum_compare(const void *_a, const void *_b) {
@@ -1923,7 +1927,8 @@ static int vacuum_compare(const void *_a, const void *_b) {
a = _a;
b = _b;
- if (sd_id128_equal(a->seqnum_id, b->seqnum_id)) {
+ if (a->have_seqnum && b->have_seqnum &&
+ sd_id128_equal(a->seqnum_id, b->seqnum_id)) {
if (a->seqnum < b->seqnum)
return -1;
else if (a->seqnum > b->seqnum)
@@ -1936,8 +1941,10 @@ static int vacuum_compare(const void *_a, const void *_b) {
return -1;
else if (a->realtime > b->realtime)
return 1;
- else
+ else if (a->have_seqnum && b->have_seqnum)
return memcmp(&a->seqnum_id, &b->seqnum_id, 16);
+ else
+ return strcmp(a->filename, b->filename);
}
int journal_directory_vacuum(const char *directory, uint64_t max_use, uint64_t min_free) {
@@ -1964,6 +1971,7 @@ int journal_directory_vacuum(const char *directory, uint64_t max_use, uint64_t m
char *p;
unsigned long long seqnum, realtime;
sd_id128_t seqnum_id;
+ bool have_seqnum;
k = readdir_r(d, &buf, &de);
if (k != 0) {
@@ -1974,41 +1982,71 @@ int journal_directory_vacuum(const char *directory, uint64_t max_use, uint64_t m
if (!de)
break;
- if (!dirent_is_file_with_suffix(de, ".journal"))
+ if (fstatat(dirfd(d), de->d_name, &st, AT_SYMLINK_NOFOLLOW) < 0)
+ continue;
+
+ if (!S_ISREG(st.st_mode))
continue;
q = strlen(de->d_name);
- if (q < 1 + 32 + 1 + 16 + 1 + 16 + 8)
- continue;
+ if (endswith(de->d_name, ".journal")) {
- if (de->d_name[q-8-16-1] != '-' ||
- de->d_name[q-8-16-1-16-1] != '-' ||
- de->d_name[q-8-16-1-16-1-32-1] != '@')
- continue;
+ /* Vacuum archived files */
- if (fstatat(dirfd(d), de->d_name, &st, AT_SYMLINK_NOFOLLOW) < 0)
- continue;
+ if (q < 1 + 32 + 1 + 16 + 1 + 16 + 8)
+ continue;
- if (!S_ISREG(st.st_mode))
- continue;
+ if (de->d_name[q-8-16-1] != '-' ||
+ de->d_name[q-8-16-1-16-1] != '-' ||
+ de->d_name[q-8-16-1-16-1-32-1] != '@')
+ continue;
- p = strdup(de->d_name);
- if (!p) {
- r = -ENOMEM;
- goto finish;
- }
+ p = strdup(de->d_name);
+ if (!p) {
+ r = -ENOMEM;
+ goto finish;
+ }
- de->d_name[q-8-16-1-16-1] = 0;
- if (sd_id128_from_string(de->d_name + q-8-16-1-16-1-32, &seqnum_id) < 0) {
- free(p);
- continue;
- }
+ de->d_name[q-8-16-1-16-1] = 0;
+ if (sd_id128_from_string(de->d_name + q-8-16-1-16-1-32, &seqnum_id) < 0) {
+ free(p);
+ continue;
+ }
+
+ if (sscanf(de->d_name + q-8-16-1-16, "%16llx-%16llx.journal", &seqnum, &realtime) != 2) {
+ free(p);
+ continue;
+ }
+
+ have_seqnum = true;
+
+ } else if (endswith(de->d_name, ".journal~")) {
+ unsigned long long tmp;
+
+ /* Vacuum corrupted files */
+
+ if (q < 1 + 16 + 1 + 16 + 8 + 1)
+ continue;
- if (sscanf(de->d_name + q-8-16-1-16, "%16llx-%16llx.journal", &seqnum, &realtime) != 2) {
- free(p);
+ if (de->d_name[q-1-8-16-1] != '-' ||
+ de->d_name[q-1-8-16-1-16-1] != '@')
+ continue;
+
+ p = strdup(de->d_name);
+ if (!p) {
+ r = -ENOMEM;
+ goto finish;
+ }
+
+ if (sscanf(de->d_name + q-1-8-16-1-16, "%16llx-%16llx.journal~", &realtime, &tmp) != 2) {
+ free(p);
+ continue;
+ }
+
+ have_seqnum = false;
+ } else
continue;
- }
if (n_list >= n_allocated) {
struct vacuum_info *j;
@@ -2029,6 +2067,7 @@ int journal_directory_vacuum(const char *directory, uint64_t max_use, uint64_t m
list[n_list].seqnum = seqnum;
list[n_list].realtime = realtime;
list[n_list].seqnum_id = seqnum_id;
+ list[n_list].have_seqnum = have_seqnum;
sum += list[n_list].usage;
commit 9447a7f1de5e5798cf324ef26579d0dd7e601203
Author: Lennart Poettering <lennart at poettering.net>
Date: Thu Mar 15 01:13:01 2012 +0100
journal: if we encounter a corrupted file, rotate and go on
diff --git a/src/journal/journal-file.c b/src/journal/journal-file.c
index 8c17620..1e6d78c 100644
--- a/src/journal/journal-file.c
+++ b/src/journal/journal-file.c
@@ -1727,6 +1727,9 @@ int journal_file_open(
(flags & O_ACCMODE) != O_RDWR)
return -EINVAL;
+ if (!endswith(fname, ".journal"))
+ return -EINVAL;
+
f = new0(JournalFile, 1);
if (!f)
return -ENOMEM;
@@ -1840,7 +1843,7 @@ int journal_file_rotate(JournalFile **f) {
l = strlen(old_file->path);
- p = new(char, l + 1 + 16 + 1 + 32 + 1 + 16 + 1);
+ p = new(char, l + 1 + 32 + 1 + 16 + 1 + 16 + 1);
if (!p)
return -ENOMEM;
@@ -1867,6 +1870,44 @@ int journal_file_rotate(JournalFile **f) {
return r;
}
+int journal_file_open_reliably(
+ const char *fname,
+ int flags,
+ mode_t mode,
+ JournalFile *template,
+ JournalFile **ret) {
+
+ int r;
+ size_t l;
+ char *p;
+
+ r = journal_file_open(fname, flags, mode, template, ret);
+ if (r != -EBADMSG)
+ return r;
+
+ if ((flags & O_ACCMODE) == O_RDONLY)
+ return r;
+
+ if (!(flags & O_CREAT))
+ return r;
+
+ l = strlen(fname);
+ if (asprintf(&p, "%.*s@%016llx-%016llx.journal~",
+ (int) (l-8), fname,
+ (unsigned long long) now(CLOCK_REALTIME),
+ random_ull()) < 0)
+ return -ENOMEM;
+
+ r = rename(fname, p);
+ free(p);
+ if (r < 0)
+ return -errno;
+
+ log_warning("File %s corrupted, renaming and replacing.", fname);
+
+ return journal_file_open(fname, flags, mode, template, ret);
+}
+
struct vacuum_info {
off_t usage;
char *filename;
diff --git a/src/journal/journal-file.h b/src/journal/journal-file.h
index 4ef4a14..4d6e140 100644
--- a/src/journal/journal-file.h
+++ b/src/journal/journal-file.h
@@ -89,6 +89,8 @@ typedef enum direction {
int journal_file_open(const char *fname, int flags, mode_t mode, JournalFile *template, JournalFile **ret);
void journal_file_close(JournalFile *j);
+int journal_file_open_reliably(const char *fname, int flags, mode_t mode, JournalFile *template, JournalFile **ret);
+
int journal_file_move_to_object(JournalFile *f, int type, uint64_t offset, Object **ret);
uint64_t journal_file_entry_n_items(Object *o);
diff --git a/src/journal/journald.c b/src/journal/journald.c
index 37e6484..e9ac897 100644
--- a/src/journal/journald.c
+++ b/src/journal/journald.c
@@ -301,7 +301,7 @@ static JournalFile* find_journal(Server *s, uid_t uid) {
journal_file_close(f);
}
- r = journal_file_open(p, O_RDWR|O_CREAT, 0640, s->system_journal, &f);
+ r = journal_file_open_reliably(p, O_RDWR|O_CREAT, 0640, s->system_journal, &f);
free(p);
if (r < 0)
@@ -604,8 +604,12 @@ retry:
else {
r = journal_file_append_entry(f, NULL, iovec, n, &s->seqnum, NULL, NULL);
- if (r == -E2BIG && !vacuumed) {
- log_info("Allocation limit reached.");
+ if ((r == -EBADMSG || r == -E2BIG) && !vacuumed) {
+
+ if (r == -E2BIG)
+ log_info("Allocation limit reached, rotating.");
+ else
+ log_warning("Journal file corrupted, rotating.");
server_rotate(s);
server_vacuum(s);
@@ -1875,7 +1879,7 @@ static int system_journal_open(Server *s) {
if (!fn)
return -ENOMEM;
- r = journal_file_open(fn, O_RDWR|O_CREAT, 0640, NULL, &s->system_journal);
+ r = journal_file_open_reliably(fn, O_RDWR|O_CREAT, 0640, NULL, &s->system_journal);
free(fn);
if (r >= 0) {
@@ -1906,7 +1910,7 @@ static int system_journal_open(Server *s) {
* if it already exists, so that we can flush
* it into the system journal */
- r = journal_file_open(fn, O_RDWR, 0640, NULL, &s->runtime_journal);
+ r = journal_file_open_reliably(fn, O_RDWR, 0640, NULL, &s->runtime_journal);
free(fn);
if (r < 0) {
@@ -1922,7 +1926,7 @@ static int system_journal_open(Server *s) {
* it if necessary. */
(void) mkdir_parents(fn, 0755);
- r = journal_file_open(fn, O_RDWR|O_CREAT, 0640, NULL, &s->runtime_journal);
+ r = journal_file_open_reliably(fn, O_RDWR|O_CREAT, 0640, NULL, &s->runtime_journal);
free(fn);
if (r < 0) {
@@ -2666,10 +2670,6 @@ static int server_init(Server *s) {
if (r < 0)
return r;
- r = system_journal_open(s);
- if (r < 0)
- return r;
-
r = open_signalfd(s);
if (r < 0)
return r;
@@ -2678,6 +2678,10 @@ static int server_init(Server *s) {
if (!s->rate_limit)
return -ENOMEM;
+ r = system_journal_open(s);
+ if (r < 0)
+ return r;
+
return 0;
}
commit 4d1c38b8072dca18807371170d5e14fa8dc0baa5
Author: Lennart Poettering <lennart at poettering.net>
Date: Thu Mar 15 00:45:02 2012 +0100
nspawn: mount /etc/timezone into nspawn environment too
diff --git a/src/nspawn.c b/src/nspawn.c
index b548b12..6f5a9d9 100644
--- a/src/nspawn.c
+++ b/src/nspawn.c
@@ -197,7 +197,7 @@ static int mount_all(const char *dest) {
}
/* Fix the timezone, if possible */
- if (asprintf(&where, "%s/%s", dest, "/etc/localtime") >= 0) {
+ if (asprintf(&where, "%s/etc/localtime", dest) >= 0) {
if (mount("/etc/localtime", where, "bind", MS_BIND, NULL) >= 0)
mount("/etc/localtime", where, "bind", MS_BIND|MS_REMOUNT|MS_RDONLY, NULL);
@@ -205,6 +205,14 @@ static int mount_all(const char *dest) {
free(where);
}
+ if (asprintf(&where, "%s/etc/timezone", dest) >= 0) {
+
+ if (mount("/etc/timezone", where, "bind", MS_BIND, NULL) >= 0)
+ mount("/etc/timezone", where, "bind", MS_BIND|MS_REMOUNT|MS_RDONLY, NULL);
+
+ free(where);
+ }
+
return r;
}
commit 6bc1ce40e531257ae8dd9bbbbcb48e5de0a1187b
Author: Lennart Poettering <lennart at poettering.net>
Date: Thu Mar 15 00:44:26 2012 +0100
journald: fix typo
diff --git a/src/journal/journald.c b/src/journal/journald.c
index 50f66be..37e6484 100644
--- a/src/journal/journald.c
+++ b/src/journal/journald.c
@@ -2308,7 +2308,7 @@ static int open_syslog_socket(Server *s) {
return -errno;
}
-#ifdef HAVE_SE
+#ifdef HAVE_SELINUX
one = 1;
r = setsockopt(s->syslog_fd, SOL_SOCKET, SO_PASSSEC, &one, sizeof(one));
if (r < 0)
commit 4f4d6a7073e6aa740291bbe54da809024d372955
Author: Lennart Poettering <lennart at poettering.net>
Date: Thu Mar 15 00:44:10 2012 +0100
journalctl: suppress messages about adm group if ACL support is not enabled
diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c
index 5f8b240..38c9d73 100644
--- a/src/journal/journalctl.c
+++ b/src/journal/journalctl.c
@@ -210,8 +210,10 @@ int main(int argc, char *argv[]) {
goto finish;
}
+#ifdef HAVE_ACL
if (!arg_quiet && geteuid() != 0 && in_group("adm") <= 0)
log_warning("Showing user generated messages only. Users in the group 'adm' can see all messages. Pass -q to turn this message off.");
+#endif
r = sd_journal_open(&j, 0);
if (r < 0) {
commit fb0864e7b9c6d26269ccea6ec5c0fd921c029781
Author: Lennart Poettering <lennart at poettering.net>
Date: Thu Mar 15 00:43:47 2012 +0100
virt: the pidns controller does not exist anymore
diff --git a/TODO b/TODO
index dece055..4936fde 100644
--- a/TODO
+++ b/TODO
@@ -18,6 +18,14 @@ Bugfixes:
Features:
+* Add ConditionReadWriteFileSystem= so that systemd-sysctl doesn't get executed when /proc/sys is read-only
+
+* unset container= and container_uuid= for child processes
+
+* when bind mounting /etc/machine-id, do so from /run/machine-id
+
+* introduce mix of BindTo and Requisite
+
* journalctl: show multiline log messages sanely, expand tabs, and show all valid utf8 messages
* introduce NeedsMounts= or so to create .mount dependencies automatically for a specific path
diff --git a/man/systemd.unit.xml b/man/systemd.unit.xml
index eecff73..3cc126b 100644
--- a/man/systemd.unit.xml
+++ b/man/systemd.unit.xml
@@ -780,8 +780,7 @@
<varname>openvz</varname>,
<varname>lxc</varname>,
<varname>lxc-libvirt</varname>,
- <varname>systemd-nspawn</varname>,
- <varname>pidns</varname> to test
+ <varname>systemd-nspawn</varname> to test
against a specific implementation. If
multiple virtualization technologies
are nested only the innermost is
diff --git a/src/virt.c b/src/virt.c
index 3f0912a..4c526ff 100644
--- a/src/virt.c
+++ b/src/virt.c
@@ -236,35 +236,6 @@ int detect_container(const char **id) {
fclose(f);
}
- f = fopen("/proc/self/cgroup", "re");
- if (f) {
-
- for (;;) {
- char line[LINE_MAX], *p;
-
- if (!fgets(line, sizeof(line), f))
- break;
-
- p = strchr(strstrip(line), ':');
- if (!p)
- continue;
-
- if (strncmp(p, ":ns:", 4))
- continue;
-
- if (!streq(p, ":ns:/")) {
- fclose(f);
-
- if (id)
- *id = "pidns";
-
- return 1;
- }
- }
-
- fclose(f);
- }
-
return 0;
}
commit 67aa455172189d92abbcf3dc90b2848278edcf1b
Author: Lennart Poettering <lennart at poettering.net>
Date: Wed Mar 14 20:07:50 2012 +0100
journald: set SO_PASSEC only if selinux is enabled
diff --git a/src/journal/journald.c b/src/journal/journald.c
index aea7816..50f66be 100644
--- a/src/journal/journald.c
+++ b/src/journal/journald.c
@@ -2308,10 +2308,12 @@ static int open_syslog_socket(Server *s) {
return -errno;
}
+#ifdef HAVE_SE
one = 1;
r = setsockopt(s->syslog_fd, SOL_SOCKET, SO_PASSSEC, &one, sizeof(one));
if (r < 0)
log_warning("SO_PASSSEC failed: %m");
+#endif
one = 1;
r = setsockopt(s->syslog_fd, SOL_SOCKET, SO_TIMESTAMP, &one, sizeof(one));
@@ -2369,10 +2371,12 @@ static int open_native_socket(Server*s) {
return -errno;
}
+#ifdef HAVE_SELINUX
one = 1;
r = setsockopt(s->syslog_fd, SOL_SOCKET, SO_PASSSEC, &one, sizeof(one));
if (r < 0)
log_warning("SO_PASSSEC failed: %m");
+#endif
one = 1;
r = setsockopt(s->native_fd, SOL_SOCKET, SO_TIMESTAMP, &one, sizeof(one));
More information about the systemd-commits
mailing list