mirror of
https://github.com/git/git.git
synced 2024-05-27 16:56:15 +02:00
Merge branch 'ma/win32-unix-domain-socket' into next
Windows binary used to decide the use of unix-domain socket at build time, but it learned to make the decision at runtime instead. * ma/win32-unix-domain-socket: Win32: detect unix socket support at runtime
This commit is contained in:
commit
b98021a65c
|
@ -294,6 +294,8 @@ int cmd_credential_cache_daemon(int argc, const char **argv, const char *prefix)
|
||||||
argc = parse_options(argc, argv, prefix, options, usage, 0);
|
argc = parse_options(argc, argv, prefix, options, usage, 0);
|
||||||
socket_path = argv[0];
|
socket_path = argv[0];
|
||||||
|
|
||||||
|
if (!have_unix_sockets())
|
||||||
|
die(_("credential-cache--daemon unavailable; no unix socket support"));
|
||||||
if (!socket_path)
|
if (!socket_path)
|
||||||
usage_with_options(usage, options);
|
usage_with_options(usage, options);
|
||||||
|
|
||||||
|
|
|
@ -149,6 +149,9 @@ int cmd_credential_cache(int argc, const char **argv, const char *prefix)
|
||||||
usage_with_options(usage, options);
|
usage_with_options(usage, options);
|
||||||
op = argv[0];
|
op = argv[0];
|
||||||
|
|
||||||
|
if (!have_unix_sockets())
|
||||||
|
die(_("credential-cache unavailable; no unix socket support"));
|
||||||
|
|
||||||
if (!socket_path)
|
if (!socket_path)
|
||||||
socket_path = get_socket_path();
|
socket_path = get_socket_path();
|
||||||
if (!socket_path)
|
if (!socket_path)
|
||||||
|
|
|
@ -3158,3 +3158,22 @@ int uname(struct utsname *buf)
|
||||||
"%u", (v >> 16) & 0x7fff);
|
"%u", (v >> 16) & 0x7fff);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int mingw_have_unix_sockets(void)
|
||||||
|
{
|
||||||
|
SC_HANDLE scm, srvc;
|
||||||
|
SERVICE_STATUS_PROCESS status;
|
||||||
|
DWORD bytes;
|
||||||
|
int ret = 0;
|
||||||
|
scm = OpenSCManagerA(NULL, NULL, SC_MANAGER_CONNECT);
|
||||||
|
if (scm) {
|
||||||
|
srvc = OpenServiceA(scm, "afunix", SERVICE_QUERY_STATUS);
|
||||||
|
if (srvc) {
|
||||||
|
if(QueryServiceStatusEx(srvc, SC_STATUS_PROCESS_INFO, (LPBYTE)&status, sizeof(SERVICE_STATUS_PROCESS), &bytes))
|
||||||
|
ret = status.dwCurrentState == SERVICE_RUNNING;
|
||||||
|
CloseServiceHandle(srvc);
|
||||||
|
}
|
||||||
|
CloseServiceHandle(scm);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
|
@ -631,3 +631,9 @@ void open_in_gdb(void);
|
||||||
* Used by Pthread API implementation for Windows
|
* Used by Pthread API implementation for Windows
|
||||||
*/
|
*/
|
||||||
int err_win_to_posix(DWORD winerr);
|
int err_win_to_posix(DWORD winerr);
|
||||||
|
|
||||||
|
#ifndef NO_UNIX_SOCKETS
|
||||||
|
int mingw_have_unix_sockets(void);
|
||||||
|
#undef have_unix_sockets
|
||||||
|
#define have_unix_sockets mingw_have_unix_sockets
|
||||||
|
#endif
|
||||||
|
|
|
@ -447,7 +447,6 @@ ifeq ($(uname_S),Windows)
|
||||||
NO_POLL = YesPlease
|
NO_POLL = YesPlease
|
||||||
NO_SYMLINK_HEAD = YesPlease
|
NO_SYMLINK_HEAD = YesPlease
|
||||||
NO_IPV6 = YesPlease
|
NO_IPV6 = YesPlease
|
||||||
NO_UNIX_SOCKETS = YesPlease
|
|
||||||
NO_SETENV = YesPlease
|
NO_SETENV = YesPlease
|
||||||
NO_STRCASESTR = YesPlease
|
NO_STRCASESTR = YesPlease
|
||||||
NO_STRLCPY = YesPlease
|
NO_STRLCPY = YesPlease
|
||||||
|
@ -661,7 +660,6 @@ ifeq ($(uname_S),MINGW)
|
||||||
NO_LIBGEN_H = YesPlease
|
NO_LIBGEN_H = YesPlease
|
||||||
NO_POLL = YesPlease
|
NO_POLL = YesPlease
|
||||||
NO_SYMLINK_HEAD = YesPlease
|
NO_SYMLINK_HEAD = YesPlease
|
||||||
NO_UNIX_SOCKETS = YesPlease
|
|
||||||
NO_SETENV = YesPlease
|
NO_SETENV = YesPlease
|
||||||
NO_STRCASESTR = YesPlease
|
NO_STRCASESTR = YesPlease
|
||||||
NO_STRLCPY = YesPlease
|
NO_STRLCPY = YesPlease
|
||||||
|
|
|
@ -218,6 +218,18 @@ struct strbuf;
|
||||||
#define GIT_WINDOWS_NATIVE
|
#define GIT_WINDOWS_NATIVE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(NO_UNIX_SOCKETS) || !defined(GIT_WINDOWS_NATIVE)
|
||||||
|
static inline int _have_unix_sockets(void)
|
||||||
|
{
|
||||||
|
#if defined(NO_UNIX_SOCKETS)
|
||||||
|
return 0;
|
||||||
|
#else
|
||||||
|
return 1;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
#define have_unix_sockets _have_unix_sockets
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
|
@ -8,6 +8,14 @@ test -z "$NO_UNIX_SOCKETS" || {
|
||||||
skip_all='skipping credential-cache tests, unix sockets not available'
|
skip_all='skipping credential-cache tests, unix sockets not available'
|
||||||
test_done
|
test_done
|
||||||
}
|
}
|
||||||
|
if test_have_prereq MINGW
|
||||||
|
then
|
||||||
|
service_running=$(sc query afunix | grep "4 RUNNING")
|
||||||
|
test -z "$service_running" || {
|
||||||
|
skip_all='skipping credential-cache tests, unix sockets not available'
|
||||||
|
test_done
|
||||||
|
}
|
||||||
|
fi
|
||||||
|
|
||||||
uname_s=$(uname -s)
|
uname_s=$(uname -s)
|
||||||
case $uname_s in
|
case $uname_s in
|
||||||
|
|
Loading…
Reference in New Issue