summaryrefslogtreecommitdiff
path: root/src/python-systemd/_reader.c
Commit message (Collapse)AuthorAgeFilesLines
* systemd-python: add wrappers for easy functions in sd-loginZbigniew Jędrzejewski-Szmek2013-05-081-13/+1
| | | | sd_get_uids, sd_get_seats, sd_get_sessions, and sd_get_machine_names.
* systemd-python: add __version__ stringsZbigniew Jędrzejewski-Szmek2013-05-081-1/+3
|
* systemd-python: wrap sd_journal_add_conjunctionZbigniew Jędrzejewski-Szmek2013-04-181-1/+22
|
* move _cleanup_ attribute in front of the typeHarald Hoyer2013-04-181-5/+5
| | | | http://lists.freedesktop.org/archives/systemd-devel/2013-April/010510.html
* python-systemd: Reader return special fields and _Reader changesSteven Hiscocks2013-04-171-63/+28
| | | | | | | | | | | | | | | | | | | | | | | | Changes to _Reader make it match closer to C API, by removing `get_next` and `get_previous`. A `get_all` method added, which returns dictionary of fields using C API SD_JOURNAL_FOREACH_DATA macro, which can be used in conjunction with `next`. _Reader `get`, `next`, `get_{realtime,monotonic,cursor}` and new `previous` methods are made private. This is so the traversal and getting of journal fields can be made transparent in the python interface. Reader now solely implements `get_next` and `get_previous`, returning a standard dictionary (future: other mapping types?) with all standard and special fields through the converters. This makes the output the same as journalctl json/export format output. Iterator methods also moved to Reader, as they do not function as intend with changes to _Reader. These changes also mean that more optimised journal interfaces can be made more easily from _Reader, by avoiding getting of unrequired fields by using the `_get` method, and avoiding field conversions.
* systemd-python: export new sd_journal_{process,get_events,get_timeout}Zbigniew Jędrzejewski-Szmek2013-04-161-4/+103
| | | | | | | get_timeout_ms is added as a convenience function, since it is abysmally hard to call clock_gettime() in Python versions lower than 3.3. And even for Python 3.3 users it saves a few lines.
* systemd-python: fix formatting in docstringZbigniew Jędrzejewski-Szmek2013-04-141-5/+6
|
* Use initalization instead of explicit zeroingZbigniew Jędrzejewski-Szmek2013-04-051-3/+3
| | | | | | | | | | | | | | | | | | | | | | | Before, we would initialize many fields twice: first by filling the structure with zeros, and then a second time with the real values. We can let the compiler do the job for us, avoiding one copy. A downside of this patch is that text gets slightly bigger. This is because all zero() calls are effectively inlined: $ size build/.libs/systemd text data bss dec hex filename before 897737 107300 2560 1007597 f5fed build/.libs/systemd after 897873 107300 2560 1007733 f6075 build/.libs/systemd … actually less than 1‰. A few asserts that the parameter is not null had to be removed. I don't think this changes much, because first, it is quite unlikely for the assert to fail, and second, an immediate SEGV is almost as good as an assert.
* systemd-python: allow retrieval of single fieldsZbigniew Jędrzejewski-Szmek2013-03-211-18/+91
| | | | | This can give huge efficiency gains, e.g. if only MESSAGE is required and all other fields can be ignored.
* systemd-python: split out realtime and monotonic into separate functionsZbigniew Jędrzejewski-Szmek2013-03-211-65/+99
| | | | | | | | | | | 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.
* systemd-python: implement _Reader.test_cursorZbigniew Jędrzejewski-Szmek2013-03-211-20/+46
| | | | | | 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.
* systemd-python: cleanup up usec_t handlingZbigniew Jędrzejewski-Szmek2013-03-211-27/+12
| | | | | | | | | 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.
* systemd-python: export sd_journal_get_usageZbigniew Jędrzejewski-Szmek2013-03-211-6/+29
|
* systemd-python: small cleanupsZbigniew Jędrzejewski-Szmek2013-03-191-9/+29
| | | | | | - separate methods with two empty lines for clarity - avoid malloc(0) by specyfing private data size as -1 - add method name in error messages
* systemd-python: add journal.get_catalog()Zbigniew Jędrzejewski-Szmek2013-03-191-7/+46
| | | | | This one wraps sd_journal_get_catalog_from_message_id. Thanks to Python namespacing, we can stick to a shorter name.
* systemd-python: add _Reader.get_catalog()Zbigniew Jędrzejewski-Szmek2013-03-191-0/+24
| | | | This one wraps sd_journaal_get_catalog.
* systemd-python: add _Reader.closed attributeZbigniew Jędrzejewski-Szmek2013-03-191-2/+14
| | | | This should make the file interface of _Reader complete.
* systemd-python: allow Reader to be used as a context managerZbigniew Jędrzejewski-Szmek2013-03-181-0/+32
|
* systemd-python: add systemd.daemon wrapping sd-daemonZbigniew Jędrzejewski-Szmek2013-03-151-17/+0
| | | | | | | | | Please see the documentation (e.g. pydoc3 systemd.daemon) for full description. As usual, systemd._daemon wraps the raw interface, while systemd.daemon provides the more pythonic API. sd_listen_fds, sd_booted, sd_is_fifo, sd_is_socket, sd_is_socket_unix, sd_is_socket_inet, sd_is_mq, and SD_LISTEN_FDS_START are currently wrapped.
* systemd-python: fix segfault on double closeZbigniew Jędrzejewski-Szmek2013-03-071-0/+1
|
* systemd-python: fix typosZbigniew Jędrzejewski-Szmek2013-03-071-2/+2
|
* systemd-python: refuse path and flags together in __init__Zbigniew Jędrzejewski-Szmek2013-03-071-7/+16
| | | | | | | | | It's better to explictly check, instead of just documenting it. The return value from init is changed from 1 to -1 on error. Python seems to ignore 1 every second time. Looks like a bug in Python, but the return value doesn't seem to be documented anywhere, and -1 works as expected... so let's just use that.
* systemd-python: export sd_j_get_fd, sd_j_reliable_fd, sd_j_closeZbigniew Jędrzejewski-Szmek2013-03-071-0/+44
| | | | | | | | | sd_journal_get_fd(j) is called j.fileno(), for compatiblity with Python conventions for file-like objects. More importantly, those new .seek_head() and .seek_tail() do not call .get_next(). This is better, if one wants to skip before retrieving an entry.
* systemd-python: split .seek() into .seek_head() and .seek_tail()Zbigniew Jędrzejewski-Szmek2013-03-071-52/+27
| | | | | This way python code follows the original interface more closely. Also, .seek(0, journal.SEEK_END) was just to much to type.
* systemd-python: fix error check in _Reader.wait()Zbigniew Jędrzejewski-Szmek2013-03-051-2/+3
|
* systemd-python: add missing check for return of PyDict_SetItem in _reader.cLukas Nykryn2013-03-011-1/+1
|
* python-systemd: rename Journal to ReaderZbigniew Jędrzejewski-Szmek2013-02-281-61/+61
| | | | | | It seems inevitable that we'll also grow a writing interface, and then it'll be cumbersome to have a "Journal" for reading, and a "Writer" for writing.
* systemd-python: return both parts of sd_journal_get_monotonic_usecZbigniew Jędrzejewski-Szmek2013-02-281-12/+62
| | | | | In Python 3, a named tuple is used. In Python 2, a simple tuple is used. In either case, the pair is (timestamp, bootid).
* python-systemd: check all errors and use automatic cleanupZbigniew Jędrzejewski-Szmek2013-02-281-116/+177
| | | | | | | | __REALTIME_TIMESTAMP and __MONOTONIC_TIMESTAMP return ints. It doesn't make sense to convert to string, just to convert back to a number later on. Also try to follow systemd rules for indentation.
* systemd-python: polish the docstringsZbigniew Jędrzejewski-Szmek2013-02-281-25/+29
|
* systemd-python: indenation and style tweaksZbigniew Jędrzejewski-Szmek2013-02-221-97/+80
|
* systemd-python: downgrade _reader.c to C89Zbigniew Jędrzejewski-Szmek2013-02-221-81/+86
|
* systemd-python: add casts and fix unused variable warnings in _readerZbigniew Jędrzejewski-Szmek2013-02-221-24/+34
|
* systemd-python: wrap some python differences using macrosZbigniew Jędrzejewski-Szmek2013-02-221-48/+26
|
* systemd-python: introduce error setting helperZbigniew Jędrzejewski-Szmek2013-02-221-95/+42
|
* systemd-python: fix memory leak in _reader and minor bugsSteven Hiscocks2013-02-221-2/+3
| | | | | iternext now checks for error from get_next, and changed a DECREF to XDECREF rather than NULL check
* systemd-python: update Journal python docstringsSteven Hiscocks2013-02-221-1/+1
|
* systemd-python: tidy up import names in journalSteven Hiscocks2013-02-221-1/+1
|
* systemd-python: remove unneeded ifdef for query_uniqueSteven Hiscocks2013-02-221-4/+0
|
* systemd-python: _reader now takes unix timestamp in secondsSteven Hiscocks2013-02-221-3/+6
|
* systemd-python: Update _reader docstringsSteven Hiscocks2013-02-221-8/+5
|
* systemd-python: _reader add_match takes single stringSteven Hiscocks2013-02-221-99/+13
| | | | python code now takes care of multiple matches
* systemd-python: correct data_threshold error return valueSteven Hiscocks2013-02-221-1/+1
|
* systemd-python: updated _reader header to standard licenseSteven Hiscocks2013-02-221-18/+20
|
* systemd-python: Moved _reader datetime usage to pythonSteven Hiscocks2013-02-221-44/+8
|
* systemd-python: Tidy up _reader error handlingSteven Hiscocks2013-02-221-69/+71
|
* systemd-python: some python3 and bug fixesSteven Hiscocks2013-02-221-7/+12
|
* systemd-python: implement this_boot/this_machine in PythonSteven Hiscocks2013-02-221-68/+0
|
* systemd-python: Journal log_level moved to pythonSteven Hiscocks2013-02-221-32/+0
|
* systemd-python: move default call dicts from C to pythonSteven Hiscocks2013-02-221-179/+17
|