Skip to content

Instantly share code, notes, and snippets.

@InfRandomness
Last active June 10, 2021 20:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save InfRandomness/64a8b03ca031480ad682306b07ef9c2b to your computer and use it in GitHub Desktop.
Save InfRandomness/64a8b03ca031480ad682306b07ef9c2b to your computer and use it in GitHub Desktop.
Patch to make CMake 3.20.3 build on SGI-IRIX
Index: Utilities/cmlibarchive/libarchive/archive_read_disk_posix.c
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/Utilities/cmlibarchive/libarchive/archive_read_disk_posix.c b/Utilities/cmlibarchive/libarchive/archive_read_disk_posix.c
--- a/Utilities/cmlibarchive/libarchive/archive_read_disk_posix.c (revision 13d112ea03f2b068da1f7ac3239a42a6cff94eda)
+++ b/Utilities/cmlibarchive/libarchive/archive_read_disk_posix.c (date 1623343720115)
@@ -2526,7 +2526,7 @@
tree_current_lstat(struct tree *t)
{
if (!(t->flags & hasLstat)) {
-#ifdef HAVE_FSTATAT
+#if defined(HAVE_FSTATAT) && !defined(__sgi)
if (fstatat(tree_current_dir_fd(t),
tree_current_access_path(t), &t->lst,
AT_SYMLINK_NOFOLLOW) != 0)
Index: Source/CTest/cmProcess.cxx
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/Source/CTest/cmProcess.cxx b/Source/CTest/cmProcess.cxx
--- a/Source/CTest/cmProcess.cxx (revision 13d112ea03f2b068da1f7ac3239a42a6cff94eda)
+++ b/Source/CTest/cmProcess.cxx (date 1623343403847)
@@ -106,7 +106,7 @@
options.stdio_count = 3; // in, out and err
options.exit_cb = &cmProcess::OnExitCB;
options.stdio = stdio;
-#if !defined(CMAKE_USE_SYSTEM_LIBUV)
+#if !defined(CMAKE_USE_SYSTEM_LIBUV) && !defined(__sgi)
std::vector<char> cpumask;
if (affinity && !affinity->empty()) {
cpumask.resize(static_cast<size_t>(uv_cpumask_size()), 0);
Index: Source/cmSystemTools.cxx
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
--- a/Source/cmSystemTools.cxx (revision 13d112ea03f2b068da1f7ac3239a42a6cff94eda)
+++ b/Source/cmSystemTools.cxx (date 1623343521217)
@@ -2079,7 +2079,9 @@
// Try using a real random source.
cmsys::ifstream fin;
- fin.rdbuf()->pubsetbuf(nullptr, 0); // Unbuffered read.
+ if !defined(__sgi)
+ fin.rdbuf()->pubsetbuf(nullptr, 0); // Unbuffered read.
+ endif
fin.open("/dev/urandom");
if (fin.good() && fin.read(seed.bytes, sizeof(seed)) &&
fin.gcount() == sizeof(seed)) {
Index: Source/kwsys/ProcessUNIX.c
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/Source/kwsys/ProcessUNIX.c b/Source/kwsys/ProcessUNIX.c
--- a/Source/kwsys/ProcessUNIX.c (revision 13d112ea03f2b068da1f7ac3239a42a6cff94eda)
+++ b/Source/kwsys/ProcessUNIX.c (date 1623343603138)
@@ -101,6 +101,7 @@
*/
#if !defined(__BEOS__) && !defined(__VMS) && !defined(__MINT__) && \
!defined(KWSYSPE_USE_SELECT)
+ !defined(KWSYSPE_USE_SELECT) && !defined(__sgi)
# define KWSYSPE_USE_SELECT 1
#endif
Index: Utilities/cmlibarchive/libarchive/filter_fork_posix.c
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/Utilities/cmlibarchive/libarchive/filter_fork_posix.c b/Utilities/cmlibarchive/libarchive/filter_fork_posix.c
--- a/Utilities/cmlibarchive/libarchive/filter_fork_posix.c (revision 13d112ea03f2b068da1f7ac3239a42a6cff94eda)
+++ b/Utilities/cmlibarchive/libarchive/filter_fork_posix.c (date 1623343885336)
@@ -77,7 +77,7 @@
{
pid_t child;
int stdin_pipe[2], stdout_pipe[2], tmp;
-#if HAVE_POSIX_SPAWNP
+#if defined(HAVE_POSIX_SPAWNP) && !defined(__sgi)
posix_spawn_file_actions_t actions;
int r;
#endif
@@ -106,7 +106,7 @@
stdout_pipe[1] = tmp;
}
-#if HAVE_POSIX_SPAWNP
+#if defined(HAVE_POSIX_SPAWNP) && !defined(__sgi)
r = posix_spawn_file_actions_init(&actions);
if (r != 0) {
@@ -179,7 +179,7 @@
return child;
-#if HAVE_POSIX_SPAWNP
+#if defined(HAVE_POSIX_SPAWNP) && !defined(__sgi)
actions_inited:
errno = r;
posix_spawn_file_actions_destroy(&actions);
Index: Utilities/cmlibuv/include/uv/unix.h
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/Utilities/cmlibuv/include/uv/unix.h b/Utilities/cmlibuv/include/uv/unix.h
--- a/Utilities/cmlibuv/include/uv/unix.h (revision 13d112ea03f2b068da1f7ac3239a42a6cff94eda)
+++ b/Utilities/cmlibuv/include/uv/unix.h (date 1623345377110)
@@ -74,6 +74,8 @@
defined(__MSYS__) || \
defined(__GNU__)
# include "posix.h"
+#elif defined(__sgi)
+# include "posix.h"
#elif defined(__HAIKU__)
# include "posix.h"
#elif defined(__QNX__)
Index: Utilities/cmlibuv/src/unix/internal.h
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/Utilities/cmlibuv/src/unix/internal.h b/Utilities/cmlibuv/src/unix/internal.h
--- a/Utilities/cmlibuv/src/unix/internal.h (revision 13d112ea03f2b068da1f7ac3239a42a6cff94eda)
+++ b/Utilities/cmlibuv/src/unix/internal.h (date 1623346167947)
@@ -201,7 +201,11 @@
int uv__close_nocheckstdio(int fd);
int uv__close_nocancel(int fd);
int uv__socket(int domain, int type, int protocol);
+#if defined(__sgi)
+ssize_t uv__recvmsg(int fd, struct xpg5_msghdr *msg, int flags);
+#else
ssize_t uv__recvmsg(int fd, struct msghdr *msg, int flags);
+#endif
void uv__make_close_pending(uv_handle_t* handle);
int uv__getiovmax(void);
@@ -329,11 +333,17 @@
#endif
typedef int (*uv__peersockfunc)(int, struct sockaddr*, socklen_t*);
-
+#if defined(__sgi)
+int uv__getsockpeername(const uv_handle_t* handle,
+ uv__peersockfunc func,
+ struct sockaddr* name,
+ socklen_t* namelen);
+#else
int uv__getsockpeername(const uv_handle_t* handle,
uv__peersockfunc func,
struct sockaddr* name,
int* namelen);
+#endif
#if defined(__linux__) || \
defined(__FreeBSD__) || \
Index: Utilities/cmlibuv/include/uv.h
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/Utilities/cmlibuv/include/uv.h b/Utilities/cmlibuv/include/uv.h
--- a/Utilities/cmlibuv/include/uv.h (revision 13d112ea03f2b068da1f7ac3239a42a6cff94eda)
+++ b/Utilities/cmlibuv/include/uv.h (date 1623345431844)
@@ -24,6 +24,33 @@
#ifndef UV_H
#define UV_H
+#if defined(__sgi)
+
+# define SCM_RIGHTS 0x01
+
+# include <unistd.h>
+# include <sys/types.h>
+# include <sys/socket.h>
+# include <bstring.h>
+# include <sys/time.h>
+/* Ugly redefines to use xpg5 style recvmsg/sendmsg and msg_flags */
+/* (Since we can't just define _XOPEN_SOURCE 500 without breaking other stuff */
+/*
+# undef CMSG_FIRSTHDR
+# define CMSG_FIRSTHDR(mhdr) ((struct cmsghdr *)(mhdr)->msg_ctrl)
+# undef CMSG_NXTHDR
+# define CMSG_NXTHDR(mhdr, cmsg) \
+ (((caddr_t)(cmsg) (cmsg)->cmsg_len sizeof(struct cmsghdr) > \
+ (caddr_t)(mhdr)->msg_ctrl (mhdr)->msg_ctrllen) ? \
+ (struct cmsghdr *)0L : \
+ (struct cmsghdr *)((caddr_t)(cmsg) _ALIGN((cmsg)->cmsg_len)))
+extern ssize_t _xpg5_recvmsg(int, struct xpg5_msghdr *, int);
+extern ssize_t _xpg5_sendmsg(int, const struct xpg5_msghdr *, int);
+*/
+
+#endif
+
+
/* Include KWSys Large File Support configuration. */
#include <cmsys/Configure.h>
@@ -751,7 +778,7 @@
UV_EXTERN int uv_tty_get_vterm_state(uv_tty_vtermstate_t* state);
#ifdef __cplusplus
-extern "C++" {
+extern "C" {
inline int uv_tty_set_mode(uv_tty_t* handle, int mode) {
return uv_tty_set_mode(handle, static_cast<uv_tty_mode_t>(mode));
@@ -1256,7 +1283,7 @@
UV_EXTERN int uv_os_unsetenv(const char* name);
#ifdef MAXHOSTNAMELEN
-# define UV_MAXHOSTNAMESIZE (MAXHOSTNAMELEN + 1)
+# define UV_MAXHOSTNAMESIZE (MAXHOSTNAMELEN 1)
#else
/*
Fallback for the maximum hostname size, including the null terminator. The
@@ -1679,11 +1706,11 @@
uv_random_cb cb);
#if defined(IF_NAMESIZE)
-# define UV_IF_NAMESIZE (IF_NAMESIZE + 1)
+# define UV_IF_NAMESIZE (IF_NAMESIZE 1)
#elif defined(IFNAMSIZ)
-# define UV_IF_NAMESIZE (IFNAMSIZ + 1)
+# define UV_IF_NAMESIZE (IFNAMSIZ 1)
#else
-# define UV_IF_NAMESIZE (16 + 1)
+# define UV_IF_NAMESIZE (16 1)
#endif
UV_EXTERN int uv_if_indextoname(unsigned int ifindex,
Index: Utilities/cmlibuv/src/unix/core.c
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/Utilities/cmlibuv/src/unix/core.c b/Utilities/cmlibuv/src/unix/core.c
--- a/Utilities/cmlibuv/src/unix/core.c (revision 13d112ea03f2b068da1f7ac3239a42a6cff94eda)
+++ b/Utilities/cmlibuv/src/unix/core.c (date 1623345807537)
@@ -592,7 +592,7 @@
}
-#if !defined(__hpux) && !defined(__CYGWIN__) && !defined(__MSYS__) && !defined(__HAIKU__)
+#if !defined(__hpux) && !defined(__CYGWIN__) && !defined(__MSYS__) && !defined(__HAIKU__) && !defined(__sgi)
int uv__cloexec_ioctl(int fd, int set) {
int r;
@@ -669,8 +669,11 @@
return 0;
}
-
+#if defined(__sgii)
+ssize_t uv__recvmsg(int fd, struct xpg5_msghdr* msg, int flags) {
+#else
ssize_t uv__recvmsg(int fd, struct msghdr* msg, int flags) {
+#endif
struct cmsghdr* cmsg;
ssize_t rc;
int* pfd;
@@ -690,12 +693,18 @@
} else {
rc = recvmsg(fd, msg, flags);
}
+#elif defined(__sgii)
+ rc = _xpg5_recvmsg(fd, msg, flags);
#else
rc = recvmsg(fd, msg, flags);
#endif
if (rc == -1)
return UV__ERR(errno);
+#if defined(__sgi)
+ /* if(msg->msg_ctrllen == 0) */
+#else
if (msg->msg_controllen == 0)
+#endif
return rc;
for (cmsg = CMSG_FIRSTHDR(msg); cmsg != NULL; cmsg = CMSG_NXTHDR(msg, cmsg))
if (cmsg->cmsg_type == SCM_RIGHTS)
Index: Utilities/cmlibuv/CMakeLists.txt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/Utilities/cmlibuv/CMakeLists.txt b/Utilities/cmlibuv/CMakeLists.txt
--- a/Utilities/cmlibuv/CMakeLists.txt (revision 13d112ea03f2b068da1f7ac3239a42a6cff94eda)
+++ b/Utilities/cmlibuv/CMakeLists.txt (date 1623346194208)
@@ -33,7 +33,7 @@
src/uv-common.h
src/uv-data-getter-setters.c
src/version.c
- )
+ src/unix/irix.c)
if(WIN32)
list(APPEND uv_libraries
ws2_32
@@ -353,6 +353,40 @@
socket
)
endif()
+
+if(CMAKE_SYSTEM_NAME MATCHES "IRIX")
+ list(APPEND uv_libraries dl rt)
+ list(APPEND uv_headers
+ include/uv/posix.h
+ )
+ list(APPEND uv_defines
+ _SGI_SOURCE
+ _SGI_REENTRANT_FUNCTIONS
+ )
+ list(APPEND uv_sources
+ src/unix/irix.c
+ src/unix/no-fsevents.c
+ src/unix/posix-poll.c
+ src/unix/posix-hrtime.c
+ )
+endif()
+
+if(CMAKE_SYSTEM_NAME MATCHES "IRIX")
+ list(APPEND uv_libraries dl rt)
+ list(APPEND uv_headers
+ include/uv/posix.h
+ )
+ list(APPEND uv_defines
+ _SGI_SOURCE
+ _SGI_REENTRANT_FUNCTIONS
+ )
+ list(APPEND uv_sources
+ src/unix/irix.c
+ src/unix/no-fsevents.c
+ src/unix/posix-poll.c
+ src/unix/posix-hrtime.c
+ )
+endif()
include_directories(
${uv_includes}
Index: Utilities/cmlibuv/src/unix/fs.c
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/Utilities/cmlibuv/src/unix/fs.c b/Utilities/cmlibuv/src/unix/fs.c
--- a/Utilities/cmlibuv/src/unix/fs.c (revision 13d112ea03f2b068da1f7ac3239a42a6cff94eda)
+++ b/Utilities/cmlibuv/src/unix/fs.c (date 1623345996648)
@@ -518,7 +518,7 @@
}
-#if defined(__APPLE__) && !defined(MAC_OS_X_VERSION_10_8)
+#if (defined(__APPLE__) || defined(__sgi)) && !defined(MAC_OS_X_VERSION_10_8)
#define UV_CONST_DIRENT uv__dirent_t
#else
#define UV_CONST_DIRENT const uv__dirent_t
@@ -764,8 +764,12 @@
#else
ssize_t len;
+#if defined(__sgi)
+ buf = uv__malloc(PATH_MAX + 1);
+#else
len = uv__fs_pathmax_size(req->path);
buf = uv__malloc(len + 1);
+#endif
if (buf == NULL) {
errno = ENOMEM;
Index: Utilities/cmlibuv/src/unix/posix-hrtime.c
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/Utilities/cmlibuv/src/unix/posix-hrtime.c b/Utilities/cmlibuv/src/unix/posix-hrtime.c
--- a/Utilities/cmlibuv/src/unix/posix-hrtime.c (revision 13d112ea03f2b068da1f7ac3239a42a6cff94eda)
+++ b/Utilities/cmlibuv/src/unix/posix-hrtime.c (date 1623346354770)
@@ -19,20 +19,21 @@
* IN THE SOFTWARE.
*/
-#include "uv.h"
#include "internal.h"
+#include "uv.h"
#if defined(__APPLE__)
/* Special case for CMake bootstrap: no clock_gettime on macOS < 10.12 */
-#ifndef CMAKE_BOOTSTRAP
-#error "This code path meant only for use during CMake bootstrap."
-#endif
+# ifndef CMAKE_BOOTSTRAP
+# error "This code path meant only for use during CMake bootstrap."
+# endif
-#include <mach/mach.h>
-#include <mach/mach_time.h>
+# include <mach/mach.h>
+# include <mach/mach_time.h>
-uint64_t uv__hrtime(uv_clocktype_t type) {
+uint64_t uv__hrtime(uv_clocktype_t type)
+{
static mach_timebase_info_data_t info;
if ((ACCESS_ONCE(uint32_t, info.numer) == 0 ||
@@ -46,29 +47,35 @@
#elif defined(__hpux)
/* Special case for CMake bootstrap: no CLOCK_MONOTONIC on HP-UX */
-#ifndef CMAKE_BOOTSTRAP
-#error "This code path meant only for use during CMake bootstrap."
-#endif
+# ifndef CMAKE_BOOTSTRAP
+# error "This code path meant only for use during CMake bootstrap."
+# endif
-#include <stdint.h>
-#include <time.h>
+# include <stdint.h>
+# include <time.h>
-uint64_t uv__hrtime(uv_clocktype_t type) {
- return (uint64_t) gethrtime();
+uint64_t uv__hrtime(uv_clocktype_t type)
+{
+ return (uint64_t)gethrtime();
}
#else
-#include <stdint.h>
-#include <time.h>
+# include <stdint.h>
+# include <time.h>
-#undef NANOSEC
-#define NANOSEC ((uint64_t) 1e9)
+# undef NANOSEC
+# define NANOSEC ((uint64_t)1e9)
-uint64_t uv__hrtime(uv_clocktype_t type) {
+uint64_t uv__hrtime(uv_clocktype_t type)
+{
struct timespec ts;
+# if defined(__sgi)
+ clock_gettime(CLOCK_SGI_CYCLE, &ts);
+# else
clock_gettime(CLOCK_MONOTONIC, &ts);
- return (((uint64_t) ts.tv_sec) * NANOSEC + ts.tv_nsec);
+# endif
+ return (((uint64_t)ts.tv_sec) * NANOSEC + ts.tv_nsec);
}
#endif
Index: Utilities/cmlibuv/src/unix/stream.c
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/Utilities/cmlibuv/src/unix/stream.c b/Utilities/cmlibuv/src/unix/stream.c
--- a/Utilities/cmlibuv/src/unix/stream.c (revision 13d112ea03f2b068da1f7ac3239a42a6cff94eda)
+++ b/Utilities/cmlibuv/src/unix/stream.c (date 1623346824813)
@@ -840,7 +840,11 @@
if (req->send_handle) {
int fd_to_send;
+#if defined(__sgi)
+ struct xpg5_msghdr msg;
+#else
struct msghdr msg;
+#endif
struct cmsghdr *cmsg;
union {
char data[64];
@@ -862,11 +866,16 @@
msg.msg_namelen = 0;
msg.msg_iov = iov;
msg.msg_iovlen = iovcnt;
+#if !defined(__sgi)
msg.msg_flags = 0;
-
+#endif
+#if defined(__sgi) \
+ /*msg.msg_ctrl = &scratch.alias;
+ msg.msg_ctrllen = CMSG_SPACE(sizeof(fd_to_send));*/
+#else
msg.msg_control = &scratch.alias;
msg.msg_controllen = CMSG_SPACE(sizeof(fd_to_send));
-
+#endif
cmsg = CMSG_FIRSTHDR(&msg);
cmsg->cmsg_level = SOL_SOCKET;
cmsg->cmsg_type = SCM_RIGHTS;
@@ -880,7 +889,11 @@
}
do
+#if defined(__sgi)
+ n = _xpg5_sendmsg(uv__stream_fd(stream), &msg, 0);
+#else
n = sendmsg(uv__stream_fd(stream), &msg, 0);
+#endif
while (n == -1 && RETRY_ON_WRITE_ERROR(errno));
/* Ensure the handle isn't sent again in case this is a partial write. */
@@ -1056,8 +1069,11 @@
#endif
#define UV__CMSG_FD_SIZE (UV__CMSG_FD_COUNT * sizeof(int))
-
+#if defined(__sgii)
+static int uv__stream_recv_cmsg(uv_stream_t* stream, struct xpg5_msghdr* msg) {
+#else
static int uv__stream_recv_cmsg(uv_stream_t* stream, struct msghdr* msg) {
+#endif
struct cmsghdr* cmsg;
for (cmsg = CMSG_FIRSTHDR(msg); cmsg != NULL; cmsg = CMSG_NXTHDR(msg, cmsg)) {
@@ -1116,7 +1132,11 @@
static void uv__read(uv_stream_t* stream) {
uv_buf_t buf;
ssize_t nread;
+#if defined(__sgii)
+ struct xpg5_msghdr msg;
+#else
struct msghdr msg;
+#endif
char cmsg_space[CMSG_SPACE(UV__CMSG_FD_SIZE)];
int count;
int err;
@@ -1157,15 +1177,21 @@
while (nread < 0 && errno == EINTR);
} else {
/* ipc uses recvmsg */
+#if !defined(__sgi)
msg.msg_flags = 0;
+#endif
msg.msg_iov = (struct iovec*) &buf;
msg.msg_iovlen = 1;
msg.msg_name = NULL;
msg.msg_namelen = 0;
/* Set up to receive a descriptor even if one isn't in the message */
+#if defined(__sgi) \
+ /*msg.msg_ctrllen = sizeof(cmsg_space);
+ msg.msg_ctrl = cmsg_space;*/
+#else
msg.msg_controllen = sizeof(cmsg_space);
msg.msg_control = cmsg_space;
-
+#endif
do {
nread = uv__recvmsg(uv__stream_fd(stream), &msg, 0);
}
Index: Source/CMakeLists.txt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
--- a/Source/CMakeLists.txt (revision 13d112ea03f2b068da1f7ac3239a42a6cff94eda)
+++ b/Source/CMakeLists.txt (date 1623341690240)
@@ -80,6 +80,12 @@
)
endif()
+if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
+ if ("${CMAKE_CXX_SIMULATE_ID}" STREQUAL "MSVC")
+ ADD_COMPILE_OPTIONS("/EHs")
+ endif()
+endif()
+
# configure the .h file
configure_file(
"${CMake_SOURCE_DIR}/Source/cmConfigure.cmake.h.in"
Index: Utilities/cmlibuv/src/unix/thread.c
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/Utilities/cmlibuv/src/unix/thread.c b/Utilities/cmlibuv/src/unix/thread.c
--- a/Utilities/cmlibuv/src/unix/thread.c (revision 13d112ea03f2b068da1f7ac3239a42a6cff94eda)
+++ b/Utilities/cmlibuv/src/unix/thread.c (date 1623348912941)
@@ -709,7 +709,7 @@
if (err)
return UV__ERR(err);
-#if !defined(__hpux)
+#if !defined(__hpux) && !defined(__sgi)
err = pthread_condattr_setclock(&attr, CLOCK_MONOTONIC);
if (err)
goto error2;
@@ -787,7 +787,7 @@
int uv_cond_timedwait(uv_cond_t* cond, uv_mutex_t* mutex, uint64_t timeout) {
int r;
struct timespec ts;
-#if defined(__MVS__)
+#if defined(__MVS__) || defined() defined(__sgi)
struct timeval tv;
#endif
@@ -796,7 +796,7 @@
ts.tv_nsec = timeout % NANOSEC;
r = pthread_cond_timedwait_relative_np(cond, mutex, &ts);
#else
-#if defined(__MVS__)
+#if defined(__MVS__) || defined(__sgi)
if (gettimeofday(&tv, NULL))
abort();
timeout += tv.tv_sec * NANOSEC + tv.tv_usec * 1e3;
Index: Utilities/cmlibuv/src/unix/tty.c
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/Utilities/cmlibuv/src/unix/tty.c b/Utilities/cmlibuv/src/unix/tty.c
--- a/Utilities/cmlibuv/src/unix/tty.c (revision 13d112ea03f2b068da1f7ac3239a42a6cff94eda)
+++ b/Utilities/cmlibuv/src/unix/tty.c (date 1623348974308)
@@ -228,7 +228,7 @@
static void uv__tty_make_raw(struct termios* tio) {
assert(tio != NULL);
-#if defined __sun || defined __MVS__ || defined __hpux
+#if defined __sun || defined __MVS__ || defined __hpux || defined(__sgi)
/*
* This implementation of cfmakeraw for Solaris and derivatives is taken from
* http://www.perkin.org.uk/posts/solaris-portability-cfmakeraw.html.
@@ -349,7 +349,7 @@
return UV_UDP;
if (type == SOCK_STREAM) {
-#if defined(_AIX) || defined(__DragonFly__)
+#if defined(_AIX) || defined(__DragonFly__) || ACCESS_ONCE() defined(__sgi)
/* on AIX/DragonFly the getsockname call returns an empty sa structure
* for sockets of type AF_UNIX. For all other types it will
* return a properly filled in structure.
Index: Utilities/cmlibuv/src/unix/udp.c
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/Utilities/cmlibuv/src/unix/udp.c b/Utilities/cmlibuv/src/unix/udp.c
--- a/Utilities/cmlibuv/src/unix/udp.c (revision 13d112ea03f2b068da1f7ac3239a42a6cff94eda)
+++ b/Utilities/cmlibuv/src/unix/udp.c (date 1623349384535)
@@ -19,30 +19,31 @@
* IN THE SOFTWARE.
*/
-#include "uv.h"
-#include "internal.h"
-
#include <assert.h>
-#include <string.h>
#include <errno.h>
#include <stdlib.h>
+#include <string.h>
#include <unistd.h>
+
+#include "internal.h"
+#include "uv.h"
#if defined(__MVS__)
-#include <xti.h>
+# include <xti.h>
#endif
#include <sys/un.h>
#define UV__UDP_DGRAM_MAXSIZE (64 * 1024)
#if defined(IPV6_JOIN_GROUP) && !defined(IPV6_ADD_MEMBERSHIP)
-# define IPV6_ADD_MEMBERSHIP IPV6_JOIN_GROUP
+# define IPV6_ADD_MEMBERSHIP IPV6_JOIN_GROUP
#endif
#if defined(IPV6_LEAVE_GROUP) && !defined(IPV6_DROP_MEMBERSHIP)
-# define IPV6_DROP_MEMBERSHIP IPV6_LEAVE_GROUP
+# define IPV6_DROP_MEMBERSHIP IPV6_LEAVE_GROUP
#endif
-union uv__sockaddr {
+union uv__sockaddr
+{
struct sockaddr_in6 in6;
struct sockaddr_in in;
struct sockaddr addr;
@@ -52,13 +53,12 @@
static void uv__udp_io(uv_loop_t* loop, uv__io_t* w, unsigned int revents);
static void uv__udp_recvmsg(uv_udp_t* handle);
static void uv__udp_sendmsg(uv_udp_t* handle);
-static int uv__udp_maybe_deferred_bind(uv_udp_t* handle,
- int domain,
+static int uv__udp_maybe_deferred_bind(uv_udp_t* handle, int domain,
unsigned int flags);
#if HAVE_MMSG
-#define UV__MMSG_MAXWIDTH 20
+# define UV__MMSG_MAXWIDTH 20
static int uv__udp_recvmmsg(uv_udp_t* handle, uv_buf_t* buf);
static void uv__udp_sendmmsg(uv_udp_t* handle);
@@ -67,7 +67,8 @@
static int uv__sendmmsg_avail;
static uv_once_t once = UV_ONCE_INIT;
-static void uv__udp_mmsg_init(void) {
+static void uv__udp_mmsg_init(void)
+{
int ret;
int s;
s = uv__socket(AF_INET, SOCK_DGRAM, 0);
@@ -87,7 +88,8 @@
#endif
-void uv__udp_close(uv_udp_t* handle) {
+void uv__udp_close(uv_udp_t* handle)
+{
uv__io_close(handle->loop, &handle->io_watcher);
uv__handle_stop(handle);
@@ -97,8 +99,8 @@
}
}
-
-void uv__udp_finish_close(uv_udp_t* handle) {
+void uv__udp_finish_close(uv_udp_t* handle)
+{
uv_udp_send_t* req;
QUEUE* q;
@@ -125,8 +127,8 @@
/* but _do not_ touch close_cb */
}
-
-static void uv__udp_run_completed(uv_udp_t* handle) {
+static void uv__udp_run_completed(uv_udp_t* handle)
+{
uv_udp_send_t* req;
QUEUE* q;
@@ -169,8 +171,8 @@
handle->flags &= ~UV_HANDLE_UDP_PROCESSING;
}
-
-static void uv__udp_io(uv_loop_t* loop, uv__io_t* w, unsigned int revents) {
+static void uv__udp_io(uv_loop_t* loop, uv__io_t* w, unsigned int revents)
+{
uv_udp_t* handle;
handle = container_of(w, uv_udp_t, io_watcher);
@@ -186,7 +188,8 @@
}
#if HAVE_MMSG
-static int uv__udp_recvmmsg(uv_udp_t* handle, uv_buf_t* buf) {
+static int uv__udp_recvmmsg(uv_udp_t* handle, uv_buf_t* buf)
+{
struct sockaddr_in6 peers[UV__MMSG_MAXWIDTH];
struct iovec iov[UV__MMSG_MAXWIDTH];
struct uv__mmsghdr msgs[UV__MMSG_MAXWIDTH];
@@ -223,17 +226,14 @@
handle->recv_cb(handle, UV__ERR(errno), buf, NULL, 0);
} else {
/* pass each chunk to the application */
- for (k = 0; k < (size_t) nread && handle->recv_cb != NULL; k++) {
+ for (k = 0; k < (size_t)nread && handle->recv_cb != NULL; k++) {
flags = UV_UDP_MMSG_CHUNK;
if (msgs[k].msg_hdr.msg_flags & MSG_TRUNC)
flags |= UV_UDP_PARTIAL;
chunk_buf = uv_buf_init(iov[k].iov_base, iov[k].iov_len);
- handle->recv_cb(handle,
- msgs[k].msg_len,
- &chunk_buf,
- msgs[k].msg_hdr.msg_name,
- flags);
+ handle->recv_cb(handle, msgs[k].msg_len, &chunk_buf,
+ msgs[k].msg_hdr.msg_name, flags);
}
/* one last callback so the original buffer is freed */
@@ -244,9 +244,14 @@
}
#endif
-static void uv__udp_recvmsg(uv_udp_t* handle) {
+static void uv__udp_recvmsg(uv_udp_t* handle)
+{
struct sockaddr_storage peer;
+#if defined(__sgii)
+ struct xpg5_msghdr h;
+#else
struct msghdr h;
+#endif
ssize_t nread;
uv_buf_t buf;
int flags;
@@ -262,7 +267,7 @@
do {
buf = uv_buf_init(NULL, 0);
- handle->alloc_cb((uv_handle_t*) handle, UV__UDP_DGRAM_MAXSIZE, &buf);
+ handle->alloc_cb((uv_handle_t*)handle, UV__UDP_DGRAM_MAXSIZE, &buf);
if (buf.base == NULL || buf.len == 0) {
handle->recv_cb(handle, UV_ENOBUFS, &buf, NULL, 0);
return;
@@ -282,41 +287,44 @@
memset(&peer, 0, sizeof(peer));
h.msg_name = &peer;
h.msg_namelen = sizeof(peer);
- h.msg_iov = (void*) &buf;
+ h.msg_iov = (void*)&buf;
h.msg_iovlen = 1;
do {
+#if defined(__sgii)
+ nread = _xpg5_recvmsg(handle->io_watcher.fd, &h, 0);
+#else
nread = recvmsg(handle->io_watcher.fd, &h, 0);
- }
- while (nread == -1 && errno == EINTR);
+#endif
+ } while (nread == -1 && errno == EINTR);
if (nread == -1) {
if (errno == EAGAIN || errno == EWOULDBLOCK)
handle->recv_cb(handle, 0, &buf, NULL, 0);
else
handle->recv_cb(handle, UV__ERR(errno), &buf, NULL, 0);
- }
- else {
+ } else {
flags = 0;
+#if !defined(__sgi)
if (h.msg_flags & MSG_TRUNC)
flags |= UV_UDP_PARTIAL;
-
- handle->recv_cb(handle, nread, &buf, (const struct sockaddr*) &peer, flags);
+#endif
+ handle->recv_cb(handle, nread, &buf, (const struct sockaddr*)&peer,
+ flags);
}
count--;
}
/* recv_cb callback may decide to pause or close the handle */
- while (nread != -1
- && count > 0
- && handle->io_watcher.fd != -1
- && handle->recv_cb != NULL);
+ while (nread != -1 && count > 0 && handle->io_watcher.fd != -1 &&
+ handle->recv_cb != NULL);
}
#if HAVE_MMSG
-static void uv__udp_sendmmsg(uv_udp_t* handle) {
+static void uv__udp_sendmmsg(uv_udp_t* handle)
+{
uv_udp_send_t* req;
struct uv__mmsghdr h[UV__MMSG_MAXWIDTH];
- struct uv__mmsghdr *p;
+ struct uv__mmsghdr* p;
QUEUE* q;
ssize_t npkts;
size_t pkts;
@@ -351,7 +359,7 @@
abort();
}
}
- h[pkts].msg_hdr.msg_iov = (struct iovec*) req->bufs;
+ h[pkts].msg_hdr.msg_iov = (struct iovec*)req->bufs;
h[pkts].msg_hdr.msg_iovlen = req->nbufs;
}
@@ -395,7 +403,8 @@
QUEUE_INSERT_TAIL(&handle->write_completed_queue, &req->queue);
}
- /* couldn't batch everything, continue sending (jump to avoid stack growth) */
+ /* couldn't batch everything, continue sending (jump to avoid stack growth)
+ */
if (!QUEUE_EMPTY(&handle->write_queue))
goto write_queue_drain;
uv__io_feed(handle->loop, &handle->io_watcher);
@@ -403,10 +412,15 @@
}
#endif
-static void uv__udp_sendmsg(uv_udp_t* handle) {
+static void uv__udp_sendmsg(uv_udp_t* handle)
+{
uv_udp_send_t* req;
- struct msghdr h;
QUEUE* q;
+#if defined(__sgii)
+ struct xpg5_msghdr h;
+# els
+ struct msghdr h;
+#endif
ssize_t size;
#if HAVE_MMSG
@@ -441,11 +455,15 @@
abort();
}
}
- h.msg_iov = (struct iovec*) req->bufs;
+ h.msg_iov = (struct iovec*)req->bufs;
h.msg_iovlen = req->nbufs;
do {
+#if defined(__sgii)
+ size = _xpg5_sendmsg(handle->io_watcher.fd, &h, 0);
+#else
size = sendmsg(handle->io_watcher.fd, &h, 0);
+#endif
} while (size == -1 && errno == EINTR);
if (size == -1) {
@@ -477,21 +495,22 @@
* zOS does not support getsockname with SO_REUSEPORT option when using
* AF_UNIX.
*/
-static int uv__set_reuse(int fd) {
+static int uv__set_reuse(int fd)
+{
int yes;
yes = 1;
#if defined(SO_REUSEPORT) && defined(__MVS__)
struct sockaddr_in sockfd;
unsigned int sockfd_len = sizeof(sockfd);
- if (getsockname(fd, (struct sockaddr*) &sockfd, &sockfd_len) == -1)
- return UV__ERR(errno);
+ if (getsockname(fd, (struct sockaddr*)&sockfd, &sockfd_len) == -1)
+ return UV__ERR(errno);
if (sockfd.sin_family == AF_UNIX) {
if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(yes)))
return UV__ERR(errno);
} else {
if (setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, &yes, sizeof(yes)))
- return UV__ERR(errno);
+ return UV__ERR(errno);
}
#elif defined(SO_REUSEPORT) && !defined(__linux__)
if (setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, &yes, sizeof(yes)))
@@ -504,11 +523,9 @@
return 0;
}
-
-int uv__udp_bind(uv_udp_t* handle,
- const struct sockaddr* addr,
- unsigned int addrlen,
- unsigned int flags) {
+int uv__udp_bind(uv_udp_t* handle, const struct sockaddr* addr,
+ unsigned int addrlen, unsigned int flags)
+{
int err;
int yes;
int fd;
@@ -565,10 +582,9 @@
return 0;
}
-
-static int uv__udp_maybe_deferred_bind(uv_udp_t* handle,
- int domain,
- unsigned int flags) {
+static int uv__udp_maybe_deferred_bind(uv_udp_t* handle, int domain,
+ unsigned int flags)
+{
union uv__sockaddr taddr;
socklen_t addrlen;
@@ -576,36 +592,33 @@
return 0;
switch (domain) {
- case AF_INET:
- {
- struct sockaddr_in* addr = &taddr.in;
- memset(addr, 0, sizeof *addr);
- addr->sin_family = AF_INET;
- addr->sin_addr.s_addr = INADDR_ANY;
- addrlen = sizeof *addr;
- break;
- }
- case AF_INET6:
- {
- struct sockaddr_in6* addr = &taddr.in6;
- memset(addr, 0, sizeof *addr);
- addr->sin6_family = AF_INET6;
- addr->sin6_addr = in6addr_any;
- addrlen = sizeof *addr;
- break;
- }
- default:
- assert(0 && "unsupported address family");
- abort();
+ case AF_INET: {
+ struct sockaddr_in* addr = &taddr.in;
+ memset(addr, 0, sizeof *addr);
+ addr->sin_family = AF_INET;
+ addr->sin_addr.s_addr = INADDR_ANY;
+ addrlen = sizeof *addr;
+ break;
+ }
+ case AF_INET6: {
+ struct sockaddr_in6* addr = &taddr.in6;
+ memset(addr, 0, sizeof *addr);
+ addr->sin6_family = AF_INET6;
+ addr->sin6_addr = in6addr_any;
+ addrlen = sizeof *addr;
+ break;
+ }
+ default:
+ assert(0 && "unsupported address family");
+ abort();
}
return uv__udp_bind(handle, &taddr.addr, addrlen, flags);
}
-
-int uv__udp_connect(uv_udp_t* handle,
- const struct sockaddr* addr,
- unsigned int addrlen) {
+int uv__udp_connect(uv_udp_t* handle, const struct sockaddr* addr,
+ unsigned int addrlen)
+{
int err;
err = uv__udp_maybe_deferred_bind(handle, addr->sa_family, 0);
@@ -625,35 +638,31 @@
return 0;
}
-
-int uv__udp_disconnect(uv_udp_t* handle) {
- int r;
- struct sockaddr addr;
+int uv__udp_disconnect(uv_udp_t* handle)
+{
+ int r;
+ struct sockaddr addr;
- memset(&addr, 0, sizeof(addr));
+ memset(&addr, 0, sizeof(addr));
- addr.sa_family = AF_UNSPEC;
+ addr.sa_family = AF_UNSPEC;
- do {
- errno = 0;
- r = connect(handle->io_watcher.fd, &addr, sizeof(addr));
- } while (r == -1 && errno == EINTR);
+ do {
+ errno = 0;
+ r = connect(handle->io_watcher.fd, &addr, sizeof(addr));
+ } while (r == -1 && errno == EINTR);
- if (r == -1 && errno != EAFNOSUPPORT)
- return UV__ERR(errno);
+ if (r == -1 && errno != EAFNOSUPPORT)
+ return UV__ERR(errno);
- handle->flags &= ~UV_HANDLE_UDP_CONNECTED;
- return 0;
+ handle->flags &= ~UV_HANDLE_UDP_CONNECTED;
+ return 0;
}
-
-int uv__udp_send(uv_udp_send_t* req,
- uv_udp_t* handle,
- const uv_buf_t bufs[],
- unsigned int nbufs,
- const struct sockaddr* addr,
- unsigned int addrlen,
- uv_udp_send_cb send_cb) {
+int uv__udp_send(uv_udp_send_t* req, uv_udp_t* handle, const uv_buf_t bufs[],
+ unsigned int nbufs, const struct sockaddr* addr,
+ unsigned int addrlen, uv_udp_send_cb send_cb)
+{
int err;
int empty_queue;
@@ -712,12 +721,10 @@
return 0;
}
-
-int uv__udp_try_send(uv_udp_t* handle,
- const uv_buf_t bufs[],
- unsigned int nbufs,
- const struct sockaddr* addr,
- unsigned int addrlen) {
+int uv__udp_try_send(uv_udp_t* handle, const uv_buf_t bufs[],
+ unsigned int nbufs, const struct sockaddr* addr,
+ unsigned int addrlen)
+{
int err;
struct msghdr h;
ssize_t size;
@@ -737,13 +744,17 @@
}
memset(&h, 0, sizeof h);
- h.msg_name = (struct sockaddr*) addr;
+ h.msg_name = (struct sockaddr*)addr;
h.msg_namelen = addrlen;
- h.msg_iov = (struct iovec*) bufs;
+ h.msg_iov = (struct iovec*)bufs;
h.msg_iovlen = nbufs;
do {
+#if defined(__sgii)
+ size = _xpg5_sendmsg(handle->io_watcher.fd, &h, 0);
+#else
size = sendmsg(handle->io_watcher.fd, &h, 0);
+#endif
} while (size == -1 && errno == EINTR);
if (size == -1) {
@@ -756,11 +767,11 @@
return size;
}
-
static int uv__udp_set_membership4(uv_udp_t* handle,
const struct sockaddr_in* multicast_addr,
const char* interface_addr,
- uv_membership membership) {
+ uv_membership membership)
+{
struct ip_mreq mreq;
int optname;
int err;
@@ -778,24 +789,21 @@
mreq.imr_multiaddr.s_addr = multicast_addr->sin_addr.s_addr;
switch (membership) {
- case UV_JOIN_GROUP:
- optname = IP_ADD_MEMBERSHIP;
- break;
- case UV_LEAVE_GROUP:
- optname = IP_DROP_MEMBERSHIP;
- break;
- default:
- return UV_EINVAL;
+ case UV_JOIN_GROUP:
+ optname = IP_ADD_MEMBERSHIP;
+ break;
+ case UV_LEAVE_GROUP:
+ optname = IP_DROP_MEMBERSHIP;
+ break;
+ default:
+ return UV_EINVAL;
}
- if (setsockopt(handle->io_watcher.fd,
- IPPROTO_IP,
- optname,
- &mreq,
+ if (setsockopt(handle->io_watcher.fd, IPPROTO_IP, optname, &mreq,
sizeof(mreq))) {
#if defined(__MVS__)
- if (errno == ENXIO)
- return UV_ENODEV;
+ if (errno == ENXIO)
+ return UV_ENODEV;
#endif
return UV__ERR(errno);
}
@@ -803,11 +811,11 @@
return 0;
}
-
static int uv__udp_set_membership6(uv_udp_t* handle,
const struct sockaddr_in6* multicast_addr,
const char* interface_addr,
- uv_membership membership) {
+ uv_membership membership)
+{
int optname;
struct ipv6_mreq mreq;
struct sockaddr_in6 addr6;
@@ -825,24 +833,21 @@
mreq.ipv6mr_multiaddr = multicast_addr->sin6_addr;
switch (membership) {
- case UV_JOIN_GROUP:
- optname = IPV6_ADD_MEMBERSHIP;
- break;
- case UV_LEAVE_GROUP:
- optname = IPV6_DROP_MEMBERSHIP;
- break;
- default:
- return UV_EINVAL;
+ case UV_JOIN_GROUP:
+ optname = IPV6_ADD_MEMBERSHIP;
+ break;
+ case UV_LEAVE_GROUP:
+ optname = IPV6_DROP_MEMBERSHIP;
+ break;
+ default:
+ return UV_EINVAL;
}
- if (setsockopt(handle->io_watcher.fd,
- IPPROTO_IPV6,
- optname,
- &mreq,
+ if (setsockopt(handle->io_watcher.fd, IPPROTO_IPV6, optname, &mreq,
sizeof(mreq))) {
#if defined(__MVS__)
- if (errno == ENXIO)
- return UV_ENODEV;
+ if (errno == ENXIO)
+ return UV_ENODEV;
#endif
return UV__ERR(errno);
}
@@ -850,17 +855,13 @@
return 0;
}
-
-#if !defined(__OpenBSD__) && \
- !defined(__NetBSD__) && \
- !defined(__ANDROID__) && \
- !defined(__DragonFly__) & \
- !defined(__QNX__)
-static int uv__udp_set_source_membership4(uv_udp_t* handle,
- const struct sockaddr_in* multicast_addr,
- const char* interface_addr,
- const struct sockaddr_in* source_addr,
- uv_membership membership) {
+#if !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__ANDROID__) && \
+ !defined(__DragonFly__) & !defined(__QNX__)
+static int uv__udp_set_source_membership4(
+ uv_udp_t* handle, const struct sockaddr_in* multicast_addr,
+ const char* interface_addr, const struct sockaddr_in* source_addr,
+ uv_membership membership)
+{
struct ip_mreq_source mreq;
int optname;
int err;
@@ -889,10 +890,7 @@
else
return UV_EINVAL;
- if (setsockopt(handle->io_watcher.fd,
- IPPROTO_IP,
- optname,
- &mreq,
+ if (setsockopt(handle->io_watcher.fd, IPPROTO_IP, optname, &mreq,
sizeof(mreq))) {
return UV__ERR(errno);
}
@@ -900,12 +898,11 @@
return 0;
}
-
-static int uv__udp_set_source_membership6(uv_udp_t* handle,
- const struct sockaddr_in6* multicast_addr,
- const char* interface_addr,
- const struct sockaddr_in6* source_addr,
- uv_membership membership) {
+static int uv__udp_set_source_membership6(
+ uv_udp_t* handle, const struct sockaddr_in6* multicast_addr,
+ const char* interface_addr, const struct sockaddr_in6* source_addr,
+ uv_membership membership)
+{
struct group_source_req mreq;
struct sockaddr_in6 addr6;
int optname;
@@ -938,10 +935,7 @@
else
return UV_EINVAL;
- if (setsockopt(handle->io_watcher.fd,
- IPPROTO_IPV6,
- optname,
- &mreq,
+ if (setsockopt(handle->io_watcher.fd, IPPROTO_IPV6, optname, &mreq,
sizeof(mreq))) {
return UV__ERR(errno);
}
@@ -950,11 +944,9 @@
}
#endif
-
-int uv__udp_init_ex(uv_loop_t* loop,
- uv_udp_t* handle,
- unsigned flags,
- int domain) {
+int uv__udp_init_ex(uv_loop_t* loop, uv_udp_t* handle, unsigned flags,
+ int domain)
+{
int fd;
fd = -1;
@@ -976,8 +968,8 @@
return 0;
}
-
-int uv_udp_using_recvmmsg(const uv_udp_t* handle) {
+int uv_udp_using_recvmmsg(const uv_udp_t* handle)
+{
#if HAVE_MMSG
if (handle->flags & UV_HANDLE_UDP_RECVMMSG) {
uv_once(&once, uv__udp_mmsg_init);
@@ -987,8 +979,8 @@
return 0;
}
-
-int uv_udp_open(uv_udp_t* handle, uv_os_sock_t sock) {
+int uv_udp_open(uv_udp_t* handle, uv_os_sock_t sock)
+{
int err;
/* Check for already active socket. */
@@ -1013,11 +1005,9 @@
return 0;
}
-
-int uv_udp_set_membership(uv_udp_t* handle,
- const char* multicast_addr,
- const char* interface_addr,
- uv_membership membership) {
+int uv_udp_set_membership(uv_udp_t* handle, const char* multicast_addr,
+ const char* interface_addr, uv_membership membership)
+{
int err;
struct sockaddr_in addr4;
struct sockaddr_in6 addr6;
@@ -1037,17 +1027,13 @@
}
}
-
-int uv_udp_set_source_membership(uv_udp_t* handle,
- const char* multicast_addr,
+int uv_udp_set_source_membership(uv_udp_t* handle, const char* multicast_addr,
const char* interface_addr,
const char* source_addr,
- uv_membership membership) {
-#if !defined(__OpenBSD__) && \
- !defined(__NetBSD__) && \
- !defined(__ANDROID__) && \
- !defined(__DragonFly__) && \
- !defined(__QNX__)
+ uv_membership membership)
+{
+#if !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__ANDROID__) && \
+ !defined(__DragonFly__) && !defined(__QNX__)
int err;
union uv__sockaddr mcast_addr;
union uv__sockaddr src_addr;
@@ -1060,56 +1046,38 @@
err = uv_ip6_addr(source_addr, 0, &src_addr.in6);
if (err)
return err;
- return uv__udp_set_source_membership6(handle,
- &mcast_addr.in6,
- interface_addr,
- &src_addr.in6,
- membership);
+ return uv__udp_set_source_membership6(
+ handle, &mcast_addr.in6, interface_addr, &src_addr.in6, membership);
}
err = uv_ip4_addr(source_addr, 0, &src_addr.in);
if (err)
return err;
- return uv__udp_set_source_membership4(handle,
- &mcast_addr.in,
- interface_addr,
- &src_addr.in,
- membership);
+ return uv__udp_set_source_membership4(handle, &mcast_addr.in, interface_addr,
+ &src_addr.in, membership);
#else
return UV_ENOSYS;
#endif
}
-
-static int uv__setsockopt(uv_udp_t* handle,
- int option4,
- int option6,
- const void* val,
- socklen_t size) {
+static int uv__setsockopt(uv_udp_t* handle, int option4, int option6,
+ const void* val, socklen_t size)
+{
int r;
if (handle->flags & UV_HANDLE_IPV6)
- r = setsockopt(handle->io_watcher.fd,
- IPPROTO_IPV6,
- option6,
- val,
- size);
+ r = setsockopt(handle->io_watcher.fd, IPPROTO_IPV6, option6, val, size);
else
- r = setsockopt(handle->io_watcher.fd,
- IPPROTO_IP,
- option4,
- val,
- size);
+ r = setsockopt(handle->io_watcher.fd, IPPROTO_IP, option4, val, size);
if (r)
return UV__ERR(errno);
return 0;
}
-static int uv__setsockopt_maybe_char(uv_udp_t* handle,
- int option4,
- int option6,
- int val) {
+static int uv__setsockopt_maybe_char(uv_udp_t* handle, int option4,
+ int option6, int val)
+{
#if defined(__sun) || defined(_AIX) || defined(__MVS__)
char arg = val;
#elif defined(__OpenBSD__)
@@ -1124,12 +1092,9 @@
return uv__setsockopt(handle, option4, option6, &arg, sizeof(arg));
}
-
-int uv_udp_set_broadcast(uv_udp_t* handle, int on) {
- if (setsockopt(handle->io_watcher.fd,
- SOL_SOCKET,
- SO_BROADCAST,
- &on,
+int uv_udp_set_broadcast(uv_udp_t* handle, int on)
+{
+ if (setsockopt(handle->io_watcher.fd, SOL_SOCKET, SO_BROADCAST, &on,
sizeof(on))) {
return UV__ERR(errno);
}
@@ -1137,14 +1102,14 @@
return 0;
}
-
-int uv_udp_set_ttl(uv_udp_t* handle, int ttl) {
+int uv_udp_set_ttl(uv_udp_t* handle, int ttl)
+{
if (ttl < 1 || ttl > 255)
return UV_EINVAL;
#if defined(__MVS__)
if (!(handle->flags & UV_HANDLE_IPV6))
- return UV_ENOTSUP; /* zOS does not support setting ttl for IPv4 */
+ return UV_ENOTSUP; /* zOS does not support setting ttl for IPv4 */
#endif
/*
@@ -1153,84 +1118,69 @@
* so hardcode the size of these options on this platform,
* and use the general uv__setsockopt_maybe_char call on other platforms.
*/
-#if defined(__sun) || defined(_AIX) || defined(__OpenBSD__) || \
- defined(__MVS__) || defined(__QNX__)
+#if defined(__sun) || defined(_AIX) || defined(__OpenBSD__) || \
+ defined(__MVS__) || defined(__QNX__)
- return uv__setsockopt(handle,
- IP_TTL,
- IPV6_UNICAST_HOPS,
- &ttl,
- sizeof(ttl));
+ return uv__setsockopt(handle, IP_TTL, IPV6_UNICAST_HOPS, &ttl, sizeof(ttl));
-#else /* !(defined(__sun) || defined(_AIX) || defined (__OpenBSD__) ||
+#else /* !(defined(__sun) || defined(_AIX) || defined (__OpenBSD__) || \
defined(__MVS__) || defined(__QNX__)) */
- return uv__setsockopt_maybe_char(handle,
- IP_TTL,
- IPV6_UNICAST_HOPS,
- ttl);
+ return uv__setsockopt_maybe_char(handle, IP_TTL, IPV6_UNICAST_HOPS, ttl);
-#endif /* defined(__sun) || defined(_AIX) || defined (__OpenBSD__) ||
+#endif /* defined(__sun) || defined(_AIX) || defined (__OpenBSD__) || \
defined(__MVS__) || defined(__QNX__) */
}
-
-int uv_udp_set_multicast_ttl(uv_udp_t* handle, int ttl) {
+int uv_udp_set_multicast_ttl(uv_udp_t* handle, int ttl)
+{
/*
* On Solaris and derivatives such as SmartOS, the length of socket options
* is sizeof(int) for IPV6_MULTICAST_HOPS and sizeof(char) for
* IP_MULTICAST_TTL, so hardcode the size of the option in the IPv6 case,
* and use the general uv__setsockopt_maybe_char call otherwise.
*/
-#if defined(__sun) || defined(_AIX) || defined(__OpenBSD__) || \
- defined(__MVS__) || defined(__QNX__)
+#if defined(__sun) || defined(_AIX) || defined(__OpenBSD__) || \
+ defined(__MVS__) || defined(__QNX__)
if (handle->flags & UV_HANDLE_IPV6)
- return uv__setsockopt(handle,
- IP_MULTICAST_TTL,
- IPV6_MULTICAST_HOPS,
- &ttl,
+ return uv__setsockopt(handle, IP_MULTICAST_TTL, IPV6_MULTICAST_HOPS, &ttl,
sizeof(ttl));
-#endif /* defined(__sun) || defined(_AIX) || defined(__OpenBSD__) || \
+#endif /* defined(__sun) || defined(_AIX) || defined(__OpenBSD__) || \
defined(__MVS__) || defined(__QNX__) */
- return uv__setsockopt_maybe_char(handle,
- IP_MULTICAST_TTL,
- IPV6_MULTICAST_HOPS,
- ttl);
+ return uv__setsockopt_maybe_char(handle, IP_MULTICAST_TTL,
+ IPV6_MULTICAST_HOPS, ttl);
}
-
-int uv_udp_set_multicast_loop(uv_udp_t* handle, int on) {
+int uv_udp_set_multicast_loop(uv_udp_t* handle, int on)
+{
/*
* On Solaris and derivatives such as SmartOS, the length of socket options
* is sizeof(int) for IPV6_MULTICAST_LOOP and sizeof(char) for
* IP_MULTICAST_LOOP, so hardcode the size of the option in the IPv6 case,
* and use the general uv__setsockopt_maybe_char call otherwise.
*/
-#if defined(__sun) || defined(_AIX) || defined(__OpenBSD__) || \
- defined(__MVS__) || defined(__QNX__)
+#if defined(__sun) || defined(_AIX) || defined(__OpenBSD__) || \
+ defined(__MVS__) || defined(__QNX__)
if (handle->flags & UV_HANDLE_IPV6)
- return uv__setsockopt(handle,
- IP_MULTICAST_LOOP,
- IPV6_MULTICAST_LOOP,
- &on,
+ return uv__setsockopt(handle, IP_MULTICAST_LOOP, IPV6_MULTICAST_LOOP, &on,
sizeof(on));
-#endif /* defined(__sun) || defined(_AIX) ||defined(__OpenBSD__) ||
+#endif /* defined(__sun) || defined(_AIX) ||defined(__OpenBSD__) || \
defined(__MVS__) || defined(__QNX__) */
- return uv__setsockopt_maybe_char(handle,
- IP_MULTICAST_LOOP,
- IPV6_MULTICAST_LOOP,
- on);
+ return uv__setsockopt_maybe_char(handle, IP_MULTICAST_LOOP,
+ IPV6_MULTICAST_LOOP, on);
}
-int uv_udp_set_multicast_interface(uv_udp_t* handle, const char* interface_addr) {
+int uv_udp_set_multicast_interface(uv_udp_t* handle,
+ const char* interface_addr)
+{
struct sockaddr_storage addr_st;
struct sockaddr_in* addr4;
struct sockaddr_in6* addr6;
- addr4 = (struct sockaddr_in*) &addr_st;
- addr6 = (struct sockaddr_in6*) &addr_st;
+ addr4 = (struct sockaddr_in*)&addr_st;
+ addr6 = (struct sockaddr_in6*)&addr_st;
if (!interface_addr) {
memset(&addr_st, 0, sizeof addr_st);
@@ -1250,17 +1200,12 @@
}
if (addr_st.ss_family == AF_INET) {
- if (setsockopt(handle->io_watcher.fd,
- IPPROTO_IP,
- IP_MULTICAST_IF,
- (void*) &addr4->sin_addr,
- sizeof(addr4->sin_addr)) == -1) {
+ if (setsockopt(handle->io_watcher.fd, IPPROTO_IP, IP_MULTICAST_IF,
+ (void*)&addr4->sin_addr, sizeof(addr4->sin_addr)) == -1) {
return UV__ERR(errno);
}
} else if (addr_st.ss_family == AF_INET6) {
- if (setsockopt(handle->io_watcher.fd,
- IPPROTO_IPV6,
- IPV6_MULTICAST_IF,
+ if (setsockopt(handle->io_watcher.fd, IPPROTO_IPV6, IPV6_MULTICAST_IF,
&addr6->sin6_scope_id,
sizeof(addr6->sin6_scope_id)) == -1) {
return UV__ERR(errno);
@@ -1273,37 +1218,32 @@
return 0;
}
-int uv_udp_getpeername(const uv_udp_t* handle,
- struct sockaddr* name,
- int* namelen) {
+int uv_udp_getpeername(const uv_udp_t* handle, struct sockaddr* name,
+ int* namelen)
+{
- return uv__getsockpeername((const uv_handle_t*) handle,
- getpeername,
- name,
+ return uv__getsockpeername((const uv_handle_t*)handle, getpeername, name,
namelen);
}
-int uv_udp_getsockname(const uv_udp_t* handle,
- struct sockaddr* name,
- int* namelen) {
+int uv_udp_getsockname(const uv_udp_t* handle, struct sockaddr* name,
+ int* namelen)
+{
- return uv__getsockpeername((const uv_handle_t*) handle,
- getsockname,
- name,
+ return uv__getsockpeername((const uv_handle_t*)handle, getsockname, name,
namelen);
}
-
-int uv__udp_recv_start(uv_udp_t* handle,
- uv_alloc_cb alloc_cb,
- uv_udp_recv_cb recv_cb) {
+int uv__udp_recv_start(uv_udp_t* handle, uv_alloc_cb alloc_cb,
+ uv_udp_recv_cb recv_cb)
+{
int err;
if (alloc_cb == NULL || recv_cb == NULL)
return UV_EINVAL;
if (uv__io_active(&handle->io_watcher, POLLIN))
- return UV_EALREADY; /* FIXME(bnoordhuis) Should be UV_EBUSY. */
+ return UV_EALREADY; /* FIXME(bnoordhuis) Should be UV_EBUSY. */
err = uv__udp_maybe_deferred_bind(handle, AF_INET, 0);
if (err)
@@ -1318,8 +1258,8 @@
return 0;
}
-
-int uv__udp_recv_stop(uv_udp_t* handle) {
+int uv__udp_recv_stop(uv_udp_t* handle)
+{
uv__io_stop(handle->loop, &handle->io_watcher, POLLIN);
if (!uv__io_active(&handle->io_watcher, POLLOUT))
Index: Utilities/cmjsoncpp/CMakeLists.txt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/Utilities/cmjsoncpp/CMakeLists.txt b/Utilities/cmjsoncpp/CMakeLists.txt
--- a/Utilities/cmjsoncpp/CMakeLists.txt (revision 13d112ea03f2b068da1f7ac3239a42a6cff94eda)
+++ b/Utilities/cmjsoncpp/CMakeLists.txt (date 1623341979278)
@@ -20,6 +20,12 @@
${KWSYS_HEADER_ROOT}
)
+if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
+ if ("${CMAKE_CXX_SIMULATE_ID}" STREQUAL "MSVC")
+ ADD_COMPILE_OPTIONS("/EHs")
+ endif()
+endif()
+
add_library(cmjsoncpp ${JSONCPP_SOURCES})
target_link_libraries(cmjsoncpp ${CMake_KWIML_LIBRARIES})
set_property(TARGET cmjsoncpp PROPERTY CXX_INCLUDE_WHAT_YOU_USE "")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment