mirror of
https://github.com/systemd/systemd.git
synced 2024-11-23 10:13:34 +08:00
1fe6d37ea5
Quoting Richard Fontana in [1]: CC0 has been listed by Fedora as a 'good' license for code and content (corresponding to allowed and allowed-content under the new system). We plan to classify CC0 as allowed-content only, so that CC0 would no longer be allowed for code. Over a long period of time a consensus has been building in FOSS that licenses that preclude any form of patent licensing or patent forbearance cannot be considered FOSS. CC0 has a clause that says: "No trademark or patent rights held by Affirmer are waived, abandoned, surrendered, licensed or otherwise affected by this document." (The trademark side of that clause is nonproblematic from a FOSS licensing norms standpoint.) The regular Creative Commons licenses have similar clauses. For the case of our documentation snippets, patent issues do not matter much. But it is always nicer to have a license that is considerred acceptable without any further considerations. So let's change the license to the (now recommended replacement) MIT-0. [1] https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/message/NO7KGDNL5GX3KCB7T3XTGFA3QPSUJA6R/ Using 'git blame -b' and 'git log -p --follow', I identified the following folks as having made non-trivial changes to those snippets: Lennart Poettering Tom Gundersen Luca Bocassi Zbigniew Jędrzejewski-Szmek Thomas Mühlbacher Daan De Meyer I'll ask for confirmation in the pull request.
49 lines
1.2 KiB
C
49 lines
1.2 KiB
C
/* SPDX-License-Identifier: MIT-0 */
|
|
|
|
#include <stdlib.h>
|
|
#include <glib.h>
|
|
#include <systemd/sd-event.h>
|
|
|
|
typedef struct SDEventSource {
|
|
GSource source;
|
|
GPollFD pollfd;
|
|
sd_event *event;
|
|
} SDEventSource;
|
|
|
|
static gboolean event_prepare(GSource *source, gint *timeout_) {
|
|
return sd_event_prepare(((SDEventSource *)source)->event) > 0;
|
|
}
|
|
|
|
static gboolean event_check(GSource *source) {
|
|
return sd_event_wait(((SDEventSource *)source)->event, 0) > 0;
|
|
}
|
|
|
|
static gboolean event_dispatch(GSource *source, GSourceFunc callback, gpointer user_data) {
|
|
return sd_event_dispatch(((SDEventSource *)source)->event) > 0;
|
|
}
|
|
|
|
static void event_finalize(GSource *source) {
|
|
sd_event_unref(((SDEventSource *)source)->event);
|
|
}
|
|
|
|
static GSourceFuncs event_funcs = {
|
|
.prepare = event_prepare,
|
|
.check = event_check,
|
|
.dispatch = event_dispatch,
|
|
.finalize = event_finalize,
|
|
};
|
|
|
|
GSource *g_sd_event_create_source(sd_event *event) {
|
|
SDEventSource *source;
|
|
|
|
source = (SDEventSource *)g_source_new(&event_funcs, sizeof(SDEventSource));
|
|
|
|
source->event = sd_event_ref(event);
|
|
source->pollfd.fd = sd_event_get_fd(event);
|
|
source->pollfd.events = G_IO_IN | G_IO_HUP | G_IO_ERR;
|
|
|
|
g_source_add_poll((GSource *)source, &source->pollfd);
|
|
|
|
return (GSource *)source;
|
|
}
|