Re: systemd-activation: it's a mess for beginners

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Mar 20, 2019 at 9:46 PM Reindl Harald <h.reindl@xxxxxxxxxxxxx> wrote:
>
> http://0pointer.de/blog/projects/socket-activation.html
>
> ---------------------------------------------
>
> #include <stdio.h>
> #include <stdlib.h>
> #include <unistd.h>
> #include <arpa/inet.h>
> #include <netinet/in.h>
> #include <stdio.h>
> #include <sys/types.h>
> #include <sys/socket.h>
> #include <unistd.h>
> #include <string.h>
> #include <stdlib.h>
> #include </usr/include/systemd/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;
>
> ---------------------------------------------
>
> demo-udp.c:16:1: error: expected identifier or '(' before 'if'
>  if(sd_listen_fds(0) != 1)
>  ^~
> demo-udp.c:22:1: warning: data definition has no type or storage class
>  fd = SD_LISTEN_FDS_START + 0;
>  ^~
> demo-udp.c:22:1: warning: type defaults to 'int' in declaration of 'fd'
> [-Wimplicit-int]
>
> ---------------------------------------------

I think you got the wrong mailing list; the requirement to put the
code inside a main() function is a basic feature of C syntax and is
not part of systemd.

-- 
Mantas Mikulėnas
_______________________________________________
systemd-devel mailing list
systemd-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/systemd-devel




[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux