posix.h 2.32 KB
Newer Older
Vicent Marti committed
1
/*
Edward Thomson committed
2
 * Copyright (C) the libgit2 contributors. All rights reserved.
Vicent Marti committed
3 4 5 6
 *
 * This file is part of libgit2, distributed under the GNU GPL v2 with
 * a Linking Exception. For full terms see the included COPYING file.
 */
Vicent Marti committed
7 8 9 10
#ifndef INCLUDE_posix__w32_h__
#define INCLUDE_posix__w32_h__

#include "common.h"
Vicent Marti committed
11
#include "../posix.h"
12
#include "win32-compat.h"
13
#include "path_w32.h"
14
#include "utf-conv.h"
Vicent Marti committed
15
#include "dir.h"
Vicent Marti committed
16

17
typedef SOCKET GIT_SOCKET;
18

19
#define p_lseek(f,n,w) _lseeki64(f, n, w)
20 21

extern int p_fstat(int fd, struct stat *buf);
22
extern int p_lstat(const char *file_name, struct stat *buf);
23
extern int p_stat(const char* path, struct stat *buf);
Vicent Marti committed
24

25 26
extern int p_utimes(const char *filename, const struct p_timeval times[2]);
extern int p_futimes(int fd, const struct p_timeval times[2]);
27

28 29
extern int p_readlink(const char *path, char *buf, size_t bufsiz);
extern int p_symlink(const char *old, const char *new);
30
extern int p_link(const char *old, const char *new);
Vicent Marti committed
31
extern int p_unlink(const char *path);
32
extern int p_mkdir(const char *path, mode_t mode);
33
extern int p_fsync(int fd);
34
extern char *p_realpath(const char *orig_path, char *buffer);
35 36 37 38 39

extern int p_recv(GIT_SOCKET socket, void *buffer, size_t length, int flags);
extern int p_send(GIT_SOCKET socket, const void *buffer, size_t length, int flags);
extern int p_inet_pton(int af, const char* src, void* dst);

40
extern int p_vsnprintf(char *buffer, size_t count, const char *format, va_list argptr);
41
extern int p_snprintf(char *buffer, size_t count, const char *format, ...) GIT_FORMAT_PRINTF(3, 4);
42
extern int p_mkstemp(char *tmp_path);
43
extern int p_chdir(const char* path);
44
extern int p_chmod(const char* path, mode_t mode);
45
extern int p_rmdir(const char* path);
46
extern int p_access(const char* path, mode_t mode);
47
extern int p_ftruncate(int fd, git_off_t size);
48

49 50 51 52 53 54 55 56
/* p_lstat is almost but not quite POSIX correct.  Specifically, the use of
 * ENOTDIR is wrong, in that it does not mean precisely that a non-directory
 * entry was encountered.  Making it correct is potentially expensive,
 * however, so this is a separate version of p_lstat to use when correct
 * POSIX ENOTDIR semantics is required.
 */
extern int p_lstat_posixly(const char *filename, struct stat *buf);

57 58 59
extern struct tm * p_localtime_r(const time_t *timer, struct tm *result);
extern struct tm * p_gmtime_r(const time_t *timer, struct tm *result);

Vicent Marti committed
60
#endif