pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

corefx-git: Remove merged patches Also add back those which were accidentally removed in 63c5b19.



Module Name:	pkgsrc-wip
Committed By:	jasonwilliams200ok <necmon%yahoo.com@localhost>
Pushed By:	danglingpointer
Date:		Tue Feb 9 11:15:20 2016 +0000
Changeset:	04c9feaf2767edc6a8ce70492f97a50a08adca57

Modified Files:
	corefx-git/distinfo
Added Files:
	corefx-git/patches/patch-src_Native_System.Native_pal__interfaceaddresses.cpp
	corefx-git/patches/patch-src_Native_System.Native_pal__mount.cpp
	corefx-git/patches/patch-src_Native_System.Native_pal__networking.cpp

Log Message:
corefx-git: Remove merged patches
Also add back those which were accidentally removed in 63c5b19.

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=04c9feaf2767edc6a8ce70492f97a50a08adca57

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 corefx-git/distinfo                                |   5 +
 ...ative_System.Native_pal__interfaceaddresses.cpp |  12 +
 .../patch-src_Native_System.Native_pal__mount.cpp  |  54 ++++
 ...ch-src_Native_System.Native_pal__networking.cpp | 329 +++++++++++++++++++++
 4 files changed, 400 insertions(+)

diffs:
diff --git a/corefx-git/distinfo b/corefx-git/distinfo
index b90c043..75f93d2 100644
--- a/corefx-git/distinfo
+++ b/corefx-git/distinfo
@@ -1,4 +1,9 @@
 $NetBSD$
 SHA1 (patch-src_Native_Common_pal__config.h.in) = 37fa257faf95a5da68f9dfa2e609afdaddd1ed9a
+SHA1 (patch-src_Native_System.Native_pal__errno.cpp) = f619d61f531e31cf80113553c7fcc84c15fd2798
+SHA1 (patch-src_Native_System.Native_pal__errno.h) = 12663841b61986caf2272c28ea7ac93da2940d6d
+SHA1 (patch-src_Native_System.Native_pal__interfaceaddresses.cpp) = 4f82e6f028fe2b9826ba6afb62869e42a0b6ee3d
+SHA1 (patch-src_Native_System.Native_pal__mount.cpp) = 7858f5ff60fcb0d60452648aef1b1034698e2c85
+SHA1 (patch-src_Native_System.Native_pal__networking.cpp) = 4f8ef34ed37564978e9370c6f07114b72ef36bd3
 SHA1 (patch-src_Native_configure.cmake) = c4d12c3a55c97804fd053c6923df08fe72c4d91d
 SHA1 (patch-src_Native_gen-buildsys-clang.sh) = efc34b0da3d11b1c66625336bb4d3c7ac5273b60
diff --git a/corefx-git/patches/patch-src_Native_System.Native_pal__interfaceaddresses.cpp b/corefx-git/patches/patch-src_Native_System.Native_pal__interfaceaddresses.cpp
new file mode 100644
index 0000000..c78a90c
--- /dev/null
+++ b/corefx-git/patches/patch-src_Native_System.Native_pal__interfaceaddresses.cpp
@@ -0,0 +1,12 @@
+$NetBSD$
+
+--- src/Native/System.Native/pal_interfaceaddresses.cpp.orig	2016-02-07 13:49:29.000000000 +0000
++++ src/Native/System.Native/pal_interfaceaddresses.cpp
+@@ -8,6 +8,7 @@
+ #include "pal_utilities.h"
+ 
+ #include <assert.h>
++#include <sys/types.h>
+ #include <ifaddrs.h>
+ #include <net/if.h>
+ #include <netinet/in.h>
diff --git a/corefx-git/patches/patch-src_Native_System.Native_pal__mount.cpp b/corefx-git/patches/patch-src_Native_System.Native_pal__mount.cpp
new file mode 100644
index 0000000..b617698
--- /dev/null
+++ b/corefx-git/patches/patch-src_Native_System.Native_pal__mount.cpp
@@ -0,0 +1,54 @@
+$NetBSD$
+
+--- src/Native/System.Native/pal_mount.cpp.orig	2016-02-07 13:49:29.000000000 +0000
++++ src/Native/System.Native/pal_mount.cpp
+@@ -22,7 +22,11 @@ static int32_t GetMountInfo(MountPointFo
+ {
+ #if HAVE_MNTINFO
+     // getmntinfo returns pointers to OS-internal structs, so we don't need to worry about free'ing the object
++#if HAVE_SYS_STATVFS
++    struct statvfs* mounts = nullptr;
++#else
+     struct statfs* mounts = nullptr;
++#endif
+     int count = getmntinfo(&mounts, 0);
+     for (int32_t i = 0; i < count; i++)
+     {
+@@ -68,8 +72,13 @@ extern "C" int32_t SystemNative_GetSpace
+     assert(name != nullptr);
+     assert(mpi != nullptr);
+ 
+-    struct statfs stats = {};
++#if HAVE_SYS_STATVFS
++    struct statvfs stats = {};
++    int result = statvfs(name, &stats);
++#else
++    struct statvfs stats = {};
+     int result = statfs(name, &stats);
++#endif
+     if (result == 0)
+     {
+         // Note that these have signed integer types on some platforms but musn't be negative.
+@@ -98,13 +107,22 @@ SystemNative_GetFormatInfoForMountPoint(
+     assert((formatNameBuffer != nullptr) && (formatType != nullptr));
+     assert(bufferLength > 0);
+ 
++#if HAVE_SYS_STATVFS
++    struct statvfs stats;
++    int result = statvfs(name, &stats);
++#else
+     struct statfs stats;
+     int result = statfs(name, &stats);
++#endif
+     if (result == 0)
+     {
+ 
+ #if HAVE_STATFS_FSTYPENAME
++#if HAVE_VFS_NAMELEN
++        if (bufferLength < VFS_NAMELEN)
++#else
+         if (bufferLength < MFSNAMELEN)
++#endif
+         {
+             result = ERANGE;
+             *formatType = 0;
diff --git a/corefx-git/patches/patch-src_Native_System.Native_pal__networking.cpp b/corefx-git/patches/patch-src_Native_System.Native_pal__networking.cpp
new file mode 100644
index 0000000..7b5b423
--- /dev/null
+++ b/corefx-git/patches/patch-src_Native_System.Native_pal__networking.cpp
@@ -0,0 +1,329 @@
+$NetBSD$
+
+--- src/Native/System.Native/pal_networking.cpp.orig	2016-02-08 16:12:54.000000000 +0000
++++ src/Native/System.Native/pal_networking.cpp
+@@ -381,7 +381,138 @@ static void ConvertHostEntPlatformToPal(
+     }
+ }
+ 
+-#if HAVE_GETHOSTBYNAME_R
++#if defined(HAVE_GETNAMEINFO) || defined(HAVE_GETADDRINFO)
++#define BUFFER_OVERFLOW 255
++static int copy_hostent(struct hostent* from, struct hostent* to,
++                        char* buffer, size_t buflen, int* error)
++{
++    int i, len;
++    char* ptr = buffer;
++
++    *error = 0;
++    to->h_addrtype = from->h_addrtype;
++    to->h_length = from->h_length;
++    to->h_name = static_cast<char*>(ptr);
++
++    /* copy hostname to buffer */
++    len= static_cast<int>(strlen(from->h_name)+1);
++    strcpy(ptr, from->h_name);
++    ptr += len;
++
++    /* copy aliases to buffer */
++    to->h_aliases = reinterpret_cast<char**>(ptr);
++    for(i = 0; from->h_aliases[i]; i++);
++    ptr += (i+1) * static_cast<int>(sizeof(char*));
++
++    for(i = 0; from->h_aliases[i]; i++)
++    {
++        len = static_cast<int>(strlen(from->h_aliases[i])+1);
++        if (static_cast<size_t>((ptr-buffer)+len) < buflen)
++        {
++            to->h_aliases[i] = ptr;
++            strcpy(ptr, from->h_aliases[i]);
++            ptr += len;
++        }
++        else
++        {
++            *error = BUFFER_OVERFLOW;
++            return *error;
++        }
++    }
++    to->h_aliases[i] = NULL;
++
++    /* copy addr_list to buffer */
++    to->h_addr_list = reinterpret_cast<char**>(ptr);
++    for(i = 0; reinterpret_cast<int*>(from->h_addr_list[i]) != 0; i++);
++    ptr += (i+1) * static_cast<int>(sizeof(int*));
++
++    for(i = 0; reinterpret_cast<int*>(from->h_addr_list[i]) != 0; i++)
++    {
++        len = sizeof(int);
++        if (static_cast<size_t>((ptr-buffer)+len) < buflen)
++        {
++            to->h_addr_list[i] = ptr;
++            memcpy(ptr, from->h_addr_list[i], static_cast<size_t>(len));
++            ptr += len;
++        }
++        else
++        {
++            *error = BUFFER_OVERFLOW;
++            return *error;
++        }
++    }
++    to->h_addr_list[i] = 0;
++    return *error;
++}
++#endif /* defined(HAVE_GETNAMEINFO) || defined(HAVE_GETADDRINFO) */
++
++#if defined(HAVE_GETNAMEINFO)
++static int gethostbyname_r(char const* hostname, struct hostent* result,
++                                       char* buffer, size_t buflen, hostent** entry, int* error)
++{
++#ifdef HAVE_PTHREAD_H
++    if (fr_hostbyname == 0)
++    {
++        pthread_mutex_init(&fr_hostbyname_mutex, NULL);
++        fr_hostbyname = 1;
++    }
++    pthread_mutex_lock(&fr_hostbyname_mutex);
++#endif
++
++    *entry = gethostbyname(hostname);
++    if ((!(*entry)) || ((*entry)->h_addrtype != AF_INET) || ((*entry)->h_length != 4))
++    {
++         *error = h_errno;
++         *entry = NULL;
++    }
++    else
++    {
++         copy_hostent(*entry, result, buffer, buflen, error);
++         *entry = result;
++    }
++
++#ifdef HAVE_PTHREAD_H
++    pthread_mutex_unlock(&fr_hostbyname_mutex);
++#endif
++
++    return h_errno;
++}
++#endif /* defined(HAVE_GETNAMEINFO) */
++
++#if defined(HAVE_GETADDRINFO)
++static int gethostbyaddr_r(const uint8_t* addr, const socklen_t len, int type, struct hostent* result,
++                           char* buffer, size_t buflen, hostent** entry, int* error)
++{
++#ifdef HAVE_PTHREAD_H
++    if (fr_hostbyaddr == 0)
++    {
++        pthread_mutex_init(&fr_hostbyaddr_mutex, NULL);
++        fr_hostbyaddr = 1;
++    }
++    pthread_mutex_lock(&fr_hostbyaddr_mutex);
++#endif
++
++    *entry = gethostbyaddr(reinterpret_cast<const char*>(addr), static_cast<unsigned int>(len), type);
++    if ((!(*entry)) || ((*entry)->h_addrtype != AF_INET) || ((*entry)->h_length != 4))
++    {
++         *error = h_errno;
++         *entry = nullptr;
++    }
++    else
++    {
++         copy_hostent(*entry, result, buffer, buflen, error);
++         *entry = result;
++    }
++
++#ifdef HAVE_PTHREAD_H
++    pthread_mutex_unlock(&fr_hostbyaddr_mutex);
++#endif
++
++    return h_errno;
++}
++#endif /* defined(HAVE_GETADDRINFO) */
++
++#if defined(HAVE_GETHOSTBYNAME_R) || defined(HAVE_GETNAMEINFO)
+ static int GetHostByNameHelper(const uint8_t* hostname, hostent** entry)
+ {
+     assert(hostname != nullptr);
+@@ -421,7 +552,7 @@ static int GetHostByNameHelper(const uin
+         }
+     }
+ }
+-#endif
++#endif /* defined(HAVE_GETHOSTBYNAME_R) || defined(HAVE_GETNAMEINFO) */
+ 
+ extern "C" int32_t SystemNative_GetHostByName(const uint8_t* hostname, HostEntry* entry)
+ {
+@@ -436,7 +567,7 @@ extern "C" int32_t SystemNative_GetHostB
+ #if HAVE_THREAD_SAFE_GETHOSTBYNAME_AND_GETHOSTBYADDR
+     hostEntry = gethostbyname(reinterpret_cast<const char*>(hostname));
+     error = h_errno;
+-#elif HAVE_GETHOSTBYNAME_R
++#elif HAVE_GETHOSTBYNAME_R || HAVE_GETADDRINFO
+     error = GetHostByNameHelper(hostname, &hostEntry);
+ #else
+ #error Platform does not provide thread-safe gethostbyname
+@@ -451,7 +582,7 @@ extern "C" int32_t SystemNative_GetHostB
+     return PAL_SUCCESS;
+ }
+ 
+-#if HAVE_GETHOSTBYADDR_R
++#if defined(HAVE_GETHOSTBYADDR_R) || defined(HAVE_HOSTADDRINFO)
+ static int GetHostByAddrHelper(const uint8_t* addr, const socklen_t addrLen, int type, hostent** entry)
+ {
+     assert(addr != nullptr);
+@@ -491,7 +622,7 @@ static int GetHostByAddrHelper(const uin
+         }
+     }
+ }
+-#endif
++#endif /* defined(HAVE_GETHOSTBYADDR_R) || defined(HAVE_HOSTADDRINFO) */
+ 
+ extern "C" int32_t SystemNative_GetHostByAddress(const IPAddress* address, HostEntry* entry)
+ {
+@@ -1188,7 +1319,11 @@ extern "C" Error SystemNative_GetIPv4Mul
+         return PAL_EINVAL;
+     }
+ 
++#if HAVE_IP_MREQ
++    ip_mreq opt;
++#elif HAVE_IP_MREQN
+     ip_mreqn opt;
++#endif
+     socklen_t len = sizeof(opt);
+     int err = getsockopt(socket, IPPROTO_IP, optionName, &opt, &len);
+     if (err != 0)
+@@ -1197,8 +1332,12 @@ extern "C" Error SystemNative_GetIPv4Mul
+     }
+ 
+     *option = {.MulticastAddress = opt.imr_multiaddr.s_addr,
++#if HAVE_IP_MREQ
++               .LocalAddress = opt.imr_interface.s_addr};
++#elif HAVE_IP_MREQN
+                .LocalAddress = opt.imr_address.s_addr,
+                .InterfaceIndex = opt.imr_ifindex};
++#endif
+     return PAL_SUCCESS;
+ }
+ 
+@@ -1215,9 +1354,14 @@ extern "C" Error SystemNative_SetIPv4Mul
+         return PAL_EINVAL;
+     }
+ 
++#if HAVE_IP_MREQ
++    ip_mreq opt = {.imr_multiaddr = {.s_addr = option->MulticastAddress},
++                   .imr_interface = {.s_addr = option->LocalAddress}};
++#elif HAVE_IP_MREQN
+     ip_mreqn opt = {.imr_multiaddr = {.s_addr = option->MulticastAddress},
+                     .imr_address = {.s_addr = option->LocalAddress},
+                     .imr_ifindex = option->InterfaceIndex};
++#endif
+     int err = setsockopt(socket, IPPROTO_IP, optionName, &opt, sizeof(opt));
+     return err == 0 ? PAL_SUCCESS : SystemNative_ConvertErrorPlatformToPal(errno);
+ }
+@@ -1729,21 +1873,29 @@ static bool TryGetPlatformSocketOption(i
+ 
+                 // case PAL_SO_IP_DONTFRAGMENT:
+ 
++#ifdef IP_ADD_SOURCE_MEMBERSHIP
+                 case PAL_SO_IP_ADD_SOURCE_MEMBERSHIP:
+                     optName = IP_ADD_SOURCE_MEMBERSHIP;
+                     return true;
++#endif
+ 
++#ifdef IP_DROP_SOURCE_MEMBERSHIP
+                 case PAL_SO_IP_DROP_SOURCE_MEMBERSHIP:
+                     optName = IP_DROP_SOURCE_MEMBERSHIP;
+                     return true;
++#endif
+ 
++#ifdef IP_BLOCK_SOURCE
+                 case PAL_SO_IP_BLOCK_SOURCE:
+                     optName = IP_BLOCK_SOURCE;
+                     return true;
++#endif
+ 
++#ifdef IP_UNBLOCK_SOURCE
+                 case PAL_SO_IP_UNBLOCK_SOURCE:
+                     optName = IP_UNBLOCK_SOURCE;
+                     return true;
++#endif
+ 
+                 case PAL_SO_IP_PKTINFO:
+                     optName = IP_PKTINFO;
+@@ -2317,8 +2469,13 @@ static Error CloseSocketEventPortInner(i
+ static Error TryChangeSocketEventRegistrationInner(
+     int32_t port, int32_t socket, SocketEvents currentEvents, SocketEvents newEvents, uintptr_t data)
+ {
++#ifdef EV_RECEIPT
+     const uint16_t AddFlags = EV_ADD | EV_CLEAR | EV_RECEIPT;
+     const uint16_t RemoveFlags = EV_DELETE | EV_RECEIPT;
++#else
++    const uint16_t AddFlags = EV_ADD | EV_CLEAR;
++    const uint16_t RemoveFlags = EV_DELETE;
++#endif
+ 
+     assert(currentEvents != newEvents);
+ 
+@@ -2331,6 +2488,15 @@ static Error TryChangeSocketEventRegistr
+     int i = 0;
+     if (readChanged)
+     {
++#if KEVENT_HAS_NUMERIC_DATA
++        EV_SET(&events[i++],
++               static_cast<uint64_t>(socket),
++               EVFILT_READ,
++               (newEvents & PAL_SA_READ) == 0 ? RemoveFlags : AddFlags,
++               0,
++               0,
++               data);
++#else
+         EV_SET(&events[i++],
+                static_cast<uint64_t>(socket),
+                EVFILT_READ,
+@@ -2338,6 +2504,7 @@ static Error TryChangeSocketEventRegistr
+                0,
+                0,
+                reinterpret_cast<void*>(data));
++#endif
+     }
+ 
+     if (writeChanged)
+@@ -2348,11 +2515,15 @@ static Error TryChangeSocketEventRegistr
+                (newEvents & PAL_SA_WRITE) == 0 ? RemoveFlags : AddFlags,
+                0,
+                0,
+-               reinterpret_cast<void*>(data));
++               data);
+     }
+ 
+     int err;
++#if KEVENT_REQUIRES_SIZE_T_NUMERICS
++    while (CheckInterrupted(err = kevent(port, events, static_cast<size_t>(i), nullptr, 0, nullptr)));
++#else
+     while (CheckInterrupted(err = kevent(port, events, i, nullptr, 0, nullptr)));
++#endif
+     return err == 0 ? PAL_SUCCESS : SystemNative_ConvertErrorPlatformToPal(errno);
+ }
+ 
+@@ -2364,7 +2535,11 @@ static Error WaitForSocketEventsInner(in
+ 
+     auto* events = reinterpret_cast<struct kevent*>(buffer);
+     int numEvents;
++#if KEVENT_REQUIRES_SIZE_T_NUMERICS
++    while (CheckInterrupted(numEvents = kevent(port, nullptr, 0, events, static_cast<size_t>(*count), nullptr)));
++#else
+     while (CheckInterrupted(numEvents = kevent(port, nullptr, 0, events, *count, nullptr)));
++#endif
+     if (numEvents == -1)
+     {
+         *count = -1;
+@@ -2382,7 +2557,11 @@ static Error WaitForSocketEventsInner(in
+     {
+         // This copy is made deliberately to avoid overwriting data.
+         struct kevent evt = events[i];
++#if KEVENT_HAS_NUMERIC_DATA
++        buffer[i] = {.Data = static_cast<unsigned long>(evt.udata), .Events = GetSocketEvents(static_cast<short>(evt.filter), static_cast<unsigned short>(evt.flags))};
++#else
+         buffer[i] = {.Data = reinterpret_cast<uintptr_t>(evt.udata), .Events = GetSocketEvents(evt.filter, evt.flags)};
++#endif
+     }
+ 
+     *count = numEvents;


Home | Main Index | Thread Index | Old Index