From f04ee9c28e307cef1191774b3135c47736d9feb3 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Sat, 6 Aug 2011 15:04:48 +0200 Subject: [PATCH] Support NO_UNIX_SOCKETS The year is 2011AD. Desktop computers are entirely occupied by POSIX-conforming operating systems. Well, not entirely...! One small operating system of indomitable APIs still holds out against the invaders, their POSIX functions and datatypes... and their Unix sockets. Signed-off-by: Johannes Schindelin --- Makefile | 6 ++++++ unix-socket.c | 14 ++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/Makefile b/Makefile index 6d67e444de..234d0af0fd 100644 --- a/Makefile +++ b/Makefile @@ -258,6 +258,8 @@ all:: # dependency rules. # # Define NATIVE_CRLF if your platform uses CRLF for line endings. +# +# Define NO_UNIX_SOCKETS if your platform does not have them. GIT-VERSION-FILE: FORCE @$(SHELL_PATH) ./GIT-VERSION-GEN @@ -1214,6 +1216,7 @@ ifneq (,$(findstring MINGW,$(uname_S))) NO_INET_NTOP = YesPlease NO_POSIX_GOODIES = UnfortunatelyYes NO_D_INO_IN_DIRENT = YesPlease + NO_UNIX_SOCKETS = UnfortunatelyNot COMPAT_CFLAGS += -D__USE_MINGW_ACCESS -DNOGDI -Icompat -Icompat/win32 COMPAT_CFLAGS += -DSTRIP_EXTENSION=\".exe\" COMPAT_OBJS += compat/mingw.o compat/winansi.o \ @@ -1624,6 +1627,9 @@ endif ifdef GIT_TEST_CMP_USE_COPIED_CONTEXT export GIT_TEST_CMP_USE_COPIED_CONTEXT endif +ifdef NO_UNIX_SOCKETS + COMPAT_CFLAGS += -DNO_UNIX_SOCKETS=1 +endif ifeq ($(TCLTK_PATH),) NO_TCLTK=NoThanks diff --git a/unix-socket.c b/unix-socket.c index cf9890f57c..8defa80c31 100644 --- a/unix-socket.c +++ b/unix-socket.c @@ -1,6 +1,19 @@ #include "cache.h" #include "unix-socket.h" +#ifdef NO_UNIX_SOCKETS +int unix_stream_connect(const char *path) +{ + errno = ENOSYS; + return -1; +} + +int unix_stream_listen(const char *path) +{ + errno = ENOSYS; + return -1; +} +#else static int unix_stream_socket(void) { int fd = socket(AF_UNIX, SOCK_STREAM, 0); @@ -56,3 +69,4 @@ int unix_stream_listen(const char *path) return fd; } +#endif