1 /* SPDX-License-Identifier: LGPL-2.1+ */
4 #include <sys/socket.h>
8 #include "socket-util.h"
10 /// Additional includes needed by elogind
11 #include "musl_missing.h"
13 int main(int argc, char *argv[]) {
15 static const union sockaddr_union sa = {
16 .un.sun_family = AF_UNIX,
17 .un.sun_path = "/run/systemd/cgroups-agent",
20 _cleanup_close_ int fd = -1;
25 log_error("Incorrect number of arguments.");
29 elogind_set_program_name(argv[0]);
30 log_set_target(LOG_TARGET_AUTO);
31 log_parse_environment();
34 fd = socket(AF_UNIX, SOCK_DGRAM|SOCK_CLOEXEC, 0);
36 log_debug_errno(errno, "Failed to allocate socket: %m");
42 n = sendto(fd, argv[1], l, 0, &sa.sa, SOCKADDR_UN_LEN(sa.un));
44 log_debug_errno(errno, "Failed to send cgroups agent message: %m");
48 if ((size_t) n != l) {
49 log_debug("Datagram size mismatch");