Skip to content

Commit

Permalink
Add byte order detection and THREAD_YIELD support for Solaris
Browse files Browse the repository at this point in the history
  • Loading branch information
papadave66 committed Jun 1, 2019
1 parent 17bf6a2 commit 2cd6837
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 1 deletion.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ Nathan French <[email protected]>
Redjack, LLC
Roger Shimizu <[email protected]>
Toby DiPasquale <[email protected]>
Rivoreo Group
4 changes: 4 additions & 0 deletions include/libcork/config/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@
/* Do some BSD (4.3 code base or newer)specific autodetection. */
#include <libcork/config/bsd.h>

#elif defined(__sun) && defined(__SVR4)
/* Solaris and its derivatives */
#include <libcork/config/solaris.h>

#endif /* platforms */


Expand Down
29 changes: 29 additions & 0 deletions include/libcork/config/solaris.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/* -*- 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 <sys/byteorder.h>

#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_PTHREADS 1

#endif /* LIBCORK_CONFIG_SOLARIS_H */
2 changes: 1 addition & 1 deletion src/libcork/posix/subprocess.c
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ cork_subprocess_is_finished(struct cork_subprocess *self)
#if defined(__APPLE__)
#include <pthread.h>
#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 <sched.h>
#define THREAD_YIELD sched_yield
#else
Expand Down

0 comments on commit 2cd6837

Please sign in to comment.