[systemd-commits] 2 commits - .gitignore NEWS src/journal

Lennart Poettering lennart at kemper.freedesktop.org
Mon Sep 24 01:19:08 PDT 2012


 .gitignore                    |    1 
 NEWS                          |    6 +--
 src/journal/test-mmap-cache.c |   79 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 83 insertions(+), 3 deletions(-)

New commits:
commit 2a2507e60df45b69d69a026661f865b971ff4f29
Author: Lennart Poettering <lennart at poettering.net>
Date:   Mon Sep 24 10:18:10 2012 +0200

    journal: add missing test file

diff --git a/.gitignore b/.gitignore
index cc904f1..db7fcdf 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
+/test-mmap-cache
 /test-unit-file
 /test-log
 /test-journal-verify
diff --git a/src/journal/test-mmap-cache.c b/src/journal/test-mmap-cache.c
new file mode 100644
index 0000000..e2ffaf4
--- /dev/null
+++ b/src/journal/test-mmap-cache.c
@@ -0,0 +1,79 @@
+/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
+
+/***
+  This file is part of systemd.
+
+  Copyright 2012 Lennart Poettering
+
+  systemd is free software; you can redistribute it and/or modify it
+  under the terms of the GNU Lesser General Public License as published by
+  the Free Software Foundation; either version 2.1 of the License, or
+  (at your option) any later version.
+
+  systemd is distributed in the hope that it will be useful, but
+  WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  Lesser General Public License for more details.
+
+  You should have received a copy of the GNU Lesser General Public License
+  along with systemd; If not, see <http://www.gnu.org/licenses/>.
+***/
+
+#include <stdlib.h>
+#include <sys/mman.h>
+#include <unistd.h>
+
+#include "log.h"
+#include "macro.h"
+#include "util.h"
+#include "mmap-cache.h"
+
+int main(int argc, char *argv[]) {
+        int x, y, z, r;
+        char px[] = "/tmp/testmmapXXXXXXX", py[] = "/tmp/testmmapYXXXXXX", pz[] = "/tmp/testmmapZXXXXXX";
+        MMapCache *m;
+        void *p, *q;
+
+        assert_se(m = mmap_cache_new());
+
+        x = mkstemp(px);
+        assert(x >= 0);
+        unlink(px);
+
+        y = mkstemp(py);
+        assert(y >= 0);
+        unlink(py);
+
+        z = mkstemp(pz);
+        assert(z >= 0);
+        unlink(pz);
+
+        r = mmap_cache_get(m, x, PROT_READ, 0, false, 1, 2, NULL, &p);
+        assert(r >= 0);
+
+        r = mmap_cache_get(m, x, PROT_READ, 0, false, 2, 2, NULL, &q);
+        assert(r >= 0);
+
+        assert((uint8_t*) p + 1 == (uint8_t*) q);
+
+        r = mmap_cache_get(m, x, PROT_READ, 1, false, 3, 2, NULL, &q);
+        assert(r >= 0);
+
+        assert((uint8_t*) p + 2 == (uint8_t*) q);
+
+        r = mmap_cache_get(m, x, PROT_READ, 0, false, 16ULL*1024ULL*1024ULL, 2, NULL, &p);
+        assert(r >= 0);
+
+        r = mmap_cache_get(m, x, PROT_READ, 1, false, 16ULL*1024ULL*1024ULL+1, 2, NULL, &q);
+        assert(r >= 0);
+
+        assert((uint8_t*) p + 1 == (uint8_t*) q);
+
+        mmap_cache_unref(m);
+
+        close_nointr_nofail(x);
+        close_nointr_nofail(y);
+        close_nointr_nofail(z);
+
+        return 0;
+}

commit 6563b535a062055ae68f2e574018d9d04a864b65
Author: Lennart Poettering <lennart at poettering.net>
Date:   Sun Sep 23 19:19:22 2012 +0200

    NEWS: fix some typos

diff --git a/NEWS b/NEWS
index 7b7f3c0..a5d2ba0 100644
--- a/NEWS
+++ b/NEWS
@@ -15,7 +15,7 @@ CHANGES WITH 191:
           take up on disk. This is particularly useful if the default
           built-in logic of determining this parameter from the file
           system size is used. Use "systemctl status
-          systemd-journald.service" to see this information
+          systemd-journald.service" to see this information.
 
         * The multi-seat X wrapper tool has been stripped down. As X
           is now capable of enumerating graphics devices via udev in a
@@ -23,11 +23,11 @@ CHANGES WITH 191:
           anymore. A stripped down temporary stop-gap is still shipped
           until the upstream display managers have been updated to
           fully support the new X logic. Expect this wrapper to be
-          removed entirely in one the next releases.
+          removed entirely in one of the next releases.
 
         * HandleSleepKey= in logind.conf has been split up into
           HandleSuspendKey= and HandleHibernateKey=. The old setting
-          is not available anymore. The kernel and X11 is
+          is not available anymore. X11 and the kernel are
           distuingishing between these keys and we should too. This
           also means the inhibition lock for these keys has been split
           into two.



More information about the systemd-commits mailing list