summaryrefslogtreecommitdiff
path: root/ace
diff options
context:
space:
mode:
authorcoryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-01-29 20:52:16 +0000
committercoryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-01-29 20:52:16 +0000
commit22c6ecbd0dd7cf14bb3af73841e9d433f0c93733 (patch)
tree49ea2137d9c1b25f9d292f9fdaaa3e7732df251c /ace
parente98cab44b71b4ec780fe2f407cf039f69e639b3f (diff)
downloadATCD-22c6ecbd0dd7cf14bb3af73841e9d433f0c93733.tar.gz
ChangeLogTag:Fri Jan 29 14:49:37 1999 Carlos O'Ryan <coryan@cs.wustl.edu>
Diffstat (limited to 'ace')
-rw-r--r--ace/ACE.cpp39
-rw-r--r--ace/Basic_Types.h20
-rw-r--r--ace/INET_Addr.cpp4
-rw-r--r--ace/Memory_Pool.cpp14
-rw-r--r--ace/OS.cpp6
-rw-r--r--ace/OS.h12
-rw-r--r--ace/OS.i10
-rw-r--r--ace/SOCK_Dgram_Bcast.cpp10
-rw-r--r--ace/config-cray.h240
9 files changed, 347 insertions, 8 deletions
diff --git a/ace/ACE.cpp b/ace/ACE.cpp
index cebb8d9fd58..ba6ed00a3d2 100644
--- a/ace/ACE.cpp
+++ b/ace/ACE.cpp
@@ -520,7 +520,12 @@ u_long ACE::crc_table_[] =
u_long
ACE::crc32 (const char *string)
{
-#define COMPUTE(var, ch) (var) = ((var) << 8) ^ ACE::crc_table_[((var) >> 24) ^ (ch)]
+// UNICOS UINT32's are 64-bit on the Cray PVP architecture
+#if !defined(_UNICOS)
+# define COMPUTE(var, ch) (var) = ((var) << 8) ^ ACE::crc_table_[((var) >> 24) ^ (ch)]
+#else /* ! _UNICOS */
+# define COMPUTE(var, ch) (var) = ( 0x00000000ffffffff & ((var) << 8)) ^ ACE::crc_table_[((var) >> 24) ^ (ch)]
+#endif /* ! _UNICOS */
register ACE_UINT32 crc = 0;
u_long len = 0;
@@ -2708,16 +2713,30 @@ ACE::get_bcast_addr (ACE_UINT32 &bcast_addr,
if (hp == 0)
return -1;
else
+#if !defined(_UNICOS)
ACE_OS::memcpy ((char *) &ip_addr.sin_addr.s_addr,
(char *) hp->h_addr,
hp->h_length);
+#else /* _UNICOS */
+ {
+ ACE_UINT64 haddr; // a place to put the address
+ char * haddrp = (char *) &haddr; // convert to char pointer
+ haddr += 4; // adjust within the word
+ ACE_OS::memcpy(haddrp,(char *) hp->h_addr,hp->h_length);
+ ip_addr.sin_addr.s_addr = haddr;
+ }
+#endif /* ! _UNICOS */
}
else
{
ACE_OS::memset ((void *) &ip_addr, 0, sizeof ip_addr);
+#if !defined(_UNICOS)
ACE_OS::memcpy ((void *) &ip_addr.sin_addr,
(void*) &host_addr,
sizeof ip_addr.sin_addr);
+#else /* _UNICOS */
+ ip_addr.sin_addr.s_addr = host_addr; // just copy to the bitfield
+#endif /* ! _UNICOS */
}
for (int n = ifc.ifc_len / sizeof (struct ifreq);
@@ -3190,6 +3209,7 @@ ACE::get_ip_interfaces (size_t &count,
{
if (pcur->ifr_addr.sa_family == AF_INET)
{
+#if !defined(_UNICOS)
struct sockaddr_in *addr =
ACE_reinterpret_cast(sockaddr_in *, &pcur->ifr_addr);
@@ -3202,6 +3222,23 @@ ACE::get_ip_interfaces (size_t &count,
0);
count++;
}
+#else /* ! _UNICOS */
+ // need to explicitly copy on the Cray, since the bitfields kinda
+ // screw things up here
+ struct sockaddr_in inAddr;
+
+ inAddr.sin_len = pcur->ifr_addr.sa_len;
+ inAddr.sin_family = pcur->ifr_addr.sa_family;
+ memcpy((void *)&(inAddr.sin_addr),
+ (const void *)&(pcur->ifr_addr.sa_data[8]),
+ sizeof(struct in_addr));
+
+ if (inAddr.sin_addr.s_addr != 0)
+ {
+ addrs[count].set(&inAddr, sizeof(struct sockaddr_in));
+ count++;
+ }
+#endif /* ! _UNICOS */
}
pcur++;
diff --git a/ace/Basic_Types.h b/ace/Basic_Types.h
index 75c3d57fae7..039c8b0e75e 100644
--- a/ace/Basic_Types.h
+++ b/ace/Basic_Types.h
@@ -162,6 +162,19 @@
# elif ACE_SIZEOF_INT == 2
typedef int ACE_INT16;
typedef unsigned short ACE_UINT16;
+# elif (ACE_SIZEOF_SHORT) == 4 && defined(_CRAYMPP)
+ // mpp cray - uses Alpha processors
+ // Use the real 32-bit quantity for ACE_INT32's, and use a "long"
+ // for shorts. This gets around conflicts with size_t in some ACE
+ // method signatures, among other things.
+ typedef short ACE_INT16;
+ typedef unsigned short ACE_UINT16;
+ typedef short ACE_INT32;
+ typedef unsigned short ACE_UINT32;
+# elif (ACE_SIZEOF_SHORT) == 8 && defined(_UNICOS)
+ // vector cray - hard 64-bit, all 64 bit types
+ typedef short ACE_INT16;
+ typedef unsigned short ACE_UINT16;
# else
# error Have to add to the ACE_UINT16 type setting
# endif
@@ -174,6 +187,13 @@ typedef ACE_UINT16 ACE_USHORT16;
# elif ACE_SIZEOF_LONG == 4
typedef long ACE_INT32;
typedef unsigned long ACE_UINT32;
+# elif (ACE_SIZEOF_INT) == 8 && defined(_UNICOS)
+ // vector cray - hard 64-bit, all 64 bit types
+# if !defined(_CRAYMPP)
+ typedef int ACE_INT32;
+ typedef unsigned int ACE_UINT32;
+# endif
+ typedef unsigned long ACE_UINT64;
# else
# error Have to add to the ACE_UINT32 type setting
# endif
diff --git a/ace/INET_Addr.cpp b/ace/INET_Addr.cpp
index f78adcb62b3..7a1628f518e 100644
--- a/ace/INET_Addr.cpp
+++ b/ace/INET_Addr.cpp
@@ -423,7 +423,11 @@ ACE_INET_Addr::get_host_name (ASYS_TCHAR hostname[], size_t len) const
return -1;
}
#else
+# if !defined(_UNICOS)
int a_len = sizeof this->inet_addr_.sin_addr.s_addr;
+# else /* _UNICOS */
+ int a_len = sizeof this->inet_addr_.sin_addr;
+# endif /* ! _UNICOS */
int error = 0;
#if defined (CHORUS)
diff --git a/ace/Memory_Pool.cpp b/ace/Memory_Pool.cpp
index f1b0cf59719..3acd2ee2441 100644
--- a/ace/Memory_Pool.cpp
+++ b/ace/Memory_Pool.cpp
@@ -518,7 +518,7 @@ ACE_Shared_Memory_Pool::in_use (off_t &offset,
}
int
-ACE_Shared_Memory_Pool::find_seg (const void*const searchPtr,
+ACE_Shared_Memory_Pool::find_seg (const void* const searchPtr,
off_t &offset,
size_t &counter)
{
@@ -606,11 +606,19 @@ ACE_Shared_Memory_Pool::handle_signal (int , siginfo_t *siginfo, ucontext_t *)
size_t counter;
if (this->in_use (offset, counter) == -1)
ACE_ERROR ((LM_ERROR, ASYS_TEXT ("(%P|%t) %p\n"), ASYS_TEXT ("in_use")));
+#if !defined(_UNICOS)
else if (!(siginfo->si_code == SEGV_MAPERR
&& siginfo->si_addr < (((char *) this->base_addr_) + offset)
&& siginfo->si_addr >= ((char *) this->base_addr_)))
ACE_ERROR_RETURN ((LM_ERROR, "(%P|%t) address %u out of range\n",
siginfo->si_addr), -1);
+#else /* ! _UNICOS */
+ else if (!(siginfo->si_code == SEGV_MEMERR
+ && siginfo->si_addr < (((unsigned long) this->base_addr_) + offset)
+ && siginfo->si_addr >= ((unsigned long) this->base_addr_)))
+ ACE_ERROR_RETURN ((LM_ERROR, "(%P|%t) address %u out of range\n",
+ siginfo->si_addr), -1);
+#endif /* ! _UNICOS */
}
// The above if case will check to see that the address is in the
@@ -620,7 +628,11 @@ ACE_Shared_Memory_Pool::handle_signal (int , siginfo_t *siginfo, ucontext_t *)
size_t counter; // ret value to get shmid from the st table.
+#if !defined(_UNICOS)
if (this->find_seg (siginfo->si_addr, offset, counter) == -1)
+#else /* ! _UNICOS */
+ if (this->find_seg ((const void *)siginfo->si_addr, offset, counter) == -1)
+#endif /* ! _UNICOS */
ACE_ERROR_RETURN ((LM_ERROR, ASYS_TEXT ("(%P|%t) %p\n"), ASYS_TEXT ("in_use")), -1);
void *address = (void *) (((char *) this->base_addr_) + offset);
diff --git a/ace/OS.cpp b/ace/OS.cpp
index f00baff6ed2..133e5025b23 100644
--- a/ace/OS.cpp
+++ b/ace/OS.cpp
@@ -3959,7 +3959,13 @@ ACE_OS::inet_aton (const char *host_name, struct in_addr *addr)
return 0;
else
{
+#if !defined(_UNICOS)
ACE_OS::memcpy ((void *) addr, (void *) &ip_addr, sizeof ip_addr);
+#else /* ! _UNICOS */
+ // on UNICOS, perform assignment to bitfield, since doing the above
+ // actually puts the address outside of the 32-bit bitfield
+ addr->s_addr = ip_addr;
+#endif /* ! _UNICOS */
return 1;
}
}
diff --git a/ace/OS.h b/ace/OS.h
index e0a9097304b..7bbc0337df6 100644
--- a/ace/OS.h
+++ b/ace/OS.h
@@ -1794,11 +1794,17 @@ struct stat
// programs to have their own ACE-wide "default".
// PROCESS-level values
-# define ACE_PROC_PRI_FIFO_MIN (sched_get_priority_min(SCHED_FIFO))
+# if !defined(_UNICOS)
+# define ACE_PROC_PRI_FIFO_MIN (sched_get_priority_min(SCHED_FIFO))
+# define ACE_PROC_PRI_RR_MIN (sched_get_priority_min(SCHED_RR))
+# define ACE_PROC_PRI_OTHER_MIN (sched_get_priority_min(SCHED_OTHER))
+# else // UNICOS is missing a sched_get_priority_min() implementation
+# define ACE_PROC_PRI_FIFO_MIN 0
+# define ACE_PROC_PRI_RR_MIN 0
+# define ACE_PROC_PRI_OTHER_MIN 0
+# endif
# define ACE_PROC_PRI_FIFO_MAX (sched_get_priority_max(SCHED_FIFO))
-# define ACE_PROC_PRI_RR_MIN (sched_get_priority_min(SCHED_RR))
# define ACE_PROC_PRI_RR_MAX (sched_get_priority_max(SCHED_RR))
-# define ACE_PROC_PRI_OTHER_MIN (sched_get_priority_min(SCHED_OTHER))
# define ACE_PROC_PRI_OTHER_MAX (sched_get_priority_max(SCHED_OTHER))
# if !defined(ACE_PROC_PRI_FIFO_DEF)
# define ACE_PROC_PRI_FIFO_DEF (ACE_PROC_PRI_FIFO_MIN + (ACE_PROC_PRI_FIFO_MAX - ACE_PROC_PRI_FIFO_MIN)/2)
diff --git a/ace/OS.i b/ace/OS.i
index 849278247e6..052bfa43716 100644
--- a/ace/OS.i
+++ b/ace/OS.i
@@ -6198,7 +6198,7 @@ ACE_OS::thr_kill (ACE_thread_t thr_id, int signum)
// ACE_TRACE ("ACE_OS::thr_kill");
#if defined (ACE_HAS_THREADS)
# if defined (ACE_HAS_PTHREADS)
-# if defined (ACE_HAS_PTHREADS_DRAFT4)
+# if defined (ACE_HAS_PTHREADS_DRAFT4) || defined(ACE_LACKS_PTHREAD_KILL)
ACE_UNUSED_ARG (signum);
ACE_UNUSED_ARG (thr_id);
ACE_NOTSUP_RETURN (-1);
@@ -7506,8 +7506,12 @@ ACE_OS::readlink (const char *path, char *buf, size_t bufsiz)
ACE_UNUSED_ARG (buf);
ACE_UNUSED_ARG (bufsiz);
ACE_NOTSUP_RETURN (-1);
-#else
- ACE_OSCALL_RETURN (::readlink (path, buf, bufsiz), int, -1);
+# else
+# if !defined(ACE_HAS_NONCONST_READLINK)
+ ACE_OSCALL_RETURN (::readlink (path, buf, bufsiz), int, -1);
+# else
+ ACE_OSCALL_RETURN (::readlink ((char *)path, buf, bufsiz), int, -1);
+# endif
# endif /* ACE_LACKS_READLINK */
}
diff --git a/ace/SOCK_Dgram_Bcast.cpp b/ace/SOCK_Dgram_Bcast.cpp
index e3546e301c0..061ab9f669d 100644
--- a/ace/SOCK_Dgram_Bcast.cpp
+++ b/ace/SOCK_Dgram_Bcast.cpp
@@ -140,9 +140,19 @@ ACE_SOCK_Dgram_Bcast::mk_broadcast (const ASYS_TCHAR *host_name)
if (hp == 0)
return -1;
else
+#if !defined(_UNICOS)
ACE_OS::memcpy ((char *) &host_addr.sin_addr.s_addr,
(char *) hp->h_addr,
hp->h_length);
+#else /* _UNICOS */
+ {
+ ACE_UINT64 haddr; // a place to put the address
+ char * haddrp = (char *) &haddr; // convert to char pointer
+ haddr += 4; // adjust within the word
+ ACE_OS::memcpy(haddrp,(char *) hp->h_addr,hp->h_length);
+ host_addr.sin_addr.s_addr = haddr;
+ }
+#endif /* ! _UNICOS */
}
for (int n = ifc.ifc_len / sizeof (struct ifreq) ; n > 0; n--, ifr++)
diff --git a/ace/config-cray.h b/ace/config-cray.h
new file mode 100644
index 00000000000..076c5394b41
--- /dev/null
+++ b/ace/config-cray.h
@@ -0,0 +1,240 @@
+/* -*- C++ -*- */
+// $Id$
+
+#ifndef ACE_CONFIG_CRAY_H
+#define ACE_CONFIG_CRAY_H
+
+/*
+ The following predefined macros are used within ACE ifdefs.
+ These are defined when using the Cray compilers. _CRAYMPP
+ is defined, for example, if you are running on a Cray T3E
+ massively parallel machine. Moreover, in the case of the T3E,
+ _CRAYT3E will be defined. This is used to determine the
+ ACE_SIZEOF defines for primitive types.
+
+ _UNICOS is defined as either the major version of UNICOS being run,
+ e.g. 9 or 10 on the vector machines (e.g. C90, T90, J90, YMP, ...)
+ or the major+minor+level UNICOS/mk version, e.g. 2.0.3 => 203,
+ being run on an MPP machine.
+
+ Summary:
+
+ _CRAYMPP (defined only if running on MPP machine, e.g. T3E, UNICOS/mk)
+ _CRAYT3E (defined specifically if compiling on a Cray T3E)
+ _UNICOS (defined if running UNICOS or UNICOS/mk)
+
+ Tested on UNICOS 10.0.0.2, UNICOS/mk 2.0.3.10
+
+ Contributed by Doug Anderson <doug@clark.net>
+*/
+
+#if defined (_UNICOS) && !defined (MAXPATHLEN)
+#define MAXPATHLEN 1023
+#endif /* _UNICOS */
+
+// Turns off the tracing feature.
+#if !defined (ACE_NTRACE)
+#define ACE_NTRACE 1
+#endif /* ACE_NTRACE */
+
+#define ACE_DEFAULT_CLOSE_ALL_HANDLES 0
+
+// Defines the page size of the system.
+#define ACE_PAGE_SIZE 4096
+
+#define ACE_HAS_CPLUSPLUS_HEADERS
+
+// using cray's autoinstantiation gives C++ prelinker: error: instantiation loop
+#define ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA
+
+#define ACE_HAS_TEMPLATE_SPECIALIZATION
+
+#define ACE_HAS_ANSI_CASTS
+
+#define ACE_HAS_USING_KEYWORD
+
+#define ACE_HAS_SSIZE_T
+
+#define ACE_HAS_SYSV_IPC
+
+#define ACE_MT_SAFE 1
+
+#define ACE_HAS_THREADS
+
+#define ACE_HAS_PTHREADS
+
+// UNICOS implements a small subset of POSIX Threads, but the prototypes follow
+// the POSIX.1c-1995 definitions
+#define ACE_HAS_PTHREADS_STD
+
+#define ACE_HAS_THREAD_SPECIFIC_STORAGE
+
+#define ACE_HAS_PTHREAD_MUTEXATTR_SETKIND_NP
+
+#define ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R
+
+#define ACE_HAS_POSIX_TIME
+
+#define ACE_HAS_TIMEZONE_GETTIMEOFDAY
+
+#define ACE_HAS_POSIX_NONBLOCK
+
+#define ACE_HAS_TERM_IOCTLS
+
+#define ACE_HAS_DIRENT
+
+#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT
+
+#define ACE_HAS_IP_MULTICAST
+
+#define ACE_HAS_SIN_LEN
+
+#define ACE_HAS_NONCONST_SELECT_TIMEVAL
+
+#define ACE_HAS_NONCONST_READLINK
+
+#define ACE_HAS_CHARPTR_SOCKOPT
+
+#define ACE_HAS_NONCONST_GETBY
+
+// has man pages, but links with missing symbols and I can't find lib yet
+/* #define ACE_HAS_REGEX */
+
+#define ACE_HAS_SIG_MACROS
+
+#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES
+
+#define ACE_HAS_SIGWAIT
+
+#define ACE_HAS_SIG_ATOMIC_T
+
+#define ACE_HAS_SIGISMEMBER_BUG
+
+#define ACE_HAS_MSG
+
+#define ACE_HAS_STRERROR
+
+#define ACE_HAS_GPERF
+
+// Special modifications that apply to UNICOS/mk
+#if defined(_CRAYMPP)
+
+# define ACE_HAS_SIGINFO_T
+# define ACE_HAS_UCONTEXT_T
+
+#endif
+
+// The Cray T90 supposedly supports SYSV SHMEM, but I was unable to get it
+// working. Of course, all other Cray PVP and MPP systems do NOT support it,
+// so it's probably good to just define like this for consistency
+#define ACE_LACKS_SYSV_SHMEM
+
+#define ACE_LACKS_MMAP
+
+#define ACE_LACKS_CONST_TIMESPEC_PTR
+
+#define ACE_LACKS_SYSCALL
+
+#define ACE_LACKS_STRRECVFD
+
+#define ACE_LACKS_MADVISE
+
+#define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS
+
+#define ACE_LACKS_LINEBUFFERED_STREAMBUF
+
+#define ACE_LACKS_PTHREAD_CLEANUP
+
+#define ACE_LACKS_CONDATTR_PSHARED
+
+#define ACE_LACKS_THREAD_PROCESS_SCOPING
+
+#if !defined(_CRAYMPP)
+
+#define ACE_LACKS_PTHREAD_CANCEL
+
+#define ACE_LACKS_PTHREAD_KILL
+
+#endif
+
+#define ACE_LACKS_MUTEXATTR_PSHARED
+
+#define ACE_LACKS_RWLOCK_T
+
+#define ACE_LACKS_PRI_T
+
+#define ACE_LACKS_GETPGID
+
+#define ACE_LACKS_MPROTECT
+
+#define ACE_LACKS_MSYNC
+
+#define ACE_LACKS_READV
+
+#define ACE_LACKS_RLIMIT
+
+// we probably want to fake not having this, since Cray memory mgmt is different
+#define ACE_LACKS_SBRK
+
+#define ACE_LACKS_SETSCHED
+
+#define ACE_LACKS_SIGINFO_H
+
+#define ACE_LACKS_TIMESPEC_T
+
+#define ACE_LACKS_WRITEV
+
+// Cray vector machines are "word" oriented, and modern ones are hard 64-bit.
+// "char" is somewhat of a special case. Most problems arise when code thinks
+// it can address 32-bit quantities and the like. MPP crays are typically
+// byte oriented, e.g. T3E uses Alpha processors, so we don't need as much
+// special treatment.
+
+#ifndef _CRAYMPP
+
+# define ACE_SIZEOF_CHAR 1
+# define ACE_SIZEOF_SHORT 8
+# define ACE_SIZEOF_INT 8
+# define ACE_SIZEOF_LONG 8
+# define ACE_SIZEOF_LONG_LONG 8
+# define ACE_SIZEOF_FLOAT 8
+# define ACE_SIZEOF_DOUBLE 8
+# define ACE_SIZEOF_LONG_DOUBLE 16
+# define ACE_SIZEOF_VOID_P 8
+
+#elif defined(_CRAYT3E)
+
+# define ACE_SIZEOF_CHAR 1
+# define ACE_SIZEOF_SHORT 4
+# define ACE_SIZEOF_INT 8
+# define ACE_SIZEOF_LONG 8
+# define ACE_SIZEOF_LONG_LONG 8
+# define ACE_SIZEOF_FLOAT 4
+# define ACE_SIZEOF_DOUBLE 8
+# define ACE_SIZEOF_LONG_DOUBLE 8
+# define ACE_SIZEOF_VOID_P 8
+
+#endif
+
+// Ones to check out at some point
+
+/* #define ACE_HAS_SYS_SIGLIST */
+
+// C++ Compiler stuff to verify
+/* #define ACE_NEW_THROWS_EXCEPTIONS */
+/* #define ACE_HAS_TEMPLATE_TYPEDEFS */
+
+// thread issues to check out
+/* #define ACE_LACKS_TIMEDWAIT_PROTOTYPES */
+
+// Cray does seem to support it, in -lnsl and has tiuser.h header
+/* #define ACE_HAS_TLI */
+/* #define ACE_HAS_TIUSER_H */
+/* #define ACE_HAS_TLI_PROTOTYPES */
+/* #define ACE_LACKS_T_ERRNO */
+
+/* #define ACE_LACKS_NAMED_POSIX_SEM */
+
+/* #define ACE_HAS_SYS_ERRLIST */
+
+#endif /* ACE_CONFIG_CRAY_H */