summaryrefslogtreecommitdiff
path: root/src/core/dbus-socket.c
Commit message (Collapse)AuthorAgeFilesLines
* tree-wide: drop duplicated blank linesYu Watanabe2019-07-151-1/+0
| | | | | | | ``` $ for i in */*.[ch] */*/*.[ch]; do sed -e '/^$/ {N; s/\n$//g}' -i $i; done $ git checkout HEAD -- basic/linux shared/linux ```
* tree-wide: code improvements suggested by CoccinelleFrantisek Sumsal2019-04-301-2/+6
|
* Remove 'inline' attributes from static functions in .c files (#11426)Topi Miettinen2019-01-151-2/+2
| | | Let the compiler perform inlining (see #11397).
* util: rename socket_protocol_{from,to}_name() to ip_protocol_{from,to}_name()Yu Watanabe2018-12-021-4/+4
|
* cgroup: drastically simplify caching of cgroups members maskLennart Poettering2018-11-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | Previously we tried to be smart: when a new unit appeared and it only added controllers to the cgroup mask we'd update the cached members mask in all parents by ORing in the controller flags in their cached values. Unfortunately this was quite broken, as we missed some conditions when this cache had to be reset (for example, when a unit got unloaded), moreover the optimization doesn't work when a controller is removed anyway (as in that case there's no other way for the parent to iterate though all children if any other, remaining child unit still needs it). Hence, let's simplify the logic substantially: instead of updating the cache on the right events (which we didn't get right), let's simply invalidate the cache, and generate it lazily when we encounter it later. This should actually result in better behaviour as we don't have to calculate the new members mask for a whole subtree whever we have the suspicion something changed, but can delay it to the point where we actually need the members mask. This allows us to simplify things quite a bit, which is good, since validating this cache for correctness is hard enough. Fixes: #9512
* core: use structured initializationLennart Poettering2018-10-171-6/+6
|
* core: shorten list appending a bit, by using better macrosLennart Poettering2018-10-171-7/+1
|
* dbus: add missing OOM checkLennart Poettering2018-10-171-0/+3
|
* core: validate socket path with path_is_valid()Lennart Poettering2018-10-171-0/+3
|
* tree-wide: remove Lennart's copyright linesLennart Poettering2018-06-141-3/+0
| | | | | | | | | | | 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-06-141-2/+0
| | | | | | | | | | | | | | | | 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.
* Add counter for socket unit refuse events (#9217)xginn82018-06-111-0/+1
| | | core: add counter for socket unit rejection events
* path-util: introduce path_simplify()Yu Watanabe2018-06-031-1/+1
| | | | | | | | The function is similar to path_kill_slashes() but also removes initial './', trailing '/.', and '/./' in the path. When the second argument of path_simplify() is false, then it behaves as the same as path_kill_slashes(). Hence, this also replaces path_kill_slashes() with path_simplify().
* load-fragment: make SocketProtocol= accept the empty stringYu Watanabe2018-05-311-2/+5
|
* socket-util: rename parse_socket_address_bind_ipv6_only_or_bool() to ↵Yu Watanabe2018-05-311-1/+1
| | | | | | | socket_address_bind_ipv6_only_or_bool_from_string() Hence, we can define config_parse_socket_bind() by using DEFINE_CONFIG_PARSE_ENUM() macro.
* dbus-socket: use BUS_DEFINE_PROPERTY_GET* macrosYu Watanabe2018-05-131-18/+1
|
* core: use bus_property_get_*() functions instead of NULLYu Watanabe2018-05-101-2/+2
|
* tree-wide: drop spurious newlines (#8764)Lennart Poettering2018-04-191-2/+0
| | | | | | | | Double newlines (i.e. one empty lines) are great to structure code. But let's avoid triple newlines (i.e. two empty lines), quadruple newlines, quintuple newlines, …, that's just spurious whitespace. It's an easy way to drop 121 lines of code, and keeps the coding style of our sources a bit tigther.
* tree-wide: drop license boilerplateZbigniew Jędrzejewski-Szmek2018-04-061-13/+0
| | | | | | | | | | 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.
* dbus-socket: simplify bus_socket_set_transient_property()Yu Watanabe2018-01-021-291/+111
|
* core: rename bus_exec_command_set_transient_property() to ↵Yu Watanabe2018-01-021-1/+1
| | | | bus_set_transient_exec_command()
* dbus-socket: move truncation check to bus_socket_set_transient_property()Yu Watanabe2017-12-231-0/+3
|
* basic: introduce socket_protocol_{from,to}_name()Yu Watanabe2017-12-231-3/+9
| | | | And use them where they can be applicable.
* core: implement transient socket unitYu Watanabe2017-12-231-1/+485
|
* core: add proper escaping to writing of drop-ins/transient unit filesLennart Poettering2017-11-291-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | This majorly refactors the transient unit file and drop-in writing logic, so that we properly C-escape and specifier-escape (% → %%) everything we write out, so that when we read it back again, specifiers are parsed that aren't supposed to be parsed. This renames unit_write_drop_in() and friends by unit_write_setting(). The name change is supposed to clarify that the functions are not only used to write drop-in files, but also transient unit files. The previous "mode" parameter to this function is replaced by a more generic "flags", which knows additional flags for implicit C-style and specifier escaping before writing things out. This can cover most properties where either form of escaping is defined. For the cases where this isn't sufficient, we add helpers unit_escape_setting() and unit_concat_strv() for escaping individual strings or strvs properly. While we are at it, we also prettify generation of transient unit files: we try to reduce the number of section headers written out: previously we'd write the right section header our for each setting. With this change we do so only if the setting lives in a different section than the one before. (This should also be considered preparation for when we add proper APIs to systemd to write normal, persistant unit files through the bus API)
* Add SPDX license identifiers to source files under the LGPLZbigniew Jędrzejewski-Szmek2017-11-191-0/+1
| | | | | This follows what the kernel is doing, c.f. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5fd54ace4721fc5ce2bb5aef6318fcf17f421460.
* core: add RemoveIPC= settingLennart Poettering2016-08-191-0/+2
| | | | | | | | | | | | | | | | | | This adds the boolean RemoveIPC= setting to service, socket, mount and swap units (i.e. all unit types that may invoke processes). if turned on, and the unit's user/group is not root, all IPC objects of the user/group are removed when the service is shut down. The life-cycle of the IPC objects is hence bound to the unit life-cycle. This is particularly relevant for units with dynamic users, as it is essential that no objects owned by the dynamic users survive the service exiting. In fact, this patch adds code to imply RemoveIPC= if DynamicUser= is set. In order to communicate the UID/GID of an executed process back to PID 1 this adds a new "user lookup" socket pair, that is inherited into the forked processes, and closed before the exec(). This is needed since we cannot do NSS from PID 1 due to deadlock risks, However need to know the used UID/GID in order to clean up IPC owned by it if the unit shuts down.
* socket: add support to control no. of connections from one source (#3607)Susant Sahani2016-08-021-0/+1
| | | | | | Introduce MaxConnectionsPerSource= that is number of concurrent connections allowed per IP. RFE: 1939
* core: expose TriggerLimitIntervalUSecEvgeny Vereshchagin2016-05-061-1/+1
| | | | | | | | | | Before: $ systemctl show --property TriggerLimitIntervalSec test.socket TriggerLimitIntervalSec=2000000 After: $ systemctl show --property TriggerLimitIntervalUSec test.socket TriggerLimitIntervalUSec=2s
* core: introduce activation rate limiting for socket unitsLennart Poettering2016-04-291-0/+2
| | | | | | | | | | | | | | This adds two new settings TriggerLimitIntervalSec= and TriggerLimitBurst= that define a rate limit for activation of socket units. When the limit is hit, the socket is is put into a failure mode. This is an alternative fix for #2467, since the original fix resulted in issue #2684. In a later commit the StartLimitInterval=/StartLimitBurst= rate limiter will be changed to be applied after any start conditions checks are made. This way, there are two separate rate limiters enforced: one at triggering time, before any jobs are queued with this patch, as well as the start limit that is moved again to be run immediately before the unit is activated. Condition checks are done in between the two, and thus no longer affect the start limit.
* tree-wide: remove Emacs lines from all filesDaniel Mack2016-02-101-2/+0
| | | | | This should be handled fine now by .dir-locals.el, so need to carry that stuff in every file.
* Socket: socket protocol add to dbus propertiesSusant Sahani2015-11-181-0/+1
|
* util-lib: split out allocation calls into alloc-util.[ch]Lennart Poettering2015-10-271-1/+2
|
* util-lib: split our string related calls from util.[ch] into its own file ↵Lennart Poettering2015-10-241-4/+5
| | | | | | | | | | | | | | string-util.[ch] There are more than enough calls doing string manipulations to deserve its own files, hence do something about it. This patch also sorts the #include blocks of all files that needed to be updated, according to the sorting suggestions from CODING_STYLE. Since pretty much every file needs our string manipulation functions this effectively means that most files have sorted #include blocks now. Also touches a few unrelated include files.
* core: add support for naming file descriptors passed using socket activationLennart Poettering2015-10-061-0/+20
| | | | | | | | | | | | | | | | | | | | | | | This adds support for naming file descriptors passed using socket activation. The names are passed in a new $LISTEN_FDNAMES= environment variable, that matches the existign $LISTEN_FDS= one and contains a colon-separated list of names. This also adds support for naming fds submitted to the per-service fd store using FDNAME= in the sd_notify() message. This also adds a new FileDescriptorName= setting for socket unit files to set the name for fds created by socket units. This also adds a new call sd_listen_fds_with_names(), that is similar to sd_listen_fds(), but also returns the names of the fds. systemd-activate gained the new --fdname= switch to specify a name for testing socket activation. This is based on #1247 by Maciej Wereski. Fixes #1247.
* core: add new setting Writable= to ListenSpecial= socket unitsLennart Poettering2015-10-011-0/+1
| | | | | | | | | Writable= is a new boolean setting. If ture, then ListenSpecial= will open the specified path in O_RDWR mode, rather than just O_RDONLY. This is useful for implementing services like rfkill, where /dev/rfkill is more useful when opened in write mode, if we want to not only save but also restore its state.
* core: Add socket type for usb functionfs endpointsPawel Szewczyk2015-09-221-0/+1
| | | | For handling functionfs endpoints additional socket type is added.
* remove unused includesThomas Hindoe Paaboel Andersen2015-02-231-2/+0
| | | | | | This patch removes includes that are not used. The removals were found with include-what-you-use which checks if any of the symbols from a header is in use.
* socket: suffix newly added TCP sockopt time properties with "Sec"Lennart Poettering2014-08-191-3/+3
| | | | | | This is what we have done so far for all other time values, and hence we should do this here. This indicates the default unit of time values specified here, if they don't contain a unit.
* socket: add bus property for bus property NoDelaySusant Sahani2014-08-141-0/+1
| | | | Missed to add the SD_BUS_PROPERTY for no_delay.
* socket: Add support for TCP defer acceptSusant Sahani2014-08-141-0/+1
| | | | | | | | | | | TCP_DEFER_ACCEPT Allow a listener to be awakened only when data arrives on the socket. If TCP_DEFER_ACCEPT set on a server-side listening socket, the TCP/IP stack will not to wait for the final ACK packet and not to initiate the process until the first packet of real data has arrived. After sending the SYN/ACK, the server will then wait for a data packet from a client. Now, only three packets will be sent over the network, and the connection establishment delay will be significantly reduced.
* socket: Add Support for TCP keep alive variablesSusant Sahani2014-08-141-0/+3
| | | | | | | | | | | | | | The tcp keep alive variables now can be configured via conf parameter. Follwing variables are now supported by this patch. tcp_keepalive_intvl: The number of seconds between TCP keep-alive probes tcp_keepalive_probes: The maximum number of TCP keep-alive probes to send before giving up and killing the connection if no response is obtained from the other end. tcp_keepalive_time: The number of seconds a connection needs to be idle before TCP begins sending out keep-alive probes.
* Revert "socket: add support for TCP fast Open"Lennart Poettering2014-08-141-1/+0
| | | | | | | | This reverts commit 9528592ff8d7ff361da430285deba8196e8984d5. Apparently TFO is actually the default at least for the server side now. Also the setsockopt doesn't actually take a bool, but a qlen integer.
* socket: add support for TCP fast OpenSusant Sahani2014-08-141-0/+1
| | | | | | | | | | TCP Fast Open (TFO) speeds up the opening of successiveTCP) connections between two endpoints.It works by using a TFO cookie in the initial SYN packet to authenticate a previously connected client. It starts sending data to the client before the receipt of the final ACK packet of the three way handshake is received, skipping a round trip and lowering the latency in the start of transmission of data.
* socket: add SocketUser= and SocketGroup= for chown()ing sockets in the file ↵Lennart Poettering2014-06-051-1/+3
| | | | | | | system This is relatively complex, as we cannot invoke NSS from PID 1, and thus need to fork a helper process temporarily.
* socket: add new Symlinks= option for socket unitsLennart Poettering2014-06-041-0/+1
| | | | | | | | | | | With Symlinks= we can manage one or more symlinks to AF_UNIX or FIFO nodes in the file system, with the same lifecycle as the socket itself. This has two benefits: first, this allows us to remove /dev/log and /dev/initctl from /dev, thus leaving only symlinks, device nodes and directories in the /dev tree. More importantly however, this allows us to move /dev/log out of /dev, while still making it accessible there, so that PrivateDevices= can provide /dev/log too.
* socket: optionally remove sockets/FIFOs in the file system after useLennart Poettering2014-06-041-0/+1
|
* core: rework cgroup mask propagationLennart Poettering2014-02-171-0/+2
| | | | | | | Previously a cgroup setting down tree would result in cgroup membership additions being propagated up the tree and to the siblings, however a unit could never lose cgroup memberships again. With this change we'll make sure that both cgroup additions and removals propagate properly.
* core: no need to list properties for PropertiesChanged messages anymoreLennart Poettering2013-12-221-12/+4
| | | | Since the vtable includes this information anyway, let's just use that
* bus: decorate the various object vtables with SD_BUS_VTABLE_PROPERTY_CONST ↵Lennart Poettering2013-12-221-34/+34
| | | | where appropriate