summaryrefslogtreecommitdiff
path: root/src/systemd
Commit message (Collapse)AuthorAge
* Prep v239: Add missing updates that evaded migration.Sven Eden2018-08-24
|
* Drop my copyright headersZbigniew Jędrzejewski-Szmek2018-08-24
| | | | | | | perl -i -0pe 's/\s*Copyright © .... Zbigniew Jędrzejewski.*?\n/\n/gms' man/*xml git grep -e 'Copyright.*Jędrzejewski' -l | xargs perl -i -0pe 's/(#\n)?# +Copyright © [0-9, -]+ Zbigniew Jędrzejewski.*?\n//gms' git grep -e 'Copyright.*Jędrzejewski' -l | xargs perl -i -0pe 's/\s*\/\*\*\*\s+Copyright © [0-9, -]+ Zbigniew Jędrzejewski[^\n]*?\s*\*\*\*\/\s*/\n\n/gms' git grep -e 'Copyright.*Jędrzejewski' -l | xargs perl -i -0pe 's/\s+Copyright © [0-9, -]+ Zbigniew Jędrzejewski[^\n]*//gms'
* tree-wide: beautify remaining copyright statementsLennart Poettering2018-08-24
| | | | | | Let's unify an beautify our remaining copyright statements, with a unicode ©. This means our copyright statements are now always formatted the same way. Yay.
* tree-wide: remove Lennart's copyright linesLennart Poettering2018-08-24
| | | | | | | | | | | These lines are generally out-of-date, incomplete and unnecessary. With SPDX and git repository much more accurate and fine grained information about licensing and authorship is available, hence let's drop the per-file copyright notice. Of course, removing copyright lines of others is problematic, hence this commit only removes my own lines and leaves all others untouched. It might be nicer if sooner or later those could go away too, making git the only and accurate source of authorship information.
* tree-wide: drop 'This file is part of systemd' blurbLennart Poettering2018-08-24
| | | | | | | | | | | | | | | | This part of the copyright blurb stems from the GPL use recommendations: https://www.gnu.org/licenses/gpl-howto.en.html The concept appears to originate in times where version control was per file, instead of per tree, and was a way to glue the files together. Ultimately, we nowadays don't live in that world anymore, and this information is entirely useless anyway, as people are very welcome to copy these files into any projects they like, and they shouldn't have to change bits that are part of our copyright header for that. hence, let's just get rid of this old cruft, and shorten our codebase a bit.
* sd-event: add destroy callback logic to sd-event tooLennart Poettering2018-08-24
| | | | | This adds what has been added to sd_bus_slot and sd_bus_track to sd_event too.
* sd-bus: also add destroy callbacks to sd_bus_track objectsLennart Poettering2018-08-24
| | | | | This augments previous work for this for sd_bus_slot objects, and adds the same concept to sd_bus_track objects, too.
* bus: optionally call a callbacks for cleanupZbigniew Jędrzejewski-Szmek2018-08-24
| | | | | | | | | | | | | | | This adds a function sd_bus_slot_set_destroy_callback() to set a function which can free userdata or perform other cleanups. sd_bus_slot_get_destory_callback() queries the callback, and is included for completeness. Without something like this, for floating asynchronous callbacks, which might be called or not, depending on the sequence of events, it's hard to perform resource cleanup. The alternative would be to always perform the cleanup from the caller too, but that requires more coordination and keeping of some shared state. It's nicer to keep the cleanup contained between the callback and the function that requests the callback.
* sd-event: add new API for subscribing to inotify eventsLennart Poettering2018-08-24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds a new call sd_event_add_inotify() which allows watching for inotify events on specified paths. sd-event will try to minimize the number of inotify fds allocated, and will try to add file watches to the same inotify fd objects as far as that's possible. Doing this kind of inotify object should optimize behaviour in programs that watch a limited set of mostly independent files as in most cases a single inotify object will suffice for watching all files. Traditionally, this kind of coalescing logic (i.e. that multiple event sources are implemented on top of a single inotify object) was very hard to do, as the inotify API had serious limitations: it only allowed adding watches by path, and would implicitly merge watches installed on the same node via different path, without letting the caller know about whether such merging took place or not. With the advent of O_PATH this issue can be dealt with to some point: instead of adding a path to watch to an inotify object with inotify_add_watch() right away, we can open the path with O_PATH first, call fstat() on the fd, and check the .st_dev/.st_ino fields of that against a list of watches we already have in place. If we find one we know that the inotify_add_watch() will update the watch mask of the existing watch, otherwise it will create a new watch. To make this race-free we use inotify_add_watch() on the /proc/self/fd/ path of the O_PATH fd, instead of the original path, so that we do the checking and watch updating with guaranteed the same inode. This approach let's us deal safely with inodes that may appear under various different paths (due to symlinks, hardlinks, bind mounts, fs namespaces). However it's not a perfect solution: currently the kernel has no API for changing the watch mask of an existing watch -- unless you have a path or fd to the original inode. This means we can "merge" the watches of the same inode of multiple event sources correctly, but we cannot "unmerge" it again correctly in many cases, as access to the original inode might have been lost, due to renames, mount/unmount, or deletions. We could in theory always keep open an O_PATH fd of the inode to watch so that we can change the mask anytime we want, but this is highly problematics, as it would consume too many fds (and in fact the scarcity of fds is the reason why watch descriptors are a separate concepts from fds) and would keep the backing mounts busy (wds do not keep mounts busy, fds do). The current implemented approach to all this: filter in userspace and accept that the watch mask on some inode might be higher than necessary due to earlier installed event sources that might have ceased to exist. This approach while ugly shouldn't be too bad for most cases as the same inodes are probably wacthed for the same masks in most implementations. In order to implement priorities correctly a seperate inotify object is allocated for each priority that is used. This way we get separate per-priority event queues, of which we never dequeue more than a few events at a time. Fixes: #3982
* sd-bus: add new sd_bus_slot_set_floating() callLennart Poettering2018-08-24
| | | | | | | | | | This new call allows explicit control of the "floating" state of a bus slot object. This is useful for creating a bus slot object first, retaining a reference to it, using it for making changes to the slot object (for example, set a description) and then handing it over to sd-bus for lifecycle management. It's also useful to fix #8551.
* meson: test out headers with more standard versionsZbigniew Jędrzejewski-Szmek2018-08-24
| | | | They all pass fine, but let's keep testing regularly.
* tree-wide: drop license boilerplateZbigniew Jędrzejewski-Szmek2018-08-24
| | | | | | | | | | Files which are installed as-is (any .service and other unit files, .conf files, .policy files, etc), are left as is. My assumption is that SPDX identifiers are not yet that well known, so it's better to retain the extended header to avoid any doubt. I also kept any copyright lines. We can probably remove them, but it'd nice to obtain explicit acks from all involved authors before doing that.
* sd-bus: allow description to be set for system/user busses (#8594)Zbigniew Jędrzejewski-Szmek2018-08-24
| | | | | | | | | | | | | sd_bus_open/sd_bus_open_system/sd_bus_open_user are convenient, but don't allow the description to be set. After they return, the bus is is already started, and sd_bus_set_description() fails with -EBUSY. It would be possible to allow sd_bus_set_description() to update the description "live", but messages are already emitted from sd_bus_open functions, so it's better to allow the description to be set in sd_bus_open/sd_bus_open_system/sd_bus_open_user. Fixes message like: Bus n/a: changing state UNSET → OPENING
* Fix include mask in API header sd-event.h to be C90 conformant. (Closes #69)Sven Eden2018-06-29
|
* ISO-C compatibility: Remove empty initializer (#8713)Leonard2018-06-28
| | | | | | | | | | ISO-C doesn't allow empty initializers, so replace it by explicitly initializing to zero. Also add braces because x is a union and we initialize a subobject, so a compiler might warn about suggesting braces. Shut that up. (cherry picked from commit d579a56c397a1aeaa490032a9f7aabd82124f1c8)
* core: don't process dbus unit and job queue when there are already too many ↵Lennart Poettering2018-05-30
| | | | | | | | | | | | | | | | | | | | | | | | | | messages pending We maintain a queue of units and jobs that we are supposed to generate change/new notifications for because they were either just created or some of their property has changed. Let's throttle processing of this queue a bit: as soon as > 1K of bus messages are queued for writing let's skip processing the queue, and then recheck on the next iteration again. Moreover, never process more than 100 units in one go, return to the event loop after that. Both limits together should put effective limits on both space and time usage of the function, delaying further operations until a later moment, when the queue is empty or the the event loop is sufficiently idle again. This should keep the number of generated messages much lower than before on busy systems or where some client is hanging. Note that this also means a bad client can slow down message dispatching substantially for up to 90s if it likes to, for all clients. But that should be acceptable as we only allow trusted bus clients, anyway. Fixes: #8166
* Add fd close support to sd_event_sourceNathaniel McCallum2018-05-30
| | | | | | | | | | | | | | It is often the case that a file descriptor and its corresponding IO sd_event_source share a life span. When this is the case, developers will have to unref the event source and close the file descriptor. Instead, we can just have the event source take ownership of the file descriptor and close it when the event source is freed. This is especially useful when combined with cleanup attributes and sd_event_source_unrefp(). This patch adds two new public functions: sd_event_source_get_io_fd_own() sd_event_source_set_io_fd_own()
* Include time.h in sd-event.hNathaniel McCallum2018-05-30
| | | | | | The time-related functions in sd-event.h take as inputs constants (CLOCK_*) defined in time.h. By including time.h in sd-event.h, we free the developer from having to do this manually.
* Add support for SD_BUS_DEFAULT*Nathaniel McCallum2018-05-30
| | | | | | | | | | | | | | | | | | | | | | Currently, sd-bus supports the ability to have thread-local default busses. However, this is less useful than it can be since all functions which require an sd_bus* as input require the caller to pass it. This patch adds a new macro which allows the developer to pass a constant SD_BUS_DEFAULT, SD_BUS_DEFAULT_USER or SD_BUS_DEFAULT_SYSTEM instead. This reduces work for the caller. For example: r = sd_bus_default(&bus); r = sd_bus_call_method(bus, ...); sd_bus_unref(bus); Becomes: r = sd_bus_call_method(SD_BUS_DEFAULT, ...); If the specified thread-local default bus does not exist, the function calls will return -ENOPKG. No bus will ever be implicitly created.
* Add support for SD_EVENT_DEFAULTNathaniel McCallum2018-05-30
| | | | | | | | | | | | | | | | | | | | | Currently, sd-event supports the ability to have a thread-local default event loop. However, this is less useful than it can be since all functions which require an sd_event* as input require the caller to pass it. This patch adds a new macro which allows the developer to pass a constant SD_EVENT_DEFAULT instead. This reduces work for the caller. For example: r = sd_event_default(&e); r = sd_event_add_io(e, ...); sd_event_unref(e); Becomes: r = sd_event_add_io(SD_EVENT_DEFAULT, ...); If no thread-local default event loop exists, the function calls will return -ENOPKG. No event loop will ever be implicitly created.
* sd-bus: add API to optionally set a sender field on all outgoing messagesLennart Poettering2018-05-30
| | | | | | | | | | This is useful on direct connections to generate messages with valid sender fields. This is particularly useful for services that are accessible both through direct connections and the broker, as it allows clients to install matches on the sender service name, and they work the same in both cases.
* networkd,resolved: make use of watch_bind feature to connect to the busLennart Poettering2018-05-30
| | | | | | | | | | The changes both networkd and resolved to make use of the watch_bind feature of sd-bus to connect to the system bus. This way, both daemons can be started during early boot, and automatically and instantly connect to the system bus as it becomes available. This replaces prior code that used a time-based retry logic to connect to the bus.
* sd-bus: add new sd_bus_is_ready() APILennart Poettering2018-05-30
| | | | | | | | This new call is much light sd_bus_is_open(), but returns true only if the connection is fully set up, i.e. after we finished with the authentication and Hello() phase. This API is useful for clients in particular when using the "watch_bind" feature, as that way it can be determined in advance whether it makes sense to sync on some operation.
* sd-bus: add new API sd_bus_match_signal() + sd_bus_match_signal_asnyc()Lennart Poettering2018-05-30
| | | | | | These are convenience helpers that hide the match string logic (which we probably should never have exposed), and instead just takes regular C arguments.
* sd-bus: add asynchronous version of sd_bus_match()Lennart Poettering2018-05-30
| | | | | | | We usually enqueue a number of these calls on each service initialization. Let's do this asynchronously, and thus remove synchronization points. This improves both performance behaviour and reduces the chances to deadlock.
* sd-bus: add APIs to request/release names asynchronouslyLennart Poettering2018-05-30
| | | | | | | | | | | They do the same thing as their synchronous counterparts, but only enqueue the operation, thus removing synchronization points during service initialization. If the callback function is passed as NULL we'll fallback to generic implementations of the reply handlers, that terminate the connection if the requested name cannot be acquired, under the assumption that not being able to acquire the name is a technical problem.
* sd-bus: optionally, use inotify to wait for bus sockets to appearLennart Poettering2018-05-30
| | | | | | | | | | | This adds a "watch-bind" feature to sd-bus connections. If set and the AF_UNIX socket we are connecting to doesn't exist yet, we'll establish an inotify watch instead, and wait for the socket to appear. In other words, a missing AF_UNIX just makes connecting slower. This is useful for daemons such as networkd or resolved that shall be able to run during early-boot, before dbus-daemon is up, and want to connect to dbus-daemon as soon as it becomes ready.
* Prep v236 : Add missing SPDX-License-Identifier (7/9) src/systemdSven Eden2018-03-26
|
* Prep v236: Apply missing upstream updates to the build systemSven Eden2018-03-13
|
* Some minor cleanupsSven Eden2018-03-07
|
* Meson build system: Add missing '#' in masked blocksSven Eden2018-03-07
|
* Prep 235: Make elogind masks in sd-bus.h c90 compatible again.Sven Eden2018-01-09
|
* Prep 235: Enabled sd_bus_creds_get_slice(), sd_bus_creds_get_user_slice(), ↵Sven Eden2018-01-09
| | | | sd_peer_get_user_slice() and sd_pid_get_user_slice() to try to work with eloginds session id to user mapping.
* src/systemd/meson.build: Fix add_install_script() callSven Eden2018-01-09
|
* Forgot to symlink _sdcommon.hSven Eden2017-12-15
|
* sd-bus.h, sd-daemon.h : MAke elogind masks ISO C90 compatible.Sven Eden2017-12-13
|
* Prep v232.6: Make all supportable API functions visibleSven Eden2017-12-12
| | | | (v232 addition).
* Prep 229.9: Make all supportable API functions visible.Sven Eden2017-12-12
| | | | | | | | | | The process of cleaning up elogind, meaning to mask all bits that are unneeded by elogind, has been finished a while ago. It is therefore time to re-enable all previously masked API functions that elogind can support. This will make it easier for future developers to integrate elogind into their software where they already support systemd-login.
* Meson build system: Recreate the symlinking of elogind/systemd/*.h headers ↵Sven Eden2017-12-08
| | | | into elogin/
* Apply updates from upstreamSven Eden2017-12-07
|
* build-sys: use #if Y instead of #ifdef Y everywhereZbigniew Jędrzejewski-Szmek2017-11-23
| | | | | | | | | | | | | | | The advantage is that is the name is mispellt, cpp will warn us. $ git grep -Ee "conf.set\('(HAVE|ENABLE)_" -l|xargs sed -r -i "s/conf.set\('(HAVE|ENABLE)_/conf.set10('\1_/" $ git grep -Ee '#ifn?def (HAVE|ENABLE)' -l|xargs sed -r -i 's/#ifdef (HAVE|ENABLE)/#if \1/; s/#ifndef (HAVE|ENABLE)/#if ! \1/;' $ git grep -Ee 'if.*defined\(HAVE' -l|xargs sed -i -r 's/defined\((HAVE_[A-Z0-9_]*)\)/\1/g' $ git grep -Ee 'if.*defined\(ENABLE' -l|xargs sed -i -r 's/defined\((ENABLE_[A-Z0-9_]*)\)/\1/g' + manual changes to meson.build squash! build-sys: use #if Y instead of #ifdef Y everywhere v2: - fix incorrect setting of HAVE_LIBIDN2
* Prep v235: Apply upstream fixes (8/10) [src/systemd]Sven Eden2017-08-14
|
* General: Update build system to upstream support of meson+ninja.Sven Eden2017-08-04
| | | | | | | | Upstream thinks, that the auto tools are too 'legacy', or that they are at least no longer fitting. We follow, as the classic auto tools files have been removed, so no other choice here...
* Prep v234: Apply missing upstream fixes in src/systemd (5/6)Sven Eden2017-07-25
|
* sd-bus: fix c++ compatibility (#5941)Matthijs van Duin2017-07-25
| | | | | | | g++ annoyingly requires a non-empty struct-initializer to initialize all struct members, in order of declaration. Signed-off-by: Matthijs van Duin <matthijsvanduin@gmail.com>
* check for _POSIX_C_SOURCE instead of __USE_POSIX*Matija Skala2017-07-25
| | | | | check for _GNU_SOURCE as well as sd_event_child_handler_t needs to be defined correctly while compiling elogind
* headers: check that __INCLUDE_LEVEL__ is defined before using it (#5575)Zbigniew Jędrzejewski-Szmek2017-07-25
| | | | | That macro is a gcc extension, and while widely supported, not ubiquitous. In particular the coverity scanner is having trouble with it.
* Prep v233.3: Unmask various functions for future coverage tests.Sven Eden2017-07-19
| | | | | These functions, although not used by elogind itself, are mostly tiny and crucial for important tests to work.
* Prep v233: Add missing updates from upstream in src/systemdSven Eden2017-07-17
|
* Syntax for defines that is also unterstood by the GNU C/C++ compilers. (#5397)pyBlob2017-07-17
|