Used in FreeBSD IPv6 code sys/netinet6/frag6.c IP6Q_TRYLOCK().
---
 bsd/porting/sync_stub.c | 5 +++++
 bsd/porting/sync_stub.h | 1 +
 2 files changed, 6 insertions(+)

diff --git a/bsd/porting/sync_stub.c b/bsd/porting/sync_stub.c
index 8d341d8..e871b20 100644
--- a/bsd/porting/sync_stub.c
+++ b/bsd/porting/sync_stub.c
@@ -26,6 +26,11 @@ void mtx_lock(struct mtx *mp)
     mutex_lock(&mp->_mutex);
 }
 
+int mtx_trylock(struct mtx *mp)
+{
+    return mutex_trylock(&mp->_mutex) ? 1 : 0;
+}
+
 void mtx_unlock(struct mtx *mp)
 {
     mutex_unlock(&mp->_mutex);
diff --git a/bsd/porting/sync_stub.h b/bsd/porting/sync_stub.h
index 8ffc09b..f666984 100644
--- a/bsd/porting/sync_stub.h
+++ b/bsd/porting/sync_stub.h
@@ -32,6 +32,7 @@ __BEGIN_DECLS
 void mtx_init(struct mtx *m, const char *name, const char *type, int opts);
 void mtx_destroy(struct mtx *m);
 void mtx_lock(struct mtx *mp);
+int mtx_trylock(struct mtx *mp);
 void mtx_unlock(struct mtx *mp);
 void mtx_assert(struct mtx *mp, int flag);
 
-- 
2.7.4

-- 
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to osv-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to