]> git.ipfire.org Git - thirdparty/git.git/blobdiff - compat/mingw.c
The fifth batch
[thirdparty/git.git] / compat / mingw.c
index 320fb99a90e1db6006135e9798f7300f6fa29798..6b06ea540fdb7ac5d425ba46eac5abbce2fc46e3 100644 (file)
@@ -3158,3 +3158,24 @@ int uname(struct utsname *buf)
                  "%u", (v >> 16) & 0x7fff);
        return 0;
 }
+
+#ifndef NO_UNIX_SOCKETS
+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;
+}
+#endif