]> git.proxmox.com Git - libgit2.git/blob - src/util/win32/posix.h
03fa2ac52b6d1e8c901c0ae2edea394e7f06f37a
[libgit2.git] / src / util / win32 / posix.h
1 /*
2 * Copyright (C) the libgit2 contributors. All rights reserved.
3 *
4 * This file is part of libgit2, distributed under the GNU GPL v2 with
5 * a Linking Exception. For full terms see the included COPYING file.
6 */
7 #ifndef INCLUDE_win32_posix_h__
8 #define INCLUDE_win32_posix_h__
9
10 #include "git2_util.h"
11 #include "../posix.h"
12 #include "win32-compat.h"
13 #include "path_w32.h"
14 #include "utf-conv.h"
15 #include "dir.h"
16
17 extern unsigned long git_win32__createfile_sharemode;
18 extern int git_win32__retries;
19
20 typedef SOCKET GIT_SOCKET;
21
22 #define p_lseek(f,n,w) _lseeki64(f, n, w)
23
24 extern int p_fstat(int fd, struct stat *buf);
25 extern int p_lstat(const char *file_name, struct stat *buf);
26 extern int p_stat(const char *path, struct stat *buf);
27
28 extern int p_utimes(const char *filename, const struct p_timeval times[2]);
29 extern int p_futimes(int fd, const struct p_timeval times[2]);
30
31 extern int p_readlink(const char *path, char *buf, size_t bufsiz);
32 extern int p_symlink(const char *old, const char *new);
33 extern int p_link(const char *old, const char *new);
34 extern int p_unlink(const char *path);
35 extern int p_mkdir(const char *path, mode_t mode);
36 extern int p_fsync(int fd);
37 extern char *p_realpath(const char *orig_path, char *buffer);
38
39 extern int p_recv(GIT_SOCKET socket, void *buffer, size_t length, int flags);
40 extern int p_send(GIT_SOCKET socket, const void *buffer, size_t length, int flags);
41 extern int p_inet_pton(int af, const char *src, void* dst);
42
43 extern int p_vsnprintf(char *buffer, size_t count, const char *format, va_list argptr);
44 extern int p_snprintf(char *buffer, size_t count, const char *format, ...) GIT_FORMAT_PRINTF(3, 4);
45 extern int p_chdir(const char *path);
46 extern int p_chmod(const char *path, mode_t mode);
47 extern int p_rmdir(const char *path);
48 extern int p_access(const char *path, mode_t mode);
49 extern int p_ftruncate(int fd, off64_t size);
50
51 /* p_lstat is almost but not quite POSIX correct. Specifically, the use of
52 * ENOTDIR is wrong, in that it does not mean precisely that a non-directory
53 * entry was encountered. Making it correct is potentially expensive,
54 * however, so this is a separate version of p_lstat to use when correct
55 * POSIX ENOTDIR semantics is required.
56 */
57 extern int p_lstat_posixly(const char *filename, struct stat *buf);
58
59 extern struct tm * p_localtime_r(const time_t *timer, struct tm *result);
60 extern struct tm * p_gmtime_r(const time_t *timer, struct tm *result);
61
62 #endif