Skip to content

Commit

Permalink
Merge branch 'ef/mingw-daemon'
Browse files Browse the repository at this point in the history
* ef/mingw-daemon:
  daemon: opt-out on features that require posix
  daemon: make --inetd and --detach incompatible
  daemon: use socklen_t
  mingw: use poll-emulation from gnulib
  mingw: import poll-emulation from gnulib
  daemon: get remote host address from root-process
  Improve the mingw getaddrinfo stub to handle more use cases
  daemon: use full buffered mode for stderr
  daemon: use run-command api for async serving
  mingw: add kill emulation
  mingw: support waitpid with pid > 0 and WNOHANG
  mingw: use real pid
  inet_ntop: fix a couple of old-style decls
  compat: add inet_pton and inet_ntop prototypes
  mingw: implement syslog
  mingw: add network-wrappers for daemon
  • Loading branch information
Junio C Hamano committed Nov 24, 2010
2 parents d313c1c + a666b47 commit 89ba4e7
Show file tree
Hide file tree
Showing 12 changed files with 1,117 additions and 231 deletions.
3 changes: 2 additions & 1 deletion Documentation/git-daemon.txt
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ OPTIONS

--inetd::
Have the server run as an inetd service. Implies --syslog.
Incompatible with --port, --listen, --user and --group options.
Incompatible with --detach, --port, --listen, --user and --group
options.

--listen=<host_or_ipaddr>::
Listen on a specific IP address or hostname. IP addresses can
Expand Down
23 changes: 16 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,7 @@ EXTRA_PROGRAMS =
# ... and all the rest that could be moved out of bindir to gitexecdir
PROGRAMS += $(EXTRA_PROGRAMS)

PROGRAM_OBJS += daemon.o
PROGRAM_OBJS += fast-import.o
PROGRAM_OBJS += imap-send.o
PROGRAM_OBJS += shell.o
Expand Down Expand Up @@ -496,6 +497,8 @@ LIB_H += compat/bswap.h
LIB_H += compat/cygwin.h
LIB_H += compat/mingw.h
LIB_H += compat/win32/pthread.h
LIB_H += compat/win32/syslog.h
LIB_H += compat/win32/sys/poll.h
LIB_H += csum-file.h
LIB_H += decorate.h
LIB_H += delta.h
Expand Down Expand Up @@ -1064,7 +1067,6 @@ ifeq ($(uname_S),Windows)
NO_SVN_TESTS = YesPlease
NO_PERL_MAKEMAKER = YesPlease
RUNTIME_PREFIX = YesPlease
NO_POSIX_ONLY_PROGRAMS = YesPlease
NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
NO_NSEC = YesPlease
USE_WIN32_MMAP = YesPlease
Expand All @@ -1075,13 +1077,14 @@ ifeq ($(uname_S),Windows)
NO_CURL = YesPlease
NO_PYTHON = YesPlease
BLK_SHA1 = YesPlease
NO_POSIX_GOODIES = UnfortunatelyYes
NATIVE_CRLF = YesPlease

CC = compat/vcbuild/scripts/clink.pl
AR = compat/vcbuild/scripts/lib.pl
CFLAGS =
BASIC_CFLAGS = -nologo -I. -I../zlib -Icompat/vcbuild -Icompat/vcbuild/include -DWIN32 -D_CONSOLE -DHAVE_STRING_H -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE
COMPAT_OBJS = compat/msvc.o compat/fnmatch/fnmatch.o compat/winansi.o compat/win32/pthread.o
COMPAT_OBJS = compat/msvc.o compat/fnmatch/fnmatch.o compat/winansi.o compat/win32/pthread.o compat/win32/syslog.o compat/win32/sys/poll.o
COMPAT_CFLAGS = -D__USE_MINGW_ACCESS -DNOGDI -DHAVE_STRING_H -DHAVE_ALLOCA_H -Icompat -Icompat/fnmatch -Icompat/regex -Icompat/fnmatch -Icompat/win32 -DSTRIP_EXTENSION=\".exe\"
BASIC_LDFLAGS = -IGNORE:4217 -IGNORE:4049 -NOLOGO -SUBSYSTEM:CONSOLE -NODEFAULTLIB:MSVCRT.lib
EXTLIBS = advapi32.lib shell32.lib wininet.lib ws2_32.lib
Expand Down Expand Up @@ -1117,7 +1120,6 @@ ifneq (,$(findstring MINGW,$(uname_S)))
NO_SVN_TESTS = YesPlease
NO_PERL_MAKEMAKER = YesPlease
RUNTIME_PREFIX = YesPlease
NO_POSIX_ONLY_PROGRAMS = YesPlease
NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
NO_NSEC = YesPlease
USE_WIN32_MMAP = YesPlease
Expand All @@ -1128,10 +1130,14 @@ ifneq (,$(findstring MINGW,$(uname_S)))
NO_PYTHON = YesPlease
BLK_SHA1 = YesPlease
ETAGS_TARGET = ETAGS
NO_INET_PTON = YesPlease
NO_INET_NTOP = YesPlease
NO_POSIX_GOODIES = UnfortunatelyYes
COMPAT_CFLAGS += -D__USE_MINGW_ACCESS -DNOGDI -Icompat -Icompat/fnmatch -Icompat/win32
COMPAT_CFLAGS += -DSTRIP_EXTENSION=\".exe\"
COMPAT_OBJS += compat/mingw.o compat/fnmatch/fnmatch.o compat/winansi.o \
compat/win32/pthread.o
compat/win32/pthread.o compat/win32/syslog.o \
compat/win32/sys/poll.o
EXTLIBS += -lws2_32
PTHREAD_LIBS =
X = .exe
Expand Down Expand Up @@ -1246,9 +1252,6 @@ ifdef ZLIB_PATH
endif
EXTLIBS += -lz

ifndef NO_POSIX_ONLY_PROGRAMS
PROGRAM_OBJS += daemon.o
endif
ifndef NO_OPENSSL
OPENSSL_LIBSSL = -lssl
ifdef OPENSSLDIR
Expand Down Expand Up @@ -1397,9 +1400,11 @@ endif
endif
ifdef NO_INET_NTOP
LIB_OBJS += compat/inet_ntop.o
BASIC_CFLAGS += -DNO_INET_NTOP
endif
ifdef NO_INET_PTON
LIB_OBJS += compat/inet_pton.o
BASIC_CFLAGS += -DNO_INET_PTON
endif

ifdef NO_ICONV
Expand All @@ -1414,6 +1419,10 @@ ifdef NO_DEFLATE_BOUND
BASIC_CFLAGS += -DNO_DEFLATE_BOUND
endif

ifdef NO_POSIX_GOODIES
BASIC_CFLAGS += -DNO_POSIX_GOODIES
endif

ifdef BLK_SHA1
SHA1_HEADER = "block-sha1/sha1.h"
LIB_OBJS += block-sha1/sha1.o
Expand Down
22 changes: 6 additions & 16 deletions compat/inet_ntop.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@

#include <errno.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>

#include "../git-compat-util.h"

#include <stdio.h>
#include <string.h>

Expand Down Expand Up @@ -50,10 +50,7 @@
* Paul Vixie, 1996.
*/
static const char *
inet_ntop4(src, dst, size)
const u_char *src;
char *dst;
size_t size;
inet_ntop4(const u_char *src, char *dst, size_t size)
{
static const char fmt[] = "%u.%u.%u.%u";
char tmp[sizeof "255.255.255.255"];
Expand All @@ -78,10 +75,7 @@ inet_ntop4(src, dst, size)
* Paul Vixie, 1996.
*/
static const char *
inet_ntop6(src, dst, size)
const u_char *src;
char *dst;
size_t size;
inet_ntop6(const u_char *src, char *dst, size_t size)
{
/*
* Note that int32_t and int16_t need only be "at least" large enough
Expand Down Expand Up @@ -178,11 +172,7 @@ inet_ntop6(src, dst, size)
* Paul Vixie, 1996.
*/
const char *
inet_ntop(af, src, dst, size)
int af;
const void *src;
char *dst;
size_t size;
inet_ntop(int af, const void *src, char *dst, size_t size)
{
switch (af) {
case AF_INET:
Expand Down
8 changes: 5 additions & 3 deletions compat/inet_pton.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@

#include <errno.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>

#include "../git-compat-util.h"

#include <stdio.h>
#include <string.h>

Expand All @@ -41,7 +41,9 @@
*/

static int inet_pton4(const char *src, unsigned char *dst);
#ifndef NO_IPV6
static int inet_pton6(const char *src, unsigned char *dst);
#endif

/* int
* inet_pton4(src, dst)
Expand Down
Loading

0 comments on commit 89ba4e7

Please sign in to comment.