summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog-99b18
-rw-r--r--ace/Log_Msg.cpp4
-rw-r--r--ace/Malloc.cpp12
-rw-r--r--ace/OS.cpp96
-rw-r--r--ace/OS.h18
-rw-r--r--ace/OS.i94
-rw-r--r--ace/Process_Manager.cpp4
-rw-r--r--ace/SOCK_Dgram_Mcast.cpp35
-rw-r--r--ace/Service_Config.cpp9
-rw-r--r--ace/Service_Config.h18
-rw-r--r--ace/Task.cpp4
-rw-r--r--ace/Thread.i61
-rw-r--r--ace/Thread_Manager.cpp11
-rw-r--r--ace/Thread_Manager.h11
-rw-r--r--ace/config-psos-diab-ppc.h35
15 files changed, 332 insertions, 98 deletions
diff --git a/ChangeLog-99b b/ChangeLog-99b
index 0a0447755ef..1e9f1ada298 100644
--- a/ChangeLog-99b
+++ b/ChangeLog-99b
@@ -1,3 +1,21 @@
+Tue Dec 28 15:37:11 1999 Chris Gill <cdgill@cs.wustl.edu>
+
+ * ace/Log_Msg.cpp
+ ace/Malloc.cpp
+ ace/OS.{cpp, h, i}
+ ace/Process_Manager.cpp
+ ace/SOCK_Dgram_Mcast.cpp
+ ace/Service_Config.{cpp, h}
+ ace/Task.cpp
+ ace/Thread.i
+ ace/Thread_Manager.{cpp, h}
+
+ ace/config-psos-diab-ppc.h: merged in changes for pSOS (Diab PPC)
+ to support additional pHILE+ file system capabilities, and to deal
+ with the limitations on sharing file and socket handles across pSOS
+ tasks. Thanks to Sarmeesha Reddy and Steve Tine of Motorola for
+ contributing these changes to ACE.
+
Tue Dec 28 15:32:55 1999 David L. Levine <levine@cs.wustl.edu>
* tests/Makefile: build libDLL_Test.so before building
diff --git a/ace/Log_Msg.cpp b/ace/Log_Msg.cpp
index 07952b08f50..83ca4802dbd 100644
--- a/ace/Log_Msg.cpp
+++ b/ace/Log_Msg.cpp
@@ -868,7 +868,7 @@ ACE_Log_Msg::log (const ASYS_TCHAR *format_str,
// PharLap can't do FormatMessage, so try for socket
// error.
# if !defined (ACE_HAS_PHARLAP)
- ::FormatMessage (FORMAT_MESSAGE_ALLOCATE_BUFFER
+ ::FormatMessage (FORMAT_MESSAGE_ALLOCATE_BUFFER
| FORMAT_MESSAGE_MAX_WIDTH_MASK
| FORMAT_MESSAGE_FROM_SYSTEM,
NULL,
@@ -932,7 +932,7 @@ ACE_Log_Msg::log (const ASYS_TCHAR *format_str,
// PharLap can't do FormatMessage, so try for socket
// error.
# if !defined (ACE_HAS_PHARLAP)
- ::FormatMessage (FORMAT_MESSAGE_ALLOCATE_BUFFER
+ ::FormatMessage (FORMAT_MESSAGE_ALLOCATE_BUFFER
| FORMAT_MESSAGE_MAX_WIDTH_MASK
| FORMAT_MESSAGE_FROM_SYSTEM,
NULL,
diff --git a/ace/Malloc.cpp b/ace/Malloc.cpp
index cd813118646..bbda6a9be22 100644
--- a/ace/Malloc.cpp
+++ b/ace/Malloc.cpp
@@ -117,7 +117,9 @@ ACE_Control_Block::ACE_Name_Node::ACE_Name_Node (const char *name,
ACE_Control_Block::ACE_Name_Node::ACE_Name_Node (const ACE_Name_Node &)
{
ACE_TRACE ("ACE_Name_Node::ACE_Name_Node");
- ACE_ASSERT (!"not implemented!");
+#if !defined (ACE_PSOS)
+ ACE_ASSERT (0 == "not implemented!");
+#endif /* ! ACE_PSOS */
}
const char *
@@ -130,7 +132,9 @@ ACE_Control_Block::ACE_Name_Node::name (void) const
void
ACE_Control_Block::ACE_Name_Node::name (const char *)
{
- ACE_ASSERT (!"not implemented yet");
+#if !defined (ACE_PSOS)
+ ACE_ASSERT (0 == "not implemented!");
+#endif /* ! ACE_PSOS */
}
ACE_Control_Block::ACE_Malloc_Header::ACE_Malloc_Header (void)
@@ -250,7 +254,7 @@ ACE_PI_Control_Block::ACE_Name_Node::ACE_Name_Node (const char *name,
ACE_PI_Control_Block::ACE_Name_Node::ACE_Name_Node (const ACE_Name_Node &)
{
ACE_TRACE ("ACE_Name_Node::ACE_Name_Node");
- ACE_ASSERT (!"not implemented!");
+ ACE_ASSERT (0 == "not implemented!");
}
const char *
@@ -263,7 +267,7 @@ ACE_PI_Control_Block::ACE_Name_Node::name (void) const
void
ACE_PI_Control_Block::ACE_Name_Node::name (const char *)
{
- ACE_ASSERT (!"not implemented yet");
+ ACE_ASSERT (0 == "not implemented yet");
}
ACE_PI_Control_Block::ACE_Malloc_Header::ACE_Malloc_Header (void)
diff --git a/ace/OS.cpp b/ace/OS.cpp
index a87f1edd7eb..0c5da4b59d7 100644
--- a/ace/OS.cpp
+++ b/ace/OS.cpp
@@ -4,6 +4,14 @@
#include "ace/OS.h"
#include "ace/Sched_Params.h"
+#if defined (ACE_THREADS_DONT_INHERIT_LOG_MSG) || \
+ defined (ACE_HAS_MINIMAL_ACE_OS)
+# if defined (ACE_PSOS)
+// Unique file identifier
+int unique_file_id=0;
+# endif /* ACE_PSOS */
+#endif /* ACE_THREADS_DONT_INHERIT_LOG_MSG) || ACE_HAS_MINIMAL_ACE_OS */
+
// Perhaps we should *always* include ace/OS.i in order to make sure
// we can always link against the OS symbols?
#if !defined (ACE_HAS_INLINED_OSCALLS)
@@ -2395,6 +2403,19 @@ ACE_Thread_Adapter::inherit_log_msg (void)
// Block the thread from proceeding until
// thread manager has thread descriptor ready.
+# else /* Don't inherit Log Msg */
+# if defined (ACE_PSOS)
+ //Create a special name for each thread...
+ char new_name[MAXPATHLEN]={"Ace_thread-"};
+ char new_id[2]={0,0}; //Now it's pre-terminated!
+
+ new_id[0] = '0' + (unique_file_id++); //Unique identifier
+ ACE_OS::strcat(new_name, new_id);
+
+ //Initialize the task specific logger
+ ACE_LOG_MSG->open(new_name);
+ ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("(%P|%t) starting %s thread at %D\n"),new_name));
+# endif /* ACE_PSOS */
#endif /* ! ACE_THREADS_DONT_INHERIT_LOG_MSG && ! ACE_HAS_MINIMAL_ACE_OS */
}
@@ -2473,6 +2494,7 @@ ACE_Thread_Adapter::invoke (void)
ACE_THR_FUNC_INTERNAL func = ACE_reinterpret_cast (ACE_THR_FUNC_INTERNAL,
this->user_func_);
void *arg = this->arg_;
+
#if defined (ACE_WIN32) && defined (ACE_HAS_MFC) && (ACE_HAS_MFC != 0)
ACE_OS_Thread_Descriptor *thr_desc = this->thr_desc_;
#endif /* ACE_WIN32 && ACE_HAS_MFC && (ACE_HAS_MFC != 0) */
@@ -2514,11 +2536,16 @@ ACE_Thread_Adapter::invoke (void)
status = hook->start (ACE_reinterpret_cast (ACE_THR_FUNC, func),
arg);
else
- // Call thread entry point.
- status = ACE_reinterpret_cast (void *, (*func) (arg));
-
+ {
+ // Call thread entry point.
+#if defined (ACE_PSOS)
+ (*func) (arg);
+#else /* ! ACE_PSOS */
+ status = ACE_reinterpret_cast (void *, (*func) (arg));
+#endif /* ACE_PSOS */
+ }
#if defined (ACE_PSOS)
- // pSOS thread functions do not return a value.
+ // pSOS task functions do not return a value.
status = 0;
#endif /* ACE_PSOS */
}
@@ -2624,8 +2651,12 @@ ace_cleanup_destroyer (ACE_Cleanup *object, void *param)
// Run the thread entry point for the <ACE_Thread_Adapter>. This must
// be an extern "C" to make certain compilers happy...
+#if defined (ACE_PSOS)
+extern "C" void ace_thread_adapter (unsigned long args)
+#else /* ! defined (ACE_PSOS) */
extern "C" void *
ace_thread_adapter (void *args)
+#endif /* ACE_PSOS */
{
ACE_TRACE ("ace_thread_adapter");
@@ -2642,9 +2673,12 @@ ace_thread_adapter (void *args)
// Invoke the user-supplied function with the args.
void *status = thread_args->invoke ();
+#if ! defined (ACE_PSOS)
return status;
+#endif /* ACE_PSOS */
}
+
ACE_Thread_Adapter::ACE_Thread_Adapter (ACE_THR_FUNC user_func,
void *arg,
ACE_THR_C_FUNC entry_point,
@@ -3388,6 +3422,10 @@ ACE_OS::thr_create (ACE_THR_FUNC func,
priority = PSOS_TASK_MAX_PRIORITY;
}
+ // set the stacksize to a default value if no size is specified
+ if (stacksize == 0)
+ stacksize = ACE_PSOS_DEFAULT_STACK_SIZE;
+
ACE_hthread_t tid;
*thr_handle = 0;
@@ -3399,9 +3437,9 @@ ACE_OS::thr_create (ACE_THR_FUNC func,
T_LOCAL, // local to the pSOS+ node (does not support pSOS+m)
&tid) // receives task id
!= 0)
- {
- return -1;
- }
+ {
+ return -1;
+ }
// pSOS tasks are passed an array of 4 u_longs
u_long targs[4];
@@ -3413,7 +3451,8 @@ ACE_OS::thr_create (ACE_THR_FUNC func,
// start the thread
if (t_start (tid,
T_PREEMPT | // Task can be preempted
- T_NOTSLICE | // Task is not timesliced with other tasks at same priority
+// T_NOTSLICE | // Task is not timesliced with other tasks at same priority
+ T_TSLICE | // Task is timesliced with other tasks at same priority
T_NOASR | // Task level signals disabled
T_SUPV | // Task runs strictly in supervisor mode
T_ISR, // Hardware interrupts are enabled
@@ -4276,6 +4315,9 @@ ACE_OS::read_n (ACE_HANDLE handle,
return bytes_transferred;
}
+// Write <len> bytes from <buf> to <handle> (uses the <write>
+// system call on UNIX and the <WriteFile> call on Win32).
+
ssize_t
ACE_OS::write_n (ACE_HANDLE handle,
const void *buf,
@@ -5094,7 +5136,6 @@ ACE_OS::open (const char *filename,
else
return h;
#elif defined (ACE_PSOS)
- ACE_UNUSED_ARG (mode);
ACE_UNUSED_ARG (perms);
ACE_UNUSED_ARG (sa);
# if defined (ACE_PSOS_LACKS_PHILE)
@@ -5105,8 +5146,32 @@ ACE_OS::open (const char *filename,
result = ::open_f (&handle, ACE_const_cast(char *, filename), 0);
if (result != 0)
{
- errno = result;
- return ACE_static_cast (ACE_HANDLE, -1);
+ // We need to clean this up...not 100% correct!
+ // To correct we should handle all the cases of TRUNC and CREAT
+ if ((result == 0x200B) && (ACE_BIT_ENABLED (mode, O_CREAT)))
+ {
+ result = ::create_f(ACE_const_cast(char *, filename),1,0);
+ if (result != 0)
+ {
+ errno = result;
+ return ACE_static_cast (ACE_HANDLE, -1);
+ }
+ else //File created...try to open it again
+ {
+ result = ::open_f (&handle, ACE_const_cast(char *, filename), 0);
+ if (result != 0)
+ {
+ errno = result;
+ return ACE_static_cast (ACE_HANDLE, -1);
+ }
+
+ }
+ }
+ else
+ {
+ errno = result;
+ return ACE_static_cast (ACE_HANDLE, -1);
+ }
}
return ACE_static_cast (ACE_HANDLE, handle);
# endif /* defined (ACE_PSOS_LACKS_PHILE) */
@@ -5805,7 +5870,11 @@ ACE_OS::cond_timedwait (ACE_cond_t *cv,
// Inline the call to ACE_OS::sema_wait () because it takes an
// ACE_Time_Value argument. Avoid the cost of that conversion . . .
u_long ticks = (KC_TICKS2SEC * msec_timeout) / ACE_ONE_SECOND_IN_MSECS;
- result = ::sm_p (cv->sema_.sema_, SM_WAIT, ticks);
+ //Tick set to 0 tells pSOS to wait forever is SM_WAIT is set.
+ if(ticks == 0)
+ result = ::sm_p (cv->sema_.sema_, SM_NOWAIT, ticks); //no timeout
+ else
+ result = ::sm_p (cv->sema_.sema_, SM_WAIT, ticks);
# elif defined (VXWORKS)
// Inline the call to ACE_OS::sema_wait () because it takes an
// ACE_Time_Value argument. Avoid the cost of that conversion . . .
@@ -5842,7 +5911,8 @@ ACE_OS::cond_timedwait (ACE_cond_t *cv,
{
switch (result)
{
- case ERR_TIMEOUT:
+ case ERR_TIMEOUT: // Timeout occured with SM_WAIT
+ case ERR_NOMSG: // Didn't acquire semaphore w/ SM_NOWAIT (ticks=0)
error = ETIME;
break;
default:
diff --git a/ace/OS.h b/ace/OS.h
index 3c02f056be5..425b422e331 100644
--- a/ace/OS.h
+++ b/ace/OS.h
@@ -2836,12 +2836,12 @@ typedef unsigned int size_t;
# if defined (ACE_PSOS_SNARFS_HEADER_INFO)
// Header information snarfed from compiler provided header files
// that are not included because there is already an identically
- // named file provided with pSOS, which does not have this info from
- // compiler supplied stdio.h.
- extern FILE *fdopen (int, const char *);
- extern int getopt (int, char *const *, const char *);
- extern char *tempnam (const char *, const char *);
- extern "C" int fileno (FILE *);
+ // named file provided with pSOS, which does not have this info
+ // from compiler supplied stdio.h
+ extern FILE *fdopen(int, const char *);
+ extern int getopt(int, char *const *, const char *);
+ extern char *tempnam(const char *, const char *);
+ extern "C" int fileno(FILE *);
// #define fileno(stream) ((stream)->_file)
@@ -4545,6 +4545,7 @@ typedef const char **SYS_SIGLIST;
typedef void *(*ACE_THR_FUNC)(void *);
// This is for C++ static methods.
# if defined (VXWORKS)
+typedef int ACE_THR_FUNC_INTERNAL_RETURN_TYPE;
typedef FUNCPTR ACE_THR_FUNC_INTERNAL; // where typedef int (*FUNCPTR) (...)
# elif defined (ACE_PSOS)
typedef void (*ACE_THR_FUNC_INTERNAL)(void *);
@@ -4862,7 +4863,11 @@ private:
// Run the thread entry point for the <ACE_Thread_Adapter>. This must
// be an extern "C" to make certain compilers happy...
+#if defined (ACE_PSOS)
+extern "C" void ace_thread_adapter (unsigned long args);
+#else /* ! defined (ACE_PSOS) */
extern "C" ACE_Export void *ace_thread_adapter (void *args);
+#endif /* ACE_PSOS */
class ACE_OS_Thread_Descriptor
{
@@ -6401,6 +6406,7 @@ public:
static ACE_HANDLE socket (int protocol_family,
int type,
int proto);
+
// Create a BSD-style socket (no QoS).
static ACE_HANDLE socket (int protocol_family,
int type,
diff --git a/ace/OS.i b/ace/OS.i
index 97f538784e0..7b745557438 100644
--- a/ace/OS.i
+++ b/ace/OS.i
@@ -1464,7 +1464,12 @@ ACE_OS::strnchr (const char *s, int c, size_t len)
ACE_INLINE char *
ACE_OS::strnchr (char *s, int c, size_t len)
{
+#if defined ACE_PSOS_DIAB_PPC //Complier problem Diab 4.2b
+ const char *const_char_s=s;
+ return (char *) ACE_OS::strnchr (const_char_s, c, len);
+#else
return (char *) ACE_OS::strnchr ((const char *) s, c, len);
+#endif
}
ACE_INLINE const char *
@@ -1514,7 +1519,12 @@ ACE_OS::strnstr (const char *s1, const char *s2, size_t len2)
ACE_INLINE char *
ACE_OS::strnstr (char *s, const char *t, size_t len)
{
+#if defined ACE_PSOS_DIAB_PPC //Complier problem Diab 4.2b
+ const char *const_char_s=s;
+ return (char *) ACE_OS::strnstr (const_char_s, t, len);
+#else
return (char *) ACE_OS::strnstr ((const char *) s, t, len);
+#endif
}
ACE_INLINE char *
@@ -3372,15 +3382,14 @@ ACE_OS::sema_init (ACE_sema_t *s,
return result;
# endif /* ACE_USES_WINCE_SEMA_SIMULATION */
# elif defined (ACE_PSOS)
- int result;
+ u_long result;
ACE_OS::memcpy (s->name_, name, sizeof (s->name_));
// default semaphore creation flags to priority based, global across nodes
u_long flags = 0;
flags |= (type & SM_LOCAL) ? SM_LOCAL : SM_GLOBAL;
flags |= (type & SM_FIFO) ? SM_FIFO : SM_PRIOR;
- ACE_OSCALL (ACE_ADAPT_RETVAL (::sm_create (s->name_, count, flags, &(s->sema_)),
- result), int, -1, result);
- return result;
+ result = ::sm_create (s->name_, count, flags, &(s->sema_));
+ return (result == 0) ? 0 : -1;
# elif defined (VXWORKS)
ACE_UNUSED_ARG (name);
ACE_UNUSED_ARG (arg);
@@ -3388,7 +3397,6 @@ ACE_OS::sema_init (ACE_sema_t *s,
ACE_UNUSED_ARG (sa);
s->name_ = 0;
s->sema_ = ::semCCreate (type, count);
-
return s->sema_ ? 0 : -1;
# endif /* ACE_HAS_STHREADS */
# else
@@ -3867,7 +3875,10 @@ ACE_OS::sema_wait (ACE_sema_t *s, ACE_Time_Value &tv)
u_long ticks = relative_time.sec() * KC_TICKS2SEC +
relative_time.usec () * KC_TICKS2SEC /
ACE_ONE_SECOND_IN_USECS;
- ACE_OSCALL_RETURN (::sm_p (s->sema_, SM_WAIT, ticks), int, -1);
+ if(ticks == 0)
+ ACE_OSCALL_RETURN (::sm_p (s->sema_, SM_NOWAIT, 0), int, -1); //no timeout
+ else
+ ACE_OSCALL_RETURN (::sm_p (s->sema_, SM_WAIT, ticks), int, -1);
# elif defined (VXWORKS)
// Note that we must convert between absolute time (which is
// passed as a parameter) and relative time (which is what
@@ -5336,32 +5347,32 @@ ACE_OS::ioctl (ACE_HANDLE socket,
NULL,
NULL);
-
+
if (result == SOCKET_ERROR)
{
u_long dwErr = ::WSAGetLastError ();
-
+
if (dwErr == WSAEWOULDBLOCK)
{
errno = dwErr;
- return -1;
- }
+ return -1;
+ }
else
if (dwErr != WSAENOBUFS)
{
errno = dwErr;
return -1;
}
- }
-
+ }
+
char *qos_buf;
ACE_NEW_RETURN (qos_buf,
char [dwBufferLen],
-1);
QOS *qos = ACE_reinterpret_cast (QOS*,
- qos_buf);
-
+ qos_buf);
+
result = ::WSAIoctl ((ACE_SOCKET) socket,
io_control_code,
NULL,
@@ -5412,7 +5423,7 @@ ACE_OS::ioctl (ACE_HANDLE socket,
ace_qos.sending_flowspec (sending_flowspec);
ace_qos.receiving_flowspec (receiving_flowspec);
ace_qos.provider_specific (*((struct iovec *) (&qos->ProviderSpecific)));
-
+
return result;
}
@@ -8330,6 +8341,8 @@ ACE_OS::closesocket (ACE_HANDLE handle)
ACE_TRACE ("ACE_OS::close");
#if defined (ACE_WIN32)
ACE_SOCKCALL_RETURN (::closesocket ((SOCKET) handle), int, -1);
+#elif defined (ACE_PSOS_DIAB_PPC)
+ ACE_OSCALL_RETURN (::pna_close (handle), int, -1);
#else
ACE_OSCALL_RETURN (::close (handle), int, -1);
#endif /* ACE_WIN32 */
@@ -8827,7 +8840,10 @@ ACE_OS::write (ACE_HANDLE handle, const void *buf, size_t nbyte)
ACE_UNUSED_ARG (nbyte);
ACE_NOTSUP_RETURN (-1);
# else
- ACE_OSCALL_RETURN (::write_f (handle, buf, nbyte), ssize_t, -1);
+ if(::write_f(handle, (void *) buf, nbyte) == 0)
+ return (ssize_t) nbyte;
+ else
+ return -1;
# endif /* defined (ACE_PSOS_LACKS_PHILE) */
#else
# if defined (ACE_LACKS_POSIX_PROTOTYPES)
@@ -10915,7 +10931,41 @@ ACE_OS::mkdir (const char *path, mode_t mode)
ACE_UNUSED_ARG (mode);
ACE_NOTSUP_RETURN (-1);
# elif defined (ACE_PSOS)
- ACE_OSCALL_RETURN (::make_dir ((char *) path, mode), int, -1);
+ //The pSOS make_dir fails if the last character is a '/'
+ int location;
+ char *phile_path;
+
+ phile_path = (char *)ACE_OS::malloc(strlen(path));
+ if (phile_path == 0)
+ {
+ ACE_OS::printf ("malloc in make_dir failed: [%X]\n", errno);
+ return -1;
+ }
+ else
+ {
+ ACE_OS::strcpy (phile_path, path);
+ }
+
+ location = ACE_OS::strlen(phile_path);
+ if(phile_path[location-1] == '/')
+ {
+ phile_path[location-1] = 0;
+ }
+
+ u_long result;
+ result = ::make_dir ((char *) phile_path, mode);
+ if (result == 0x2011) // Directory already exists
+ {
+ result = 0;
+ }
+ else if (result != 0)
+ {
+ result = -1;
+ }
+
+ ACE_OS::free(phile_path);
+ return result;
+
# elif defined (VXWORKS)
ACE_UNUSED_ARG (mode);
ACE_OSCALL_RETURN (::mkdir ((char *) path), int, -1);
@@ -11243,7 +11293,12 @@ ACE_OS::strchr (wchar_t *s, wint_t c)
ACE_INLINE wchar_t *
ACE_OS::strnchr (wchar_t *s, wint_t c, size_t len)
{
+#if defined ACE_PSOS_DIAB_PPC //Complier problem Diab 4.2b
+ const wchar_t *const_wchar_s=s;
+ return (wchar_t *) ACE_OS::strnchr (const_wchar_s, c, len);
+#else
return (wchar_t *) ACE_OS::strnchr ((const wchar_t *) s, c, len);
+#endif
}
ACE_INLINE wchar_t *
@@ -11442,7 +11497,12 @@ ACE_OS::strnstr (const wchar_t *s1, const wchar_t *s2, size_t len2)
ACE_INLINE wchar_t *
ACE_OS::strnstr (wchar_t *s, const wchar_t *t, size_t len)
{
+#if defined ACE_PSOS_DIAB_PPC //Complier problem Diab 4.2b
+ const wchar_t *const_wchar_s=s;
+ return (wchar_t *) ACE_OS::strnstr (const_wchar_s, t, len);
+#else
return (wchar_t *) ACE_OS::strnstr ((const wchar_t *) s, t, len);
+#endif
}
ACE_INLINE wchar_t *
diff --git a/ace/Process_Manager.cpp b/ace/Process_Manager.cpp
index f6c2a3637b1..5d5d14ea1c9 100644
--- a/ace/Process_Manager.cpp
+++ b/ace/Process_Manager.cpp
@@ -180,7 +180,7 @@ ACE_Process_Manager::open (size_t size,
if (r)
{
ACE_Event_Handler::reactor (r);
-#if !defined(ACE_WIN32)
+#if !defined(ACE_WIN32) && !defined (ACE_PSOS)
// (No signals for child-exited on Win32) Assign the
// Process_Manager a dummy I/O descriptor. Note that even
// though we open this file "Write Only" we still need to use
@@ -210,7 +210,7 @@ ACE_Process_Manager::open (size_t size,
"%p\n%a",
"register_handler",
1));
-#endif // !defined(ACE_WIN32)
+#endif // !defined(ACE_WIN32) && !defined (ACE_PSOS)
}
ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1));
diff --git a/ace/SOCK_Dgram_Mcast.cpp b/ace/SOCK_Dgram_Mcast.cpp
index 91be405541f..925cdf74c11 100644
--- a/ace/SOCK_Dgram_Mcast.cpp
+++ b/ace/SOCK_Dgram_Mcast.cpp
@@ -8,6 +8,12 @@
#include "ace/SOCK_Dgram_Mcast.i"
#endif /* ACE_LACKS_INLINE_FUNCTIONS */
+// This is a workaround for platforms with non-standard
+// definitions of the ip_mreq structure
+#if ! defined (IMR_MULTIADDR)
+#define IMR_MULTIADDR imr_multiaddr
+#endif /* ! defined (IMR_MULTIADDR) */
+
ACE_RCSID(ace, SOCK_Dgram_Mcast, "$Id$")
ACE_ALLOC_HOOK_DEFINE(ACE_SOCK_Dgram_Mcast)
@@ -405,15 +411,15 @@ ACE_SOCK_Dgram_Mcast::subscribe (const ACE_INET_Addr &mcast_addr,
// Check for the "short-circuit" return value of 1 (for NT).
if (result != 0)
return result;
-
+
// Tell network device driver to read datagrams with a
// <mcast_request_if_> IP interface.
- else
+ else
{
- // Check if the mcast_addr passed into this method is the
- // same as the QoS session address.
+ // Check if the mcast_addr passed into this method is the
+ // same as the QoS session address.
if (mcast_addr == qos_session->dest_addr ())
-
+
// Subscribe to the QoS session.
if (this->join_qos_session (qos_session) == -1)
ACE_ERROR_RETURN ((LM_ERROR,
@@ -424,14 +430,15 @@ ACE_SOCK_Dgram_Mcast::subscribe (const ACE_INET_Addr &mcast_addr,
"Dest Addr in the QoS Session does"
" not match the address passed into"
" subscribe\n"),
- -1);
-
+ -1);
+
sockaddr_in mult_addr;
-
+
mult_addr.sin_family = protocolinfo->iAddressFamily;
mult_addr.sin_port = ACE_HTONS (mcast_addr.get_port_number ());
- mult_addr.sin_addr = this->mcast_request_if_.imr_multiaddr;
-
+
+ mult_addr.sin_addr = this->mcast_request_if_.IMR_MULTIADDR;
+
if (ACE_OS::join_leaf (this->get_handle (),
ACE_reinterpret_cast (const sockaddr *,
&mult_addr),
@@ -440,7 +447,7 @@ ACE_SOCK_Dgram_Mcast::subscribe (const ACE_INET_Addr &mcast_addr,
return -1;
else
qos_session->qos (*(qos_params.socket_qos ()));
-
+
return 0;
}
}
@@ -608,11 +615,7 @@ ACE_SOCK_Dgram_Mcast::make_multicast_address_i (const ACE_INET_Addr &mcast_addr,
else
multicast_address.imr_interface.s_addr = INADDR_ANY;
-#if defined (ACE_PSOS) && !defined (ACE_PSOS_TM) && !defined (ACE_PSOS_DIAB_MIPS)
- multicast_address.imr_mcastaddr.s_addr = htonl (mcast_addr.get_ip_address());
-#else
- multicast_address.imr_multiaddr.s_addr = htonl (mcast_addr.get_ip_address ());
-#endif /* defined (ACE_PSOS) */
+ multicast_address.IMR_MULTIADDR.s_addr = htonl (mcast_addr.get_ip_address ());
return 0;
}
diff --git a/ace/Service_Config.cpp b/ace/Service_Config.cpp
index d27e5b856a3..afcd273306e 100644
--- a/ace/Service_Config.cpp
+++ b/ace/Service_Config.cpp
@@ -125,15 +125,22 @@ ACE_Thread_Manager *
ACE_Service_Config::thr_mgr (void)
{
ACE_TRACE ("ACE_Service_Config::thr_mgr");
+
+#if defined (ACE_THREAD_MANAGER_LACKS_STATICS)
+ return ACE_THREAD_MANAGER_SINGLETON::instance ();
+#else /* ! ACE_THREAD_MANAGER_LACKS_STATICS */
return ACE_Thread_Manager::instance ();
+#endif /* ACE_THREAD_MANAGER_LACKS_STATICS */
}
+#if ! defined (ACE_THREAD_MANAGER_LACKS_STATICS)
ACE_Thread_Manager *
ACE_Service_Config::thr_mgr (ACE_Thread_Manager *tm)
{
ACE_TRACE ("ACE_Service_Config::thr_mgr");
return ACE_Thread_Manager::instance (tm);
}
+#endif /* ! ACE_THREAD_MANAGER_LACKS_STATICS */
// Totally remove <svc_name> from the daemon by removing it from the
// ACE_Reactor, and unlinking it if necessary.
@@ -818,7 +825,9 @@ ACE_Service_Config::close_singletons (void)
#if !defined (ACE_HAS_WINCE)
ACE_Proactor::close_singleton ();
#endif /* !ACE_HAS_WINCE */
+#if ! defined (ACE_THREAD_MANAGER_LACKS_STATICS)
ACE_Thread_Manager::close_singleton ();
+#endif /* ! ACE_THREAD_MANAGER_LACKS_STATICS */
return 0;
}
diff --git a/ace/Service_Config.h b/ace/Service_Config.h
index 159a484c52d..233634957fc 100644
--- a/ace/Service_Config.h
+++ b/ace/Service_Config.h
@@ -102,7 +102,7 @@ class ACE_Export ACE_Service_Config
// not eliminated, by _not_ #defining
// ACE_HAS_NONSTATIC_OBJECT_MANAGER.
public:
- enum
+ enum
{
MAX_SERVICES = ACE_DEFAULT_SERVICE_REPOSITORY_SIZE
};
@@ -261,11 +261,13 @@ public:
// DO NOT USE THIS METHOD. It may be unsupported in future releases.
// Use <ACE_Thread_Manager::instance> instead.
+#if ! defined (ACE_THREAD_MANAGER_LACKS_STATICS)
static ACE_Thread_Manager *thr_mgr (ACE_Thread_Manager *);
// Set pointer to a process-wide <ACE_Thread_Manager> and return
// existing pointer.
// DO NOT USE THIS METHOD. It may be unsupported in future releases.
- // Use <ACE_Thread_Manager::instance> instead.
+ // Use ACE_Thread_Manager::instance() instead.
+#endif /* ! defined (ACE_THREAD_MANAGER_LACKS_STATICS) */
static ACE_Allocator *alloc (void);
// Get pointer to a default <ACE_Allocator>.
@@ -349,6 +351,18 @@ protected:
// Handle the command-line options intended for the
// <ACE_Service_Config>. Note that <argv[0]> is assumed to be the
// program name.
+ // The arguments that are valid in a call to this method are
+ // '-b' - Option to indicate that we should be a daemon
+ // '-d' - Turn on debugging mode
+ // '-f' - Option to read in the list of svc.conf file names
+ // '-k' - Option to read a wide string where in the logger output can
+ // be written
+ // '-y' - Turn on the flag for a repository of statically
+ // linked services
+ // '-n' - Need not have a repository of statically linked services
+ // '-S' - Option to read in the list of services on the command-line
+ // Please observe the difference between options '-f' that looks
+ // for a list of files and here a list of services.
static int start_daemon (void);
// Become a daemon.
diff --git a/ace/Task.cpp b/ace/Task.cpp
index fbbc7678914..20f4d7d5595 100644
--- a/ace/Task.cpp
+++ b/ace/Task.cpp
@@ -99,7 +99,11 @@ ACE_Task_Base::activate (long flags,
// active object and the caller didn't supply us with a
// Thread_Manager.
if (this->thr_mgr_ == 0)
+# if defined (ACE_THREAD_MANAGER_LACKS_STATICS)
+ this->thr_mgr_ = ACE_THREAD_MANAGER_SINGLETON::instance ();
+# else /* ! ACE_THREAD_MANAGER_LACKS_STATICS */
this->thr_mgr_ = ACE_Thread_Manager::instance ();
+# endif /* ACE_THREAD_MANAGER_LACKS_STATICS */
int grp_spawned = -1;
if (thread_ids == 0)
diff --git a/ace/Thread.i b/ace/Thread.i
index 76ac587a774..103e348fa77 100644
--- a/ace/Thread.i
+++ b/ace/Thread.i
@@ -32,7 +32,7 @@ ACE_Thread::keyfree (ACE_thread_key_t key)
// Bind value to the thread-specific data key, <key>, for the calling
// thread.
-ACE_INLINE int
+ACE_INLINE int
ACE_Thread::setspecific (ACE_thread_key_t key, void *value)
{
// ACE_TRACE ("ACE_Thread::setspecific");
@@ -42,21 +42,21 @@ ACE_Thread::setspecific (ACE_thread_key_t key, void *value)
// Stores the current value bound to <key> for the calling thread
// into the location pointed to by <valuep>.
-ACE_INLINE int
+ACE_INLINE int
ACE_Thread::getspecific (ACE_thread_key_t key, void **valuep)
{
// ACE_TRACE ("ACE_Thread::getspecific");
return ACE_OS::thr_getspecific (key, valuep);
}
-ACE_INLINE ACE_thread_t
+ACE_INLINE ACE_thread_t
ACE_Thread::self (void)
{
// ACE_TRACE ("ACE_Thread::self");
return ACE_OS::thr_self ();
}
-ACE_INLINE void
+ACE_INLINE void
ACE_Thread::exit (void *status)
{
ACE_TRACE ("ACE_Thread::exit");
@@ -70,60 +70,61 @@ ACE_Thread::yield (void)
ACE_OS::thr_yield ();
}
-ACE_INLINE int
-ACE_Thread::spawn (ACE_THR_FUNC func,
- void *arg,
- long flags,
- ACE_thread_t *t_id,
+ACE_INLINE int
+ACE_Thread::spawn (ACE_THR_FUNC func,
+ void *arg,
+ long flags,
+ ACE_thread_t *t_id,
ACE_hthread_t *t_handle,
long priority,
- void *thr_stack,
+ void *thr_stack,
size_t thr_stack_size,
ACE_Thread_Adapter *thread_adapter)
{
ACE_TRACE ("ACE_Thread::spawn");
+
return ACE_OS::thr_create (func,
arg,
flags,
t_id,
- t_handle,
+ t_handle,
priority,
thr_stack,
thr_stack_size,
thread_adapter);
}
-ACE_INLINE int
+ACE_INLINE int
ACE_Thread::resume (ACE_hthread_t t_id)
{
ACE_TRACE ("ACE_Thread::resume");
return ACE_OS::thr_continue (t_id);
}
-ACE_INLINE int
+ACE_INLINE int
ACE_Thread::suspend (ACE_hthread_t t_id)
{
ACE_TRACE ("ACE_Thread::suspend");
return ACE_OS::thr_suspend (t_id);
}
-ACE_INLINE int
+ACE_INLINE int
ACE_Thread::kill (ACE_thread_t t_id, int signum)
{
ACE_TRACE ("ACE_Thread::kill");
return ACE_OS::thr_kill (t_id, signum);
}
-ACE_INLINE int
-ACE_Thread::join (ACE_thread_t wait_for,
- ACE_thread_t *departed,
+ACE_INLINE int
+ACE_Thread::join (ACE_thread_t wait_for,
+ ACE_thread_t *departed,
void **status)
{
ACE_TRACE ("ACE_Thread::join");
return ACE_OS::thr_join (wait_for, departed, status);
}
-ACE_INLINE int
+ACE_INLINE int
ACE_Thread::join (ACE_hthread_t wait_for,
void **status)
{
@@ -131,23 +132,23 @@ ACE_Thread::join (ACE_hthread_t wait_for,
return ACE_OS::thr_join (wait_for, status);
}
-ACE_INLINE int
+ACE_INLINE int
ACE_Thread::getconcurrency (void)
{
ACE_TRACE ("ACE_Thread::getconcurrency");
return ACE_OS::thr_getconcurrency ();
}
-ACE_INLINE int
+ACE_INLINE int
ACE_Thread::setconcurrency (int new_level)
{
ACE_TRACE ("ACE_Thread::setconcurrency");
return ACE_OS::thr_setconcurrency (new_level);
}
-ACE_INLINE int
-ACE_Thread::sigsetmask (int how,
- const sigset_t *sigset,
+ACE_INLINE int
+ACE_Thread::sigsetmask (int how,
+ const sigset_t *sigset,
sigset_t *osigset)
{
ACE_TRACE ("ACE_Thread::sigsetmask");
@@ -172,7 +173,7 @@ ACE_Thread::disablecancel (struct cancel_state *old_state)
}
ACE_INLINE int
-ACE_Thread::enablecancel (struct cancel_state *old_state,
+ACE_Thread::enablecancel (struct cancel_state *old_state,
int flag)
{
ACE_TRACE ("ACE_Thread::enablecancel");
@@ -208,17 +209,17 @@ ACE_Thread::setcancelstate (struct cancel_state &new_state,
int old_ctype = 0;
if (new_state.cancelstate != 0
- && ACE_OS::thr_setcancelstate (new_state.cancelstate,
+ && ACE_OS::thr_setcancelstate (new_state.cancelstate,
&old_cstate) == 0)
return -1;
- if (new_state.canceltype != 0
- && ACE_OS::thr_setcanceltype (new_state.canceltype,
+ if (new_state.canceltype != 0
+ && ACE_OS::thr_setcanceltype (new_state.canceltype,
&old_ctype) == 0)
{
int o_cstate;
- ACE_OS::thr_setcancelstate (old_cstate,
+ ACE_OS::thr_setcancelstate (old_cstate,
&o_cstate);
return -1;
}
@@ -255,14 +256,14 @@ ACE_Thread::self (ACE_hthread_t &t_id)
ACE_OS::thr_self (t_id);
}
-ACE_INLINE int
+ACE_INLINE int
ACE_Thread::getprio (ACE_hthread_t t_id, int &prio)
{
ACE_TRACE ("ACE_Thread::getprio");
return ACE_OS::thr_getprio (t_id, prio);
}
-ACE_INLINE int
+ACE_INLINE int
ACE_Thread::setprio (ACE_hthread_t t_id, int prio)
{
ACE_TRACE ("ACE_Thread::setprio");
diff --git a/ace/Thread_Manager.cpp b/ace/Thread_Manager.cpp
index ac43d2f896d..7447f3bdf8b 100644
--- a/ace/Thread_Manager.cpp
+++ b/ace/Thread_Manager.cpp
@@ -17,12 +17,14 @@ ACE_RCSID(ace, Thread_Manager, "$Id$")
ACE_ALLOC_HOOK_DEFINE(ACE_Thread_Control)
ACE_ALLOC_HOOK_DEFINE(ACE_Thread_Manager)
+#if ! defined (ACE_THREAD_MANAGER_LACKS_STATICS)
// Process-wide Thread Manager.
ACE_Thread_Manager *ACE_Thread_Manager::thr_mgr_ = 0;
// Controls whether the Thread_Manager is deleted when we shut down
// (we can only delete it safely if we created it!)
int ACE_Thread_Manager::delete_thr_mgr_ = 0;
+#endif /* ! defined (ACE_THREAD_MANAGER_LACKS_STATICS) */
void
ACE_Thread_Manager::dump (void)
@@ -326,6 +328,7 @@ ACE_Thread_Manager::ACE_Thread_Manager (size_t prealloc,
ACE_TRACE ("ACE_Thread_Manager::ACE_Thread_Manager");
}
+#if ! defined (ACE_THREAD_MANAGER_LACKS_STATICS)
ACE_Thread_Manager *
ACE_Thread_Manager::instance (void)
{
@@ -381,6 +384,7 @@ ACE_Thread_Manager::close_singleton (void)
ACE_Thread_Manager::delete_thr_mgr_ = 0;
}
}
+#endif /* ! defined (ACE_THREAD_MANAGER_LACKS_STATICS) */
// Close up and release all resources.
@@ -742,6 +746,7 @@ ACE_Thread_Manager::spawn (ACE_THR_FUNC func,
size_t stack_size)
{
ACE_TRACE ("ACE_Thread_Manager::spawn");
+
ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1));
if (grp_id == -1)
@@ -2379,6 +2384,9 @@ ACE_Thread_Control::exit (void *exit_status, int do_thr_exit)
}
#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
+# if defined (ACE_THREAD_MANAGER_LACKS_STATICS)
+ template class ACE_Singleton<ACE_Thread_Manager, ACE_SYNCH_MUTEX>;
+# endif /* defined (ACE_THREAD_MANAGER_LACKS_STATICS) */
template class ACE_Auto_Basic_Ptr<ACE_Thread_Descriptor>;
template class auto_ptr<ACE_Thread_Descriptor>;
template class ACE_Double_Linked_List<ACE_Thread_Descriptor_Base>;
@@ -2398,6 +2406,9 @@ ACE_Thread_Control::exit (void *exit_status, int do_thr_exit)
template class ACE_TSS<ACE_Thread_Exit>;
# endif /* ACE_HAS_THREADS && (ACE_HAS_THREAD_SPECIFIC_STORAGE || ACE_HAS_TSS_EMULATION) */
#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
+# if defined (ACE_THREAD_MANAGER_LACKS_STATICS)
+ #pragma instantiate ACE_Singleton<ACE_Thread_Manager, ACE_SYNCH_MUTEX>
+# endif /* defined (ACE_THREAD_MANAGER_LACKS_STATICS) */
#pragma instantiate ACE_Auto_Basic_Ptr<ACE_Thread_Descriptor>
#pragma instantiate auto_ptr<ACE_Thread_Descriptor>
#pragma instantiate ACE_Double_Linked_List<ACE_Thread_Descriptor_Base>
diff --git a/ace/Thread_Manager.h b/ace/Thread_Manager.h
index 197a8ba17b1..08c85fabaac 100644
--- a/ace/Thread_Manager.h
+++ b/ace/Thread_Manager.h
@@ -26,6 +26,7 @@
#include "ace/Synch.h"
#include "ace/Containers.h"
#include "ace/Free_List.h"
+#include "ace/Singleton.h"
// The following macros control how a Thread Manager manages a pool of
// Thread_Descriptor. Currently, the default behavior is not to
@@ -402,6 +403,7 @@ public:
size_t hwm = ACE_DEFAULT_THREAD_MANAGER_HWM);
virtual ~ACE_Thread_Manager (void);
+#if ! defined (ACE_THREAD_MANAGER_LACKS_STATICS)
static ACE_Thread_Manager *instance (void);
// Get pointer to a process-wide <ACE_Thread_Manager>.
@@ -411,6 +413,7 @@ public:
static void close_singleton (void);
// Delete the dynamically allocated Singleton
+#endif /* ! defined (ACE_THREAD_MANAGER_LACKS_STATICS) */
int open (size_t size = 0);
// No-op. Currently unused.
@@ -871,13 +874,21 @@ protected:
private:
ACE_Locked_Free_List<ACE_Thread_Descriptor, ACE_SYNCH_MUTEX> thread_desc_freelist_;
+#if ! defined (ACE_THREAD_MANAGER_LACKS_STATICS)
static ACE_Thread_Manager *thr_mgr_;
// Pointer to a process-wide <ACE_Thread_Manager>.
static int delete_thr_mgr_;
// Must delete the <thr_mgr_> if non-0.
+#endif /* ! defined (ACE_THREAD_MANAGER_LACKS_STATICS) */
};
+#if defined (ACE_THREAD_MANAGER_LACKS_STATICS)
+#define ACE_THREAD_MANAGER_SINGLETON_DEFINE \
+ ACE_Singleton<ACE_Thread_Manager, ACE_SYNCH_MUTEX>;
+typedef ACE_Singleton<ACE_Thread_Manager, ACE_SYNCH_MUTEX> ACE_THREAD_MANAGER_SINGLETON;
+#endif /* defined (ACE_THREAD_MANAGER_LACKS_STATICS) */
+
#if defined (__ACE_INLINE__)
#include "ace/Thread_Manager.i"
#endif /* __ACE_INLINE__ */
diff --git a/ace/config-psos-diab-ppc.h b/ace/config-psos-diab-ppc.h
index 346c4a225d7..ae59200c431 100644
--- a/ace/config-psos-diab-ppc.h
+++ b/ace/config-psos-diab-ppc.h
@@ -67,11 +67,11 @@
// IO Streams stuff
// #define ACE_HAS_MINIMUM_IOSTREAMH_INCLUSION
-#define ACE_LACKS_IOSTREAM_TOTALLY
-#define ACE_LACKS_ACE_IOSTREAM
-#define ACE_LACKS_IOSTREAM_FX
-#define ACE_DEFAULT_LOG_STREAM 0
-#define ostream FILE
+//#define ACE_LACKS_IOSTREAM_TOTALLY
+//#define ACE_LACKS_ACE_IOSTREAM
+//#define ACE_LACKS_IOSTREAM_FX
+//#define ACE_DEFAULT_LOG_STREAM 0
+//#define ostream FILE
#define ACE_LACKS_HRTIME_T
@@ -211,6 +211,9 @@
#define ACE_LACKS_UNIX_SIGNALS
+#defined ACE_THREADS_LACK_SHARED_SOCKETS
+
+// #define ACE_MALLOC_ALIGN 8
// #define ACE_LACKS_SYSTIME_H
#define ACE_PAGE_SIZE 4096
@@ -242,5 +245,25 @@
#define ACE_PSOS_DIAB
#define ACE_PSOS_DIAB_PPC
-#define ACE_MALLOC_ALIGN 8
+
+/* Defining PNANOREDEF will avoid the redefinition of close to pna_close in
+ * pna.h In OS.i we make sure that pna_close is called in place of close
+ * when a socket is closed.
+ */
+#define _PNANOREDEF_
+
+/* needed for portability, due to non-standard ip_mreq
+ structure definition for pSOS Diab PPC */
+#define IMR_MULTIADDR imr_mcastaddr
+
+#define ACE_THREADS_DONT_INHERIT_LOG_MSG /* Stream sharing problem for tasks */
+
+#define ACE_THREADS_MUST_EXPLICITLY_SHARE_SOCKETS /* Can't just share sockets */
+
+#define ACE_PSOS_DEFAULT_STACK_SIZE 30720 /* Default task stack size to 30K */
+
+#define ACE_DEFAULT_THREAD_PRIORITY 239
+
+#define ACE_THREAD_MANAGER_LACKS_STATICS
+
#endif /* ACE_CONFIG_H */