]>
git.ipfire.org Git - thirdparty/systemd.git/blob - src/cgroups-agent/cgroups-agent.c
1 /* SPDX-License-Identifier: LGPL-2.1+ */
4 #include <sys/socket.h>
8 #include "socket-util.h"
10 int main(int argc
, char *argv
[]) {
12 static const union sockaddr_union sa
= {
13 .un
.sun_family
= AF_UNIX
,
14 .un
.sun_path
= "/run/systemd/cgroups-agent",
17 _cleanup_close_
int fd
= -1;
22 log_error("Incorrect number of arguments.");
26 log_set_target(LOG_TARGET_AUTO
);
27 log_parse_environment();
30 fd
= socket(AF_UNIX
, SOCK_DGRAM
|SOCK_CLOEXEC
, 0);
32 log_debug_errno(errno
, "Failed to allocate socket: %m");
38 n
= sendto(fd
, argv
[1], l
, 0, &sa
.sa
, SOCKADDR_UN_LEN(sa
.un
));
40 log_debug_errno(errno
, "Failed to send cgroups agent message: %m");
44 if ((size_t) n
!= l
) {
45 log_debug("Datagram size mismatch");