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"
11
#include "utf-conv.h"
Vicent Marti committed
12

13
GIT_INLINE(int) p_link(const char *old, const char *new)
Vicent Marti committed
14
{
15 16
	GIT_UNUSED(old);
	GIT_UNUSED(new);
Vicent Marti committed
17 18 19 20
	errno = ENOSYS;
	return -1;
}

21
GIT_INLINE(int) p_mkdir(const char *path, mode_t mode)
Vicent Marti committed
22
{
23
	wchar_t buf[GIT_WIN_PATH];
24
	GIT_UNUSED(mode);
25
	git__utf8_to_16(buf, GIT_WIN_PATH, path);
26
	return _wmkdir(buf);
Vicent Marti committed
27 28 29 30 31
}

extern int p_unlink(const char *path);
extern int p_lstat(const char *file_name, struct stat *buf);
extern int p_readlink(const char *link, char *target, size_t target_len);
Ben Straub committed
32
extern int p_symlink(const char *old, const char *new);
Vicent Marti committed
33
extern int p_hide_directory__w32(const char *path);
34
extern char *p_realpath(const char *orig_path, char *buffer);
35
extern int p_vsnprintf(char *buffer, size_t count, const char *format, va_list argptr);
36
extern int p_snprintf(char *buffer, size_t count, const char *format, ...) GIT_FORMAT_PRINTF(3, 4);
37
extern int p_mkstemp(char *tmp_path);
38
extern int p_setenv(const char* name, const char* value, int overwrite);
39 40
extern int p_stat(const char* path, struct stat* buf);
extern int p_chdir(const char* path);
41
extern int p_chmod(const char* path, mode_t mode);
42
extern int p_rmdir(const char* path);
43
extern int p_access(const char* path, mode_t mode);
44
extern int p_fsync(int fd);
45
extern int p_open(const char *path, int flags, ...);
46
extern int p_creat(const char *path, mode_t mode);
47
extern int p_getcwd(char *buffer_out, size_t size);
48
extern int p_rename(const char *from, const char *to);
49 50
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);
51
extern int p_inet_pton(int af, const char* src, void* dst);
Vicent Marti committed
52

53 54 55 56 57 58 59 60
/* 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);

Vicent Marti committed
61
#endif