mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-22 08:27:31 +09:00
Issue #2058 - add patches from dbsoft to fix Mac and FreeBSD builds
This commit is contained in:
parent
0e0bd83fe2
commit
21c624222f
1 changed files with 24 additions and 25 deletions
|
|
@ -32,7 +32,7 @@
|
|||
* THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#if defined(__FreeBSD__) && !defined(__Userspace__)
|
||||
#if defined(__FreeBSD__)
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD: head/sys/netinet/sctp_bsd_addr.c 366426 2020-10-04 15:37:34Z tuexen $");
|
||||
#endif
|
||||
|
|
@ -50,7 +50,8 @@ __FBSDID("$FreeBSD: head/sys/netinet/sctp_bsd_addr.c 366426 2020-10-04 15:37:34Z
|
|||
#include <netinet/sctp_asconf.h>
|
||||
#include <netinet/sctp_sysctl.h>
|
||||
#include <netinet/sctp_indata.h>
|
||||
#if defined(__FreeBSD__) && !defined(__Userspace__)
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
#include <sys/unistd.h>
|
||||
#endif
|
||||
|
||||
|
|
@ -78,8 +79,8 @@ MALLOC_DEFINE(SCTP_M_MCORE, "sctp_mcore", "sctp mcore queue");
|
|||
|
||||
/* Global NON-VNET structure that controls the iterator */
|
||||
struct iterator_control sctp_it_ctl;
|
||||
#if !(defined(__FreeBSD__) && !defined(__Userspace__))
|
||||
|
||||
#if !defined(__FreeBSD__)
|
||||
static void
|
||||
sctp_cleanup_itqueue(void)
|
||||
{
|
||||
|
|
@ -129,7 +130,7 @@ sctp_iterator_thread(void *v SCTP_UNUSED)
|
|||
#endif
|
||||
SCTP_IPI_ITERATOR_WQ_LOCK();
|
||||
/* In FreeBSD this thread never terminates. */
|
||||
#if defined(__FreeBSD__) && !defined(__Userspace__)
|
||||
#if defined(__FreeBSD__)
|
||||
for (;;) {
|
||||
#else
|
||||
while ((sctp_it_ctl.iterator_flags & SCTP_ITERATOR_MUST_EXIT) == 0) {
|
||||
|
|
@ -138,7 +139,7 @@ sctp_iterator_thread(void *v SCTP_UNUSED)
|
|||
msleep(&sctp_it_ctl.iterator_running,
|
||||
#if defined(__FreeBSD__)
|
||||
&sctp_it_ctl.ipi_iterator_wq_mtx,
|
||||
#elif defined(__APPLE__)
|
||||
#elif defined(__APPLE__) || defined(__Userspace_os_Darwin)
|
||||
sctp_it_ctl.ipi_iterator_wq_mtx,
|
||||
#endif
|
||||
0, "waiting_for_work", 0);
|
||||
|
|
@ -149,14 +150,14 @@ sctp_iterator_thread(void *v SCTP_UNUSED)
|
|||
pthread_cond_wait(&sctp_it_ctl.iterator_wakeup, &sctp_it_ctl.ipi_iterator_wq_mtx);
|
||||
#endif
|
||||
#endif
|
||||
#if !(defined(__FreeBSD__) && !defined(__Userspace__))
|
||||
#if !defined(__FreeBSD__)
|
||||
if (sctp_it_ctl.iterator_flags & SCTP_ITERATOR_MUST_EXIT) {
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
sctp_iterator_worker();
|
||||
}
|
||||
#if !(defined(__FreeBSD__) && !defined(__Userspace__))
|
||||
#if !defined(__FreeBSD__)
|
||||
/* Now this thread needs to be terminated */
|
||||
sctp_cleanup_itqueue();
|
||||
sctp_it_ctl.iterator_flags |= SCTP_ITERATOR_EXITED;
|
||||
|
|
@ -251,7 +252,7 @@ sctp_is_desired_interface_type(struct ifnet *ifn)
|
|||
int result;
|
||||
|
||||
/* check the interface type to see if it's one we care about */
|
||||
#if defined(__APPLE__) && !defined(__Userspace__)
|
||||
#if defined(__APPLE__)
|
||||
switch(ifnet_type(ifn)) {
|
||||
#else
|
||||
switch (ifn->if_type) {
|
||||
|
|
@ -277,7 +278,7 @@ sctp_is_desired_interface_type(struct ifnet *ifn)
|
|||
case IFT_GIF:
|
||||
case IFT_L2VLAN:
|
||||
case IFT_STF:
|
||||
#if !(defined(__APPLE__) && !defined(__Userspace__))
|
||||
#if !defined(__APPLE__)
|
||||
case IFT_IP:
|
||||
case IFT_IPOVERCDLC:
|
||||
case IFT_IPOVERCLAW:
|
||||
|
|
@ -293,29 +294,21 @@ sctp_is_desired_interface_type(struct ifnet *ifn)
|
|||
return (result);
|
||||
}
|
||||
#endif
|
||||
#if defined(__APPLE__) && !defined(__Userspace__)
|
||||
|
||||
#if defined(__APPLE__) && !defined(__Userspace__)
|
||||
int
|
||||
sctp_is_vmware_interface(struct ifnet *ifn)
|
||||
{
|
||||
return (strncmp(ifnet_name(ifn), "vmnet", 5) == 0);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32) && defined(__Userspace__)
|
||||
#ifdef MALLOC
|
||||
#undef MALLOC
|
||||
#define MALLOC(x) HeapAlloc(GetProcessHeap(), 0, (x))
|
||||
#endif
|
||||
#ifdef FREE
|
||||
#undef FREE
|
||||
#define FREE(x) HeapFree(GetProcessHeap(), 0, (x))
|
||||
#endif
|
||||
#if defined(_WIN32)
|
||||
static void
|
||||
sctp_init_ifns_for_vrf(int vrfid)
|
||||
{
|
||||
#if defined(INET) || defined(INET6)
|
||||
struct ifaddrs *ifa;
|
||||
struct sctp_ifa *sctp_ifa;
|
||||
DWORD Err, AdapterAddrsSize;
|
||||
PIP_ADAPTER_ADDRESSES pAdapterAddrs, pAdapt;
|
||||
|
|
@ -341,7 +334,8 @@ sctp_init_ifns_for_vrf(int vrfid)
|
|||
/* Get actual adapter information */
|
||||
if ((Err = GetAdaptersAddresses(AF_INET, 0, NULL, pAdapterAddrs, &AdapterAddrsSize)) != ERROR_SUCCESS) {
|
||||
SCTP_PRINTF("GetAdaptersV4Addresses() failed with error code %d\n", Err);
|
||||
FREE(pAdapterAddrs);
|
||||
if (pAdapterAddrs)
|
||||
GlobalFree(pAdapterAddrs);
|
||||
return;
|
||||
}
|
||||
/* Enumerate through each returned adapter and save its information */
|
||||
|
|
@ -366,7 +360,8 @@ sctp_init_ifns_for_vrf(int vrfid)
|
|||
}
|
||||
}
|
||||
}
|
||||
FREE(pAdapterAddrs);
|
||||
if (pAdapterAddrs)
|
||||
GlobalFree(pAdapterAddrs);
|
||||
#endif
|
||||
#ifdef INET6
|
||||
AdapterAddrsSize = 0;
|
||||
|
|
@ -386,7 +381,8 @@ sctp_init_ifns_for_vrf(int vrfid)
|
|||
/* Get actual adapter information */
|
||||
if ((Err = GetAdaptersAddresses(AF_INET6, 0, NULL, pAdapterAddrs, &AdapterAddrsSize)) != ERROR_SUCCESS) {
|
||||
SCTP_PRINTF("GetAdaptersV6Addresses() failed with error code %d\n", Err);
|
||||
FREE(pAdapterAddrs);
|
||||
if (pAdapterAddrs)
|
||||
GlobalFree(pAdapterAddrs);
|
||||
return;
|
||||
}
|
||||
/* Enumerate through each returned adapter and save its information */
|
||||
|
|
@ -408,7 +404,8 @@ sctp_init_ifns_for_vrf(int vrfid)
|
|||
}
|
||||
}
|
||||
}
|
||||
FREE(pAdapterAddrs);
|
||||
if (pAdapterAddrs)
|
||||
GlobalFree(pAdapterAddrs);
|
||||
#endif
|
||||
}
|
||||
#elif defined(__Userspace__)
|
||||
|
|
@ -476,6 +473,7 @@ sctp_init_ifns_for_vrf(int vrfid)
|
|||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(__APPLE__) && !defined(__Userspace__)
|
||||
static void
|
||||
sctp_init_ifns_for_vrf(int vrfid)
|
||||
|
|
@ -554,6 +552,7 @@ sctp_init_ifns_for_vrf(int vrfid)
|
|||
ifnet_list_free(ifnetlist);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(__FreeBSD__) && !defined(__Userspace__)
|
||||
static void
|
||||
sctp_init_ifns_for_vrf(int vrfid)
|
||||
|
|
@ -574,7 +573,7 @@ sctp_init_ifns_for_vrf(int vrfid)
|
|||
|
||||
IFNET_RLOCK();
|
||||
NET_EPOCH_ENTER(et);
|
||||
CK_STAILQ_FOREACH(ifn, &MODULE_GLOBAL(ifnet), if_link) {
|
||||
CK_TAILQ_FOREACH(ifn, &MODULE_GLOBAL(ifnet), if_list) {
|
||||
if (sctp_is_desired_interface_type(ifn) == 0) {
|
||||
/* non desired type */
|
||||
continue;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue