|
40 | 40 |
|
41 | 41 | #if LIBSYSTEMD_VERSION >= 229 |
42 | 42 | # define HAVE_ENUMERATE_FIELDS |
| 43 | +# define HAVE_HAS_RUNTIME_FILES |
| 44 | +# define HAVE_HAS_PERSISTENT_FILES |
43 | 45 | #endif |
44 | 46 |
|
45 | 47 | typedef struct { |
@@ -924,6 +926,48 @@ static PyObject* Reader_enumerate_fields(Reader *self, PyObject *args) { |
924 | 926 | #endif |
925 | 927 | } |
926 | 928 |
|
| 929 | +PyDoc_STRVAR(Reader_has_runtime_files__doc__, |
| 930 | + "has_runtime_files(str) -> bool\n\n" |
| 931 | + "Returns true if runtime journal files have been found.\n\n" |
| 932 | + "See man:sd_journal_test_cursor(3)."); |
| 933 | +static PyObject* Reader_has_runtime_files(Reader *self, PyObject *args) { |
| 934 | +#ifdef HAVE_ENUMERATE_FIELDS |
| 935 | + int r; |
| 936 | + |
| 937 | + assert(self); |
| 938 | + |
| 939 | + r = sd_journal_has_runtime_files(self->j); |
| 940 | + if (set_error(r, NULL, NULL) < 0) |
| 941 | + return NULL; |
| 942 | + |
| 943 | + return PyBool_FromLong(r); |
| 944 | +#else |
| 945 | + set_error(-ENOSYS, NULL, "Not implemented"); |
| 946 | + return NULL; |
| 947 | +#endif |
| 948 | +} |
| 949 | + |
| 950 | +PyDoc_STRVAR(Reader_has_persistent_files__doc__, |
| 951 | + "has_persistent_files(str) -> bool\n\n" |
| 952 | + "Returns true if persistent journal files have been found.\n\n" |
| 953 | + "See man:sd_journal_test_cursor(3)."); |
| 954 | +static PyObject* Reader_has_persistent_files(Reader *self, PyObject *args) { |
| 955 | +#ifdef HAVE_ENUMERATE_FIELDS |
| 956 | + int r; |
| 957 | + |
| 958 | + assert(self); |
| 959 | + |
| 960 | + r = sd_journal_has_persistent_files(self->j); |
| 961 | + if (set_error(r, NULL, NULL) < 0) |
| 962 | + return NULL; |
| 963 | + |
| 964 | + return PyBool_FromLong(r); |
| 965 | +#else |
| 966 | + set_error(-ENOSYS, NULL, "Not implemented"); |
| 967 | + return NULL; |
| 968 | +#endif |
| 969 | +} |
| 970 | + |
927 | 971 | PyDoc_STRVAR(Reader_get_catalog__doc__, |
928 | 972 | "get_catalog() -> str\n\n" |
929 | 973 | "Retrieve a message catalog entry for the current journal entry.\n" |
@@ -1048,37 +1092,39 @@ static PyGetSetDef Reader_getsetters[] = { |
1048 | 1092 | }; |
1049 | 1093 |
|
1050 | 1094 | static PyMethodDef Reader_methods[] = { |
1051 | | - {"fileno", (PyCFunction) Reader_fileno, METH_NOARGS, Reader_fileno__doc__}, |
1052 | | - {"reliable_fd", (PyCFunction) Reader_reliable_fd, METH_NOARGS, Reader_reliable_fd__doc__}, |
1053 | | - {"get_events", (PyCFunction) Reader_get_events, METH_NOARGS, Reader_get_events__doc__}, |
1054 | | - {"get_timeout", (PyCFunction) Reader_get_timeout, METH_NOARGS, Reader_get_timeout__doc__}, |
1055 | | - {"get_timeout_ms", (PyCFunction) Reader_get_timeout_ms, METH_NOARGS, Reader_get_timeout_ms__doc__}, |
1056 | | - {"close", (PyCFunction) Reader_close, METH_NOARGS, Reader_close__doc__}, |
1057 | | - {"get_usage", (PyCFunction) Reader_get_usage, METH_NOARGS, Reader_get_usage__doc__}, |
1058 | | - {"__enter__", (PyCFunction) Reader___enter__, METH_NOARGS, Reader___enter____doc__}, |
1059 | | - {"__exit__", (PyCFunction) Reader___exit__, METH_VARARGS, Reader___exit____doc__}, |
1060 | | - {"_next", (PyCFunction) Reader_next, METH_VARARGS, Reader_next__doc__}, |
1061 | | - {"_previous", (PyCFunction) Reader_previous, METH_VARARGS, Reader_previous__doc__}, |
1062 | | - {"_get", (PyCFunction) Reader_get, METH_VARARGS, Reader_get__doc__}, |
1063 | | - {"_get_all", (PyCFunction) Reader_get_all, METH_NOARGS, Reader_get_all__doc__}, |
1064 | | - {"_get_realtime", (PyCFunction) Reader_get_realtime, METH_NOARGS, Reader_get_realtime__doc__}, |
1065 | | - {"_get_monotonic", (PyCFunction) Reader_get_monotonic, METH_NOARGS, Reader_get_monotonic__doc__}, |
1066 | | - {"add_match", (PyCFunction) Reader_add_match, METH_VARARGS|METH_KEYWORDS, Reader_add_match__doc__}, |
1067 | | - {"add_disjunction", (PyCFunction) Reader_add_disjunction, METH_NOARGS, Reader_add_disjunction__doc__}, |
1068 | | - {"add_conjunction", (PyCFunction) Reader_add_conjunction, METH_NOARGS, Reader_add_conjunction__doc__}, |
1069 | | - {"flush_matches", (PyCFunction) Reader_flush_matches, METH_NOARGS, Reader_flush_matches__doc__}, |
1070 | | - {"seek_head", (PyCFunction) Reader_seek_head, METH_NOARGS, Reader_seek_head__doc__}, |
1071 | | - {"seek_tail", (PyCFunction) Reader_seek_tail, METH_NOARGS, Reader_seek_tail__doc__}, |
1072 | | - {"seek_realtime", (PyCFunction) Reader_seek_realtime, METH_VARARGS, Reader_seek_realtime__doc__}, |
1073 | | - {"seek_monotonic", (PyCFunction) Reader_seek_monotonic, METH_VARARGS, Reader_seek_monotonic__doc__}, |
1074 | | - {"process", (PyCFunction) Reader_process, METH_NOARGS, Reader_process__doc__}, |
1075 | | - {"wait", (PyCFunction) Reader_wait, METH_VARARGS, Reader_wait__doc__}, |
1076 | | - {"seek_cursor", (PyCFunction) Reader_seek_cursor, METH_VARARGS, Reader_seek_cursor__doc__}, |
1077 | | - {"_get_cursor", (PyCFunction) Reader_get_cursor, METH_NOARGS, Reader_get_cursor__doc__}, |
1078 | | - {"test_cursor", (PyCFunction) Reader_test_cursor, METH_VARARGS, Reader_test_cursor__doc__}, |
1079 | | - {"query_unique", (PyCFunction) Reader_query_unique, METH_VARARGS, Reader_query_unique__doc__}, |
1080 | | - {"enumerate_fields", (PyCFunction) Reader_enumerate_fields, METH_NOARGS, Reader_enumerate_fields__doc__}, |
1081 | | - {"get_catalog", (PyCFunction) Reader_get_catalog, METH_NOARGS, Reader_get_catalog__doc__}, |
| 1095 | + {"fileno", (PyCFunction) Reader_fileno, METH_NOARGS, Reader_fileno__doc__}, |
| 1096 | + {"reliable_fd", (PyCFunction) Reader_reliable_fd, METH_NOARGS, Reader_reliable_fd__doc__}, |
| 1097 | + {"get_events", (PyCFunction) Reader_get_events, METH_NOARGS, Reader_get_events__doc__}, |
| 1098 | + {"get_timeout", (PyCFunction) Reader_get_timeout, METH_NOARGS, Reader_get_timeout__doc__}, |
| 1099 | + {"get_timeout_ms", (PyCFunction) Reader_get_timeout_ms, METH_NOARGS, Reader_get_timeout_ms__doc__}, |
| 1100 | + {"close", (PyCFunction) Reader_close, METH_NOARGS, Reader_close__doc__}, |
| 1101 | + {"get_usage", (PyCFunction) Reader_get_usage, METH_NOARGS, Reader_get_usage__doc__}, |
| 1102 | + {"__enter__", (PyCFunction) Reader___enter__, METH_NOARGS, Reader___enter____doc__}, |
| 1103 | + {"__exit__", (PyCFunction) Reader___exit__, METH_VARARGS, Reader___exit____doc__}, |
| 1104 | + {"_next", (PyCFunction) Reader_next, METH_VARARGS, Reader_next__doc__}, |
| 1105 | + {"_previous", (PyCFunction) Reader_previous, METH_VARARGS, Reader_previous__doc__}, |
| 1106 | + {"_get", (PyCFunction) Reader_get, METH_VARARGS, Reader_get__doc__}, |
| 1107 | + {"_get_all", (PyCFunction) Reader_get_all, METH_NOARGS, Reader_get_all__doc__}, |
| 1108 | + {"_get_realtime", (PyCFunction) Reader_get_realtime, METH_NOARGS, Reader_get_realtime__doc__}, |
| 1109 | + {"_get_monotonic", (PyCFunction) Reader_get_monotonic, METH_NOARGS, Reader_get_monotonic__doc__}, |
| 1110 | + {"add_match", (PyCFunction) Reader_add_match, METH_VARARGS|METH_KEYWORDS, Reader_add_match__doc__}, |
| 1111 | + {"add_disjunction", (PyCFunction) Reader_add_disjunction, METH_NOARGS, Reader_add_disjunction__doc__}, |
| 1112 | + {"add_conjunction", (PyCFunction) Reader_add_conjunction, METH_NOARGS, Reader_add_conjunction__doc__}, |
| 1113 | + {"flush_matches", (PyCFunction) Reader_flush_matches, METH_NOARGS, Reader_flush_matches__doc__}, |
| 1114 | + {"seek_head", (PyCFunction) Reader_seek_head, METH_NOARGS, Reader_seek_head__doc__}, |
| 1115 | + {"seek_tail", (PyCFunction) Reader_seek_tail, METH_NOARGS, Reader_seek_tail__doc__}, |
| 1116 | + {"seek_realtime", (PyCFunction) Reader_seek_realtime, METH_VARARGS, Reader_seek_realtime__doc__}, |
| 1117 | + {"seek_monotonic", (PyCFunction) Reader_seek_monotonic, METH_VARARGS, Reader_seek_monotonic__doc__}, |
| 1118 | + {"process", (PyCFunction) Reader_process, METH_NOARGS, Reader_process__doc__}, |
| 1119 | + {"wait", (PyCFunction) Reader_wait, METH_VARARGS, Reader_wait__doc__}, |
| 1120 | + {"seek_cursor", (PyCFunction) Reader_seek_cursor, METH_VARARGS, Reader_seek_cursor__doc__}, |
| 1121 | + {"_get_cursor", (PyCFunction) Reader_get_cursor, METH_NOARGS, Reader_get_cursor__doc__}, |
| 1122 | + {"test_cursor", (PyCFunction) Reader_test_cursor, METH_VARARGS, Reader_test_cursor__doc__}, |
| 1123 | + {"query_unique", (PyCFunction) Reader_query_unique, METH_VARARGS, Reader_query_unique__doc__}, |
| 1124 | + {"enumerate_fields", (PyCFunction) Reader_enumerate_fields, METH_NOARGS, Reader_enumerate_fields__doc__}, |
| 1125 | + {"has_runtime_files", (PyCFunction) Reader_has_runtime_files, METH_NOARGS, Reader_has_runtime_files__doc__}, |
| 1126 | + {"has_persistent_files", (PyCFunction) Reader_has_persistent_files, METH_NOARGS, Reader_has_persistent_files__doc__}, |
| 1127 | + {"get_catalog", (PyCFunction) Reader_get_catalog, METH_NOARGS, Reader_get_catalog__doc__}, |
1082 | 1128 | {} /* Sentinel */ |
1083 | 1129 | }; |
1084 | 1130 |
|
|
0 commit comments