summaryrefslogtreecommitdiff
path: root/ace
diff options
context:
space:
mode:
authorSteve Huston <shuston@riverace.com>2001-05-10 22:48:11 +0000
committerSteve Huston <shuston@riverace.com>2001-05-10 22:48:11 +0000
commit92b1ba96085dd4d9d03f6c3b9f0b09b8ce6183f5 (patch)
tree02a459c70e19ca4f48a3497b665af2b5e8083c81 /ace
parent93346cf3709295f11bbd1f9ad79a085819c5ff05 (diff)
downloadATCD-92b1ba96085dd4d9d03f6c3b9f0b09b8ce6183f5.tar.gz
ChangeLogTag:Thu May 10 18:37:41 2001 Steve Huston <shuston@riverace.com>
Diffstat (limited to 'ace')
-rw-r--r--ace/DLL.cpp30
-rw-r--r--ace/POSIX_Asynch_IO.cpp4
-rw-r--r--ace/Parse_Node.cpp122
-rw-r--r--ace/Parse_Node.h10
-rw-r--r--ace/Proactor.h18
-rw-r--r--ace/Process_Mutex.cpp20
-rw-r--r--ace/Process_Mutex.h31
-rw-r--r--ace/Process_Mutex.inl8
-rw-r--r--ace/SString.cpp2
-rw-r--r--ace/Synch.cpp5
-rw-r--r--ace/Synch.h4
-rw-r--r--ace/config-hpux-11.00.h3
-rw-r--r--ace/config-sunos5.6.h27
13 files changed, 148 insertions, 136 deletions
diff --git a/ace/DLL.cpp b/ace/DLL.cpp
index 9a247b17b73..622cbe081ab 100644
--- a/ace/DLL.cpp
+++ b/ace/DLL.cpp
@@ -83,9 +83,33 @@ ACE_DLL::open (const ACE_TCHAR *dll_filename,
open_mode);
if (this->handle_ == ACE_SHLIB_INVALID_HANDLE)
- ACE_ERROR_RETURN ((LM_ERROR,
- ACE_LIB_TEXT ("%s\n"), this->error ()),
- -1);
+ {
+#if defined (AIX)
+ do
+ {
+ // AIX often puts the shared library file (most often named shr.o)
+ // inside an archive library. If this is an archive library
+ // name, then try appending [shr.o] and retry.
+ if (0 != ACE_OS_String::strstr (dll_pathname, ACE_LIB_TEXT (".a")))
+ {
+ ACE_OS_String::strcat (dll_pathname, ACE_LIB_TEXT ("(shr.o)"));
+ open_mode |= RTLD_MEMBER;
+ this->handle_ = ACE_OS::dlopen (dll_pathname, open_mode);
+ if (this->handle_ != ACE_SHLIB_INVALID_HANDLE)
+ break; // end up returning 0
+ }
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_LIB_TEXT ("%s\n"), this->error ()),
+ -1);
+ }
+ while (0);
+#else
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_LIB_TEXT ("%s\n"), this->error ()),
+ -1);
+#endif /* AIX */
+ }
+
return 0;
}
diff --git a/ace/POSIX_Asynch_IO.cpp b/ace/POSIX_Asynch_IO.cpp
index 56a2609d04d..d9bb606f0e7 100644
--- a/ace/POSIX_Asynch_IO.cpp
+++ b/ace/POSIX_Asynch_IO.cpp
@@ -118,8 +118,10 @@ ACE_POSIX_Asynch_Result::ACE_POSIX_Asynch_Result (ACE_Handler &handler,
aiocb (),
handler_ (handler),
act_ (act),
+ bytes_transferred_ (0),
success_ (0),
- completion_key_ (0)
+ completion_key_ (0),
+ error_ (0)
{
aio_offset = offset;
aio_reqprio = priority;
diff --git a/ace/Parse_Node.cpp b/ace/Parse_Node.cpp
index b2911573a37..bc552aae4df 100644
--- a/ace/Parse_Node.cpp
+++ b/ace/Parse_Node.cpp
@@ -328,7 +328,6 @@ ACE_Location_Node::dump (void) const
ACE_Location_Node::ACE_Location_Node (void)
: pathname_ (0),
- handle_ (0),
symbol_ (0)
{
ACE_TRACE ("ACE_Location_Node::ACE_Location_Node");
@@ -339,6 +338,13 @@ ACE_Location_Node::~ACE_Location_Node (void)
ACE_TRACE ("ACE_Location_Node::~ACE_Location_Node");
}
+ACE_SHLIB_HANDLE
+ACE_Location_Node::handle (void)
+{
+ ACE_TRACE ("ACE_Location_Node::handle");
+ return this->dll_.get_handle (1); // Caller now owns the handle
+}
+
const ACE_TCHAR *
ACE_Location_Node::pathname (void) const
{
@@ -354,20 +360,6 @@ ACE_Location_Node::pathname (const ACE_TCHAR *p)
}
void
-ACE_Location_Node::handle (const ACE_SHLIB_HANDLE h)
-{
- ACE_TRACE ("ACE_Location_Node::handle");
- this->handle_ = h;
-}
-
-ACE_SHLIB_HANDLE
-ACE_Location_Node::handle (void) const
-{
- ACE_TRACE ("ACE_Location_Node::handle");
- return this->handle_;
-}
-
-void
ACE_Location_Node::set_symbol (void *s)
{
ACE_TRACE ("ACE_Location_Node::set_symbol");
@@ -381,48 +373,25 @@ ACE_Location_Node::dispose (void) const
return this->must_delete_;
}
-ACE_SHLIB_HANDLE
-ACE_Location_Node::open_handle (void)
+int
+ACE_Location_Node::open_dll (void)
{
- ACE_TRACE ("ACE_Location_Node::open_handle");
-
- ACE_TCHAR dl_pathname[MAXPATHLEN + 1];
-
- // Transform the pathname into the appropriate dynamic link library
- // by searching the ACE_LD_SEARCH_PATH.
- int result = ACE_Lib_Find::ldfind (this->pathname (),
- dl_pathname,
- (sizeof dl_pathname / sizeof (ACE_TCHAR)));
-
- // Check for errors
- if (result != 0)
- return 0;
+ ACE_TRACE ("ACE_Location_Node::open_dll");
- // Set the handle
- this->handle (ACE_OS::dlopen (dl_pathname));
-
- if (this->handle () == 0)
+ if (-1 == this->dll_.open (this->pathname ()))
{
ace_yyerrno++;
+ ACE_TCHAR *errmsg = this->dll_.error ();
ACE_ERROR ((LM_ERROR,
- ACE_LIB_TEXT ("dlopen failed for %s"),
- dl_pathname));
-
- ACE_TCHAR *errmsg = ACE_OS::dlerror ();
-
- if (errmsg != 0)
- ACE_ERROR_RETURN ((LM_ERROR,
- ACE_LIB_TEXT (": %s\n"),
- errmsg),
- 0);
- else
- ACE_ERROR_RETURN ((LM_ERROR,
- ACE_LIB_TEXT ("\n")),
- 0);
+ ACE_LIB_TEXT ("ACE_DLL::open failed for %s: %s\n"),
+ this->pathname (),
+ errmsg ? errmsg : ACE_LIB_TEXT ("no error reported")));
+ return -1;
}
- else
- return this->handle ();
+
+ return 0;
+
}
ACE_ALLOC_HOOK_DEFINE(ACE_Object_Node)
@@ -446,34 +415,23 @@ void *
ACE_Object_Node::symbol (ACE_Service_Object_Exterminator *)
{
ACE_TRACE ("ACE_Object_Node::symbol");
- if (this->open_handle () != 0)
+ if (this->open_dll () == 0)
{
ACE_TCHAR *object_name = ACE_const_cast (ACE_TCHAR *, this->object_name_);
- this->symbol_ = (void *)
- ACE_OS::dlsym ((ACE_SHLIB_HANDLE) this->handle (),
- object_name);
-
+ this->symbol_ = this->dll_.symbol (object_name);
if (this->symbol_ == 0)
{
ace_yyerrno++;
+ ACE_TCHAR *errmsg = this->dll_.error ();
ACE_ERROR ((LM_ERROR,
- ACE_LIB_TEXT ("dlsym failed for object %s\n"),
- object_name));
-
- ACE_TCHAR *errmsg = ACE_OS::dlerror ();
-
- if (errmsg != 0)
- ACE_ERROR_RETURN ((LM_ERROR,
- ACE_LIB_TEXT (": %s\n"),
- errmsg),
- 0);
- else
- ACE_ERROR_RETURN ((LM_ERROR,
- ACE_LIB_TEXT ("\n")),
- 0);
+ ACE_LIB_TEXT ("ACE_DLL::symbol failed for object %s: %s\n"),
+ object_name,
+ errmsg ? errmsg : ACE_LIB_TEXT ("no error reported")));
+ return 0;
}
+
return this->symbol_;
}
@@ -507,7 +465,7 @@ void *
ACE_Function_Node::symbol (ACE_Service_Object_Exterminator *gobbler)
{
ACE_TRACE ("ACE_Function_Node::symbol");
- if (this->open_handle () != 0)
+ if (this->open_dll () == 0)
{
void *(*func) (ACE_Service_Object_Exterminator *) = 0;
this->symbol_ = 0;
@@ -530,9 +488,7 @@ ACE_Function_Node::symbol (ACE_Service_Object_Exterminator *gobbler)
// close to (or, at least claim to conform with) the standard
// did not complain about this as an illegal pointer conversion.
long temp_ptr =
- ACE_reinterpret_cast(long,
- ACE_OS::dlsym ((ACE_SHLIB_HANDLE) this->handle (),
- function_name));
+ ACE_reinterpret_cast(long, this->dll_.symbol (function_name));
func = ACE_reinterpret_cast(void *(*)(ACE_Service_Object_Exterminator *),
temp_ptr);
@@ -544,21 +500,13 @@ ACE_Function_Node::symbol (ACE_Service_Object_Exterminator *gobbler)
{
ace_yyerrno++;
+ ACE_TCHAR *errmsg = this->dll_.error ();
ACE_ERROR ((LM_ERROR,
- ACE_LIB_TEXT ("dlsym failed for function %s\n"),
- function_name));
-
- ACE_TCHAR *errmsg = ACE_OS::dlerror ();
-
- if (errmsg != 0)
- ACE_ERROR_RETURN ((LM_ERROR,
- ACE_LIB_TEXT (": %s\n"),
- errmsg),
- 0);
- else
- ACE_ERROR_RETURN ((LM_ERROR,
- ACE_LIB_TEXT ("\n")),
- 0);
+ ACE_LIB_TEXT ("ACE_DLL::symbol failed for function %s: %s\n"),
+ function_name,
+ errmsg ? errmsg :
+ ACE_LIB_TEXT ("no error reported")));
+ return 0;
}
}
// Invoke the factory function and record it's return value.
diff --git a/ace/Parse_Node.h b/ace/Parse_Node.h
index 718cb3185d4..6df9def1915 100644
--- a/ace/Parse_Node.h
+++ b/ace/Parse_Node.h
@@ -16,6 +16,7 @@
#include "ace/pre.h"
#include "ace/Service_Types.h"
+#include "ace/DLL.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
@@ -199,8 +200,7 @@ public:
ACE_Location_Node (void);
virtual void *symbol (ACE_Service_Object_Exterminator * = 0) = 0;
virtual void set_symbol (void *h);
- ACE_SHLIB_HANDLE handle (void) const;
- void handle (const ACE_SHLIB_HANDLE h);
+ ACE_SHLIB_HANDLE handle (void);
const ACE_TCHAR *pathname (void) const;
void pathname (const ACE_TCHAR *h);
int dispose (void) const;
@@ -214,7 +214,7 @@ public:
ACE_ALLOC_HOOK_DECLARE;
protected:
- ACE_SHLIB_HANDLE open_handle (void);
+ int open_dll (void);
/// Pathname to the shared library we are working on.
const ACE_TCHAR *pathname_;
@@ -226,8 +226,8 @@ protected:
*/
int must_delete_;
- /// Handle to the open shared library.
- ACE_SHLIB_HANDLE handle_;
+ /// The open shared library.
+ ACE_DLL dll_;
/// Symbol that we've obtained from the shared library.
void *symbol_;
diff --git a/ace/Proactor.h b/ace/Proactor.h
index e82af128929..94dc5c43785 100644
--- a/ace/Proactor.h
+++ b/ace/Proactor.h
@@ -253,19 +253,21 @@ public:
int dont_call_handle_close = 1);
/**
- * Dispatch a single set of events. If <wait_time> elapses before
- * any events occur, return 0. Return 1 on success i.e., when a
- * completion is dispatched, non-zero (-1) on errors and errno is
- * set accordingly.
+ * Dispatch a single set of events, waiting up to a specified time limit
+ * if necessary.
+ * @param wait_time the time to wait for an event to occur. This is
+ * a relative time. On successful return, the time is updated to
+ * reflect the amount of time spent waiting for event(s) to occur.
+ * @return Returns 0 if no events occur before the wait_time expires.
+ * Returns 1 when a completion is dispatched. On error, returns -1
+ * and sets errno accordingly.
*/
virtual int handle_events (ACE_Time_Value &wait_time);
/**
* Block indefinitely until at least one event is dispatched.
- * Dispatch a single set of events. If <wait_time> elapses before
- * any events occur, return 0. Return 1 on success i.e., when a
- * completion is dispatched, non-zero (-1) on errors and errno is
- * set accordingly.
+ * @return Returns 1 when a completion is dispatched. On error, returns -1
+ * and sets errno accordingly.
*/
virtual int handle_events (void);
diff --git a/ace/Process_Mutex.cpp b/ace/Process_Mutex.cpp
index c4cf1b7df25..ecce7bfbc40 100644
--- a/ace/Process_Mutex.cpp
+++ b/ace/Process_Mutex.cpp
@@ -21,7 +21,7 @@ ACE_Process_Mutex::dump (void) const
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
}
-#if !defined (ACE_WIN32) && !defined (ACE_HAS_POSIX_SEM) && !defined (ACE_PSOS)
+#if !defined (_ACE_HAS_INTER_PROC_MUTEX)
const ACE_TCHAR *
ACE_Process_Mutex::unique_name (void)
{
@@ -31,31 +31,31 @@ ACE_Process_Mutex::unique_name (void)
ACE::unique_name (this, this->name_, ACE_UNIQUE_NAME_LEN);
return this->name_;
}
-#endif /* !ACE_WIN32 && !ACE_HAS_POSIX_SEM && !ACE_PSOS */
+#endif /* !_ACE_HAS_INTER_PROC_MUTEX */
ACE_Process_Mutex::ACE_Process_Mutex (const char *name, void *arg)
-#if defined (ACE_WIN32) || defined (ACE_HAS_POSIX_SEM) || defined (ACE_PSOS)
+#if defined (_ACE_HAS_INTER_PROC_MUTEX)
: lock_ (USYNC_PROCESS, ACE_TEXT_CHAR_TO_TCHAR (name), (ACE_mutexattr_t *) arg)
#else
: lock_ (name ? ACE_TEXT_CHAR_TO_TCHAR (name) : ACE_Process_Mutex::unique_name ())
-#endif /* ACE_WIN32 || ACE_HAS_POSIX_SEM || ACE_PSOS */
+#endif /* _ACE_HAS_INTER_PROC_MUTEX */
{
-#if !defined (ACE_WIN32) && !defined (ACE_HAS_POSIX_SEM) && !defined (ACE_PSOS)
+#if !defined (_ACE_HAS_INTER_PROC_MUTEX)
ACE_UNUSED_ARG (arg);
-#endif /* !ACE_WIN32 && !ACE_HAS_POSIX_SEM && !ACE_PSOS */
+#endif /* !_ACE_HAS_INTER_PROC_MUTEX */
}
#if defined (ACE_HAS_WCHAR)
ACE_Process_Mutex::ACE_Process_Mutex (const wchar_t *name, void *arg)
-#if defined (ACE_WIN32) || defined (ACE_HAS_POSIX_SEM) || defined (ACE_PSOS)
+#if defined (_ACE_HAS_INTER_PROC_MUTEX)
: lock_ (USYNC_PROCESS, ACE_TEXT_WCHAR_TO_TCHAR (name), (ACE_mutexattr_t *) arg)
#else
: lock_ (name ? ACE_TEXT_WCHAR_TO_TCHAR (name): ACE_Process_Mutex::unique_name ())
-#endif /* ACE_WIN32 || ACE_HAS_POSIX_SEM || ACE_PSOS */
+#endif /* _ACE_HAS_INTER_PROC_MUTEX */
{
-#if !defined (ACE_WIN32) && !defined (ACE_HAS_POSIX_SEM) && !defined (ACE_PSOS)
+#if !defined (_ACE_HAS_INTER_PROC_MUTEX)
ACE_UNUSED_ARG (arg);
-#endif /* !ACE_WIN32 && !ACE_HAS_POSIX_SEM && !ACE_PSOS */
+#endif /* !_ACE_HAS_INTER_PROC_MUTEX */
}
#endif /* ACE_HAS_WCHAR */
ACE_Process_Mutex::~ACE_Process_Mutex (void)
diff --git a/ace/Process_Mutex.h b/ace/Process_Mutex.h
index 5f45294e5f7..91166e117e9 100644
--- a/ace/Process_Mutex.h
+++ b/ace/Process_Mutex.h
@@ -10,7 +10,6 @@
* the same host machine, as well as within a process, of
* course.
*
- *
* @author Doug Schmidt
*/
//=============================================================================
@@ -26,11 +25,25 @@
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
-#if !(defined (ACE_WIN32) || defined (ACE_HAS_POSIX_SEM) || defined (ACE_PSOS))
-#include "ace/SV_Semaphore_Complex.h"
-#else
+// The set of platforms encompassed by the set of 'defined' directives
+// below have cross-process mutex capability. Those that don't need to
+// use System V Semaphores. The following private macro sets this
+// capability difference and is used in Process_Mutex.* only.
+#if defined (_ACE_HAS_INTER_PROC_MUTEX)
+# undef _ACE_HAS_INTER_PROC_MUTEX
+#endif /* _ACE_HAS_INTER_PROC_MUTEX */
+
+// This may need more qualification on pthreads version.
+#if (defined (ACE_WIN32) || defined (ACE_PSOS) || \
+ defined (ACE_HAS_PTHREADS) || defined (ACE_HAS_STHREADS))
+# define _ACE_HAS_INTER_PROC_MUTEX
+#endif
+
+#if defined (_ACE_HAS_INTER_PROC_MUTEX)
#include "ace/Synch.h"
-#endif /* !(ACE_WIN32 || ACE_HAS_POSIX_SEM || ACE_PSOS) */
+#else
+#include "ace/SV_Semaphore_Complex.h"
+#endif /* _ACE_HAS_INTER_PROC_MUTEX */
/**
* @class ACE_Process_Mutex
@@ -105,10 +118,10 @@ public:
*/
int tryacquire_write_upgrade (void);
-#if defined (ACE_WIN32) || defined (ACE_HAS_POSIX_SEM) || defined (ACE_PSOS)
+#if defined (_ACE_HAS_INTER_PROC_MUTEX)
/// Return the underlying mutex.
const ACE_mutex_t &lock (void) const;
-#endif /* ACE_WIN32 || ACE_HAS_POSIX_SEM || ACE_PSOS */
+#endif /* _ACE_HAS_INTER_PROC_MUTEX */
/// Dump the state of an object.
void dump (void) const;
@@ -117,7 +130,7 @@ public:
ACE_ALLOC_HOOK_DECLARE;
private:
-#if defined (ACE_WIN32) || defined (ACE_HAS_POSIX_SEM) || defined (ACE_PSOS)
+#if defined (_ACE_HAS_INTER_PROC_MUTEX)
ACE_Mutex lock_;
#else
/// If the user does not provide a name we generate a unique name in
@@ -129,7 +142,7 @@ private:
/// We need this to get the right semantics...
ACE_SV_Semaphore_Complex lock_;
-#endif /* ACE_WIN32 || ACE_HAS_POSIX_SEM || ACE_PSOS */
+#endif /* _ACE_HAS_INTER_PROC_MUTEX */
};
#if defined (__ACE_INLINE__)
diff --git a/ace/Process_Mutex.inl b/ace/Process_Mutex.inl
index 6fc84c11a2b..28b282f6782 100644
--- a/ace/Process_Mutex.inl
+++ b/ace/Process_Mutex.inl
@@ -1,14 +1,14 @@
/* -*- C++ -*- */
// $Id$
-#if defined (ACE_WIN32) || defined (ACE_HAS_POSIX_SEM) || defined (ACE_PSOS)
+#if defined (_ACE_HAS_INTER_PROC_MUTEX)
ACE_INLINE const ACE_mutex_t &
ACE_Process_Mutex::lock (void) const
{
// ACE_TRACE ("ACE_Process_Mutex::lock");
return this->lock_.lock ();
}
-#endif /* ACE_WIN32 || ACE_HAS_POSIX_SEM || ACE_PSOS */
+#endif /* _ACE_HAS_INTER_PROC_MUTEX */
// Explicitly destroy the mutex.
ACE_INLINE int
@@ -28,12 +28,12 @@ ACE_Process_Mutex::acquire (void)
ACE_INLINE int
ACE_Process_Mutex::acquire (ACE_Time_Value &tv)
{
-#if defined (ACE_WIN32) || defined (ACE_HAS_POSIX_SEM) || defined (ACE_PSOS)
+#if defined (_ACE_HAS_INTER_PROC_MUTEX)
return this->lock_.acquire (tv);
#else
ACE_UNUSED_ARG (tv);
ACE_NOTSUP_RETURN (-1);
-#endif /* ACE_WIN32 || ACE_HAS_POSIX_SEM || ACE_PSOS */
+#endif /* _ACE_HAS_INTER_PROC_MUTEX */
}
// Conditionally acquire lock (i.e., don't wait on queue).
diff --git a/ace/SString.cpp b/ace/SString.cpp
index b2f879c8288..96f148ab44f 100644
--- a/ace/SString.cpp
+++ b/ace/SString.cpp
@@ -378,7 +378,7 @@ ACE_CString::substring (size_t offset,
else if (length == 0)
return nil;
// Get all remaining bytes.
- else if (length == -1)
+ else if (length == -1 || count > (this->len_ - offset))
count = this->len_ - offset;
return ACE_CString (&this->rep_[offset],
diff --git a/ace/Synch.cpp b/ace/Synch.cpp
index 0f6ff94e0f7..5949734dcdb 100644
--- a/ace/Synch.cpp
+++ b/ace/Synch.cpp
@@ -174,7 +174,7 @@ ACE_Mutex::dump (void) const
ACE_Mutex::ACE_Mutex (int type, const ACE_TCHAR *name, ACE_mutexattr_t *arg)
:
-#if defined (CHORUS)
+#if defined (CHORUS) || defined(ACE_HAS_PTHREADS) || defined(ACE_HAS_STHREADS)
process_lock_ (0),
lockname_ (0),
#endif /* CHORUS */
@@ -182,7 +182,8 @@ ACE_Mutex::ACE_Mutex (int type, const ACE_TCHAR *name, ACE_mutexattr_t *arg)
{
// ACE_TRACE ("ACE_Mutex::ACE_Mutex");
-#if defined(CHORUS)
+ // These platforms need process-wide mutex to be in shared memory.
+#if defined(CHORUS) || defined (ACE_HAS_PTHREADS) || defined (ACE_HAS_STHREADS)
if (type == USYNC_PROCESS)
{
// Let's see if the shared memory entity already exists.
diff --git a/ace/Synch.h b/ace/Synch.h
index 4dcc537b2cd..83714f7e13e 100644
--- a/ace/Synch.h
+++ b/ace/Synch.h
@@ -511,7 +511,7 @@ public:
// = This should be protected but some C++ compilers complain...
public:
-#if defined (CHORUS)
+#if defined (CHORUS) || defined(ACE_HAS_PTHREADS) || defined(ACE_HAS_STHREADS)
/// This lock resides in shared memory.
ACE_mutex_t *process_lock_;
@@ -521,7 +521,7 @@ public:
* can destroy it).
*/
const ACE_TCHAR *lockname_;
-#endif /* CHORUS */
+#endif /* CHORUS || ACE_HAS_PTHREADS */
/// Mutex type supported by the OS.
ACE_mutex_t lock_;
diff --git a/ace/config-hpux-11.00.h b/ace/config-hpux-11.00.h
index 5e49be696cb..dcb7ea6a026 100644
--- a/ace/config-hpux-11.00.h
+++ b/ace/config-hpux-11.00.h
@@ -265,6 +265,9 @@
// in the future (problem ID P64).
#define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS
+// Platform has shm_open
+#define ACE_HAS_SHM_OPEN
+
// Compiler/platform defines the sig_atomic_t typedef
#define ACE_HAS_SIG_ATOMIC_T
diff --git a/ace/config-sunos5.6.h b/ace/config-sunos5.6.h
index bec53c0590b..a4fe4fae410 100644
--- a/ace/config-sunos5.6.h
+++ b/ace/config-sunos5.6.h
@@ -10,6 +10,16 @@
// #include the SunOS 5.5 config file, then add SunOS 5.6 updates below.
+// Unless the user has set _POSIX_C_SOURCE specifically, set it up
+// to enable POSIX.1b-1993 (Real Time). This will enable shm_open
+// and friends.
+#if !defined (_POSIX_C_SOURCE)
+# define _POSIX_C_SOURCE 199309L
+# ifndef __EXTENSIONS__
+# define __EXTENSIONS__
+# endif
+#endif
+
#include "ace/config-sunos5.5.h"
#if defined(__GNUC__) && __GNUC__ >= 2 && __GNUC_MINOR__ >= 95
@@ -17,14 +27,17 @@
#undef ACE_HAS_STL_QUEUE_CONFLICT
#endif /* __GNUC__ */
-#if (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 199506L) || \
+#if (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE > 2) || \
defined (__EXTENSIONS__)
-# define ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R
+// The asctime_r/ctime_r parameters change at POSIX.1c-1995
+# if (defined (_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 199506L)
+# define ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R
+# endif /* POSIX_C_SOURCE >= 199506L */
# define ACE_HAS_SIGWAIT
-// Hack 'cuz -DPOSIX_SOURCE=199506L and -DEXTENSIONS hides this.
+// Hack 'cuz _POSIX_C_SOURCE > 2 and -DEXTENSIONS hides this.
# include <sys/types.h>
extern "C" int madvise(caddr_t, size_t, int);
-#endif /* _POSIX_C_SOURCE >= 199506L || __EXTENSIONS__ */
+#endif /* _POSIX_C_SOURCE > 2 || __EXTENSIONS__ */
// SunOS 5.6 has AIO calls.
#if !defined (ACE_HAS_AIO_CALLS)
@@ -40,4 +53,10 @@
// SunOS 5.6 has a buggy select
#define ACE_HAS_LIMITED_SELECT
+// SunOS 5.6 introduced shm_open, but need to turn on POSIX.1b or higher
+// to pick it up.
+#if defined (_POSIX_C_SOURCE) && (_POSIX_C_SOURCE > 2)
+# define ACE_HAS_SHM_OPEN
+#endif /* _POSIX_C_SOURCE > 2 */
+
#endif /* ACE_CONFIG_H */