aboutgitcodebugslistschat
path: root/util.h
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2024-03-12 19:45:07 +0100
committerStefano Brivio <sbrivio@redhat.com>2024-03-14 08:18:36 +0100
commit3fe9878db7aeda3441c9528965835316e5df4af9 (patch)
treecd94076cd9fbd0cf754cf0f09deb27ab465a6c1b /util.h
parent0761f29a143a455562788c250309bfe42b61417d (diff)
downloadpasst-3fe9878db7aeda3441c9528965835316e5df4af9.tar
passt-3fe9878db7aeda3441c9528965835316e5df4af9.tar.gz
passt-3fe9878db7aeda3441c9528965835316e5df4af9.tar.bz2
passt-3fe9878db7aeda3441c9528965835316e5df4af9.tar.lz
passt-3fe9878db7aeda3441c9528965835316e5df4af9.tar.xz
passt-3fe9878db7aeda3441c9528965835316e5df4af9.tar.zst
passt-3fe9878db7aeda3441c9528965835316e5df4af9.zip
pcap: Use clock_gettime() instead of gettimeofday()
POSIX.1-2008 declared gettimeofday() as obsolete, but I'm a dinosaur. Usually, C libraries translate that to the clock_gettime() system call anyway, but this doesn't happen in Jon's environment, and, there, seccomp happily kills pasta(1) when started with --pcap, because we didn't add gettimeofday() to our seccomp profiles. Use clock_gettime() instead. Reported-by: Jon Maloy <jmaloy@redhat.com> Signed-off-by: Stefano Brivio <sbrivio@redhat.com> Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'util.h')
-rw-r--r--util.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/util.h b/util.h
index 25e54a7..48f3560 100644
--- a/util.h
+++ b/util.h
@@ -40,6 +40,7 @@
#endif
#define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
+#define DIV_ROUND_CLOSEST(n, d) (((n) + (d) / 2) / (d))
#define ROUND_DOWN(x, y) ((x) & ~((y) - 1))
#define ROUND_UP(x, y) (((x) + (y) - 1) & ~((y) - 1))