summaryrefslogtreecommitdiff
path: root/src/unix/posix.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/unix/posix.h')
-rw-r--r--src/unix/posix.h25
1 files changed, 22 insertions, 3 deletions
diff --git a/src/unix/posix.h b/src/unix/posix.h
index 482d2c803..ee36ea0f3 100644
--- a/src/unix/posix.h
+++ b/src/unix/posix.h
@@ -7,6 +7,10 @@
#ifndef INCLUDE_posix__unix_h__
#define INCLUDE_posix__unix_h__
+#ifndef LIBGIT2_NO_FEATURES_H
+# include "git2/sys/features.h"
+#endif
+
#include <stdio.h>
#include <dirent.h>
#include <sys/param.h>
@@ -40,9 +44,14 @@ typedef int GIT_SOCKET;
#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)
extern char *p_realpath(const char *, char *);
+GIT_INLINE(int) p_fsync(int fd)
+{
+ p_fsync__cnt++;
+ return fsync(fd);
+}
+
#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)
@@ -50,7 +59,7 @@ extern char *p_realpath(const char *, char *);
#define p_strcasecmp(s1, s2) strcasecmp(s1, s2)
#define p_strncasecmp(s1, s2, c) strncasecmp(s1, s2, c)
#define p_vsnprintf(b, c, f, a) vsnprintf(b, c, f, a)
-#define p_snprintf(b, c, f, ...) snprintf(b, c, f, __VA_ARGS__)
+#define p_snprintf(b, c, ...) snprintf(b, c, __VA_ARGS__)
#define p_mkstemp(p) mkstemp(p)
#define p_chdir(p) chdir(p)
#define p_chmod(p,m) chmod(p, m)
@@ -66,7 +75,7 @@ extern char *p_realpath(const char *, char *);
#define p_timeval timeval
-#ifdef HAVE_FUTIMENS
+#ifdef GIT_USE_FUTIMENS
GIT_INLINE(int) p_futimes(int f, const struct p_timeval t[2])
{
struct timespec s[2];
@@ -80,4 +89,14 @@ GIT_INLINE(int) p_futimes(int f, const struct p_timeval t[2])
# define p_futimes futimes
#endif
+#ifdef GIT_USE_REGCOMP_L
+#include <xlocale.h>
+GIT_INLINE(int) p_regcomp(regex_t *preg, const char *pattern, int cflags)
+{
+ return regcomp_l(preg, pattern, cflags, (locale_t) 0);
+}
+#else
+# define p_regcomp regcomp
+#endif
+
#endif