initial support for OpenIndiana
Signed-off-by: Erik Boasson <eb@ilities.com>
This commit is contained in:
parent
52918b3003
commit
37953f5c49
9 changed files with 329 additions and 3 deletions
|
@ -43,6 +43,14 @@ if(CMAKE_SYSTEM_NAME STREQUAL "VxWorks")
|
|||
add_definitions(-std=c99)
|
||||
endif()
|
||||
|
||||
if(${CMAKE_C_COMPILER_ID} STREQUAL "SunPro")
|
||||
add_definitions(-m64)
|
||||
add_definitions(-xc99)
|
||||
add_definitions(-D__restrict=restrict)
|
||||
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_LINKER_FLAGS} -m64")
|
||||
set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_LINKER_FLAGS} -m64")
|
||||
endif()
|
||||
|
||||
include(FileIDs)
|
||||
include(GNUInstallDirs)
|
||||
include(AnalyzeBuild)
|
||||
|
|
|
@ -588,7 +588,9 @@ static ssize_t ddsi_tcp_conn_write (ddsi_tran_conn_t base, const nn_locator_t *d
|
|||
set_msghdr_iov (&msg, (ddsi_iovec_t *) iov, niov);
|
||||
msg.msg_name = &dstaddr;
|
||||
msg.msg_namelen = (socklen_t) os_sockaddrSizeof((os_sockaddr *) &dstaddr);
|
||||
#if SYSDEPS_MSGHDR_FLAGS
|
||||
msg.msg_flags = (int) flags;
|
||||
#endif
|
||||
len = iovlen_sum (niov, iov);
|
||||
(void) base;
|
||||
|
||||
|
|
|
@ -121,7 +121,9 @@ static ssize_t ddsi_udp_conn_write (ddsi_tran_conn_t conn, const nn_locator_t *d
|
|||
set_msghdr_iov (&msg, (ddsi_iovec_t *) iov, niov);
|
||||
msg.msg_name = &dstaddr;
|
||||
msg.msg_namelen = (socklen_t) os_sockaddrSizeof((os_sockaddr *) &dstaddr);
|
||||
#if SYSDEPS_MSGHDR_FLAGS
|
||||
msg.msg_flags = (int) flags;
|
||||
#endif
|
||||
#ifdef MSG_NOSIGNAL
|
||||
sendflags |= MSG_NOSIGNAL;
|
||||
#endif
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
string(TOLOWER ${CMAKE_SYSTEM_NAME} platform)
|
||||
|
||||
# For posix platforms include the files in the posix/ directory.
|
||||
set (posix_platforms darwin linux)
|
||||
set (posix_platforms darwin linux sunos)
|
||||
IF(${platform} IN_LIST posix_platforms)
|
||||
set(platform posix)
|
||||
ENDIF()
|
||||
|
@ -40,6 +40,11 @@ if(BUILD_TESTING)
|
|||
add_subdirectory(tests)
|
||||
endif()
|
||||
|
||||
if(${CMAKE_C_COMPILER_ID} STREQUAL "SunPro")
|
||||
target_link_libraries(OSAPI INTERFACE -lsocket -lnsl)
|
||||
add_definitions(-KPIC)
|
||||
endif()
|
||||
|
||||
install(
|
||||
FILES "${CMAKE_CURRENT_SOURCE_DIR}/include/os/os_public.h" "${CMAKE_CURRENT_SOURCE_DIR}/include/os/os_decl_attributes.h" "${CMAKE_CURRENT_SOURCE_DIR}/include/os/os_decl_attributes_sal.h"
|
||||
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/ddsc/os"
|
||||
|
|
243
src/os/include/os/os_atomics_solaris.h
Normal file
243
src/os/include/os/os_atomics_solaris.h
Normal file
|
@ -0,0 +1,243 @@
|
|||
/*
|
||||
* Copyright(c) 2006 to 2018 ADLINK Technology Limited and others
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Eclipse Public License v. 2.0 which is available at
|
||||
* http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
|
||||
* v. 1.0 which is available at
|
||||
* http://www.eclipse.org/org/documents/edl-v10.php.
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
|
||||
*/
|
||||
#include <atomic.h>
|
||||
|
||||
#define OS_ATOMIC64_SUPPORT 1
|
||||
|
||||
#if ! OS_ATOMICS_OMIT_FUNCTIONS
|
||||
|
||||
/* LD, ST */
|
||||
|
||||
VDDS_INLINE uint32_t os_atomic_ld32 (const volatile os_atomic_uint32_t *x) { return x->v; }
|
||||
VDDS_INLINE uint64_t os_atomic_ld64 (const volatile os_atomic_uint64_t *x) { return x->v; }
|
||||
VDDS_INLINE uintptr_t os_atomic_ldptr (const volatile os_atomic_uintptr_t *x) { return x->v; }
|
||||
VDDS_INLINE void *os_atomic_ldvoidp (const volatile os_atomic_voidp_t *x) { return (void *) os_atomic_ldptr (x); }
|
||||
|
||||
VDDS_INLINE void os_atomic_st32 (volatile os_atomic_uint32_t *x, uint32_t v) { x->v = v; }
|
||||
VDDS_INLINE void os_atomic_st64 (volatile os_atomic_uint64_t *x, uint64_t v) { x->v = v; }
|
||||
VDDS_INLINE void os_atomic_stptr (volatile os_atomic_uintptr_t *x, uintptr_t v) { x->v = v; }
|
||||
VDDS_INLINE void os_atomic_stvoidp (volatile os_atomic_voidp_t *x, void *v) { os_atomic_stptr (x, (uintptr_t) v); }
|
||||
|
||||
/* INC */
|
||||
|
||||
VDDS_INLINE void os_atomic_inc32 (volatile os_atomic_uint32_t *x) {
|
||||
atomic_inc_32 (&x->v);
|
||||
}
|
||||
VDDS_INLINE void os_atomic_inc64 (volatile os_atomic_uint64_t *x) {
|
||||
atomic_inc_64 (&x->v);
|
||||
}
|
||||
VDDS_INLINE void os_atomic_incptr (volatile os_atomic_uintptr_t *x) {
|
||||
atomic_inc_ulong (&x->v);
|
||||
}
|
||||
VDDS_INLINE uint32_t os_atomic_inc32_nv (volatile os_atomic_uint32_t *x) {
|
||||
return atomic_inc_32_nv (&x->v);
|
||||
}
|
||||
VDDS_INLINE uint64_t os_atomic_inc64_nv (volatile os_atomic_uint64_t *x) {
|
||||
return atomic_inc_64_nv (&x->v);
|
||||
}
|
||||
VDDS_INLINE uintptr_t os_atomic_incptr_nv (volatile os_atomic_uintptr_t *x) {
|
||||
return atomic_inc_ulong_nv (&x->v);
|
||||
}
|
||||
|
||||
/* DEC */
|
||||
|
||||
VDDS_INLINE void os_atomic_dec32 (volatile os_atomic_uint32_t *x) {
|
||||
atomic_dec_32 (&x->v);
|
||||
}
|
||||
VDDS_INLINE void os_atomic_dec64 (volatile os_atomic_uint64_t *x) {
|
||||
atomic_dec_64 (&x->v);
|
||||
}
|
||||
VDDS_INLINE void os_atomic_decptr (volatile os_atomic_uintptr_t *x) {
|
||||
atomic_dec_ulong (&x->v);
|
||||
}
|
||||
VDDS_INLINE uint32_t os_atomic_dec32_nv (volatile os_atomic_uint32_t *x) {
|
||||
return atomic_dec_32_nv (&x->v);
|
||||
}
|
||||
VDDS_INLINE uint64_t os_atomic_dec64_nv (volatile os_atomic_uint64_t *x) {
|
||||
return atomic_dec_64_nv (&x->v);
|
||||
}
|
||||
VDDS_INLINE uintptr_t os_atomic_decptr_nv (volatile os_atomic_uintptr_t *x) {
|
||||
return atomic_dec_ulong_nv (&x->v);
|
||||
}
|
||||
VDDS_INLINE uint32_t os_atomic_dec32_ov (volatile os_atomic_uint32_t *x) {
|
||||
uint32_t oldval, newval;
|
||||
do { oldval = x->v; newval = oldval - 1; } while (atomic_cas_32 (&x->v, oldval, newval) != oldval);
|
||||
return oldval;
|
||||
}
|
||||
VDDS_INLINE uint64_t os_atomic_dec64_ov (volatile os_atomic_uint64_t *x) {
|
||||
uint64_t oldval, newval;
|
||||
do { oldval = x->v; newval = oldval - 1; } while (atomic_cas_64 (&x->v, oldval, newval) != oldval);
|
||||
return oldval;
|
||||
}
|
||||
VDDS_INLINE uintptr_t os_atomic_decptr_ov (volatile os_atomic_uintptr_t *x) {
|
||||
uintptr_t oldval, newval;
|
||||
do { oldval = x->v; newval = oldval - 1; } while (atomic_cas_64 (&x->v, oldval, newval) != oldval);
|
||||
return oldval;
|
||||
}
|
||||
|
||||
/* ADD */
|
||||
|
||||
VDDS_INLINE void os_atomic_add32 (volatile os_atomic_uint32_t *x, uint32_t v) {
|
||||
atomic_add_32 (&x->v, v);
|
||||
}
|
||||
VDDS_INLINE void os_atomic_add64 (volatile os_atomic_uint64_t *x, uint64_t v) {
|
||||
atomic_add_64 (&x->v, v);
|
||||
}
|
||||
VDDS_INLINE void os_atomic_addptr (volatile os_atomic_uintptr_t *x, uintptr_t v) {
|
||||
atomic_add_long (&x->v, v);
|
||||
}
|
||||
VDDS_INLINE void os_atomic_addvoidp (volatile os_atomic_voidp_t *x, ptrdiff_t v) {
|
||||
atomic_add_ptr (&x->v, v);
|
||||
}
|
||||
VDDS_INLINE uint32_t os_atomic_add32_nv (volatile os_atomic_uint32_t *x, uint32_t v) {
|
||||
return atomic_add_32_nv (&x->v, v);
|
||||
}
|
||||
VDDS_INLINE uint64_t os_atomic_add64_nv (volatile os_atomic_uint64_t *x, uint64_t v) {
|
||||
return atomic_add_64_nv (&x->v, v);
|
||||
}
|
||||
VDDS_INLINE uintptr_t os_atomic_addptr_nv (volatile os_atomic_uintptr_t *x, uintptr_t v) {
|
||||
return atomic_add_long_nv (&x->v, v);
|
||||
}
|
||||
VDDS_INLINE void *os_atomic_addvoidp_nv (volatile os_atomic_voidp_t *x, ptrdiff_t v) {
|
||||
return atomic_add_ptr_nv (&x->v, v);
|
||||
}
|
||||
|
||||
/* SUB */
|
||||
|
||||
VDDS_INLINE void os_atomic_sub32 (volatile os_atomic_uint32_t *x, uint32_t v) {
|
||||
atomic_add_32 (&x->v, -v);
|
||||
}
|
||||
VDDS_INLINE void os_atomic_sub64 (volatile os_atomic_uint64_t *x, uint64_t v) {
|
||||
atomic_add_64 (&x->v, -v);
|
||||
}
|
||||
VDDS_INLINE void os_atomic_subptr (volatile os_atomic_uintptr_t *x, uintptr_t v) {
|
||||
atomic_add_long (&x->v, -v);
|
||||
}
|
||||
VDDS_INLINE void os_atomic_subvoidp (volatile os_atomic_voidp_t *x, ptrdiff_t v) {
|
||||
atomic_add_ptr (&x->v, -v);
|
||||
}
|
||||
VDDS_INLINE uint32_t os_atomic_sub32_nv (volatile os_atomic_uint32_t *x, uint32_t v) {
|
||||
return atomic_add_32_nv (&x->v, -v);
|
||||
}
|
||||
VDDS_INLINE uint64_t os_atomic_sub64_nv (volatile os_atomic_uint64_t *x, uint64_t v) {
|
||||
return atomic_add_64_nv (&x->v, -v);
|
||||
}
|
||||
VDDS_INLINE uintptr_t os_atomic_subptr_nv (volatile os_atomic_uintptr_t *x, uintptr_t v) {
|
||||
return atomic_add_long_nv (&x->v, -v);
|
||||
}
|
||||
VDDS_INLINE void *os_atomic_subvoidp_nv (volatile os_atomic_voidp_t *x, ptrdiff_t v) {
|
||||
return atomic_add_ptr_nv (&x->v, -v);
|
||||
}
|
||||
|
||||
/* AND */
|
||||
|
||||
VDDS_INLINE void os_atomic_and32 (volatile os_atomic_uint32_t *x, uint32_t v) {
|
||||
atomic_and_32 (&x->v, v);
|
||||
}
|
||||
VDDS_INLINE void os_atomic_and64 (volatile os_atomic_uint64_t *x, uint64_t v) {
|
||||
atomic_and_64 (&x->v, v);
|
||||
}
|
||||
VDDS_INLINE void os_atomic_andptr (volatile os_atomic_uintptr_t *x, uintptr_t v) {
|
||||
atomic_and_ulong (&x->v, v);
|
||||
}
|
||||
VDDS_INLINE uint32_t os_atomic_and32_ov (volatile os_atomic_uint32_t *x, uint32_t v) {
|
||||
uint32_t oldval, newval;
|
||||
do { oldval = x->v; newval = oldval & v; } while (atomic_cas_32 (&x->v, oldval, newval) != oldval);
|
||||
return oldval;
|
||||
}
|
||||
VDDS_INLINE uint64_t os_atomic_and64_ov (volatile os_atomic_uint64_t *x, uint64_t v) {
|
||||
uint64_t oldval, newval;
|
||||
do { oldval = x->v; newval = oldval & v; } while (atomic_cas_64 (&x->v, oldval, newval) != oldval);
|
||||
return oldval;
|
||||
}
|
||||
VDDS_INLINE uintptr_t os_atomic_andptr_ov (volatile os_atomic_uintptr_t *x, uintptr_t v) {
|
||||
uintptr_t oldval, newval;
|
||||
do { oldval = x->v; newval = oldval & v; } while (atomic_cas_ulong (&x->v, oldval, newval) != oldval);
|
||||
return oldval;
|
||||
}
|
||||
VDDS_INLINE uint32_t os_atomic_and32_nv (volatile os_atomic_uint32_t *x, uint32_t v) {
|
||||
return atomic_and_32_nv (&x->v, v);
|
||||
}
|
||||
VDDS_INLINE uint64_t os_atomic_and64_nv (volatile os_atomic_uint64_t *x, uint64_t v) {
|
||||
return atomic_and_64_nv (&x->v, v);
|
||||
}
|
||||
VDDS_INLINE uintptr_t os_atomic_andptr_nv (volatile os_atomic_uintptr_t *x, uintptr_t v) {
|
||||
return atomic_and_ulong_nv (&x->v, v);
|
||||
}
|
||||
|
||||
/* OR */
|
||||
|
||||
VDDS_INLINE void os_atomic_or32 (volatile os_atomic_uint32_t *x, uint32_t v) {
|
||||
atomic_or_32 (&x->v, v);
|
||||
}
|
||||
VDDS_INLINE void os_atomic_or64 (volatile os_atomic_uint64_t *x, uint64_t v) {
|
||||
atomic_or_64 (&x->v, v);
|
||||
}
|
||||
VDDS_INLINE void os_atomic_orptr (volatile os_atomic_uintptr_t *x, uintptr_t v) {
|
||||
atomic_or_ulong (&x->v, v);
|
||||
}
|
||||
VDDS_INLINE uint32_t os_atomic_or32_ov (volatile os_atomic_uint32_t *x, uint32_t v) {
|
||||
uint32_t oldval, newval;
|
||||
do { oldval = x->v; newval = oldval | v; } while (atomic_cas_32 (&x->v, oldval, newval) != oldval);
|
||||
return oldval;
|
||||
}
|
||||
VDDS_INLINE uint64_t os_atomic_or64_ov (volatile os_atomic_uint64_t *x, uint64_t v) {
|
||||
uint64_t oldval, newval;
|
||||
do { oldval = x->v; newval = oldval | v; } while (atomic_cas_64 (&x->v, oldval, newval) != oldval);
|
||||
return oldval;
|
||||
}
|
||||
VDDS_INLINE uintptr_t os_atomic_orptr_ov (volatile os_atomic_uintptr_t *x, uintptr_t v) {
|
||||
uintptr_t oldval, newval;
|
||||
do { oldval = x->v; newval = oldval | v; } while (atomic_cas_ulong (&x->v, oldval, newval) != oldval);
|
||||
return oldval;
|
||||
}
|
||||
VDDS_INLINE uint32_t os_atomic_or32_nv (volatile os_atomic_uint32_t *x, uint32_t v) {
|
||||
return atomic_or_32_nv (&x->v, v);
|
||||
}
|
||||
VDDS_INLINE uint64_t os_atomic_or64_nv (volatile os_atomic_uint64_t *x, uint64_t v) {
|
||||
return atomic_or_64_nv (&x->v, v);
|
||||
}
|
||||
VDDS_INLINE uintptr_t os_atomic_orptr_nv (volatile os_atomic_uintptr_t *x, uintptr_t v) {
|
||||
return atomic_or_ulong_nv (&x->v, v);
|
||||
}
|
||||
|
||||
/* CAS */
|
||||
|
||||
VDDS_INLINE int os_atomic_cas32 (volatile os_atomic_uint32_t *x, uint32_t exp, uint32_t des) {
|
||||
return atomic_cas_32 (&x->v, exp, des) == exp;
|
||||
}
|
||||
VDDS_INLINE int os_atomic_cas64 (volatile os_atomic_uint64_t *x, uint64_t exp, uint64_t des) {
|
||||
return atomic_cas_64 (&x->v, exp, des) == exp;
|
||||
}
|
||||
VDDS_INLINE int os_atomic_casptr (volatile os_atomic_uintptr_t *x, uintptr_t exp, uintptr_t des) {
|
||||
return atomic_cas_ulong (&x->v, exp, des) == exp;
|
||||
}
|
||||
VDDS_INLINE int os_atomic_casvoidp (volatile os_atomic_voidp_t *x, void *exp, void *des) {
|
||||
return atomic_cas_ptr (&x->v, exp, des) == exp;
|
||||
}
|
||||
|
||||
/* FENCES */
|
||||
|
||||
VDDS_INLINE void os_atomic_fence (void) {
|
||||
membar_exit ();
|
||||
membar_enter ();
|
||||
}
|
||||
VDDS_INLINE void os_atomic_fence_acq (void) {
|
||||
membar_enter ();
|
||||
}
|
||||
VDDS_INLINE void os_atomic_fence_rel (void) {
|
||||
membar_exit ();
|
||||
}
|
||||
|
||||
#endif /* not omit functions */
|
||||
|
||||
#define OS_ATOMIC_SUPPORT 1
|
|
@ -275,6 +275,8 @@ __pragma (warning(pop))
|
|||
/* VxWorks 7 supports __thread for both GCC and DIAB, older versions may
|
||||
support it as well, but that is not verified. */
|
||||
#define os_threadLocal __thread
|
||||
#elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
|
||||
#define os_threadLocal __thread
|
||||
#else
|
||||
#error "os_threadLocal is not supported"
|
||||
#endif
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
#include "os/windows/os_platform_public.h"
|
||||
#elif defined __APPLE__
|
||||
#include "os/posix/os_platform_public.h"
|
||||
#elif defined __sun
|
||||
#include "os/posix/os_platform_public.h"
|
||||
#else
|
||||
#error "Platform missing from os_public.h list"
|
||||
#endif
|
||||
|
|
62
src/os/include/os/solaris/os_platform.h
Normal file
62
src/os/include/os/solaris/os_platform.h
Normal file
|
@ -0,0 +1,62 @@
|
|||
/*
|
||||
* Copyright(c) 2006 to 2018 ADLINK Technology Limited and others
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Eclipse Public License v. 2.0 which is available at
|
||||
* http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
|
||||
* v. 1.0 which is available at
|
||||
* http://www.eclipse.org/org/documents/edl-v10.php.
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
|
||||
*/
|
||||
#ifndef OS_PLATFORM_H
|
||||
#define OS_PLATFORM_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <inttypes.h>
|
||||
#include <endian.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#define PRIdSIZE "zd"
|
||||
#define PRIuSIZE "zu"
|
||||
#define PRIxSIZE "zx"
|
||||
|
||||
#if defined (__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define OS_SOLARIS 1
|
||||
#define OS_SOCKET_USE_FCNTL 1
|
||||
#define OS_SOCKET_USE_IOCTL 0
|
||||
#define OS_HAS_UCONTEXT_T 1
|
||||
#define OS_FILESEPCHAR '/'
|
||||
#define OS_HAS_NO_SET_NAME_PRCTL 1
|
||||
|
||||
#define OS_ENDIANNESS OS_LITTLE_ENDIAN
|
||||
|
||||
#ifdef _LP64
|
||||
#define OS_64BIT
|
||||
#endif
|
||||
|
||||
typedef double os_timeReal;
|
||||
typedef int os_timeSec;
|
||||
typedef uid_t os_uid;
|
||||
typedef gid_t os_gid;
|
||||
typedef mode_t os_mode_t;
|
||||
typedef pid_t os_procId;
|
||||
#define PRIprocId "d"
|
||||
|
||||
#include "os/posix/os_platform_socket.h"
|
||||
#include "os/posix/os_platform_sync.h"
|
||||
#include "os/posix/os_platform_thread.h"
|
||||
#include "os/posix/os_platform_stdlib.h"
|
||||
#include "os/posix/os_platform_process.h"
|
||||
|
||||
#if defined (__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -26,7 +26,7 @@
|
|||
#include <stdio.h>
|
||||
#include <signal.h>
|
||||
/* TODO: should introduce a HAVE_PRCTL define rather than blacklisting some platforms */
|
||||
#if !defined __VXWORKS__ && !defined __APPLE__
|
||||
#if !defined __VXWORKS__ && !defined __APPLE__ && !defined __sun
|
||||
#include <sys/prctl.h>
|
||||
#endif
|
||||
#include <limits.h>
|
||||
|
@ -159,7 +159,7 @@ os_startRoutineWrapper (
|
|||
|
||||
resultValue = 0;
|
||||
|
||||
#if !defined(__VXWORKS__) && !defined(__APPLE__)
|
||||
#if !defined(__VXWORKS__) && !defined(__APPLE__) && !defined(__sun)
|
||||
prctl(PR_SET_NAME, context->threadName);
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue