posix.h 1.61 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.
 */
7 8
#ifndef INCLUDE_posix__unix_h__
#define INCLUDE_posix__unix_h__
Vicent Marti committed
9

10
#include <stdio.h>
11
#include <dirent.h>
12
#include <sys/param.h>
13
#include <sys/time.h>
14
#include <sys/stat.h>
15

16 17 18 19 20
typedef int GIT_SOCKET;
#define INVALID_SOCKET -1

#define p_lseek(f,n,w) lseek(f, n, w)
#define p_fstat(f,b) fstat(f, b)
Vicent Marti committed
21
#define p_lstat(p,b) lstat(p,b)
22
#define p_stat(p,b) stat(p, b)
23

24 25 26
#define p_utimes(f, t) utimes(f, t)
#define p_futimes(f, t) futimes(f, t)

Vicent Marti committed
27
#define p_readlink(a, b, c) readlink(a, b, c)
28
#define p_symlink(o,n) symlink(o, n)
Vicent Marti committed
29 30 31 32
#define p_link(o,n) link(o, n)
#define p_unlink(p) unlink(p)
#define p_mkdir(p,m) mkdir(p, m)
#define p_fsync(fd) fsync(fd)
33
extern char *p_realpath(const char *, char *);
34

35 36 37 38
#define p_recv(s,b,l,f) recv(s,b,l,f)
#define p_send(s,b,l,f) send(s,b,l,f)
#define p_inet_pton(a, b, c) inet_pton(a, b, c)

39 40
#define p_strcasecmp(s1, s2) strcasecmp(s1, s2)
#define p_strncasecmp(s1, s2, c) strncasecmp(s1, s2, c)
41
#define p_vsnprintf(b, c, f, a) vsnprintf(b, c, f, a)
42
#define p_snprintf(b, c, f, ...) snprintf(b, c, f, __VA_ARGS__)
43
#define p_mkstemp(p) mkstemp(p)
44 45 46 47 48
#define p_chdir(p) chdir(p)
#define p_chmod(p,m) chmod(p, m)
#define p_rmdir(p) rmdir(p)
#define p_access(p,m) access(p,m)
#define p_ftruncate(fd, sz) ftruncate(fd, sz)
Vicent Marti committed
49

50 51 52
/* see win32/posix.h for explanation about why this exists */
#define p_lstat_posixly(p,b) lstat(p,b)

53 54 55
#define p_localtime_r(c, r) localtime_r(c, r)
#define p_gmtime_r(c, r) gmtime_r(c, r)

Vicent Marti committed
56
#endif