Re: [PATCH 2/8] unix-socket: stub impl. for platforms with no unix socket support
- From
Erik Faye-Lund <kusmabite@gmail.com>
- Date
- May 13, 2014, 11:59 UTC
- Message-ID
- <CABPQNSZAxyWJucyJbO0ND2X5V+cnCFCGLZPfFhygi2tUVQCXYg@mail.gmail.com>
- In-Reply-To
- <1399979737-8577-4-git-send-email-pclouds@gmail.com>
On Tue, May 13, 2014 at 1:15 PM, Nguyễn Thái Ngọc Duy <pclouds@gmail.com> wrote:
Show 51 quoted lines
> With this we can make unix_stream_* calls without #ifdef.
>
> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
> ---
> Makefile | 2 ++
> unix-socket.h | 18 ++++++++++++++++++
> 2 files changed, 20 insertions(+)
>
> diff --git a/Makefile b/Makefile
> index 028749b..d0a2b4b 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -1417,6 +1417,8 @@ ifndef NO_UNIX_SOCKETS
> LIB_H += unix-socket.h
> PROGRAM_OBJS += credential-cache.o
> PROGRAM_OBJS += credential-cache--daemon.o
> +else
> + BASIC_CFLAGS += -DNO_UNIX_SOCKETS
> endif
>
> ifdef NO_ICONV
> diff --git a/unix-socket.h b/unix-socket.h
> index e271aee..f1cba70 100644
> --- a/unix-socket.h
> +++ b/unix-socket.h
> @@ -1,7 +1,25 @@
> #ifndef UNIX_SOCKET_H
> #define UNIX_SOCKET_H
>
> +#ifndef NO_UNIX_SOCKETS
> +
> int unix_stream_connect(const char *path);
> int unix_stream_listen(const char *path);
>
> +#else
> +
> +static inline int unix_stream_connect(const char *path)
> +{
> + errno = ENOSYS;
> + return -1;
> +}
> +
> +static inline int unix_stream_listen(const char *path)
> +{
> + errno = ENOSYS;
> + return -1;
> +}
> +
> +#endif
> +
> #endif /* UNIX_SOCKET_H */OK, so I missed this before my other two comments. But still... in what way does errno=ENOSYS make this *work*? Won't we end up compiling lots of non-functional tools on Windows in this case?