From 2cc51308d8f58ffb4f581a3db54cfe889961bc71 Mon Sep 17 00:00:00 2001 From: Steve Huston Date: Wed, 11 Feb 2015 16:42:51 -0500 Subject: Apply patches sent from Gordon Hulpieu --- ACE/ace/OS_NS_Thread.cpp | 104 ++++++++++++++++++++++++----------------------- ACE/ace/OS_NS_Thread.h | 5 ++- ACE/ace/OS_NS_signal.inl | 8 ++++ ACE/ace/OS_NS_stdlib.cpp | 65 +++++++++++++---------------- ACE/ace/Stack_Trace.cpp | 19 +++++---- 5 files changed, 104 insertions(+), 97 deletions(-) diff --git a/ACE/ace/OS_NS_Thread.cpp b/ACE/ace/OS_NS_Thread.cpp index a5bc7c4f836..b2712110da7 100644 --- a/ACE/ace/OS_NS_Thread.cpp +++ b/ACE/ace/OS_NS_Thread.cpp @@ -4436,9 +4436,9 @@ ACE_OS::thr_create (ACE_THR_FUNC func, tid = ::taskSpawn (thr_name && *thr_name ? const_cast (*thr_name) : 0, priority, (int) flags, - (int) stacksize, + stacksize, thread_args->entry_point (), - (int) thread_args, + (_Vx_usr_arg_t) thread_args, 0, 0, 0, 0, 0, 0, 0, 0, 0); # if 0 /* Don't support setting of stack, because it doesn't seem to work. */ } @@ -4472,7 +4472,7 @@ ACE_OS::thr_create (ACE_THR_FUNC func, } # endif /* 0 */ - if (tid == ERROR) + if (tid == TASK_ID_ERROR) return -1; else { @@ -4560,8 +4560,8 @@ ACE_OS::thr_exit (ACE_THR_FUNC_RETURN status) # endif /* ACE_HAS_MFC && ACE_HAS_MFS != 0*/ # elif defined (ACE_HAS_VXTHREADS) - ACE_thread_t tid = ACE_OS::thr_self (); - *((int *) status) = ::taskDelete (tid); + ACE_UNUSED_ARG (status); + ::taskDelete (ACE_OS::thr_self ()); # endif /* ACE_HAS_PTHREADS */ #else ACE_UNUSED_ARG (status); @@ -5132,7 +5132,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL int spa (FUNCPTR entry, ...) { - static const unsigned int ACE_MAX_ARGS = 10; + static _Vx_usr_arg_t const ACE_MAX_ARGS = 10; static char *argv[ACE_MAX_ARGS] = { 0 }; va_list pvar; unsigned int argc; @@ -5149,7 +5149,7 @@ spa (FUNCPTR entry, ...) // number of arguments would have to be passed. va_start (pvar, entry); - for (argc = 1; argc <= ACE_MAX_ARGS; ++argc) + for (argc = 1; argc < ACE_MAX_ARGS; ++argc) { argv[argc] = va_arg (pvar, char *); @@ -5157,41 +5157,45 @@ spa (FUNCPTR entry, ...) break; } - if (argc > ACE_MAX_ARGS && argv[argc-1] != 0) + if (argc >= ACE_MAX_ARGS && argv[ACE_MAX_ARGS - 1] != 0) { - // try to read another arg, and warn user if the limit was exceeded + // Try to read another arg, and warn user if the limit was exceeded. + // + // Note that the VxWorks shell arguments change from int to long when + // using a 64bit compiler. Cast the argument up so that the format + // specifier remains correct for either build type. if (va_arg (pvar, char *) != 0) - ACE_OS::fprintf (stderr, "spa(): number of arguments limited to %d\n", - ACE_MAX_ARGS); + ACE_OS::fprintf (stderr, "spa(): number of arguments limited to %ld\n", + (long)ACE_MAX_ARGS); } else { // fill unused argv slots with 0 to get rid of leftovers // from previous invocations - for (unsigned int i = argc; i <= ACE_MAX_ARGS; ++i) + for (_Vx_usr_arg_t i = argc; i < ACE_MAX_ARGS; ++i) argv[i] = 0; } // The hard-coded options are what ::sp () uses, except for the // larger stack size (instead of ::sp ()'s 20000). - int const ret = ::taskSpawn (argv[0], // task name - 100, // task priority - VX_FP_TASK, // task options - ACE_NEEDS_HUGE_THREAD_STACKSIZE, // stack size - entry, // entry point - argc, // first argument to main () - (int) argv, // second argument to main () - 0, 0, 0, 0, 0, 0, 0, 0); + TASK_ID const ret = ::taskSpawn (argv[0], // task name + 100, // task priority + VX_FP_TASK, // task options + ACE_NEEDS_HUGE_THREAD_STACKSIZE, // stack size + entry, // entry point + argc, // first argument to main () + (_Vx_usr_arg_t) argv, // second argument to main () + 0, 0, 0, 0, 0, 0, 0, 0); va_end (pvar); // ::taskSpawn () returns the taskID on success: return 0 instead if // successful - return ret > 0 ? 0 : ret; + return ret > 0 ? 0 : -1; } // A helper function for the extended spa functions static void -add_to_argv (int& argc, char** argv, int max_args, char* string) +add_to_argv (_Vx_usr_arg_t& argc, char** argv, int max_args, char* string) { char indouble = 0; size_t previous = 0; @@ -5267,10 +5271,10 @@ int spae (FUNCPTR entry, ...) { static int const WINDSH_ARGS = 10; - static int const ACE_MAX_ARGS = 128; + static _Vx_usr_arg_t const ACE_MAX_ARGS = 128; static char* argv[ACE_MAX_ARGS] = { const_cast ("ace_main"), 0 }; va_list pvar; - int argc = 1; + _Vx_usr_arg_t argc = 1; // Peel off arguments to spa () and put into argv. va_arg () isn't // necessarily supposed to return 0 when done, though since the @@ -5292,19 +5296,19 @@ spae (FUNCPTR entry, ...) // The hard-coded options are what ::sp () uses, except for the // larger stack size (instead of ::sp ()'s 20000). - int const ret = ::taskSpawn (argv[0], // task name - 100, // task priority - VX_FP_TASK, // task options - ACE_NEEDS_HUGE_THREAD_STACKSIZE, // stack size - entry, // entry point - argc, // first argument to main () - (int) argv, // second argument to main () - 0, 0, 0, 0, 0, 0, 0, 0); + TASK_ID const ret = ::taskSpawn (argv[0], // task name + 100, // task priority + VX_FP_TASK, // task options + ACE_NEEDS_HUGE_THREAD_STACKSIZE, // stack size + entry, // entry point + argc, // first argument to main () + (_Vx_usr_arg_t) argv, // second argument to main () + 0, 0, 0, 0, 0, 0, 0, 0); va_end (pvar); // ::taskSpawn () returns the taskID on success: return 0 instead if // successful - return ret > 0 ? 0 : ret; + return ret > 0 ? 0 : -1; } // This global function can be used from the VxWorks shell to pass @@ -5321,10 +5325,10 @@ int spaef (FUNCPTR entry, ...) { static int const WINDSH_ARGS = 10; - static int const ACE_MAX_ARGS = 128; + static _Vx_usr_arg_t const ACE_MAX_ARGS = 128; static char* argv[ACE_MAX_ARGS] = { const_cast ("ace_main"), 0 }; va_list pvar; - int argc = 1; + _Vx_usr_arg_t argc = 1; // Peel off arguments to spa () and put into argv. va_arg () isn't // necessarily supposed to return 0 when done, though since the @@ -5371,11 +5375,11 @@ _vx_call_entry(FUNCPTR entry, int argc, char* argv[]) } int -vx_execae (FUNCPTR entry, char* arg, int prio, int opt, int stacksz, ...) +vx_execae (FUNCPTR entry, char* arg, int prio, int opt, size_t stacksz, ...) { - static int const ACE_MAX_ARGS = 128; + static _Vx_usr_arg_t const ACE_MAX_ARGS = 128; static char* argv[ACE_MAX_ARGS] = { const_cast ("ace_main"), 0 }; - int argc = 1; + _Vx_usr_arg_t argc = 1; // Peel off arguments to run_main () and put into argv. if (arg) @@ -5385,22 +5389,22 @@ vx_execae (FUNCPTR entry, char* arg, int prio, int opt, int stacksz, ...) // fill unused argv slots with 0 to get rid of leftovers // from previous invocations - for (int i = argc; i < ACE_MAX_ARGS; ++i) + for (_Vx_usr_arg_t i = argc; i < ACE_MAX_ARGS; ++i) argv[i] = 0; // The hard-coded options are what ::sp () uses, except for the // larger stack size (instead of ::sp ()'s 20000). - int const ret = ::taskSpawn (argv[0], // task name - prio==0 ? 100 : prio, // task priority - opt==0 ? VX_FP_TASK : opt, // task options - stacksz==0 ? ACE_NEEDS_HUGE_THREAD_STACKSIZE : stacksz, // stack size - (FUNCPTR)_vx_call_entry, // entrypoint caller - (int)entry, // entry point - argc, // first argument to main () - (int) argv, // second argument to main () - 0, 0, 0, 0, 0, 0, 0); - - if (ret == ERROR) + TASK_ID const ret = ::taskSpawn (argv[0], // task name + prio==0 ? 100 : prio, // task priority + opt==0 ? VX_FP_TASK : opt, // task options + stacksz==0 ? ACE_NEEDS_HUGE_THREAD_STACKSIZE : stacksz, // stack size + (FUNCPTR)_vx_call_entry, // entrypoint caller + (_Vx_usr_arg_t)entry, // entry point + argc, // first argument to main () + (_Vx_usr_arg_t) argv, // second argument to main () + 0, 0, 0, 0, 0, 0, 0); + + if (ret == TASK_ID_ERROR) return 255; while( ret > 0 && ::taskIdVerify (ret) != ERROR ) diff --git a/ACE/ace/OS_NS_Thread.h b/ACE/ace/OS_NS_Thread.h index 42a48ee93e0..f3176c82396 100644 --- a/ACE/ace/OS_NS_Thread.h +++ b/ACE/ace/OS_NS_Thread.h @@ -160,6 +160,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL # elif defined (ACE_VXWORKS) # include /**/ // for sysClkRateGet() +# include /**/ # if !defined (__RTP__) # include /**/ # include /**/ @@ -228,8 +229,8 @@ typedef struct char *name_; } ACE_sema_t; # endif /* !ACE_HAS_POSIX_SEM */ -typedef int ACE_thread_t; -typedef int ACE_hthread_t; +typedef TASK_ID ACE_thread_t; +typedef TASK_ID ACE_hthread_t; // Key type: the ACE TSS emulation requires the key type be unsigned, // for efficiency. (Current POSIX and Solaris TSS implementations also // use u_int, so the ACE TSS emulation is compatible with them.) diff --git a/ACE/ace/OS_NS_signal.inl b/ACE/ace/OS_NS_signal.inl index 562d2701f33..087dbbf25da 100644 --- a/ACE/ace/OS_NS_signal.inl +++ b/ACE/ace/OS_NS_signal.inl @@ -15,6 +15,14 @@ kill (pid_t pid, int signum) ACE_UNUSED_ARG (pid); ACE_UNUSED_ARG (signum); ACE_NOTSUP_RETURN (-1); +#elif defined (ACE_VXWORKS) + /* + * The VxWorks kill interface is not really POSIX + * since they use a task id in place of a pid type. + * This only becomes an issue when using the 64bit compiler + * as the TASK_ID is no longer defined as an int. + */ + ACE_OSCALL_RETURN (::kill ((TASK_ID)pid, signum), int, -1); #else ACE_OSCALL_RETURN (::kill (pid, signum), int, -1); #endif /* ACE_LACKS_KILL */ diff --git a/ACE/ace/OS_NS_stdlib.cpp b/ACE/ace/OS_NS_stdlib.cpp index 0d8fd91ac7a..3526b9f74d6 100644 --- a/ACE/ace/OS_NS_stdlib.cpp +++ b/ACE/ace/OS_NS_stdlib.cpp @@ -283,47 +283,40 @@ ACE_OS::mktemp (ACE_TCHAR *s) if (s == 0) // check for null template string failed! return 0; - else - { - ACE_TCHAR *xxxxxx = ACE_OS::strstr (s, ACE_TEXT ("XXXXXX")); - if (xxxxxx == 0) - // the template string doesn't contain "XXXXXX"! - return s; - else + ACE_TCHAR *xxxxxx = ACE_OS::strstr (s, ACE_TEXT ("XXXXXX")); + if (xxxxxx == 0) + // the template string doesn't contain "XXXXXX"! + return s; + + // Find an unused filename for this process. It is assumed + // that the user will open the file immediately after + // getting this filename back (so, yes, there is a race + // condition if multiple threads in a process use the same + // template). This appears to match the behavior of the + // SunOS 5.5 mktemp(). + bool found = false; + for (ACE_TCHAR letter = ACE_TEXT ('a'); + letter <= ACE_TEXT ('z'); + ++letter) + { + ACE_stat sb; + ACE_OS::sprintf (xxxxxx, + ACE_TEXT ("%05d%c"), + (int)ACE_OS::getpid () % 100000, + letter); + if (ACE_OS::stat (s, &sb) < 0) { - ACE_TCHAR unique_letter = ACE_TEXT ('a'); - ACE_stat sb; - - // Find an unused filename for this process. It is assumed - // that the user will open the file immediately after - // getting this filename back (so, yes, there is a race - // condition if multiple threads in a process use the same - // template). This appears to match the behavior of the - // SunOS 5.5 mktemp(). - ACE_OS::sprintf (xxxxxx, - ACE_TEXT ("%05d%c"), - ACE_OS::getpid (), - unique_letter); - while (ACE_OS::stat (s, &sb) >= 0) - { - if (++unique_letter <= ACE_TEXT ('z')) - ACE_OS::sprintf (xxxxxx, - ACE_TEXT ("%05d%c"), - ACE_OS::getpid (), - unique_letter); - else - { - // maximum of 26 unique files per template, per process - ACE_OS::sprintf (xxxxxx, ACE_TEXT ("%s"), ACE_TEXT ("")); - return s; - } - } + found = true; + break; } - return s; } + if (!found) + // maximum of 26 unique files per template, per process + ACE_OS::sprintf (xxxxxx, ACE_TEXT ("%s"), ACE_TEXT ("")); + return s; } -#endif /* ACE_LACKS_MKTEMP &7 !ACE_DISABLE_MKTEMP */ +#endif /* ACE_LACKS_MKTEMP && !ACE_DISABLE_MKTEMP */ void * ACE_OS::realloc (void *ptr, size_t nbytes) diff --git a/ACE/ace/Stack_Trace.cpp b/ACE/ace/Stack_Trace.cpp index 582941a7b4b..f746c9041f8 100644 --- a/ACE/ace/Stack_Trace.cpp +++ b/ACE/ace/Stack_Trace.cpp @@ -123,9 +123,9 @@ static ACE_Stack_Trace_stackstate* ACE_Stack_Trace_stateptr = 0; static void ACE_Stack_Trace_Add_Frame_To_Buf (INSTR *caller, - unsigned int func, - unsigned int nargs, - unsigned int *args) + INSTR *func, + int nargs, + _Vx_usr_arg_t *args) { if (ACE_Stack_Trace_stateptr == 0) return; @@ -143,20 +143,21 @@ ACE_Stack_Trace_Add_Frame_To_Buf (INSTR *caller, // These are references so that the structure gets updated // in the code below. char*& buf = stackstate->buf; - unsigned int& len = stackstate->buflen; + size_t& len = stackstate->buflen; // At some point try using symFindByValue() to lookup func (and caller?) // to print out symbols rather than simply addresses. // VxWorks can pass -1 for "nargs" if there was an error - if (nargs == static_cast (-1)) nargs = 0; + if (nargs == -1) + nargs = 0; - len += ACE_OS::sprintf (&buf[len], "%#10x: %#10x (", (int)caller, func); - for (unsigned int i = 0; i < nargs; ++i) + len += ACE_OS::sprintf (&buf[len], "%p: %p (", caller, func); + for (int i = 0; i < nargs; ++i) { if (i != 0) len += ACE_OS::sprintf (&buf[len], ", "); - len += ACE_OS::sprintf(&buf [len], "%#x", args [i]); + len += ACE_OS::sprintf(&buf [len], "%#lx", (long)args [i]); } len += ACE_OS::sprintf(&buf[len], ")\n"); @@ -180,7 +181,7 @@ ACE_Stack_Trace::generate_trace (ssize_t starting_frame_offset, REG_SET regs; - taskRegsGet ((int)taskIdSelf(), ®s); + taskRegsGet (taskIdSelf(), ®s); // Maybe we should take a lock here to guard stateptr? ACE_Stack_Trace_stateptr = &state; trcStack (®s, (FUNCPTR)ACE_Stack_Trace_Add_Frame_To_Buf, taskIdSelf ()); -- cgit v1.2.1 From a16e1f2296eb85eed6da71b009d72223e0438a74 Mon Sep 17 00:00:00 2001 From: Steve Huston Date: Thu, 12 Feb 2015 10:02:19 -0500 Subject: Fix spa() argc type --- ACE/ace/OS_NS_Thread.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ACE/ace/OS_NS_Thread.cpp b/ACE/ace/OS_NS_Thread.cpp index b2712110da7..2d2b4cae797 100644 --- a/ACE/ace/OS_NS_Thread.cpp +++ b/ACE/ace/OS_NS_Thread.cpp @@ -5135,7 +5135,7 @@ spa (FUNCPTR entry, ...) static _Vx_usr_arg_t const ACE_MAX_ARGS = 10; static char *argv[ACE_MAX_ARGS] = { 0 }; va_list pvar; - unsigned int argc; + _Vx_usr_arg_t argc; // Hardcode a program name because the real one isn't available // through the VxWorks shell. -- cgit v1.2.1 From 5b192d1a85d54740d45211f9cc05b2442b1e1def Mon Sep 17 00:00:00 2001 From: Steve Huston Date: Thu, 12 Feb 2015 10:46:08 -0500 Subject: spa() can pass a function name ("ace_main") plus the normal 10 optional arguments. --- ACE/ace/OS_NS_Thread.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ACE/ace/OS_NS_Thread.cpp b/ACE/ace/OS_NS_Thread.cpp index 2d2b4cae797..598fa0f0762 100644 --- a/ACE/ace/OS_NS_Thread.cpp +++ b/ACE/ace/OS_NS_Thread.cpp @@ -5132,7 +5132,9 @@ ACE_END_VERSIONED_NAMESPACE_DECL int spa (FUNCPTR entry, ...) { - static _Vx_usr_arg_t const ACE_MAX_ARGS = 10; + // The called entrypoint can get the function name plus the normal 10 + // optional arguments. + static _Vx_usr_arg_t const ACE_MAX_ARGS = 1 + 10; static char *argv[ACE_MAX_ARGS] = { 0 }; va_list pvar; _Vx_usr_arg_t argc; -- cgit v1.2.1 From 35bd40132ca21673ddb4d42fbe2de22653ccf075 Mon Sep 17 00:00:00 2001 From: Steve Huston Date: Thu, 26 Feb 2015 16:28:46 -0500 Subject: Move ACE_VX_USR_ARG_T type definition out to the config-vxworks.h file and change it to a typedef instead of a macro. Generalize use of ACE_VX_USR_ARG_T in place of previously added _Vx_usr_arg_t to restore ability to build on pre-6.9 --- ACE/ace/OS_NS_Thread.cpp | 32 ++++++++++++++++---------------- ACE/ace/Stack_Trace.cpp | 13 +------------ ACE/ace/config-vxworks.h | 13 +++++++++++++ 3 files changed, 30 insertions(+), 28 deletions(-) diff --git a/ACE/ace/OS_NS_Thread.cpp b/ACE/ace/OS_NS_Thread.cpp index 598fa0f0762..a8efe375527 100644 --- a/ACE/ace/OS_NS_Thread.cpp +++ b/ACE/ace/OS_NS_Thread.cpp @@ -4438,7 +4438,7 @@ ACE_OS::thr_create (ACE_THR_FUNC func, (int) flags, stacksize, thread_args->entry_point (), - (_Vx_usr_arg_t) thread_args, + (ACE_VX_USR_ARG_T) thread_args, 0, 0, 0, 0, 0, 0, 0, 0, 0); # if 0 /* Don't support setting of stack, because it doesn't seem to work. */ } @@ -5134,10 +5134,10 @@ spa (FUNCPTR entry, ...) { // The called entrypoint can get the function name plus the normal 10 // optional arguments. - static _Vx_usr_arg_t const ACE_MAX_ARGS = 1 + 10; + static ACE_VX_USR_ARG_T const ACE_MAX_ARGS = 1 + 10; static char *argv[ACE_MAX_ARGS] = { 0 }; va_list pvar; - _Vx_usr_arg_t argc; + ACE_VX_USR_ARG_T argc; // Hardcode a program name because the real one isn't available // through the VxWorks shell. @@ -5174,7 +5174,7 @@ spa (FUNCPTR entry, ...) { // fill unused argv slots with 0 to get rid of leftovers // from previous invocations - for (_Vx_usr_arg_t i = argc; i < ACE_MAX_ARGS; ++i) + for (ACE_VX_USR_ARG_T i = argc; i < ACE_MAX_ARGS; ++i) argv[i] = 0; } @@ -5186,7 +5186,7 @@ spa (FUNCPTR entry, ...) ACE_NEEDS_HUGE_THREAD_STACKSIZE, // stack size entry, // entry point argc, // first argument to main () - (_Vx_usr_arg_t) argv, // second argument to main () + (ACE_VX_USR_ARG_T) argv, // second argument to main () 0, 0, 0, 0, 0, 0, 0, 0); va_end (pvar); @@ -5197,7 +5197,7 @@ spa (FUNCPTR entry, ...) // A helper function for the extended spa functions static void -add_to_argv (_Vx_usr_arg_t& argc, char** argv, int max_args, char* string) +add_to_argv (ACE_VX_USR_ARG_T& argc, char** argv, int max_args, char* string) { char indouble = 0; size_t previous = 0; @@ -5273,10 +5273,10 @@ int spae (FUNCPTR entry, ...) { static int const WINDSH_ARGS = 10; - static _Vx_usr_arg_t const ACE_MAX_ARGS = 128; + static ACE_VX_USR_ARG_T const ACE_MAX_ARGS = 128; static char* argv[ACE_MAX_ARGS] = { const_cast ("ace_main"), 0 }; va_list pvar; - _Vx_usr_arg_t argc = 1; + ACE_VX_USR_ARG_T argc = 1; // Peel off arguments to spa () and put into argv. va_arg () isn't // necessarily supposed to return 0 when done, though since the @@ -5304,7 +5304,7 @@ spae (FUNCPTR entry, ...) ACE_NEEDS_HUGE_THREAD_STACKSIZE, // stack size entry, // entry point argc, // first argument to main () - (_Vx_usr_arg_t) argv, // second argument to main () + (ACE_VX_USR_ARG_T) argv, // second argument to main () 0, 0, 0, 0, 0, 0, 0, 0); va_end (pvar); @@ -5327,10 +5327,10 @@ int spaef (FUNCPTR entry, ...) { static int const WINDSH_ARGS = 10; - static _Vx_usr_arg_t const ACE_MAX_ARGS = 128; + static ACE_VX_USR_ARG_T const ACE_MAX_ARGS = 128; static char* argv[ACE_MAX_ARGS] = { const_cast ("ace_main"), 0 }; va_list pvar; - _Vx_usr_arg_t argc = 1; + ACE_VX_USR_ARG_T argc = 1; // Peel off arguments to spa () and put into argv. va_arg () isn't // necessarily supposed to return 0 when done, though since the @@ -5379,9 +5379,9 @@ _vx_call_entry(FUNCPTR entry, int argc, char* argv[]) int vx_execae (FUNCPTR entry, char* arg, int prio, int opt, size_t stacksz, ...) { - static _Vx_usr_arg_t const ACE_MAX_ARGS = 128; + static ACE_VX_USR_ARG_T const ACE_MAX_ARGS = 128; static char* argv[ACE_MAX_ARGS] = { const_cast ("ace_main"), 0 }; - _Vx_usr_arg_t argc = 1; + ACE_VX_USR_ARG_T argc = 1; // Peel off arguments to run_main () and put into argv. if (arg) @@ -5391,7 +5391,7 @@ vx_execae (FUNCPTR entry, char* arg, int prio, int opt, size_t stacksz, ...) // fill unused argv slots with 0 to get rid of leftovers // from previous invocations - for (_Vx_usr_arg_t i = argc; i < ACE_MAX_ARGS; ++i) + for (ACE_VX_USR_ARG_T i = argc; i < ACE_MAX_ARGS; ++i) argv[i] = 0; // The hard-coded options are what ::sp () uses, except for the @@ -5401,9 +5401,9 @@ vx_execae (FUNCPTR entry, char* arg, int prio, int opt, size_t stacksz, ...) opt==0 ? VX_FP_TASK : opt, // task options stacksz==0 ? ACE_NEEDS_HUGE_THREAD_STACKSIZE : stacksz, // stack size (FUNCPTR)_vx_call_entry, // entrypoint caller - (_Vx_usr_arg_t)entry, // entry point + (ACE_VX_USR_ARG_T)entry, // entry point argc, // first argument to main () - (_Vx_usr_arg_t) argv, // second argument to main () + (ACE_VX_USR_ARG_T) argv, // second argument to main () 0, 0, 0, 0, 0, 0, 0); if (ret == TASK_ID_ERROR) diff --git a/ACE/ace/Stack_Trace.cpp b/ACE/ace/Stack_Trace.cpp index f746c9041f8..ae1437107b3 100644 --- a/ACE/ace/Stack_Trace.cpp +++ b/ACE/ace/Stack_Trace.cpp @@ -125,7 +125,7 @@ static void ACE_Stack_Trace_Add_Frame_To_Buf (INSTR *caller, INSTR *func, int nargs, - _Vx_usr_arg_t *args) + ACE_VX_USR_ARG_T *args) { if (ACE_Stack_Trace_stateptr == 0) return; @@ -253,17 +253,6 @@ ACE_Stack_Trace::generate_trace (ssize_t starting_frame_offset, const char *fnName = "(no symbols)"; static const int N_ARGS = 12; -#if (ACE_VXWORKS < 0x690) -# define ACE_VX_USR_ARG_T int -# define ACE_VX_ARG_FORMAT "%x" -#else -# define ACE_VX_USR_ARG_T _Vx_usr_arg_t -# ifdef _WRS_CONFIG_LP64 -# define ACE_VX_ARG_FORMAT "%lx" -# else -# define ACE_VX_ARG_FORMAT "%x" -# endif -#endif ACE_VX_USR_ARG_T buf[N_ARGS]; ACE_VX_USR_ARG_T *pArgs = 0; int numArgs = diff --git a/ACE/ace/config-vxworks.h b/ACE/ace/config-vxworks.h index ee4e2286c76..e45e05ec0f4 100644 --- a/ACE/ace/config-vxworks.h +++ b/ACE/ace/config-vxworks.h @@ -54,6 +54,19 @@ #error Unknown or unsupported VxWorks version #endif +// Adapt to system argument changes added at VxWorks 6.9 and 64-bit. +#if (ACE_VXWORKS < 0x690) +typedef int ACE_VX_USR_ARG_T; +# define ACE_VX_ARG_FORMAT "%x" +#else +typedef _Vx_usr_arg_t ACE_VX_USR_ARG_T; +# ifdef _WRS_CONFIG_LP64 +# define ACE_VX_ARG_FORMAT "%lx" +# else +# define ACE_VX_ARG_FORMAT "%x" +# endif +#endif + #include /**/ "ace/post.h" #endif /* ACE_CONFIG_VXWORKS_H */ -- cgit v1.2.1 From cfb236999fd9316695422e84b1d5e1dcd6cf19e5 Mon Sep 17 00:00:00 2001 From: Steve Huston Date: Fri, 27 Feb 2015 12:36:39 -0500 Subject: Adjustments for type and value changes made at VxWorks 6.9. --- ACE/ace/OS_NS_Thread.cpp | 56 ++++++++++++++++++++++++------------------------ ACE/ace/OS_NS_Thread.h | 4 ++-- ACE/ace/config-vxworks.h | 8 +++++-- 3 files changed, 36 insertions(+), 32 deletions(-) diff --git a/ACE/ace/OS_NS_Thread.cpp b/ACE/ace/OS_NS_Thread.cpp index a8efe375527..b760a9a07a4 100644 --- a/ACE/ace/OS_NS_Thread.cpp +++ b/ACE/ace/OS_NS_Thread.cpp @@ -4472,7 +4472,7 @@ ACE_OS::thr_create (ACE_THR_FUNC func, } # endif /* 0 */ - if (tid == TASK_ID_ERROR) + if (tid == ACE_VX_TASK_ID_ERROR) return -1; else { @@ -5180,14 +5180,14 @@ spa (FUNCPTR entry, ...) // The hard-coded options are what ::sp () uses, except for the // larger stack size (instead of ::sp ()'s 20000). - TASK_ID const ret = ::taskSpawn (argv[0], // task name - 100, // task priority - VX_FP_TASK, // task options - ACE_NEEDS_HUGE_THREAD_STACKSIZE, // stack size - entry, // entry point - argc, // first argument to main () - (ACE_VX_USR_ARG_T) argv, // second argument to main () - 0, 0, 0, 0, 0, 0, 0, 0); + ACE_VX_TASK_ID const ret = ::taskSpawn (argv[0], // task name + 100, // task priority + VX_FP_TASK, // task options + ACE_NEEDS_HUGE_THREAD_STACKSIZE, // stack size + entry, // entry point + argc, // first argument to main () + (ACE_VX_USR_ARG_T) argv, // second argument to main () + 0, 0, 0, 0, 0, 0, 0, 0); va_end (pvar); // ::taskSpawn () returns the taskID on success: return 0 instead if @@ -5298,14 +5298,14 @@ spae (FUNCPTR entry, ...) // The hard-coded options are what ::sp () uses, except for the // larger stack size (instead of ::sp ()'s 20000). - TASK_ID const ret = ::taskSpawn (argv[0], // task name - 100, // task priority - VX_FP_TASK, // task options - ACE_NEEDS_HUGE_THREAD_STACKSIZE, // stack size - entry, // entry point - argc, // first argument to main () - (ACE_VX_USR_ARG_T) argv, // second argument to main () - 0, 0, 0, 0, 0, 0, 0, 0); + ACE_VX_TASK_ID const ret = ::taskSpawn (argv[0], // task name + 100, // task priority + VX_FP_TASK, // task options + ACE_NEEDS_HUGE_THREAD_STACKSIZE, // stack size + entry, // entry point + argc, // first argument to main () + (ACE_VX_USR_ARG_T) argv, // second argument to main () + 0, 0, 0, 0, 0, 0, 0, 0); va_end (pvar); // ::taskSpawn () returns the taskID on success: return 0 instead if @@ -5396,17 +5396,17 @@ vx_execae (FUNCPTR entry, char* arg, int prio, int opt, size_t stacksz, ...) // The hard-coded options are what ::sp () uses, except for the // larger stack size (instead of ::sp ()'s 20000). - TASK_ID const ret = ::taskSpawn (argv[0], // task name - prio==0 ? 100 : prio, // task priority - opt==0 ? VX_FP_TASK : opt, // task options - stacksz==0 ? ACE_NEEDS_HUGE_THREAD_STACKSIZE : stacksz, // stack size - (FUNCPTR)_vx_call_entry, // entrypoint caller - (ACE_VX_USR_ARG_T)entry, // entry point - argc, // first argument to main () - (ACE_VX_USR_ARG_T) argv, // second argument to main () - 0, 0, 0, 0, 0, 0, 0); - - if (ret == TASK_ID_ERROR) + ACE_VX_TASK_ID const ret = ::taskSpawn (argv[0], // task name + prio==0 ? 100 : prio, // task priority + opt==0 ? VX_FP_TASK : opt, // task options + stacksz==0 ? ACE_NEEDS_HUGE_THREAD_STACKSIZE : stacksz, // stack size + (FUNCPTR)_vx_call_entry, // entrypoint caller + (ACE_VX_USR_ARG_T)entry, // entry point + argc, // first argument to main () + (ACE_VX_USR_ARG_T) argv, // second argument to main () + 0, 0, 0, 0, 0, 0, 0); + + if (ret == ACE_VX_TASK_ID_ERROR) return 255; while( ret > 0 && ::taskIdVerify (ret) != ERROR ) diff --git a/ACE/ace/OS_NS_Thread.h b/ACE/ace/OS_NS_Thread.h index f3176c82396..ce79d69198d 100644 --- a/ACE/ace/OS_NS_Thread.h +++ b/ACE/ace/OS_NS_Thread.h @@ -229,8 +229,8 @@ typedef struct char *name_; } ACE_sema_t; # endif /* !ACE_HAS_POSIX_SEM */ -typedef TASK_ID ACE_thread_t; -typedef TASK_ID ACE_hthread_t; +typedef ACE_VX_TASK_ID ACE_thread_t; +typedef ACE_VX_TASK_ID ACE_hthread_t; // Key type: the ACE TSS emulation requires the key type be unsigned, // for efficiency. (Current POSIX and Solaris TSS implementations also // use u_int, so the ACE TSS emulation is compatible with them.) diff --git a/ACE/ace/config-vxworks.h b/ACE/ace/config-vxworks.h index e45e05ec0f4..4be30a027a8 100644 --- a/ACE/ace/config-vxworks.h +++ b/ACE/ace/config-vxworks.h @@ -56,15 +56,19 @@ // Adapt to system argument changes added at VxWorks 6.9 and 64-bit. #if (ACE_VXWORKS < 0x690) -typedef int ACE_VX_USR_ARG_T; + typedef int ACE_VX_USR_ARG_T; + typedef int ACE_VX_TASK_ID # define ACE_VX_ARG_FORMAT "%x" +# define ACE_VX_TASK_ID_ERROR ERROR #else -typedef _Vx_usr_arg_t ACE_VX_USR_ARG_T; + typedef _Vx_usr_arg_t ACE_VX_USR_ARG_T; + typedef TASK_ID ACE_VX_TASK_ID # ifdef _WRS_CONFIG_LP64 # define ACE_VX_ARG_FORMAT "%lx" # else # define ACE_VX_ARG_FORMAT "%x" # endif +# define ACE_VX_TASK_ID_ERROR TASK_ID_ERROR #endif #include /**/ "ace/post.h" -- cgit v1.2.1 From 4d3d640b33043b409cf73db1bd51574f43eefaa1 Mon Sep 17 00:00:00 2001 From: Steve Huston Date: Fri, 27 Feb 2015 15:35:43 -0500 Subject: Adjust sprintf format for 64-bit differences. --- ACE/ace/Stack_Trace.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ACE/ace/Stack_Trace.cpp b/ACE/ace/Stack_Trace.cpp index ae1437107b3..9836a0e1f8a 100644 --- a/ACE/ace/Stack_Trace.cpp +++ b/ACE/ace/Stack_Trace.cpp @@ -157,7 +157,7 @@ ACE_Stack_Trace_Add_Frame_To_Buf (INSTR *caller, { if (i != 0) len += ACE_OS::sprintf (&buf[len], ", "); - len += ACE_OS::sprintf(&buf [len], "%#lx", (long)args [i]); + len += ACE_OS::sprintf(&buf[len], "0x" ACE_VX_ARG_FORMAT, args[i]); } len += ACE_OS::sprintf(&buf[len], ")\n"); -- cgit v1.2.1 From 277de4b2774b2db2194682475abb7e8be542bff1 Mon Sep 17 00:00:00 2001 From: Steve Huston Date: Fri, 27 Feb 2015 16:40:13 -0500 Subject: Change from using typedef to macro definitions because the needed system header(s) are not always included and including them here would add unnecessary build time. --- ACE/ace/config-vxworks.h | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/ACE/ace/config-vxworks.h b/ACE/ace/config-vxworks.h index 4be30a027a8..9d0ea65e25c 100644 --- a/ACE/ace/config-vxworks.h +++ b/ACE/ace/config-vxworks.h @@ -55,20 +55,22 @@ #endif // Adapt to system argument changes added at VxWorks 6.9 and 64-bit. +// It would be nicer to typedef the data types, but without including the +// applicable VxWorks headers here, that doesn't work. #if (ACE_VXWORKS < 0x690) - typedef int ACE_VX_USR_ARG_T; - typedef int ACE_VX_TASK_ID -# define ACE_VX_ARG_FORMAT "%x" -# define ACE_VX_TASK_ID_ERROR ERROR -#else - typedef _Vx_usr_arg_t ACE_VX_USR_ARG_T; - typedef TASK_ID ACE_VX_TASK_ID -# ifdef _WRS_CONFIG_LP64 -# define ACE_VX_ARG_FORMAT "%lx" -# else +# define ACE_VX_USR_ARG_T int +# define ACE_VX_TASK_ID int # define ACE_VX_ARG_FORMAT "%x" -# endif -# define ACE_VX_TASK_ID_ERROR TASK_ID_ERROR +# define ACE_VX_TASK_ID_ERROR ERROR +#else +# define ACE_VX_USR_ARG_T _Vx_usr_arg_t +# define ACE_VX_TASK_ID TASK_ID +# ifdef _WRS_CONFIG_LP64 +# define ACE_VX_ARG_FORMAT "%lx" +# else +# define ACE_VX_ARG_FORMAT "%x" +# endif +# define ACE_VX_TASK_ID_ERROR TASK_ID_ERROR #endif #include /**/ "ace/post.h" -- cgit v1.2.1 From 15d86a8c55ffa5bf9303fc878a054cb9a0cef956 Mon Sep 17 00:00:00 2001 From: Steve Huston Date: Mon, 2 Mar 2015 11:21:08 -0500 Subject: Correct VxWorks type usage on kill() --- ACE/ace/OS_NS_signal.inl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ACE/ace/OS_NS_signal.inl b/ACE/ace/OS_NS_signal.inl index 087dbbf25da..2872f27439a 100644 --- a/ACE/ace/OS_NS_signal.inl +++ b/ACE/ace/OS_NS_signal.inl @@ -22,7 +22,7 @@ kill (pid_t pid, int signum) * This only becomes an issue when using the 64bit compiler * as the TASK_ID is no longer defined as an int. */ - ACE_OSCALL_RETURN (::kill ((TASK_ID)pid, signum), int, -1); + ACE_OSCALL_RETURN (::kill ((ACE_VX_TASK_ID)pid, signum), int, -1); #else ACE_OSCALL_RETURN (::kill (pid, signum), int, -1); #endif /* ACE_LACKS_KILL */ -- cgit v1.2.1