Bug#733452: Minimal code for systemd protocol
Hello,
It's already been mentioned elsewhere, but I think it should be included in this bug for reference. The minimum code to support systemd style readyness notification is (from https://plus.google.com/+LennartPoetteringTheOneAndOnly/posts/37AWJLE3XcJ):
static void notify(const char *data) {
const char *e;
e = getenv("NOTIFY_SOCKET");
if (e) {
struct sockaddr_un un = { .sun_family = AF_UNIX };
int fd;
strncpy(un.sun_path, e, sizeof(un.sun_path));
if (un.sun_path[0] == '@')
un.sun_path[0] = 0;
fd = socket(AF_UNIX, SOCK_DGRAM, 0);
if (fd < 0)
return;
sendto(fd, data, strlen(data), MSG_NOSIGNAL, (struct sockaddr*) &un, offsetof(un.sun_path) + strlen(e));
close(fd);
}
}
Best,
Nikolaus
--
Encrypted emails preferred.
PGP fingerprint: 5B93 61F8 4EA2 E279 ABF6 02CF A9AD B7F8 AE4E 425C
»Time flies like an arrow, fruit flies like a Banana.«
Reply to: