Skip to content

Commit

Permalink
Support RHEL8 on PowerPC architecture #1700
Browse files Browse the repository at this point in the history
Did a global replace of __linux with __linux__
  • Loading branch information
alexlin0 committed Apr 26, 2024
1 parent e4f6774 commit b9b9a46
Show file tree
Hide file tree
Showing 34 changed files with 67 additions and 67 deletions.
6 changes: 3 additions & 3 deletions include/trick/GetTimeOfDayClock.hh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ PROGRAMMERS:
#ifndef GETTIMEOFDAYCLOCK_HH
#define GETTIMEOFDAYCLOCK_HH

#ifdef __linux
#ifdef __linux__
#include <time.h>
#endif

Expand All @@ -24,7 +24,7 @@ namespace Trick {
these values are available in the time module. Delete this
when everybody is using python 3.
*/
#ifdef __linux
#ifdef __linux__
enum ClockID {
TRICK_CLOCK_REALTIME = CLOCK_REALTIME ,
TRICK_CLOCK_MONOTONIC = CLOCK_MONOTONIC ,
Expand Down Expand Up @@ -55,7 +55,7 @@ namespace Trick {
int get_clock_ID() ;

protected:
#ifdef __linux
#ifdef __linux__
clockid_t clk_id ; // trick_io(**)
#endif
} ;
Expand Down
2 changes: 1 addition & 1 deletion include/trick/SysThread.hh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include <iostream>
#include <string>
#include <vector>
#if __linux
#if __linux__
#include <sys/types.h>
#endif
#include <unistd.h>
Expand Down
6 changes: 3 additions & 3 deletions include/trick/ThreadBase.hh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include <pthread.h>
#include <iostream>
#include <string>
#if __linux
#if __linux__
#include <sys/types.h>
#endif
#include <unistd.h>
Expand Down Expand Up @@ -70,7 +70,7 @@ namespace Trick {
*/
int cpu_clr(unsigned int cpu ) ;

#if __linux
#if __linux__
#ifndef SWIG
/**
* Gets the cpu set for this thread
Expand Down Expand Up @@ -184,7 +184,7 @@ namespace Trick {
bool cancellable; /**< trick_io(**) */
pthread_mutex_t shutdown_mutex; /**< trick_io(**) */

#if __linux
#if __linux__
#ifndef SWIG
/** Set of cpus to use with thread */
cpu_set_t * cpus ; /**< trick_io(**) */
Expand Down
2 changes: 1 addition & 1 deletion include/trick/Threads.hh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#include <queue>
#include <pthread.h>
#if __linux
#if __linux__
#include <sys/types.h>
#endif
#include <unistd.h>
Expand Down
4 changes: 2 additions & 2 deletions include/trick/Zeroconf.hh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#include <string>
#ifdef HAVE_ZEROCONF
#if __linux
#if __linux__
#include <avahi-client/client.h>
#include <avahi-client/publish.h>
#include <avahi-common/simple-watch.h>
Expand Down Expand Up @@ -38,7 +38,7 @@ namespace Trick {
std::string name ;
std::string type ;
#ifdef HAVE_ZEROCONF
#if __linux
#if __linux__
AvahiSimplePoll *simple_poll ;
AvahiClient *client ;
AvahiEntryGroup *group ;
Expand Down
2 changes: 1 addition & 1 deletion include/trick/parameter_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const char* trickTypeCharString( TRICK_TYPE type, const char* name);
#define TRICK_USER_DEFINED_TYPE TRICK_OPAQUE_TYPE

/* Define int_64t and uint_64t depending on compiler options */
#if __linux
#if __linux__
# include <stdint.h>
# include <sys/types.h>
# if __WORDSIZE == 64
Expand Down
2 changes: 1 addition & 1 deletion include/trick/tc.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

#include "trick/trick_error_hndlr.h"

#if (__linux)
#if (__linux__)
# define TC_NOSIGNAL MSG_NOSIGNAL
#else
# define TC_NOSIGNAL 0
Expand Down
2 changes: 1 addition & 1 deletion include/trick/vector_macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ This set of macros operates on vectors. Parameters to the macros are as follows:
#include <stdio.h>
#include <math.h>
#include <limits.h>
#if (__vxworks | __APPLE__ | __linux | __CYGWIN__)
#if (__vxworks | __APPLE__ | __linux__ | __CYGWIN__)
#include <float.h>
#endif

Expand Down
2 changes: 1 addition & 1 deletion test/SIM_trickcomm/tc_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#include "test_struct.h"

#if (__linux)
#if (__linux__)
# define TC_NOSIGNAL MSG_NOSIGNAL
#else
# define TC_NOSIGNAL 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ void HeaderSearchDirs::AddCompilerBuiltInSearchDirs () {
// Add clang specific include directory first. Only required on linux systems. :(
// This is so that ICG will find clang friendly headers first. gcc headers cause
// all kinds of problems. On macs all headers are clang friendly.
#if __linux
#if __linux__
std::stringstream icg_dir ;
icg_dir << LLVM_HOME << "/lib/clang/" ;
icg_dir << LIBCLANG_MAJOR << "." << LIBCLANG_MINOR ;
Expand Down
2 changes: 1 addition & 1 deletion trick_source/data_products/EQParse/eqparse_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -1166,7 +1166,7 @@ int main()
*/
fprintf(stderr, "\nMore tests.\n");

#if ( __linux | __APPLE__ )
#if ( __linux__ | __APPLE__ )
// Infinity
strcpy(equation1,
"10000000000000000000000000000000000^1000000000000000000000000000000000000");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ int Trick::CheckPointRestart::do_checkpoint(std::string file_name, bool print_st
if ( cpu_num != -1 ) {
// if the user specified a cpu number for the checkpoint, fork a process to write the checkpoint
if ((pid = fork()) == 0) {
#if __linux
#if __linux__
if ( cpu_num >= 0 ) {
unsigned long mask;
mask = 1 << cpu_num ;
Expand Down
8 changes: 4 additions & 4 deletions trick_source/sim_services/Clock/GetTimeOfDayClock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
-# Calls the base Clock constructor
*/
Trick::GetTimeOfDayClock::GetTimeOfDayClock() : Clock(1000000, "GetTimeOfDay - CLOCK_REALTIME")
#if ( __linux )
#if ( __linux__ )
, clk_id(CLOCK_REALTIME)
#endif
{ }
Expand All @@ -49,7 +49,7 @@ int Trick::GetTimeOfDayClock::clock_init() {
-# Return the current real time as a count of microseconds
*/
long long Trick::GetTimeOfDayClock::wall_clock_time() {
#if ( __linux )
#if ( __linux__ )
struct timespec tp ;
clock_gettime( clk_id, &tp ) ;
return (long long)tp.tv_sec * 1000000LL + (long long)((tp.tv_nsec) / 1000) ;
Expand All @@ -69,7 +69,7 @@ int Trick::GetTimeOfDayClock::clock_stop() {
}

void Trick::GetTimeOfDayClock::set_clock_ID( int id ) {
#if ( __linux )
#if ( __linux__ )
clk_id = (clockid_t)id ;
switch ( clk_id ) {
case CLOCK_REALTIME: name = "GetTimeOfDay - CLOCK_REALTIME" ; break ;
Expand All @@ -83,7 +83,7 @@ void Trick::GetTimeOfDayClock::set_clock_ID( int id ) {
}

int Trick::GetTimeOfDayClock::get_clock_ID() {
#if ( __linux )
#if ( __linux__ )
return clk_id ;
#else
message_publish(MSG_ERROR, "get_clock_ID not implemented\n");
Expand Down
2 changes: 1 addition & 1 deletion trick_source/sim_services/DataRecord/DRAscii.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ int Trick::DRAscii::copy_data_ascii_item( Trick::DataRecordBuffer * DI, int item
break;

case TRICK_UNSIGNED_CHARACTER:
#if ( __linux | __sgi )
#if ( __linux__ | __sgi )
case TRICK_BOOLEAN:
#endif
snprintf(buf, writer_buf_spare, "%u", *((unsigned char *) address));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include <unistd.h>

#include <signal.h>
#if __linux
#if __linux__
#include <sys/syscall.h>
#endif

Expand Down
2 changes: 1 addition & 1 deletion trick_source/sim_services/Executive/Executive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include <iostream>
#include <math.h>
#include <sys/stat.h>
#if __linux
#if __linux__
#include <sys/prctl.h>
#endif

Expand Down
6 changes: 3 additions & 3 deletions trick_source/sim_services/Executive/Executive_fpe_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
/*
* FPE specific headers
*/
#ifdef __linux
#ifdef __linux__
#include <fenv.h>
#endif

Expand All @@ -37,7 +37,7 @@
void Trick::Executive::fpe_handler(siginfo_t * sip __attribute__((unused)) ) {

write( 2 , "\033[31mProcess terminated by signal FPE" , 36 ) ;
#if __linux
#if __linux__
/* Determine what floating point error occurred */
if (sip != (siginfo_t *) NULL) {
switch (sip->si_code) {
Expand Down Expand Up @@ -73,7 +73,7 @@ void Trick::Executive::fpe_handler(siginfo_t * sip __attribute__((unused)) ) {
Attempt to attach with debugger or print stack trace. Not a requirement.
snprintf and system are not async signal safe, but we don't have anything to lose.
*/
#if __linux
#if __linux__
char command[1024];
if (attach_debugger == true) {
snprintf(command, sizeof(command), "%s -silent /proc/%d/exe %d", debugger_command.c_str(), getpid(), getpid());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <errno.h>

/* Headers for floating point exceptions */
#ifdef __linux
#ifdef __linux__
#include <fenv.h>
#endif

Expand Down Expand Up @@ -60,7 +60,7 @@ int Trick::Executive::set_trap_sigfpe(bool on_off) {

if ( on_off ) {
/* Assign fpe_sig_handler() as the signal handler for SIGFPE. */
#ifdef __linux
#ifdef __linux__
feenableexcept(FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW | FE_UNDERFLOW);
#endif
#if (__APPLE__ | __CYGWIN__ | __INTERIX )
Expand All @@ -70,7 +70,7 @@ int Trick::Executive::set_trap_sigfpe(bool on_off) {
sigact.sa_sigaction = (void (*)(int, siginfo_t *, void *)) fpe_sig_handler;
#endif
} else {
#ifdef __linux
#ifdef __linux__
fedisableexcept(FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW | FE_UNDERFLOW);
#endif
sigact.sa_handler = SIG_DFL;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ void Trick::Executive::signal_handler(int sig) {
* sprintf and system are not async signal safe, but we don't have anything to lose.
*/
if ( ! debugger_command.empty() ) {
#if __linux
#if __linux__
char command[1024];
if (attach_debugger == true) {
snprintf(command, sizeof(command), "%s -silent /proc/%d/exe %d", debugger_command.c_str(), getpid(), getpid());
Expand Down
6 changes: 3 additions & 3 deletions trick_source/sim_services/Executive/ThreadTrigger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ void Trick::ThreadTriggerFlag::dump(std::ostream & oss) {
oss << " trigger type = flag" << std::endl ;
}

#if __linux
#if __linux__
#include <sys/eventfd.h>
#include <sys/types.h>
#include <unistd.h>
Expand Down Expand Up @@ -128,15 +128,15 @@ void Trick::ThreadTriggerContainer::setThreadTrigger( ThreadTriggerType in_trigg
ttBase = &ttFlag ;
break ;
case TT_EVENTFD :
#if __linux
#if __linux__
ttBase = &ttEventFD ;
#else
message_publish(MSG_ERROR, "EventFD thread trigger type not available, using mutex\n") ;
ttBase = &ttMutex ;
#endif
break ;
case TT_FUTEX :
#if __linux
#if __linux__
ttBase = &ttFutex ;
#else
message_publish(MSG_ERROR, "Futex thread trigger type not available, using mutex\n") ;
Expand Down
4 changes: 2 additions & 2 deletions trick_source/sim_services/Executive/Threads_child.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include <signal.h>
#include <sys/syscall.h>

#ifdef __linux
#ifdef __linux__
#include <cxxabi.h>
#endif

Expand Down Expand Up @@ -218,7 +218,7 @@ void * Trick::Threads::thread_body() {
" THREAD STOP TIME: %f\n" ,
thread_id, ex.file.c_str(), ex.message.c_str(), exec_get_sim_time()) ;
exit(ex.ret_code) ;
#ifdef __linux
#ifdef __linux__
// for post gcc 4.1.2
} catch (abi::__forced_unwind&) {
//pthread_exit and pthread_cancel will cause an abi::__forced_unwind to be thrown. Rethrow it.
Expand Down
2 changes: 1 addition & 1 deletion trick_source/sim_services/Executive/fpe_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
/*
* FPE specific headers
*/
#ifdef __linux
#ifdef __linux__
#include <fenv.h>
#endif

Expand Down
2 changes: 1 addition & 1 deletion trick_source/sim_services/MemoryManager/ref_to_value.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ int ref_to_value(REF2 * R, V_DATA * V)
break;

case TRICK_UNSIGNED_CHARACTER:
#if ( __linux | __sgi )
#if ( __linux__ | __sgi )
case TRICK_BOOLEAN:
#endif
ucp = (unsigned char *) address;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ TEST_F(MM_declare_var, UINT32_T) {
validate_alloc_info_local(memmgr, test_var, TRICK_UNSIGNED_INTEGER, NULL, NULL, 1, 0, NULL);
}

#if __linux
#if __linux__
# include <stdint.h>
# include <sys/types.h>
# if __WORDSIZE == 64
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,15 @@ extern "C" int real_time_set_rt_clock_ratio(double in_clock_ratio) {
// not required for syncing. Therefore keep the routines as stand
// alone C functions.

#if __linux
#if __linux__
#include <sys/mman.h>
#include <errno.h>
#endif

extern "C" int real_time_lock_memory(int yes_no) {
/* lock or unlock memory based on yes_no parameter */
int ret = 0 ;
#if __linux
#if __linux__
if ( yes_no ) {
if ((ret = mlockall(MCL_CURRENT | MCL_FUTURE)) != 0 ) {
perror("Error locking memory.");
Expand Down
2 changes: 1 addition & 1 deletion trick_source/sim_services/ThreadBase/SysThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include <iostream>
#include <sstream>
#include <stdio.h>
#if __linux
#if __linux__
#include <sys/syscall.h>
#include <sys/types.h>
#include <sched.h>
Expand Down
Loading

0 comments on commit b9b9a46

Please sign in to comment.