[systemd-devel] systemd-activation: it's a mess for beginners
Reindl Harald
h.reindl at thelounge.net
Wed Mar 20 20:17:38 UTC 2019
Am 20.03.19 um 21:10 schrieb Daniele Nicolodi:
> On 20-03-2019 14:01, Reindl Harald wrote:
>> Am 20.03.19 um 20:53 schrieb Daniele Nicolodi:
>>> I am not sure what you are trying to say, but the first source code
>>> snippet in your email in not valid C code. I don't know what you mean
>>> by "beginners" in the subject of your email, but I think that the
>>> documentation assumes basic knowledge of the C programming language.
>>
>> tell that http://0pointer.de/blog/projects/socket-activation.html
>
> Communication would be more effective if you would write complete
> sentences instead than having us guess what you are trying to say.
>> that thing below "just works" (ipv4 only but well..) as ordinary
>> service, frankly i just want a "as-simple-as-possible" binary which
>> receives UDP, get fired up by systemd on-demand, answers whatever to
>> signal "this port is open and reachbale" to the client, not more
>> and not less without have to run it all the time
no idea what you need to guess here!
>> /* Source Code Example #2: UPDATED, SOCKET-ACTIVATABLE SERVICE */
>> ...
>> #include "sd-daemon.h"
>> ...
>> int fd;
>>
>> if (sd_listen_fds(0) != 1) {
>> fprintf(stderr, "No or too many file descriptors received.\n");
>> exit(1);
>> }
>>
>> fd = SD_LISTEN_FDS_START + 0;
>
> This code snipped clearly has "..." as placeholders for code parts that
> were not included in the documentation snippets. Your test program did
> not include the "..." markers, thus I believe that you understood that
> much. For how to replace the placeholders with working C code you need
> to consult your favorite C programming manual. I don't think Lennart
> blog post was meant to be a C programming tutorial as well as an
> introduction to systemd socket activation.
well, that's why i also quoted the in the meantime working full
standalone udp service called with "binary listening-ip listening-port"
which should replaced by a systemd-activated binary
look at the "worker-loop" - i want "sockfd" practically handed over form
PID1
while(1)
{
recvfrom(sockfd, (char *)buffer, MAXLINE, MSG_WAITALL, (struct
sockaddr *) &cliaddr, &len);
}
More information about the systemd-devel
mailing list