git-sh-setup.sh: add variable to use the stuck-long mode
[gitweb.git] / compat / mingw.c
index bb92c436f70790ba907991f3307aa0fe4afdf0f5..e9892f8ee48db4739321d37726cff63dec8c0f13 100644 (file)
@@ -304,23 +304,6 @@ int mingw_open (const char *filename, int oflags, ...)
        return fd;
 }
 
-#undef write
-ssize_t mingw_write(int fd, const void *buf, size_t count)
-{
-       /*
-        * While write() calls to a file on a local disk are translated
-        * into WriteFile() calls with a maximum size of 64KB on Windows
-        * XP and 256KB on Vista, no such cap is placed on writes to
-        * files over the network on Windows XP.  Unfortunately, there
-        * seems to be a limit of 32MB-28KB on X64 and 64MB-32KB on x86;
-        * bigger writes fail on Windows XP.
-        * So we cap to a nice 31MB here to avoid write failures over
-        * the net without changing the number of WriteFile() calls in
-        * the local case.
-        */
-       return write(fd, buf, min(count, 31 * 1024 * 1024));
-}
-
 static BOOL WINAPI ctrl_ignore(DWORD type)
 {
        return TRUE;
@@ -491,7 +474,6 @@ int mingw_stat(const char *file_name, struct stat *buf)
        return do_stat_internal(1, file_name, buf);
 }
 
-#undef fstat
 int mingw_fstat(int fd, struct stat *buf)
 {
        HANDLE fh = (HANDLE)_get_osfhandle(fd);
@@ -1086,6 +1068,12 @@ int mingw_kill(pid_t pid, int sig)
                errno = err_win_to_posix(GetLastError());
                CloseHandle(h);
                return -1;
+       } else if (pid > 0 && sig == 0) {
+               HANDLE h = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, pid);
+               if (h) {
+                       CloseHandle(h);
+                       return 0;
+               }
        }
 
        errno = EINVAL;