Re: [PATCH 2/8] unix-socket: stub impl. for platforms with no unix socket support
On Tue, May 13, 2014 at 1:59 PM, Erik Faye-Lund wrote: > On Tue, May 13, 2014 at 1:15 PM, Nguyễn Thái Ngọc Duy > wrote: >> With this we can make unix_stream_* calls without #ifdef. >> >> Signed-off-by: Nguyễn Thái Ngọc Duy >> --- >> 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? ENOSYS makes git-credential-cache.c just die with the message "unable to start cache daemon", and git-credential--daemon.c die with "unable to bind to ". -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/8] unix-socket: stub impl. for platforms with no unix socket support
On Tue, May 13, 2014 at 1:15 PM, Nguyễn Thái Ngọc Duy wrote: > With this we can make unix_stream_* calls without #ifdef. > > Signed-off-by: Nguyễn Thái Ngọc Duy > --- > 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? -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/8] unix-socket: stub impl. for platforms with no unix socket support
With this we can make unix_stream_* calls without #ifdef. Signed-off-by: Nguyễn Thái Ngọc Duy --- 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 */ -- 1.9.1.346.ga2b5940 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html