[vlc-commits] contrib: libdsm: fix macos build
Thomas Guillem
git at videolan.org
Mon Feb 12 10:55:20 CET 2018
vlc/vlc-3.0 | branch: master | Thomas Guillem <thomas at gllm.fr> | Mon Feb 12 10:49:20 2018 +0100| [c433a4c2a7e3d08032d59f5bf5c954e5aaa1b28c] | committer: Thomas Guillem
contrib: libdsm: fix macos build
(cherry picked from commit 858bb3f447ad927d710c7e6e7d533258ffbd6ec4)
Signed-off-by: Thomas Guillem <thomas at gllm.fr>
> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=c433a4c2a7e3d08032d59f5bf5c954e5aaa1b28c
---
...netbios-use-time-instead-of-clock_gettime.patch | 68 ++++++++++++++++++++++
contrib/src/libdsm/rules.mak | 1 +
2 files changed, 69 insertions(+)
diff --git a/contrib/src/libdsm/0001-netbios-use-time-instead-of-clock_gettime.patch b/contrib/src/libdsm/0001-netbios-use-time-instead-of-clock_gettime.patch
new file mode 100644
index 0000000000..c55edc13cc
--- /dev/null
+++ b/contrib/src/libdsm/0001-netbios-use-time-instead-of-clock_gettime.patch
@@ -0,0 +1,68 @@
+From 9bebdc7ba3da352269ff5b92a2eb568756a3105d Mon Sep 17 00:00:00 2001
+From: Thomas Guillem <thomas at gllm.fr>
+Date: Mon, 12 Feb 2018 10:46:51 +0100
+Subject: [PATCH] netbios: use time() instead of clock_gettime()
+
+We don't need more than second precisions and this function is available on
+more platforms.
+---
+ src/netbios_ns.c | 11 +++++------
+ 1 file changed, 5 insertions(+), 6 deletions(-)
+
+diff --git a/src/netbios_ns.c b/src/netbios_ns.c
+index ff37c55..89992ee 100644
+--- a/src/netbios_ns.c
++++ b/src/netbios_ns.c
+@@ -831,7 +831,6 @@ static void *netbios_ns_discover_thread(void *opaque)
+ netbios_ns *ns = (netbios_ns *) opaque;
+ while (true)
+ {
+- struct timespec tp;
+ const int remove_timeout = 5 * ns->discover_broadcast_timeout;
+ netbios_ns_entry *entry, *entry_next;
+
+@@ -840,12 +839,12 @@ static void *netbios_ns_discover_thread(void *opaque)
+
+ // check if cached entries timeout, the timeout value is 5 times the
+ // broadcast timeout.
+- clock_gettime(CLOCK_REALTIME, &tp);
++ time_t now = time(NULL);
+ for (entry = TAILQ_FIRST(&ns->entry_queue);
+ entry != NULL; entry = entry_next)
+ {
+ entry_next = TAILQ_NEXT(entry, next);
+- if (tp.tv_sec - entry->last_time_seen > remove_timeout)
++ if (now - entry->last_time_seen > remove_timeout)
+ {
+ if (entry->flag & NS_ENTRY_FLAG_VALID_NAME)
+ {
+@@ -886,7 +885,7 @@ static void *netbios_ns_discover_thread(void *opaque)
+ if (res == 0)
+ break;
+
+- clock_gettime(CLOCK_REALTIME, &tp);
++ time_t now = time(NULL);
+
+ if (name_query.type == NAME_QUERY_TYPE_NB)
+ {
+@@ -899,7 +898,7 @@ static void *netbios_ns_discover_thread(void *opaque)
+ if (!entry)
+ return NULL;
+ }
+- entry->last_time_seen = tp.tv_sec;
++ entry->last_time_seen = now;
+
+ // if entry is already valid, don't send NBSTAT query
+ if (entry->flag & NS_ENTRY_FLAG_VALID_NAME)
+@@ -922,7 +921,7 @@ static void *netbios_ns_discover_thread(void *opaque)
+ if (!entry)
+ continue;
+
+- entry->last_time_seen = tp.tv_sec;
++ entry->last_time_seen = now;
+
+ send_callback = !(entry->flag & NS_ENTRY_FLAG_VALID_NAME);
+
+--
+2.11.0
+
diff --git a/contrib/src/libdsm/rules.mak b/contrib/src/libdsm/rules.mak
index 3d400b7aef..c541c2b4ed 100644
--- a/contrib/src/libdsm/rules.mak
+++ b/contrib/src/libdsm/rules.mak
@@ -23,6 +23,7 @@ endif
libdsm: libdsm-$(LIBDSM_VERSION).tar.gz .sum-libdsm
$(UNPACK)
+ $(APPLY) $(SRC)/libdsm/0001-netbios-use-time-instead-of-clock_gettime.patch
$(MOVE)
DEPS_libdsm = libtasn1 iconv
More information about the vlc-commits
mailing list