summaryrefslogtreecommitdiff
path: root/src/unix
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@github.com>2016-12-13 11:31:38 -0500
committerEdward Thomson <ethomson@github.com>2017-02-28 13:27:49 +0000
commite6ed0d2f03625f5d6b60db54fc894902d7ddbc32 (patch)
tree6a40c9e2a5873dac410b1294dfca7fdd2790d938 /src/unix
parent6d3ad7e09ee4b101e8e68f38783e3e4139bc2691 (diff)
downloadlibgit2-e6ed0d2f03625f5d6b60db54fc894902d7ddbc32.tar.gz
odb_loose: fsync tests
Introduce a simple counter that `p_fsync` implements. This is useful for ensuring that `p_fsync` is called when we expect it to be, for example when we have enabled an odb backend to perform `fsync`s when writing objects.
Diffstat (limited to 'src/unix')
-rw-r--r--src/unix/posix.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/unix/posix.h b/src/unix/posix.h
index b4786403f..52985fd8a 100644
--- a/src/unix/posix.h
+++ b/src/unix/posix.h
@@ -40,9 +40,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)