From: Junio C Hamano Date: Wed, 18 May 2016 22:11:46 +0000 (-0700) Subject: Merge branch 'jk/push-client-deadlock-fix' X-Git-Tag: v2.9.0-rc0~15 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/b153d2ae9206f752dd383c7bc30a5ab246ee5bcc?hp=-c Merge branch 'jk/push-client-deadlock-fix' Some Windows SDK lacks pthread_sigmask() implementation and fails to compile the recently updated "git push" codepath that uses it. * jk/push-client-deadlock-fix: Windows: only add a no-op pthread_sigmask() when needed Windows: add pthread_sigmask() that does nothing --- b153d2ae9206f752dd383c7bc30a5ab246ee5bcc diff --combined compat/mingw.h index a1808b4e6b,c26b6e2958..69bb43dc35 --- a/compat/mingw.h +++ b/compat/mingw.h @@@ -1,43 -1,27 +1,43 @@@ +#ifdef __MINGW64_VERSION_MAJOR +#include +#include +typedef _sigset_t sigset_t; +#endif #include #include +/* MinGW-w64 reports to have flockfile, but it does not actually have it. */ +#ifdef __MINGW64_VERSION_MAJOR +#undef _POSIX_THREAD_SAFE_FUNCTIONS +#endif + /* * things that are not available in header files */ -typedef int pid_t; typedef int uid_t; typedef int socklen_t; +#ifndef __MINGW64_VERSION_MAJOR +typedef int pid_t; #define hstrerror strerror +#endif #define S_IFLNK 0120000 /* Symbolic link */ #define S_ISLNK(x) (((x) & S_IFMT) == S_IFLNK) #define S_ISSOCK(x) 0 +#ifndef S_IRWXG #define S_IRGRP 0 #define S_IWGRP 0 #define S_IXGRP 0 #define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP) +#endif +#ifndef S_IRWXO #define S_IROTH 0 #define S_IWOTH 0 #define S_IXOTH 0 #define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH) +#endif #define S_ISUID 0004000 #define S_ISGID 0002000 @@@ -116,10 -100,8 +116,10 @@@ static inline int symlink(const char *o { errno = ENOSYS; return -1; } static inline int fchmod(int fildes, mode_t mode) { errno = ENOSYS; return -1; } +#ifndef __MINGW64_VERSION_MAJOR static inline pid_t fork(void) { errno = ENOSYS; return -1; } +#endif static inline unsigned int alarm(unsigned int seconds) { return 0; } static inline int fsync(int fd) @@@ -142,6 -124,7 +142,7 @@@ static inline int fcntl(int fd, int cmd #define sigemptyset(x) (void)0 static inline int sigaddset(sigset_t *set, int signum) { return 0; } + #define SIG_BLOCK 0 #define SIG_UNBLOCK 0 static inline int sigprocmask(int how, const sigset_t *set, sigset_t *oldset) { return 0; } @@@ -194,10 -177,8 +195,10 @@@ int pipe(int filedes[2]) unsigned int sleep (unsigned int seconds); int mkstemp(char *template); int gettimeofday(struct timeval *tv, void *tz); +#ifndef __MINGW64_VERSION_MAJOR struct tm *gmtime_r(const time_t *timep, struct tm *result); struct tm *localtime_r(const time_t *timep, struct tm *result); +#endif int getpagesize(void); /* defined in MinGW's libgcc.a */ struct passwd *getpwuid(uid_t uid); int setitimer(int type, struct itimerval *in, struct itimerval *out); @@@ -321,10 -302,8 +322,10 @@@ static inline int getrlimit(int resourc /* * Use mingw specific stat()/lstat()/fstat() implementations on Windows. */ +#ifndef __MINGW64_VERSION_MAJOR #define off_t off64_t #define lseek _lseeki64 +#endif /* use struct stat with 64 bit st_size */ #ifdef stat @@@ -396,26 -375,19 +397,26 @@@ static inline char *mingw_find_last_dir ret = (char *)path; return ret; } +static inline void convert_slashes(char *path) +{ + for (; *path; path++) + if (*path == '\\') + *path = '/'; +} #define find_last_dir_sep mingw_find_last_dir_sep int mingw_offset_1st_component(const char *path); #define offset_1st_component mingw_offset_1st_component #define PATH_SEP ';' +#if !defined(__MINGW64_VERSION_MAJOR) && (!defined(_MSC_VER) || _MSC_VER < 1800) #define PRIuMAX "I64u" #define PRId64 "I64d" +#else +#include +#endif void mingw_open_html(const char *path); #define open_html mingw_open_html -void mingw_mark_as_git_dir(const char *dir); -#define mark_as_git_dir mingw_mark_as_git_dir - /** * Converts UTF-8 encoded string to UTF-16LE. * diff --combined compat/win32/pthread.h index b6ed9e7462,7eac560d85..1c164088fb --- a/compat/win32/pthread.h +++ b/compat/win32/pthread.h @@@ -18,10 -18,7 +18,10 @@@ */ #define pthread_mutex_t CRITICAL_SECTION -#define pthread_mutex_init(a,b) (InitializeCriticalSection((a)), 0) +static inline int return_0(int i) { + return 0; +} +#define pthread_mutex_init(a,b) return_0((InitializeCriticalSection((a)), 0)) #define pthread_mutex_destroy(a) DeleteCriticalSection((a)) #define pthread_mutex_lock EnterCriticalSection #define pthread_mutex_unlock LeaveCriticalSection @@@ -78,9 -75,9 +78,9 @@@ extern int win32_pthread_join(pthread_ #define pthread_equal(t1, t2) ((t1).tid == (t2).tid) extern pthread_t pthread_self(void); -static inline int pthread_exit(void *ret) +static inline void NORETURN pthread_exit(void *ret) { - ExitThread((DWORD)ret); + ExitThread((DWORD)(intptr_t)ret); } typedef DWORD pthread_key_t; @@@ -104,4 -101,11 +104,11 @@@ static inline void *pthread_getspecific return TlsGetValue(key); } + #ifndef __MINGW64_VERSION_MAJOR + static inline int pthread_sigmask(int how, const sigset_t *set, sigset_t *oset) + { + return 0; + } + #endif + #endif /* PTHREAD_H */