From ee0b29cb70d8750f0341b6598968522b29132f55 Mon Sep 17 00:00:00 2001 From: papadave66 Date: Sat, 1 Jun 2019 14:15:13 +0800 Subject: [PATCH] Add byte order detection and THREAD_YIELD support for Solaris --- AUTHORS | 1 + include/libcork/config/config.h | 4 ++++ include/libcork/config/solaris.h | 30 ++++++++++++++++++++++++++++++ src/libcork/posix/subprocess.c | 2 +- 4 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 include/libcork/config/solaris.h diff --git a/AUTHORS b/AUTHORS index feda011..24949f9 100644 --- a/AUTHORS +++ b/AUTHORS @@ -10,3 +10,4 @@ Nathan French Redjack, LLC Roger Shimizu Toby DiPasquale +Rivoreo Group diff --git a/include/libcork/config/config.h b/include/libcork/config/config.h index ca49047..deeb103 100644 --- a/include/libcork/config/config.h +++ b/include/libcork/config/config.h @@ -56,6 +56,10 @@ /* Do some BSD (4.3 code base or newer)specific autodetection. */ #include +#elif defined(__sun) && defined(__SVR4) +/* Solaris and its derivatives */ +#include + #endif /* platforms */ diff --git a/include/libcork/config/solaris.h b/include/libcork/config/solaris.h new file mode 100644 index 0000000..267a976 --- /dev/null +++ b/include/libcork/config/solaris.h @@ -0,0 +1,30 @@ +/* -*- coding: utf-8 -*- + * ---------------------------------------------------------------------- + * Copyright © 2019, libcork authors + * All rights reserved. + * + * Please see the COPYING file in this distribution for license details. + * ---------------------------------------------------------------------- + */ + +#ifndef LIBCORK_CONFIG_SOLARIS_H +#define LIBCORK_CONFIG_SOLARIS_H + +/*----------------------------------------------------------------------- + * Endianness + */ + +#include + +#ifdef _BIG_ENDIAN +#define CORK_CONFIG_IS_BIG_ENDIAN 1 +#define CORK_CONFIG_IS_LITTLE_ENDIAN 0 +#else +#define CORK_CONFIG_IS_BIG_ENDIAN 0 +#define CORK_CONFIG_IS_LITTLE_ENDIAN 1 +#endif + +#define CORK_HAVE_REALLOCF 0 +#define CORK_HAVE_PTHREADS 1 + +#endif /* LIBCORK_CONFIG_SOLARIS_H */ diff --git a/src/libcork/posix/subprocess.c b/src/libcork/posix/subprocess.c index b1d23a5..862c3f3 100644 --- a/src/libcork/posix/subprocess.c +++ b/src/libcork/posix/subprocess.c @@ -497,7 +497,7 @@ cork_subprocess_is_finished(struct cork_subprocess *self) #if defined(__APPLE__) #include #define THREAD_YIELD pthread_yield_np -#elif defined(__linux__) || defined(BSD) || defined(__FreeBSD_kernel__) || defined(__GNU__) +#elif defined(__linux__) || defined(BSD) || defined(__FreeBSD_kernel__) || defined(__GNU__) || defined(__SVR4) #include #define THREAD_YIELD sched_yield #else