From 36a92d5278fa1b908632ea3bcaafec7b2ef0a102 Mon Sep 17 00:00:00 2001
From: Murarth <murarth@gmail.com>
Date: Fri, 27 Sep 2019 15:25:36 -0700
Subject: [PATCH] Add `pthread_main_np` to FreeBSD-like and `_lwp_self` to
 NetBSD

---
 src/unix/bsd/freebsdlike/mod.rs       | 1 +
 src/unix/bsd/netbsdlike/netbsd/mod.rs | 3 +++
 2 files changed, 4 insertions(+)

diff --git a/src/unix/bsd/freebsdlike/mod.rs b/src/unix/bsd/freebsdlike/mod.rs
index cfb8a4e1..1b7804cb 100644
--- a/src/unix/bsd/freebsdlike/mod.rs
+++ b/src/unix/bsd/freebsdlike/mod.rs
@@ -1323,6 +1323,7 @@ extern "C" {
         attr: *mut pthread_condattr_t,
         pshared: ::c_int,
     ) -> ::c_int;
+    pub fn pthread_main_np() -> ::c_int;
     pub fn pthread_mutex_timedlock(
         lock: *mut pthread_mutex_t,
         abstime: *const ::timespec,
diff --git a/src/unix/bsd/netbsdlike/netbsd/mod.rs b/src/unix/bsd/netbsdlike/netbsd/mod.rs
index ba28bce1..97e2634a 100644
--- a/src/unix/bsd/netbsdlike/netbsd/mod.rs
+++ b/src/unix/bsd/netbsdlike/netbsd/mod.rs
@@ -8,6 +8,7 @@ pub type idtype_t = ::c_int;
 pub type mqd_t = ::c_int;
 type __pthread_spin_t = __cpu_simple_lock_nv_t;
 pub type vm_size_t = ::uintptr_t;
+pub type lwpid_t = ::c_uint;
 
 impl siginfo_t {
     pub unsafe fn si_value(&self) -> ::sigval {
@@ -1714,6 +1715,8 @@ extern "C" {
         flags: ::c_int,
         timeout: *mut ::timespec,
     ) -> ::c_int;
+
+    pub fn _lwp_self() -> lwpid_t;
 }
 
 #[link(name = "util")]
-- 
GitLab