]>
git.ipfire.org Git - thirdparty/systemd.git/blob - src/cgroups-agent/cgroups-agent.c
1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
7 #include "socket-util.h"
9 int main(int argc
, char *argv
[]) {
11 static const union sockaddr_union sa
= {
12 .un
.sun_family
= AF_UNIX
,
13 .un
.sun_path
= "/run/systemd/cgroups-agent",
16 _cleanup_close_
int fd
= -1;
21 r
= rearrange_stdio(-1, -1, -1);
23 log_error_errno(r
, "Failed to connect stdin/stdout/stderr with /dev/null: %m");
28 log_error("Incorrect number of arguments.");
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");