Skip to content

Commit 89ba4e7

Browse files
committed
Merge branch 'ef/mingw-daemon'
* 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
2 parents d313c1c + a666b47 commit 89ba4e7

File tree

12 files changed

+1117
-231
lines changed

12 files changed

+1117
-231
lines changed

Documentation/git-daemon.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ OPTIONS
7878

7979
--inetd::
8080
Have the server run as an inetd service. Implies --syslog.
81-
Incompatible with --port, --listen, --user and --group options.
81+
Incompatible with --detach, --port, --listen, --user and --group
82+
options.
8283

8384
--listen=<host_or_ipaddr>::
8485
Listen on a specific IP address or hostname. IP addresses can

Makefile

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,7 @@ EXTRA_PROGRAMS =
401401
# ... and all the rest that could be moved out of bindir to gitexecdir
402402
PROGRAMS += $(EXTRA_PROGRAMS)
403403

404+
PROGRAM_OBJS += daemon.o
404405
PROGRAM_OBJS += fast-import.o
405406
PROGRAM_OBJS += imap-send.o
406407
PROGRAM_OBJS += shell.o
@@ -496,6 +497,8 @@ LIB_H += compat/bswap.h
496497
LIB_H += compat/cygwin.h
497498
LIB_H += compat/mingw.h
498499
LIB_H += compat/win32/pthread.h
500+
LIB_H += compat/win32/syslog.h
501+
LIB_H += compat/win32/sys/poll.h
499502
LIB_H += csum-file.h
500503
LIB_H += decorate.h
501504
LIB_H += delta.h
@@ -1064,7 +1067,6 @@ ifeq ($(uname_S),Windows)
10641067
NO_SVN_TESTS = YesPlease
10651068
NO_PERL_MAKEMAKER = YesPlease
10661069
RUNTIME_PREFIX = YesPlease
1067-
NO_POSIX_ONLY_PROGRAMS = YesPlease
10681070
NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
10691071
NO_NSEC = YesPlease
10701072
USE_WIN32_MMAP = YesPlease
@@ -1075,13 +1077,14 @@ ifeq ($(uname_S),Windows)
10751077
NO_CURL = YesPlease
10761078
NO_PYTHON = YesPlease
10771079
BLK_SHA1 = YesPlease
1080+
NO_POSIX_GOODIES = UnfortunatelyYes
10781081
NATIVE_CRLF = YesPlease
10791082

10801083
CC = compat/vcbuild/scripts/clink.pl
10811084
AR = compat/vcbuild/scripts/lib.pl
10821085
CFLAGS =
10831086
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
1084-
COMPAT_OBJS = compat/msvc.o compat/fnmatch/fnmatch.o compat/winansi.o compat/win32/pthread.o
1087+
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
10851088
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\"
10861089
BASIC_LDFLAGS = -IGNORE:4217 -IGNORE:4049 -NOLOGO -SUBSYSTEM:CONSOLE -NODEFAULTLIB:MSVCRT.lib
10871090
EXTLIBS = advapi32.lib shell32.lib wininet.lib ws2_32.lib
@@ -1117,7 +1120,6 @@ ifneq (,$(findstring MINGW,$(uname_S)))
11171120
NO_SVN_TESTS = YesPlease
11181121
NO_PERL_MAKEMAKER = YesPlease
11191122
RUNTIME_PREFIX = YesPlease
1120-
NO_POSIX_ONLY_PROGRAMS = YesPlease
11211123
NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
11221124
NO_NSEC = YesPlease
11231125
USE_WIN32_MMAP = YesPlease
@@ -1128,10 +1130,14 @@ ifneq (,$(findstring MINGW,$(uname_S)))
11281130
NO_PYTHON = YesPlease
11291131
BLK_SHA1 = YesPlease
11301132
ETAGS_TARGET = ETAGS
1133+
NO_INET_PTON = YesPlease
1134+
NO_INET_NTOP = YesPlease
1135+
NO_POSIX_GOODIES = UnfortunatelyYes
11311136
COMPAT_CFLAGS += -D__USE_MINGW_ACCESS -DNOGDI -Icompat -Icompat/fnmatch -Icompat/win32
11321137
COMPAT_CFLAGS += -DSTRIP_EXTENSION=\".exe\"
11331138
COMPAT_OBJS += compat/mingw.o compat/fnmatch/fnmatch.o compat/winansi.o \
1134-
compat/win32/pthread.o
1139+
compat/win32/pthread.o compat/win32/syslog.o \
1140+
compat/win32/sys/poll.o
11351141
EXTLIBS += -lws2_32
11361142
PTHREAD_LIBS =
11371143
X = .exe
@@ -1246,9 +1252,6 @@ ifdef ZLIB_PATH
12461252
endif
12471253
EXTLIBS += -lz
12481254

1249-
ifndef NO_POSIX_ONLY_PROGRAMS
1250-
PROGRAM_OBJS += daemon.o
1251-
endif
12521255
ifndef NO_OPENSSL
12531256
OPENSSL_LIBSSL = -lssl
12541257
ifdef OPENSSLDIR
@@ -1397,9 +1400,11 @@ endif
13971400
endif
13981401
ifdef NO_INET_NTOP
13991402
LIB_OBJS += compat/inet_ntop.o
1403+
BASIC_CFLAGS += -DNO_INET_NTOP
14001404
endif
14011405
ifdef NO_INET_PTON
14021406
LIB_OBJS += compat/inet_pton.o
1407+
BASIC_CFLAGS += -DNO_INET_PTON
14031408
endif
14041409

14051410
ifdef NO_ICONV
@@ -1414,6 +1419,10 @@ ifdef NO_DEFLATE_BOUND
14141419
BASIC_CFLAGS += -DNO_DEFLATE_BOUND
14151420
endif
14161421

1422+
ifdef NO_POSIX_GOODIES
1423+
BASIC_CFLAGS += -DNO_POSIX_GOODIES
1424+
endif
1425+
14171426
ifdef BLK_SHA1
14181427
SHA1_HEADER = "block-sha1/sha1.h"
14191428
LIB_OBJS += block-sha1/sha1.o

compat/inet_ntop.c

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717

1818
#include <errno.h>
1919
#include <sys/types.h>
20-
#include <sys/socket.h>
21-
#include <netinet/in.h>
22-
#include <arpa/inet.h>
20+
21+
#include "../git-compat-util.h"
22+
2323
#include <stdio.h>
2424
#include <string.h>
2525

@@ -50,10 +50,7 @@
5050
* Paul Vixie, 1996.
5151
*/
5252
static const char *
53-
inet_ntop4(src, dst, size)
54-
const u_char *src;
55-
char *dst;
56-
size_t size;
53+
inet_ntop4(const u_char *src, char *dst, size_t size)
5754
{
5855
static const char fmt[] = "%u.%u.%u.%u";
5956
char tmp[sizeof "255.255.255.255"];
@@ -78,10 +75,7 @@ inet_ntop4(src, dst, size)
7875
* Paul Vixie, 1996.
7976
*/
8077
static const char *
81-
inet_ntop6(src, dst, size)
82-
const u_char *src;
83-
char *dst;
84-
size_t size;
78+
inet_ntop6(const u_char *src, char *dst, size_t size)
8579
{
8680
/*
8781
* Note that int32_t and int16_t need only be "at least" large enough
@@ -178,11 +172,7 @@ inet_ntop6(src, dst, size)
178172
* Paul Vixie, 1996.
179173
*/
180174
const char *
181-
inet_ntop(af, src, dst, size)
182-
int af;
183-
const void *src;
184-
char *dst;
185-
size_t size;
175+
inet_ntop(int af, const void *src, char *dst, size_t size)
186176
{
187177
switch (af) {
188178
case AF_INET:

compat/inet_pton.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717

1818
#include <errno.h>
1919
#include <sys/types.h>
20-
#include <sys/socket.h>
21-
#include <netinet/in.h>
22-
#include <arpa/inet.h>
20+
21+
#include "../git-compat-util.h"
22+
2323
#include <stdio.h>
2424
#include <string.h>
2525

@@ -41,7 +41,9 @@
4141
*/
4242

4343
static int inet_pton4(const char *src, unsigned char *dst);
44+
#ifndef NO_IPV6
4445
static int inet_pton6(const char *src, unsigned char *dst);
46+
#endif
4547

4648
/* int
4749
* inet_pton4(src, dst)

0 commit comments

Comments
 (0)