aboutsummaryrefslogtreecommitdiff
path: root/compat/mingw.c
blob: 075448d2455f8237e867bd4ff82eec7867442b27 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#include "../git-compat-util.h"

unsigned int _CRT_fmode = _O_BINARY;

unsigned int sleep (unsigned int seconds)
{
	Sleep(seconds*1000);
	return 0;
}

int mkstemp(char *template)
{
	char *filename = mktemp(template);
	if (filename == NULL)
		return -1;
	return open(filename, O_RDWR | O_CREAT, 0600);
}

int gettimeofday(struct timeval *tv, void *tz)
{
	return -1;
}

int poll(struct pollfd *ufds, unsigned int nfds, int timeout)
{
	return -1;
}

struct tm *gmtime_r(const time_t *timep, struct tm *result)
{
	/* gmtime() in MSVCRT.DLL is thread-safe, but not reentrant */
	memcpy(result, gmtime(timep), sizeof(struct tm));
	return result;
}

struct tm *localtime_r(const time_t *timep, struct tm *result)
{
	/* localtime() in MSVCRT.DLL is thread-safe, but not reentrant */
	memcpy(result, localtime(timep), sizeof(struct tm));
	return result;
}

struct passwd *getpwuid(int uid)
{
	static struct passwd p;
	return &p;
}

int setitimer(int type, struct itimerval *in, struct itimerval *out)
{
	return -1;
}

int sigaction(int sig, struct sigaction *in, struct sigaction *out)
{
	return -1;
}