[systemd-commits] 12 commits - configure.ac man/sd_journal_get_usage.xml man/shutdown.xml src/bootchart src/initctl src/journal src/python-systemd src/shared src/shutdownd TODO

Zbigniew Jędrzejewski-Szmek zbyszek at kemper.freedesktop.org
Thu Mar 21 20:35:49 PDT 2013


 TODO                                |    3 
 configure.ac                        |    2 
 man/sd_journal_get_usage.xml        |   12 -
 man/shutdown.xml                    |    2 
 src/bootchart/svg.c                 |    4 
 src/initctl/initctl.c               |   22 +
 src/journal/journal-vacuum.c        |    4 
 src/python-systemd/_reader.c        |  411 ++++++++++++++++++++++++------------
 src/python-systemd/docs/journal.rst |    3 
 src/python-systemd/journal.py       |   30 ++
 src/shared/efivars.c                |    2 
 src/shutdownd/shutdownd.c           |   23 --
 12 files changed, 342 insertions(+), 176 deletions(-)

New commits:
commit 6c142648aaced56ab681fcc97a71b06d588122a9
Author: Jan Alexander Steffens (heftig) <jan.steffens at gmail.com>
Date:   Wed Mar 20 21:32:05 2013 +0100

    Fix vacuum logic error
    
    The vacuum code used to stop vacuuming after one deletion, even
    when max_use was still exceeded.
    
    Also make usage a uint64_t, as the code already pretends it is one.
    
    Signed-off-by: Jan Alexander Steffens (heftig) <jan.steffens at gmail.com>

diff --git a/src/journal/journal-vacuum.c b/src/journal/journal-vacuum.c
index 731f6c7..4a3a5a9 100644
--- a/src/journal/journal-vacuum.c
+++ b/src/journal/journal-vacuum.c
@@ -36,7 +36,7 @@
 #include "util.h"
 
 struct vacuum_info {
-        off_t usage;
+        uint64_t usage;
         char *filename;
 
         uint64_t realtime;
@@ -293,7 +293,7 @@ int journal_directory_vacuum(
                 if (unlinkat(dirfd(d), list[i].filename, 0) >= 0) {
                         log_debug("Deleted archived journal %s/%s.", directory, list[i].filename);
 
-                        if ((uint64_t) list[i].usage > sum)
+                        if (list[i].usage < sum)
                                 sum -= list[i].usage;
                         else
                                 sum = 0;

commit 72536eb73674883f0c8522a241ecd86c032665db
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date:   Thu Mar 21 22:47:32 2013 -0400

    man/shutdown: /etc/nologin is called /run/nologin now

diff --git a/man/shutdown.xml b/man/shutdown.xml
index d54fcb2..5703833 100644
--- a/man/shutdown.xml
+++ b/man/shutdown.xml
@@ -80,7 +80,7 @@
 
                 <para>If the time argument is used, 5 minutes
                 before the system goes down the
-                <filename>/etc/nologin</filename> file is created to
+                <filename>/run/nologin</filename> file is created to
                 ensure that further logins shall not be
                 allowed.</para>
         </refsect1>

commit 811de196b3c5e08fc1fc3bef7cb062efad784303
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date:   Wed Mar 20 23:01:32 2013 -0400

    systemd-python: allow retrieval of single fields
    
    This can give huge efficiency gains, e.g. if only MESSAGE
    is required and all other fields can be ignored.

diff --git a/TODO b/TODO
index 8c99afc..c0779d4 100644
--- a/TODO
+++ b/TODO
@@ -584,7 +584,6 @@ Features:
 * drop cap bounding set in readahead and other services
 
 * systemd-python:
-   - allow reading of only select fields in systemd.journal._reader.Reader
    - figure out a simple way to wait for journal events in a way that
      works with ^C
    - add documentation to systemd.daemon
diff --git a/src/python-systemd/_reader.c b/src/python-systemd/_reader.c
index c128cf3..d1188a1 100644
--- a/src/python-systemd/_reader.c
+++ b/src/python-systemd/_reader.c
@@ -261,6 +261,73 @@ static PyObject* Reader_next(Reader *self, PyObject *args)
 }
 
 
+static int extract(const char* msg, size_t msg_len,
+                   PyObject **key, PyObject **value) {
+    PyObject *k = NULL, *v;
+    const char *delim_ptr;
+
+    delim_ptr = memchr(msg, '=', msg_len);
+    if (!delim_ptr) {
+        PyErr_SetString(PyExc_OSError,
+                        "journal gave us a field without '='");
+        return -1;
+    }
+
+    if (key) {
+        k = unicode_FromStringAndSize(msg, delim_ptr - (const char*) msg);
+        if (!k)
+            return -1;
+    }
+
+    if (value) {
+        v = PyBytes_FromStringAndSize(delim_ptr + 1,
+                             (const char*) msg + msg_len - (delim_ptr + 1));
+        if (!v) {
+            Py_XDECREF(k);
+            return -1;
+        }
+
+        *value = v;
+    }
+
+    if (key)
+        *key = k;
+
+    return 0;
+}
+
+PyDoc_STRVAR(Reader_get__doc__,
+             "get(str) -> str\n\n"
+             "Return data associated with this key in current log entry.\n"
+             "Throws KeyError is the data is not available.");
+static PyObject* Reader_get(Reader *self, PyObject *args)
+{
+    const char* field;
+    const void* msg;
+    size_t msg_len;
+    PyObject *value;
+    int r;
+
+    assert(self);
+    assert(args);
+
+    if (!PyArg_ParseTuple(args, "s:get", &field))
+        return NULL;
+
+    r = sd_journal_get_data(self->j, field, &msg, &msg_len);
+    if (r == -ENOENT) {
+        PyErr_SetString(PyExc_KeyError, field);
+        return NULL;
+    } else if (set_error(r, NULL, "field name is not valid"))
+        return NULL;
+
+    r = extract(msg, msg_len, NULL, &value);
+    if (r < 0)
+        return NULL;
+    return value;
+}
+
+
 PyDoc_STRVAR(Reader_get_next__doc__,
              "get_next([skip]) -> dict\n\n"
              "Return dictionary of the next log entry. Optional skip value will\n"
@@ -285,23 +352,9 @@ static PyObject* Reader_get_next(Reader *self, PyObject *args)
 
     SD_JOURNAL_FOREACH_DATA(self->j, msg, msg_len) {
         PyObject _cleanup_Py_DECREF_ *key = NULL, *value = NULL;
-        const char *delim_ptr;
-
-        delim_ptr = memchr(msg, '=', msg_len);
-        if (!delim_ptr) {
-            PyErr_SetString(PyExc_OSError,
-                            "journal gave us a field without '='");
-            goto error;
-        }
-
-        key = unicode_FromStringAndSize(msg, delim_ptr - (const char*) msg);
-        if (!key)
-            goto error;
 
-        value = PyBytes_FromStringAndSize(
-                delim_ptr + 1,
-                (const char*) msg + msg_len - (delim_ptr + 1) );
-        if (!value)
+        r = extract(msg, msg_len, &key, &value);
+        if (r < 0)
             goto error;
 
         if (PyDict_Contains(dict, key)) {
@@ -336,6 +389,7 @@ static PyObject* Reader_get_next(Reader *self, PyObject *args)
     }
 
     return dict;
+
 error:
     Py_DECREF(dict);
     return NULL;
@@ -724,6 +778,9 @@ static PyObject* Reader_query_unique(Reader *self, PyObject *args)
 PyDoc_STRVAR(Reader_get_catalog__doc__,
              "get_catalog() -> str\n\n"
              "Retrieve a message catalog entry for the current journal entry.\n"
+             "Will throw IndexError if the entry has no MESSAGE_ID\n"
+             "and KeyError is the id is specified, but hasn't been found\n"
+             "in the catalog.\n\n"
              "Wraps man:sd_journal_get_catalog(3).");
 static PyObject* Reader_get_catalog(Reader *self, PyObject *args)
 {
@@ -736,7 +793,22 @@ static PyObject* Reader_get_catalog(Reader *self, PyObject *args)
     Py_BEGIN_ALLOW_THREADS
     r = sd_journal_get_catalog(self->j, &msg);
     Py_END_ALLOW_THREADS
-    if (set_error(r, NULL, NULL))
+    if (r == -ENOENT) {
+        const void* mid;
+        size_t mid_len;
+
+        r = sd_journal_get_data(self->j, "MESSAGE_ID", &mid, &mid_len);
+        if (r == 0) {
+            const int l = sizeof("MESSAGE_ID");
+            assert(mid_len > l);
+            PyErr_Format(PyExc_KeyError, "%.*s", (int) mid_len - l,
+                         (const char*) mid + l);
+        } else if (r == -ENOENT)
+            PyErr_SetString(PyExc_IndexError, "no MESSAGE_ID field");
+        else
+            set_error(r, NULL, NULL);
+        return NULL;
+    } else if (set_error(r, NULL, NULL))
         return NULL;
 
     return unicode_FromString(msg);
@@ -837,6 +909,7 @@ static PyMethodDef Reader_methods[] = {
     {"__enter__",       (PyCFunction) Reader___enter__, METH_NOARGS, Reader___enter____doc__},
     {"__exit__",        (PyCFunction) Reader___exit__, METH_VARARGS, Reader___exit____doc__},
     {"next",            (PyCFunction) Reader_next, METH_VARARGS, Reader_next__doc__},
+    {"get",             (PyCFunction) Reader_get, METH_VARARGS, Reader_get__doc__},
     {"get_next",        (PyCFunction) Reader_get_next, METH_VARARGS, Reader_get_next__doc__},
     {"get_previous",    (PyCFunction) Reader_get_previous, METH_VARARGS, Reader_get_previous__doc__},
     {"get_realtime",    (PyCFunction) Reader_get_realtime, METH_NOARGS, Reader_get_realtime__doc__},
@@ -899,7 +972,7 @@ static PyTypeObject ReaderType = {
 };
 
 static PyMethodDef methods[] = {
-        { "get_catalog", get_catalog, METH_VARARGS, get_catalog__doc__},
+        { "_get_catalog", get_catalog, METH_VARARGS, get_catalog__doc__},
         { NULL, NULL, 0, NULL }        /* Sentinel */
 };
 
diff --git a/src/python-systemd/docs/journal.rst b/src/python-systemd/docs/journal.rst
index 9dc495f..08756b9 100644
--- a/src/python-systemd/docs/journal.rst
+++ b/src/python-systemd/docs/journal.rst
@@ -23,6 +23,9 @@ Accessing the Journal
 
    .. automethod:: __init__
 
+.. autofunction:: _get_catalog
+.. autofunction:: get_catalog
+
 .. autoclass:: Monotonic
 
 .. autoattribute:: systemd.journal.DEFAULT_CONVERTERS
diff --git a/src/python-systemd/journal.py b/src/python-systemd/journal.py
index a522aec..c918c43 100644
--- a/src/python-systemd/journal.py
+++ b/src/python-systemd/journal.py
@@ -35,7 +35,7 @@ from syslog import (LOG_EMERG, LOG_ALERT, LOG_CRIT, LOG_ERR,
 from ._journal import sendv, stream_fd
 from ._reader import (_Reader, NOP, APPEND, INVALIDATE,
                       LOCAL_ONLY, RUNTIME_ONLY, SYSTEM_ONLY,
-                      get_catalog)
+                      _get_catalog)
 from . import id128 as _id128
 
 if _sys.version_info >= (3,):
@@ -137,6 +137,9 @@ class Reader(_Reader):
         the conversion fails with a ValueError, unconverted bytes
         object will be returned. (Note that ValueEror is a superclass
         of UnicodeDecodeError).
+
+        Reader implements the context manager protocol: the journal
+        will be closed when exiting the block.
         """
         super(Reader, self).__init__(flags, path)
         if _sys.version_info >= (3,3):
@@ -293,6 +296,11 @@ class Reader(_Reader):
         self.add_match(_MACHINE_ID=machineid)
 
 
+def get_catalog(mid):
+    if isinstance(mid, _uuid.UUID):
+        mid = mid.get_hex()
+    return _get_catalog(mid)
+
 def _make_line(field, value):
         if isinstance(value, bytes):
                 return field.encode('utf-8') + b'=' + value

commit 5e8ba1a4601bcff83e45d1f4f26081611c3c6f2a
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date:   Wed Mar 20 19:12:27 2013 -0400

    systemd-python: split out realtime and monotonic into separate functions
    
    This matches the C API more closely, and also enables the
    user to get just partial information, should she desire to
    do so.
    
    Functions names in error messages are modified to not include
    the class name, because Python uses just the function name
    into functions declared as METH_NOARGS, and error messages
    were inconsistent.

diff --git a/src/python-systemd/_reader.c b/src/python-systemd/_reader.c
index b74d2be..c128cf3 100644
--- a/src/python-systemd/_reader.c
+++ b/src/python-systemd/_reader.c
@@ -83,8 +83,8 @@ static void Reader_dealloc(Reader* self)
 }
 
 PyDoc_STRVAR(Reader__doc__,
-             "Reader([flags | path]) -> ...\n\n"
-             "Reader allows filtering and retrieval of Journal entries.\n"
+             "_Reader([flags | path]) -> ...\n\n"
+             "_Reader allows filtering and retrieval of Journal entries.\n"
              "Note: this is a low-level interface, and probably not what you\n"
              "want, use systemd.journal.Reader instead.\n\n"
              "Argument `flags` sets open flags of the journal, which can be one\n"
@@ -93,7 +93,9 @@ PyDoc_STRVAR(Reader__doc__,
              "volatile journal files; and SYSTEM_ONLY opens only\n"
              "journal files of system services and the kernel.\n\n"
              "Argument `path` is the directory of journal files. Note that\n"
-             "`flags` and `path` are exclusive.\n");
+             "`flags` and `path` are exclusive.\n\n"
+             "_Reader implements the context manager protocol: the journal\n"
+             "will be closed when exiting the block.");
 static int Reader_init(Reader *self, PyObject *args, PyObject *keywds)
 {
     int flags = 0, r;
@@ -221,19 +223,17 @@ static PyObject* Reader___exit__(Reader *self, PyObject *args)
 }
 
 
-PyDoc_STRVAR(Reader_get_next__doc__,
-             "get_next([skip]) -> dict\n\n"
-             "Return dictionary of the next log entry. Optional skip value will\n"
-             "return the `skip`\\-th log entry.");
-static PyObject* Reader_get_next(Reader *self, PyObject *args)
+PyDoc_STRVAR(Reader_next__doc__,
+             "next([skip]) -> bool\n\n"
+             "Go to the next log entry. Optional skip value means to go to\n"
+             "the `skip`\\-th log entry.\n"
+             "Returns False if at end of file, True otherwise.");
+static PyObject* Reader_next(Reader *self, PyObject *args)
 {
-    PyObject *dict;
-    const void *msg;
-    size_t msg_len;
     int64_t skip = 1LL;
     int r;
 
-    if (!PyArg_ParseTuple(args, "|L:_Reader.get_next", &skip))
+    if (!PyArg_ParseTuple(args, "|L:next", &skip))
         return NULL;
 
     if (skip == 0LL) {
@@ -257,7 +257,26 @@ static PyObject* Reader_get_next(Reader *self, PyObject *args)
     set_error(r, NULL, NULL);
     if (r < 0)
         return NULL;
-    else if (r == 0) /* EOF */
+    return PyBool_FromLong(r);
+}
+
+
+PyDoc_STRVAR(Reader_get_next__doc__,
+             "get_next([skip]) -> dict\n\n"
+             "Return dictionary of the next log entry. Optional skip value will\n"
+             "return the `skip`\\-th log entry. Returns an empty dict on EOF.");
+static PyObject* Reader_get_next(Reader *self, PyObject *args)
+{
+    PyObject _cleanup_Py_DECREF_ *tmp = NULL;
+    PyObject *dict;
+    const void *msg;
+    size_t msg_len;
+    int r;
+
+    tmp = Reader_next(self, args);
+    if (!tmp)
+        return NULL;
+    if (tmp == Py_False) /* EOF */
         return PyDict_New();
 
     dict = PyDict_New();
@@ -316,68 +335,80 @@ static PyObject* Reader_get_next(Reader *self, PyObject *args)
         }
     }
 
-    {
-        PyObject _cleanup_Py_DECREF_ *key = NULL, *value = NULL;
-        uint64_t realtime;
+    return dict;
+error:
+    Py_DECREF(dict);
+    return NULL;
+}
 
-        r = sd_journal_get_realtime_usec(self->j, &realtime);
-        if (set_error(r, NULL, NULL))
-            goto error;
 
-        key = unicode_FromString("__REALTIME_TIMESTAMP");
-        if (!key)
-            goto error;
+PyDoc_STRVAR(Reader_get_realtime__doc__,
+             "get_realtime() -> int\n\n"
+             "Return the realtime timestamp for the current journal entry\n"
+             "in microseconds.\n\n"
+             "Wraps sd_journal_get_realtime_usec().\n"
+             "See man:sd_journal_get_realtime_usec(3).");
+static PyObject* Reader_get_realtime(Reader *self, PyObject *args)
+{
+    uint64_t timestamp;
+    int r;
 
-        assert_cc(sizeof(unsigned long long) == sizeof(realtime));
-        value = PyLong_FromUnsignedLongLong(realtime);
-        if (!value)
-            goto error;
+    assert(self);
+    assert(!args);
 
-        if (PyDict_SetItem(dict, key, value))
-            goto error;
-    }
+    r = sd_journal_get_realtime_usec(self->j, &timestamp);
+    if (set_error(r, NULL, NULL))
+        return NULL;
 
-    {
-        PyObject _cleanup_Py_DECREF_
-            *key = NULL, *timestamp = NULL, *bytes = NULL, *value = NULL;
-        sd_id128_t id;
-        uint64_t monotonic;
+    assert_cc(sizeof(unsigned long long) == sizeof(timestamp));
+    return PyLong_FromUnsignedLongLong(timestamp);
+}
 
-        r = sd_journal_get_monotonic_usec(self->j, &monotonic, &id);
-        if (set_error(r, NULL, NULL))
-            goto error;
 
-        assert_cc(sizeof(unsigned long long) == sizeof(monotonic));
-        key = unicode_FromString("__MONOTONIC_TIMESTAMP");
-        timestamp = PyLong_FromUnsignedLongLong(monotonic);
-        bytes = PyBytes_FromStringAndSize((const char*) &id.bytes, sizeof(id.bytes));
+PyDoc_STRVAR(Reader_get_monotonic__doc__,
+             "get_monotonic() -> (timestamp, bootid)\n\n"
+             "Return the monotonic timestamp for the current journal entry\n"
+             "as a tuple of time in microseconds and bootid.\n\n"
+             "Wraps sd_journal_get_monotonic_usec().\n"
+             "See man:sd_journal_get_monotonic_usec(3).");
+static PyObject* Reader_get_monotonic(Reader *self, PyObject *args)
+{
+    uint64_t timestamp;
+    sd_id128_t id;
+    PyObject *monotonic, *bootid, *tuple;
+    int r;
+
+    assert(self);
+    assert(!args);
+
+    r = sd_journal_get_monotonic_usec(self->j, &timestamp, &id);
+    if (set_error(r, NULL, NULL))
+        return NULL;
+
+    assert_cc(sizeof(unsigned long long) == sizeof(timestamp));
+    monotonic = PyLong_FromUnsignedLongLong(timestamp);
+    bootid = PyBytes_FromStringAndSize((const char*) &id.bytes, sizeof(id.bytes));
 #if PY_MAJOR_VERSION >= 3
-        value = PyStructSequence_New(&MonotonicType);
+    tuple = PyStructSequence_New(&MonotonicType);
 #else
-        value = PyTuple_New(2);
+    tuple = PyTuple_New(2);
 #endif
-        if (!key || !timestamp || !bytes || !value)
-            goto error;
-
-        Py_INCREF(timestamp);
-        Py_INCREF(bytes);
+    if (!monotonic || !bootid || !tuple) {
+        Py_XDECREF(monotonic);
+        Py_XDECREF(bootid);
+        Py_XDECREF(tuple);
+        return NULL;
+    }
 
 #if PY_MAJOR_VERSION >= 3
-        PyStructSequence_SET_ITEM(value, 0, timestamp);
-        PyStructSequence_SET_ITEM(value, 1, bytes);
+    PyStructSequence_SET_ITEM(tuple, 0, monotonic);
+    PyStructSequence_SET_ITEM(tuple, 1, bootid);
 #else
-        PyTuple_SET_ITEM(value, 0, timestamp);
-        PyTuple_SET_ITEM(value, 1, bytes);
+    PyTuple_SET_ITEM(tuple, 0, monotonic);
+    PyTuple_SET_ITEM(tuple, 1, bootid);
 #endif
 
-        if (PyDict_SetItem(dict, key, value))
-            goto error;
-    }
-
-    return dict;
-error:
-    Py_DECREF(dict);
-    return NULL;
+    return tuple;
 }
 
 
@@ -388,7 +419,7 @@ PyDoc_STRVAR(Reader_get_previous__doc__,
 static PyObject* Reader_get_previous(Reader *self, PyObject *args)
 {
     int64_t skip = 1LL;
-    if (!PyArg_ParseTuple(args, "|L:_Reader.get_previous", &skip))
+    if (!PyArg_ParseTuple(args, "|L:get_previous", &skip))
         return NULL;
 
     return PyObject_CallMethod((PyObject *)self, (char*) "get_next",
@@ -406,7 +437,7 @@ static PyObject* Reader_add_match(Reader *self, PyObject *args, PyObject *keywds
 {
     char *match;
     int match_len, r;
-    if (!PyArg_ParseTuple(args, "s#:_Reader.add_match", &match, &match_len))
+    if (!PyArg_ParseTuple(args, "s#:add_match", &match, &match_len))
         return NULL;
 
     r = sd_journal_add_match(self->j, match, match_len);
@@ -570,7 +601,7 @@ static PyObject* Reader_seek_cursor(Reader *self, PyObject *args)
     const char *cursor;
     int r;
 
-    if (!PyArg_ParseTuple(args, "s:_Reader.seek_cursor", &cursor))
+    if (!PyArg_ParseTuple(args, "s:seek_cursor", &cursor))
         return NULL;
 
     Py_BEGIN_ALLOW_THREADS
@@ -614,7 +645,7 @@ static PyObject* Reader_test_cursor(Reader *self, PyObject *args)
     assert(self);
     assert(args);
 
-    if (!PyArg_ParseTuple(args, "s:_Reader.get_cursor", &cursor))
+    if (!PyArg_ParseTuple(args, "s:test_cursor", &cursor))
         return NULL;
 
     r = sd_journal_test_cursor(self->j, cursor);
@@ -663,7 +694,7 @@ static PyObject* Reader_query_unique(Reader *self, PyObject *args)
     size_t uniq_len;
     PyObject *value_set, *key, *value;
 
-    if (!PyArg_ParseTuple(args, "s:_Reader.query_unique", &query))
+    if (!PyArg_ParseTuple(args, "s:query_unique", &query))
         return NULL;
 
     Py_BEGIN_ALLOW_THREADS
@@ -805,8 +836,11 @@ static PyMethodDef Reader_methods[] = {
     {"get_usage",       (PyCFunction) Reader_get_usage, METH_NOARGS, Reader_get_usage__doc__},
     {"__enter__",       (PyCFunction) Reader___enter__, METH_NOARGS, Reader___enter____doc__},
     {"__exit__",        (PyCFunction) Reader___exit__, METH_VARARGS, Reader___exit____doc__},
+    {"next",            (PyCFunction) Reader_next, METH_VARARGS, Reader_next__doc__},
     {"get_next",        (PyCFunction) Reader_get_next, METH_VARARGS, Reader_get_next__doc__},
     {"get_previous",    (PyCFunction) Reader_get_previous, METH_VARARGS, Reader_get_previous__doc__},
+    {"get_realtime",    (PyCFunction) Reader_get_realtime, METH_NOARGS, Reader_get_realtime__doc__},
+    {"get_monotonic",   (PyCFunction) Reader_get_monotonic, METH_NOARGS, Reader_get_monotonic__doc__},
     {"add_match",       (PyCFunction) Reader_add_match, METH_VARARGS|METH_KEYWORDS, Reader_add_match__doc__},
     {"add_disjunction", (PyCFunction) Reader_add_disjunction, METH_NOARGS, Reader_add_disjunction__doc__},
     {"flush_matches",   (PyCFunction) Reader_flush_matches, METH_NOARGS, Reader_flush_matches__doc__},

commit 1cdcd71be06a7f51012766d6b2f9e828b715f5e7
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date:   Wed Mar 20 19:00:37 2013 -0400

    systemd-python: implement _Reader.test_cursor
    
    Getting the cursor is split out from .get_next() into
    .get_cursor(). This mirrors the C API more closely, and
    also makes things a bit faster if the cursor is not needed.

diff --git a/TODO b/TODO
index 2be4503..8c99afc 100644
--- a/TODO
+++ b/TODO
@@ -585,7 +585,6 @@ Features:
 
 * systemd-python:
    - allow reading of only select fields in systemd.journal._reader.Reader
-   - export sd_journal_test_cursor in systemd.journal._reader.Reader
    - figure out a simple way to wait for journal events in a way that
      works with ^C
    - add documentation to systemd.daemon
diff --git a/src/python-systemd/_reader.c b/src/python-systemd/_reader.c
index 4fe7847..b74d2be 100644
--- a/src/python-systemd/_reader.c
+++ b/src/python-systemd/_reader.c
@@ -374,26 +374,6 @@ static PyObject* Reader_get_next(Reader *self, PyObject *args)
             goto error;
     }
 
-    {
-        PyObject _cleanup_Py_DECREF_ *key = NULL, *value = NULL;
-        char _cleanup_free_ *cursor = NULL;
-
-        r = sd_journal_get_cursor(self->j, &cursor);
-        if (set_error(r, NULL, NULL))
-            goto error;
-
-        key = unicode_FromString("__CURSOR");
-        if (!key)
-            goto error;
-
-        value = PyBytes_FromString(cursor);
-        if (!value)
-            goto error;
-
-        if (PyDict_SetItem(dict, key, value))
-            goto error;
-    }
-
     return dict;
 error:
     Py_DECREF(dict);
@@ -602,6 +582,50 @@ static PyObject* Reader_seek_cursor(Reader *self, PyObject *args)
 }
 
 
+PyDoc_STRVAR(Reader_get_cursor__doc__,
+             "get_cursor() -> str\n\n"
+             "Return a cursor string for the current journal entry.\n\n"
+             "Wraps sd_journal_get_cursor(). See man:sd_journal_get_cursor(3).");
+static PyObject* Reader_get_cursor(Reader *self, PyObject *args)
+{
+    char _cleanup_free_ *cursor = NULL;
+    int r;
+
+    assert(self);
+    assert(!args);
+
+    r = sd_journal_get_cursor(self->j, &cursor);
+    if (set_error(r, NULL, NULL))
+        return NULL;
+
+    return unicode_FromString(cursor);
+}
+
+
+PyDoc_STRVAR(Reader_test_cursor__doc__,
+             "test_cursor(str) -> bool\n\n"
+             "Test whether the cursor string matches current journal entry.\n\n"
+             "Wraps sd_journal_test_cursor(). See man:sd_journal_test_cursor(3).");
+static PyObject* Reader_test_cursor(Reader *self, PyObject *args)
+{
+    const char *cursor;
+    int r;
+
+    assert(self);
+    assert(args);
+
+    if (!PyArg_ParseTuple(args, "s:_Reader.get_cursor", &cursor))
+        return NULL;
+
+    r = sd_journal_test_cursor(self->j, cursor);
+    set_error(r, NULL, NULL);
+    if (r < 0)
+        return NULL;
+
+    return PyBool_FromLong(r);
+}
+
+
 static PyObject* Reader_iter(PyObject *self)
 {
     Py_INCREF(self);
@@ -792,6 +816,8 @@ static PyMethodDef Reader_methods[] = {
     {"seek_monotonic",  (PyCFunction) Reader_seek_monotonic, METH_VARARGS, Reader_seek_monotonic__doc__},
     {"wait",            (PyCFunction) Reader_wait, METH_VARARGS, Reader_wait__doc__},
     {"seek_cursor",     (PyCFunction) Reader_seek_cursor, METH_VARARGS, Reader_seek_cursor__doc__},
+    {"get_cursor",      (PyCFunction) Reader_get_cursor, METH_NOARGS, Reader_get_cursor__doc__},
+    {"test_cursor",     (PyCFunction) Reader_test_cursor, METH_VARARGS, Reader_test_cursor__doc__},
     {"query_unique",    (PyCFunction) Reader_query_unique, METH_VARARGS, Reader_query_unique__doc__},
     {"get_catalog",     (PyCFunction) Reader_get_catalog, METH_NOARGS, Reader_get_catalog__doc__},
     {NULL}  /* Sentinel */

commit 806bc1cb610b1795d62f59878703361c8b576b12
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date:   Wed Mar 20 18:40:05 2013 -0400

    systemd-python: cleanup up usec_t handling
    
    The behaviour wrt. seconds vs. microseconds was inconsistent.
    Now _Reader always uses native units (us), while Reader always
    uses seconds and accepts both floats and ints. This way the
    conversion is always done in the Python layer, and the lower
    level API allows access to the journal API without the potentially
    lossy conversion between double and uint64_t.

diff --git a/src/python-systemd/_reader.c b/src/python-systemd/_reader.c
index 17c0015..4fe7847 100644
--- a/src/python-systemd/_reader.c
+++ b/src/python-systemd/_reader.c
@@ -499,22 +499,15 @@ static PyObject* Reader_seek_tail(Reader *self, PyObject *args)
 PyDoc_STRVAR(Reader_seek_realtime__doc__,
              "seek_realtime(realtime) -> None\n\n"
              "Seek to nearest matching journal entry to `realtime`. Argument\n"
-             "`realtime` can must be an integer unix timestamp.");
+             "`realtime` in specified in seconds.");
 static PyObject* Reader_seek_realtime(Reader *self, PyObject *args)
 {
-    double timedouble;
     uint64_t timestamp;
     int r;
 
-    if (!PyArg_ParseTuple(args, "d:_Reader.seek_realtime", &timedouble))
+    if (!PyArg_ParseTuple(args, "K:seek_realtime", &timestamp))
         return NULL;
 
-    timestamp = (uint64_t) (timedouble * 1.0E6);
-    if ((int64_t) timestamp < 0LL) {
-        PyErr_SetString(PyExc_ValueError, "Time must be a positive integer");
-        return NULL;
-    }
-
     Py_BEGIN_ALLOW_THREADS
     r = sd_journal_seek_realtime_usec(self->j, timestamp);
     Py_END_ALLOW_THREADS
@@ -527,26 +520,18 @@ static PyObject* Reader_seek_realtime(Reader *self, PyObject *args)
 PyDoc_STRVAR(Reader_seek_monotonic__doc__,
              "seek_monotonic(monotonic[, bootid]) -> None\n\n"
              "Seek to nearest matching journal entry to `monotonic`. Argument\n"
-             "`monotonic` is an timestamp from boot in seconds.\n"
+             "`monotonic` is an timestamp from boot in microseconds.\n"
              "Argument `bootid` is a string representing which boot the\n"
              "monotonic time is reference to. Defaults to current bootid.");
 static PyObject* Reader_seek_monotonic(Reader *self, PyObject *args)
 {
-    double timedouble;
     char *bootid = NULL;
     uint64_t timestamp;
     sd_id128_t id;
     int r;
 
-    if (!PyArg_ParseTuple(args, "d|z:_Reader.seek_monotonic", &timedouble, &bootid))
-        return NULL;
-
-    timestamp = (uint64_t) (timedouble * 1.0E6);
-
-    if ((int64_t) timestamp < 0LL) {
-        PyErr_SetString(PyExc_ValueError, "Time must be positive number");
+    if (!PyArg_ParseTuple(args, "K|z:seek_monotonic", &timestamp, &bootid))
         return NULL;
-    }
 
     if (bootid) {
         r = sd_id128_from_string(bootid, &id);
@@ -565,6 +550,7 @@ static PyObject* Reader_seek_monotonic(Reader *self, PyObject *args)
     Py_END_ALLOW_THREADS
     if (set_error(r, NULL, NULL))
         return NULL;
+
     Py_RETURN_NONE;
 }
 
@@ -572,23 +558,22 @@ static PyObject* Reader_seek_monotonic(Reader *self, PyObject *args)
 PyDoc_STRVAR(Reader_wait__doc__,
              "wait([timeout]) -> state change (integer)\n\n"
              "Wait for a change in the journal. Argument `timeout` specifies\n"
-             "the maximum number of seconds to wait before returning\n"
-             "regardless of wheter the journal has changed. If `timeout` is not given\n"
-             "or is 0, then block forever.\n"
+             "the maximum number of microseconds to wait before returning\n"
+             "regardless of wheter the journal has changed. If `timeout` is -1,\n"
+             "then block forever.\n\n"
              "Will return constants: NOP if no change; APPEND if new\n"
              "entries have been added to the end of the journal; and\n"
              "INVALIDATE if journal files have been added or removed.");
-static PyObject* Reader_wait(Reader *self, PyObject *args, PyObject *keywds)
+static PyObject* Reader_wait(Reader *self, PyObject *args)
 {
     int r;
-    int64_t timeout = 0LL;
+    int64_t timeout;
 
-    if (!PyArg_ParseTuple(args, "|L:_Reader.wait", &timeout))
+    if (!PyArg_ParseTuple(args, "|L:wait", &timeout))
         return NULL;
 
     Py_BEGIN_ALLOW_THREADS
-    r = sd_journal_wait(self->j,
-                        timeout == 0 ? (uint64_t) -1 : timeout * 1E6);
+    r = sd_journal_wait(self->j, timeout);
     Py_END_ALLOW_THREADS
     if (set_error(r, NULL, NULL) < 0)
         return NULL;
diff --git a/src/python-systemd/journal.py b/src/python-systemd/journal.py
index fee39c9..a522aec 100644
--- a/src/python-systemd/journal.py
+++ b/src/python-systemd/journal.py
@@ -51,10 +51,10 @@ def _convert_source_monotonic(s):
     return _datetime.timedelta(microseconds=int(s))
 
 def _convert_realtime(t):
-    return _datetime.datetime.fromtimestamp(t / 1E6)
+    return _datetime.datetime.fromtimestamp(t / 1000000)
 
 def _convert_timestamp(s):
-    return _datetime.datetime.fromtimestamp(int(s) / 1E6)
+    return _datetime.datetime.fromtimestamp(int(s) / 1000000)
 
 if _sys.version_info >= (3,):
     def _convert_uuid(s):
@@ -209,6 +209,17 @@ class Reader(_Reader):
         return set(self._convert_field(field, value)
             for value in super(Reader, self).query_unique(field))
 
+    def wait(self, timeout=None):
+        """Wait for a change in the journal. `timeout` is the maximum
+        time in seconds to wait, or None, to wait forever.
+
+        Returns one of NOP (no change), APPEND (new entries have been
+        added to the end of the journal), or INVALIDATE (journal files
+        have been added or removed).
+        """
+        us = -1 if timeout is None else int(timeout * 1000000)
+        return super(Reader, self).wait(timeout)
+
     def seek_realtime(self, realtime):
         """Seek to a matching journal entry nearest to `realtime` time.
 
@@ -216,8 +227,8 @@ class Reader(_Reader):
         or datetime.datetime instance.
         """
         if isinstance(realtime, _datetime.datetime):
-            realtime = float(realtime.strftime("%s.%f"))
-        return super(Reader, self).seek_realtime(realtime)
+            realtime = float(realtime.strftime("%s.%f")) * 1000000
+        return super(Reader, self).seek_realtime(int(realtime))
 
     def seek_monotonic(self, monotonic, bootid=None):
         """Seek to a matching journal entry nearest to `monotonic` time.
@@ -229,6 +240,7 @@ class Reader(_Reader):
         """
         if isinstance(monotonic, _datetime.timedelta):
             monotonic = monotonic.totalseconds()
+        monotonic = int(monotonic * 1000000)
         if isinstance(bootid, _uuid.UUID):
             bootid = bootid.get_hex()
         return super(Reader, self).seek_monotonic(monotonic, bootid)

commit 50a279f85783375416dacae7dafbcbbcd2765962
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date:   Wed Mar 20 18:30:10 2013 -0400

    systemd-python: export sd_journal_get_usage

diff --git a/TODO b/TODO
index 1915412..2be4503 100644
--- a/TODO
+++ b/TODO
@@ -586,7 +586,6 @@ Features:
 * systemd-python:
    - allow reading of only select fields in systemd.journal._reader.Reader
    - export sd_journal_test_cursor in systemd.journal._reader.Reader
-   - export sd_journal_get_usage in systemd.journal._reader.Reader
    - figure out a simple way to wait for journal events in a way that
      works with ^C
    - add documentation to systemd.daemon
diff --git a/man/sd_journal_get_usage.xml b/man/sd_journal_get_usage.xml
index 14eb1e2..a2b868f 100644
--- a/man/sd_journal_get_usage.xml
+++ b/man/sd_journal_get_usage.xml
@@ -64,12 +64,12 @@
                 <title>Description</title>
 
                 <para><function>sd_journal_get_usage()</function>
-                determines the total disk space currently used up by
-                journal files. If
-                <literal>SD_JOURNAL_LOCAL_ONLY</literal> has been
-                passed when opening the journal files this value will
-                only reflect the size of journal files of the local
-                host, otherwise of all hosts.</para>
+                determines the total disk space currently used by
+                journal files (in bytes). If
+                <literal>SD_JOURNAL_LOCAL_ONLY</literal> was passed
+                when opening the journal this value will only reflect
+                the size of journal files of the local host, otherwise
+                of all hosts.</para>
         </refsect1>
 
         <refsect1>
diff --git a/src/python-systemd/_reader.c b/src/python-systemd/_reader.c
index 908d911..17c0015 100644
--- a/src/python-systemd/_reader.c
+++ b/src/python-systemd/_reader.c
@@ -130,12 +130,12 @@ PyDoc_STRVAR(Reader_fileno__doc__,
              "See man:sd_journal_get_fd(3).");
 static PyObject* Reader_fileno(Reader *self, PyObject *args)
 {
-    int r;
-    r = sd_journal_get_fd(self->j);
-    set_error(r, NULL, NULL);
-    if (r < 0)
+    int fd;
+    fd = sd_journal_get_fd(self->j);
+    set_error(fd, NULL, NULL);
+    if (fd < 0)
         return NULL;
-    return long_FromLong(r);
+    return long_FromLong(fd);
 }
 
 
@@ -171,6 +171,29 @@ static PyObject* Reader_close(Reader *self, PyObject *args)
 }
 
 
+PyDoc_STRVAR(Reader_get_usage__doc__,
+             "get_usage() -> int\n\n"
+             "Returns the total disk space currently used by journal"
+             "files (in bytes). If `SD_JOURNAL_LOCAL_ONLY` was"
+             "passed when opening the journal this value will only reflect"
+             "the size of journal files of the local host, otherwise"
+             "of all hosts.\n\n"
+             "This method invokes sd_journal_get_usage().\n"
+             "See man:sd_journal_get_usage(3).");
+static PyObject* Reader_get_usage(Reader *self, PyObject *args)
+{
+    int r;
+    uint64_t bytes;
+
+    r = sd_journal_get_usage(self->j, &bytes);
+    if (set_error(r, NULL, NULL))
+        return NULL;
+
+    assert_cc(sizeof(unsigned long long) == sizeof(bytes));
+    return PyLong_FromUnsignedLongLong(bytes);
+}
+
+
 PyDoc_STRVAR(Reader___enter____doc__,
              "__enter__() -> self\n\n"
              "Part of the context manager protocol.\n"
@@ -770,9 +793,9 @@ static PyMethodDef Reader_methods[] = {
     {"fileno",          (PyCFunction) Reader_fileno, METH_NOARGS, Reader_fileno__doc__},
     {"reliable_fd",     (PyCFunction) Reader_reliable_fd, METH_NOARGS, Reader_reliable_fd__doc__},
     {"close",           (PyCFunction) Reader_close, METH_NOARGS, Reader_close__doc__},
+    {"get_usage",       (PyCFunction) Reader_get_usage, METH_NOARGS, Reader_get_usage__doc__},
     {"__enter__",       (PyCFunction) Reader___enter__, METH_NOARGS, Reader___enter____doc__},
     {"__exit__",        (PyCFunction) Reader___exit__, METH_VARARGS, Reader___exit____doc__},
-    {"close",           (PyCFunction) Reader_close, METH_NOARGS, Reader_close__doc__},
     {"get_next",        (PyCFunction) Reader_get_next, METH_VARARGS, Reader_get_next__doc__},
     {"get_previous",    (PyCFunction) Reader_get_previous, METH_VARARGS, Reader_get_previous__doc__},
     {"add_match",       (PyCFunction) Reader_add_match, METH_VARARGS|METH_KEYWORDS, Reader_add_match__doc__},

commit 742af54adce09e019b37093af66b2f22b4ae9330
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date:   Thu Mar 21 20:55:17 2013 -0400

    efivars: fix return code
    
    Was returning 1 on read error.

diff --git a/src/shared/efivars.c b/src/shared/efivars.c
index 4fb7742..06cf127 100644
--- a/src/shared/efivars.c
+++ b/src/shared/efivars.c
@@ -111,7 +111,7 @@ int efi_get_variable(
         n = read(fd, r, (size_t) st.st_size - 4);
         if (n < 0) {
                 free(r);
-                return (int) -n;
+                return -errno;
         }
         if (n != (ssize_t) st.st_size - 4) {
                 free(r);

commit 7a4b2eab6d1d0e4b67cbcb87b84588edd34aabb5
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date:   Thu Mar 21 19:20:41 2013 -0400

    shutdownd: shut up bogus gcc warning
    
    This one is fake. But let's kill it, avoiding two condition checks
    in the process.
    
    src/shutdownd/shutdownd.c: In function 'when_wall':
    src/shutdownd/shutdownd.c:182:44: warning: 'sub' may be used uninitialized in this function [-Wmaybe-uninitialized]
             return elapse > sub ? elapse - sub : 1;
                                                ^

diff --git a/src/shutdownd/shutdownd.c b/src/shutdownd/shutdownd.c
index 0464c89..119385d 100644
--- a/src/shutdownd/shutdownd.c
+++ b/src/shutdownd/shutdownd.c
@@ -157,29 +157,26 @@ static usec_t when_wall(usec_t n, usec_t elapse) {
                 usec_t delay;
                 usec_t interval;
         } table[] = {
-                { 10 * USEC_PER_MINUTE, USEC_PER_MINUTE      },
-                { USEC_PER_HOUR,        15 * USEC_PER_MINUTE },
-                { 3 * USEC_PER_HOUR,    30 * USEC_PER_MINUTE }
+                { 0,                    USEC_PER_MINUTE      },
+                { 10 * USEC_PER_MINUTE, 15 * USEC_PER_MINUTE },
+                { USEC_PER_HOUR,        30 * USEC_PER_MINUTE },
+                { 3 * USEC_PER_HOUR,    USEC_PER_HOUR        },
         };
 
         usec_t left, sub;
-        unsigned i;
+        unsigned i = ELEMENTSOF(table) - 1;
 
         /* If the time is already passed, then don't announce */
         if (n >= elapse)
                 return 0;
 
         left = elapse - n;
-        for (i = 0; i < ELEMENTSOF(table); i++)
-                if (n + table[i].delay >= elapse) {
-                        sub = ((left / table[i].interval) * table[i].interval);
-                        break;
-                }
-
-        if (i >= ELEMENTSOF(table))
-                sub = ((left / USEC_PER_HOUR) * USEC_PER_HOUR);
+        while (left < table[i].delay)
+                i--;
+        sub = (left / table[i].interval) * table[i].interval;
 
-        return elapse > sub ? elapse - sub : 1;
+        assert(sub < elapse);
+        return elapse - sub;
 }
 
 static usec_t when_nologin(usec_t elapse) {

commit 40c2cce772ed74e7c6d302a6143ad818e9a2720d
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date:   Thu Mar 21 19:10:50 2013 -0400

    bootchart: fix two unitialized memory frees
    
    The new gcc isn't bad!
    
    In file included from src/bootchart/svg.c:36:0:
    src/bootchart/svg.c: In function 'svg_ps_bars':
    ./src/shared/util.h:524:13: warning: 'enc_name' may be used uninitialized in this function [-Wmaybe-uninitialized]
             free(*(void**) p);
                 ^
    src/bootchart/svg.c:821:37: note: 'enc_name' was declared here
                     char _cleanup_free_*enc_name;
                                         ^
      CC     src/udev/mtd_probe/mtd_probe-probe_smartmedia.o
      XSLT     man/systemd.unit.5
    In file included from src/bootchart/svg.c:36:0:
    src/bootchart/svg.c: In function 'svg_pss_graph':
    ./src/shared/util.h:524:13: warning: 'enc_name' may be used uninitialized in this function [-Wmaybe-uninitialized]
             free(*(void**) p);
                 ^
    src/bootchart/svg.c:395:37: note: 'enc_name' was declared here
                     char _cleanup_free_*enc_name;
                                         ^

diff --git a/src/bootchart/svg.c b/src/bootchart/svg.c
index 231d3da..cd89689 100644
--- a/src/bootchart/svg.c
+++ b/src/bootchart/svg.c
@@ -392,7 +392,7 @@ static void svg_pss_graph(void) {
         svg("\n\n<!-- PSS map - csv format -->\n");
         ps = ps_first;
         while (ps->next_ps) {
-                char _cleanup_free_*enc_name;
+                char _cleanup_free_ *enc_name = NULL;
                 ps = ps->next_ps;
                 if (!ps)
                         continue;
@@ -818,7 +818,7 @@ static void svg_ps_bars(void) {
         /* pass 2 - ps boxes */
         ps = ps_first;
         while ((ps = get_next_ps(ps))) {
-                char _cleanup_free_*enc_name;
+                char _cleanup_free_ *enc_name = NULL;
 
                 double starttime;
                 int t;

commit 3143987f93120da696c2d363c34cacf9a82aea93
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date:   Thu Mar 21 19:06:55 2013 -0400

    initctl: fix return from unitialized memory in error path
    
    src/initctl/initctl.c: In function 'server_init':
    src/initctl/initctl.c:282:13: warning: 'r' may be used uninitialized in this function [-Wmaybe-uninitialized]
             int r;
                 ^

diff --git a/src/initctl/initctl.c b/src/initctl/initctl.c
index 0eb008d..735f1e1 100644
--- a/src/initctl/initctl.c
+++ b/src/initctl/initctl.c
@@ -290,7 +290,8 @@ static int server_init(Server *s, unsigned n_sockets) {
 
         zero(*s);
 
-        if ((s->epoll_fd = epoll_create1(EPOLL_CLOEXEC)) < 0) {
+        s->epoll_fd = epoll_create1(EPOLL_CLOEXEC);
+        if (s->epoll_fd < 0) {
                 r = -errno;
                 log_error("Failed to create epoll object: %s", strerror(errno));
                 goto fail;
@@ -303,8 +304,10 @@ static int server_init(Server *s, unsigned n_sockets) {
 
                 fd = SD_LISTEN_FDS_START+i;
 
-                if ((r = sd_is_fifo(fd, NULL)) < 0) {
-                        log_error("Failed to determine file descriptor type: %s", strerror(-r));
+                r = sd_is_fifo(fd, NULL);
+                if (r < 0) {
+                        log_error("Failed to determine file descriptor type: %s",
+                                  strerror(-r));
                         goto fail;
                 }
 
@@ -314,9 +317,11 @@ static int server_init(Server *s, unsigned n_sockets) {
                         goto fail;
                 }
 
-                if (!(f = new0(Fifo, 1))) {
+                f = new0(Fifo, 1);
+                if (!f) {
                         r = -ENOMEM;
-                        log_error("Failed to create fifo object: %s", strerror(errno));
+                        log_error("Failed to create fifo object: %s",
+                                  strerror(errno));
                         goto fail;
                 }
 
@@ -328,7 +333,8 @@ static int server_init(Server *s, unsigned n_sockets) {
                 if (epoll_ctl(s->epoll_fd, EPOLL_CTL_ADD, fd, &ev) < 0) {
                         r = -errno;
                         fifo_free(f);
-                        log_error("Failed to add fifo fd to epoll object: %s", strerror(errno));
+                        log_error("Failed to add fifo fd to epoll object: %s",
+                                  strerror(errno));
                         goto fail;
                 }
 
@@ -339,7 +345,9 @@ static int server_init(Server *s, unsigned n_sockets) {
         }
 
         if (bus_connect(DBUS_BUS_SYSTEM, &s->bus, NULL, &error) < 0) {
-                log_error("Failed to get D-Bus connection: %s", bus_error_message(&error));
+                log_error("Failed to get D-Bus connection: %s",
+                          bus_error_message(&error));
+                r = -EIO;
                 goto fail;
         }
 

commit 7cb2086695fdeed33b2fb148492a224dd951fa7e
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date:   Thu Mar 21 18:53:12 2013 +0000

    build-sys: use _FORTIFY_SOURCE with new gcc level -Og

diff --git a/configure.ac b/configure.ac
index ae492cf..79a4ec4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -135,7 +135,7 @@ CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [\
         --param=ssp-buffer-size=4])
 AC_SUBST([OUR_CFLAGS], $with_cflags)
 
-AS_CASE([$CFLAGS], [*-O[[12345\ ]]*], [
+AS_CASE([$CFLAGS], [*-O[[12345g\ ]]*], [
         CC_CHECK_FLAGS_APPEND([with_cppflags], [CPPFLAGS], [\
                -Wp,-D_FORTIFY_SOURCE=2])], [
         python_extra_cflags=-Wp,-U_FORTIFY_SOURCE



More information about the systemd-commits mailing list