1 #include "../git-compat-util.h"
3 unsigned int _CRT_fmode = _O_BINARY;
5 unsigned int sleep (unsigned int seconds)
6 {
7 Sleep(seconds*1000);
8 return 0;
9 }
11 int mkstemp(char *template)
12 {
13 char *filename = mktemp(template);
14 if (filename == NULL)
15 return -1;
16 return open(filename, O_RDWR | O_CREAT, 0600);
17 }
19 int gettimeofday(struct timeval *tv, void *tz)
20 {
21 return -1;
22 }
24 int poll(struct pollfd *ufds, unsigned int nfds, int timeout)
25 {
26 return -1;
27 }
29 struct tm *gmtime_r(const time_t *timep, struct tm *result)
30 {
31 /* gmtime() in MSVCRT.DLL is thread-safe, but not reentrant */
32 memcpy(result, gmtime(timep), sizeof(struct tm));
33 return result;
34 }
36 struct tm *localtime_r(const time_t *timep, struct tm *result)
37 {
38 /* localtime() in MSVCRT.DLL is thread-safe, but not reentrant */
39 memcpy(result, localtime(timep), sizeof(struct tm));
40 return result;
41 }
43 #undef getcwd
44 char *mingw_getcwd(char *pointer, int len)
45 {
46 int i;
47 char *ret = getcwd(pointer, len);
48 if (!ret)
49 return ret;
50 for (i = 0; pointer[i]; i++)
51 if (pointer[i] == '\\')
52 pointer[i] = '/';
53 return ret;
54 }
56 struct passwd *getpwuid(int uid)
57 {
58 static struct passwd p;
59 return &p;
60 }
62 int setitimer(int type, struct itimerval *in, struct itimerval *out)
63 {
64 return -1;
65 }
67 int sigaction(int sig, struct sigaction *in, struct sigaction *out)
68 {
69 return -1;
70 }