diff options
author | Mike Yuan <me@yhndnzj.com> | 2024-10-08 14:53:14 +0200 |
---|---|---|
committer | Mike Yuan <me@yhndnzj.com> | 2024-10-11 18:22:19 +0200 |
commit | 32af4dd80fd0ce8ae1c30b3b8ee915b7a97cfb33 (patch) | |
tree | d99cf25bdd4c42030b02f4f546e69a8a38f4948b /src/core/service.h | |
parent | core/service: use LIST_HEAD where appropriate (diff) | |
download | systemd-32af4dd80fd0ce8ae1c30b3b8ee915b7a97cfb33.tar.xz systemd-32af4dd80fd0ce8ae1c30b3b8ee915b7a97cfb33.zip |
core/service: use array rather than list for extra fds, limit max number
Follow-up for 3543456f84ec2e83e07b6c9bf2b3a1c5d30241d8
I don't think list is particularly useful here. The passed fds are
constant for the lifetime of service, and with this commit we track
the number of extra fds in a dedicated var anyway.
Diffstat (limited to 'src/core/service.h')
-rw-r--r-- | src/core/service.h | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/src/core/service.h b/src/core/service.h index 504595b028..74b2b1c55e 100644 --- a/src/core/service.h +++ b/src/core/service.h @@ -115,8 +115,6 @@ struct ServiceFDStore { struct ServiceExtraFD { int fd; char *fdname; - - LIST_FIELDS(ServiceExtraFD, extra_fd); }; struct Service { @@ -228,23 +226,24 @@ struct Service { unsigned n_fd_store_max; ExecPreserveMode fd_store_preserve_mode; - char *usb_function_descriptors; - char *usb_function_strings; - int stdin_fd; int stdout_fd; int stderr_fd; - OOMPolicy oom_policy; + /* If service spawned from transient unit, extra file descriptors can be passed via dbus API */ + ServiceExtraFD *extra_fds; + size_t n_extra_fds; LIST_HEAD(OpenFile, open_files); - /* If service spawned from transient unit, extra file descriptors can be passed via dbus API */ - LIST_HEAD(ServiceExtraFD, extra_fds); - int reload_signal; usec_t reload_begin_usec; + OOMPolicy oom_policy; + + char *usb_function_descriptors; + char *usb_function_strings; + /* The D-Bus request, we will reply once the operation is finished, so that callers can block */ sd_bus_message *mount_request; }; @@ -306,6 +305,3 @@ DEFINE_CAST(SERVICE, Service); /* Only exported for unit tests */ int service_deserialize_exec_command(Unit *u, const char *key, const char *value); - -ServiceExtraFD* service_extra_fd_free(ServiceExtraFD *efd); -DEFINE_TRIVIAL_CLEANUP_FUNC(ServiceExtraFD*, service_extra_fd_free); |