diff options
author | schmidt <douglascraigschmidt@users.noreply.github.com> | 1996-10-29 09:52:04 +0000 |
---|---|---|
committer | schmidt <douglascraigschmidt@users.noreply.github.com> | 1996-10-29 09:52:04 +0000 |
commit | 098be87e87abaac4c5d323b134338c23630e41fe (patch) | |
tree | 11b261a2676ef1e544714d03e97a5973805d86fb /ace | |
parent | 271d64ab4e708b324b8b6fc70344803f1241ce3d (diff) | |
download | ATCD-098be87e87abaac4c5d323b134338c23630e41fe.tar.gz |
jamming
Diffstat (limited to 'ace')
-rw-r--r-- | ace/Future.cpp | 2 | ||||
-rw-r--r-- | ace/OS.cpp | 25 | ||||
-rw-r--r-- | ace/OS.i | 11 | ||||
-rw-r--r-- | ace/SOCK_Dgram.cpp | 40 | ||||
-rw-r--r-- | ace/SOCK_Dgram.h | 7 | ||||
-rw-r--r-- | ace/SOCK_IO.cpp | 4 | ||||
-rw-r--r-- | ace/SOCK_IO.h | 2 | ||||
-rw-r--r-- | ace/Thread_Manager.cpp | 3 | ||||
-rw-r--r-- | ace/Trace.cpp | 4 | ||||
-rw-r--r-- | ace/config-win32-msvc4.0.h | 8 |
10 files changed, 83 insertions, 23 deletions
diff --git a/ace/Future.cpp b/ace/Future.cpp index 3114afaf637..e95eeb3a860 100644 --- a/ace/Future.cpp +++ b/ace/Future.cpp @@ -327,7 +327,7 @@ ACE_Future<T>::dump (void) const } template <class T> void * -ACE_Future<T>::operator new (size_t nbytes) +ACE_Future<T>::operator new (size_t) { return 0; } diff --git a/ace/OS.cpp b/ace/OS.cpp index c28efabad4b..7cf2759f637 100644 --- a/ace/OS.cpp +++ b/ace/OS.cpp @@ -754,16 +754,23 @@ ACE_OS::thr_create (ACE_THR_FUNC func, int, -1, result); ::pthread_attr_delete (&attr); if (thr_handle != 0) - thr_handle = (ACE_hthread_t *) 0; -#else /* ACE_HAS_SETKIND_NP */ + *thr_handle = (ACE_hthread_t) 0; +#else /* !ACE_HAS_SETKIND_NP */ ACE_OSCALL (ACE_ADAPT_RETVAL (::pthread_create (p_thr, &attr, func, args), result), int, -1, result); ::pthread_attr_destroy (&attr); + +#if defined (ACE_HAS_STHREADS) + // This is the Solaris implementation of pthreads, where + // ACE_thread_t and ACE_hthread_t are the same. + if (result == 0 && thr_handle != 0) + *thr_handle = *thr_id; +#else if (thr_handle != 0) - *thr_handle = (ACE_hthread_t) 0; + thr_handle = (ACE_hthread_t *) 0; +#endif /* ACE_HAS_STHREADS */ #endif /* ACE_HAS_SETKIND_NP */ - return result; #elif defined (ACE_HAS_STHREADS) int result; @@ -841,8 +848,8 @@ ACE_OS::thr_create (ACE_THR_FUNC func, // an even integer. // if called with thr_create() defaults, use same default values as ::sp() - if ( stacksize == 0 ) stacksize = 20000; - if ( priority == 0 ) priority = 100; + if (stacksize == 0) stacksize = 20000; + if (priority == 0) priority = 100; ACE_hthread_t tid = ::taskSpawn (thr_id == 0 ? NULL : *thr_id, priority, (int) flags, (int) stacksize, func, @@ -852,19 +859,19 @@ ACE_OS::thr_create (ACE_THR_FUNC func, ((int *) args)[6], ((int *) args)[7], ((int *) args)[8], ((int *) args)[9]); - if ( tid == ERROR ) + if (tid == ERROR) return -1; else { // return the thr_id and thr_handle, if addresses were provided for them - if ( thr_id != 0 ) + if (thr_id != 0) // taskTcb (int tid) returns the address of the WIND_TCB // (task control block). According to the taskSpawn() // documentation, the name of the new task is stored at // pStackBase, but is that of the current task? If so, it // would be a bit quicker than this extraction of the tcb . . . *thr_id = taskTcb (tid)->name; - if ( thr_handle != 0 ) + if (thr_handle != 0) *thr_handle = tid; return 0; } @@ -832,8 +832,8 @@ ACE_OS::mutex_trylock (ACE_mutex_t *m) } /* NOTREACHED */ #elif defined (VXWORKS) - if ( ::semTake (*m, NO_WAIT) == ERROR ) - if ( errno == S_objLib_OBJ_TIMEOUT ) + if (::semTake (*m, NO_WAIT) == ERROR) + if (errno == S_objLib_OBJ_TIMEOUT) // couldn't get the semaphore return 1; else @@ -3322,7 +3322,7 @@ ACE_OS::thr_kill (ACE_thread_t thr_id, int signum) ACE_OSCALL (ACE_ADAPT_RETVAL (::taskNameToId (thr_id), tid), int, ERROR, tid); - if ( tid == ERROR ) + if (tid == ERROR) return -1; else ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::kill (tid, signum), ace_result_), @@ -3430,7 +3430,6 @@ ACE_OS::thr_suspend (ACE_hthread_t target_thread) #elif defined (ACE_HAS_DCETHREADS) || defined (ACE_HAS_PTHREADS) ACE_NOTSUP_RETURN (-1); #elif defined (ACE_HAS_WTHREADS) - if (::SuspendThread (target_thread) != ACE_SYSCALL_FAILED) return 0; else @@ -4041,7 +4040,7 @@ ACE_OS::dlclose (void *handle) #endif /* ACE_HAS_AUTOMATIC_INIT_FINI */ ACE_OSCALL_RETURN (::dlclose (handle), int, -1); #elif defined (ACE_WIN32) - ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::FreeLibrary (handle), ace_result_), int, -1); + ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::FreeLibrary ((HMODULE) handle), ace_result_), int, -1); #else ACE_NOTSUP_RETURN (-1); #endif /* ACE_HAS_SVR4_DYNAMIC_LINKING */ @@ -4095,7 +4094,7 @@ ACE_OS::dlsym (void *handle, ACE_DL_TYPE symbolname) ACE_OSCALL_RETURN (::dlsym (handle, symbolname), void *, 0); #endif /* ACE_LACKS_POSIX_PROTO */ #elif defined (ACE_WIN32) - ACE_OSCALL_RETURN (::GetProcAddress (handle, symbolname), void *, 0); + ACE_OSCALL_RETURN (::GetProcAddress ((HMODULE) handle, symbolname), void *, 0); #else ACE_NOTSUP_RETURN (0); #endif /* ACE_HAS_SVR4_DYNAMIC_LINKING */ diff --git a/ace/SOCK_Dgram.cpp b/ace/SOCK_Dgram.cpp index e6ccde3b011..95a2cbed7dd 100644 --- a/ace/SOCK_Dgram.cpp +++ b/ace/SOCK_Dgram.cpp @@ -14,6 +14,46 @@ ACE_SOCK_Dgram::dump (void) const ACE_TRACE ("ACE_SOCK_Dgram::dump"); } +// Allows a client to read from a socket without having to provide a +// buffer to read. This method determines how much data is in the +// socket, allocates a buffer of this size, reads in the data, and +// returns the number of bytes read. + +ssize_t +ACE_SOCK_Dgram::recv (iovec *io_vec, ACE_Addr &addr, int flags) const +{ + ACE_TRACE ("ACE_SOCK_Dgram::recv"); + sockaddr *saddr = (sockaddr *) addr.get_addr (); + int addr_len = addr.get_size (); + +#if defined (FIONREAD) + u_long inlen; + + if (ACE_OS::ioctl (this->get_handle (), + FIONREAD, (u_long *) &inlen) == -1) + return -1; + else if (inlen > 0) + { + io_vec->iov_base = new char[inlen]; + io_vec->iov_len = ACE_OS::recvfrom (this->get_handle (), + io_vec->iov_base, + inlen, + flags, + (sockaddr *) saddr, + &addr_len); + addr.set_size (addr_len); + return io_vec->iov_len; + } + else + return 0; +#else + flags = flags; + addr = addr; + io_vec = io_vec; + ACE_NOTSUP_RETURN (-1); +#endif /* FIONREAD */ +} + // Here's the shared open function. Note that if we are using the // PF_INET protocol family and the address of LOCAL == the address of // the special variable SAP_ANY then we are going to arbitrarily bind diff --git a/ace/SOCK_Dgram.h b/ace/SOCK_Dgram.h index 7760a9e6356..8ce511532bd 100644 --- a/ace/SOCK_Dgram.h +++ b/ace/SOCK_Dgram.h @@ -55,6 +55,13 @@ public: // Receive an <n> byte <buf> from the datagram socket (uses // recvfrom(3)). + ssize_t recv (iovec *io_vec, ACE_Addr &addr, int flags) const; + // Allows a client to read from a socket without having to provide a + // buffer to read. This method determines how much data is in the + // socket, allocates a buffer of this size, reads in the data, and + // returns the number of bytes read. The caller is responsible for + // deleting the member in the <iov_base> field of <io_vec>. + #if defined (ACE_HAS_MSG) ssize_t send (const iovec iov[], size_t n, diff --git a/ace/SOCK_IO.cpp b/ace/SOCK_IO.cpp index 3da79a7d6c9..9e63fc3ffe1 100644 --- a/ace/SOCK_IO.cpp +++ b/ace/SOCK_IO.cpp @@ -33,11 +33,11 @@ ACE_SOCK_IO::recv (iovec *io_vec) return io_vec->iov_len; } else + return 0; #else io_vec = io_vec; + ACE_NOTSUP_RETURN (-1); #endif /* FIONREAD */ - // Could return ACE_NOTSUP_RETURN - return 0; } // Send N char *ptrs and int lengths. Note that the char *'s precede diff --git a/ace/SOCK_IO.h b/ace/SOCK_IO.h index 0f78d5fa827..147403c018e 100644 --- a/ace/SOCK_IO.h +++ b/ace/SOCK_IO.h @@ -74,7 +74,7 @@ public: // buffer to read. This method determines how much data is in the // socket, allocates a buffer of this size, reads in the data, and // returns the number of bytes read. The caller is responsible for - // deleting the memory. + // deleting the member in the <iov_base> field of <io_vec>. void dump (void) const; // Dump the state of an object. diff --git a/ace/Thread_Manager.cpp b/ace/Thread_Manager.cpp index cca071714ec..c318081b424 100644 --- a/ace/Thread_Manager.cpp +++ b/ace/Thread_Manager.cpp @@ -268,7 +268,8 @@ ACE_Thread_Manager::spawn_n (int n, { // @@ What should happen if this fails?! e.g., should we try to // cancel the other threads that we've already spawned or what? - if (this->spawn_i (func, args, flags, 0, 0, priority, grp_id, task) == -1) + if (this->spawn_i (func, args, flags, 0, 0, priority, grp_id, + 0, 0, task) == -1) return -1; } diff --git a/ace/Trace.cpp b/ace/Trace.cpp index 1053a45159f..45bf0bbc52b 100644 --- a/ace/Trace.cpp +++ b/ace/Trace.cpp @@ -85,7 +85,7 @@ ACE_Trace::ACE_Trace (const char *n, && lm->trace_active () == 0) { lm->trace_active (1); - ACE_DEBUG ((LM_DEBUG, "%*s(%t) calling %s in file `%s' on line %d\n", + ACE_DEBUG ((LM_TRACE, "%*s(%t) calling %s in file `%s' on line %d\n", ACE_Trace::nesting_indent_ * lm->inc (), "", this->name_, file, line)); lm->trace_active (0); @@ -105,7 +105,7 @@ ACE_Trace::~ACE_Trace (void) && lm->trace_active () == 0) { lm->trace_active (1); - ACE_DEBUG ((LM_DEBUG, "%*s(%t) leaving %s\n", + ACE_DEBUG ((LM_TRACE, "%*s(%t) leaving %s\n", ACE_Trace::nesting_indent_ * lm->dec (), "", this->name_)); lm->trace_active (0); diff --git a/ace/config-win32-msvc4.0.h b/ace/config-win32-msvc4.0.h index d47c772c03c..56a0deaaf96 100644 --- a/ace/config-win32-msvc4.0.h +++ b/ace/config-win32-msvc4.0.h @@ -66,7 +66,7 @@ //define ACE_HAS_AUTOMATIC_INIT_FINI // Compiler doesn't support static data member templates. -#define ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES +// #define ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES // Version 1.1 of WinSock #define ACE_WSOCK_VERSION 1, 1 @@ -166,4 +166,10 @@ #define ACE_NEEDS_WRITEV #define ACE_NEEDS_READV +// STRICT type checking in WINDOWS.H enhances type safety for Windows +// programs by using distinct types to represent all the different +// HANDLES in Windows. So for example, STRICT prevents you from +// mistakenly passing an HPEN to a routine expecting an HBITMAP. +#define STRICT + #endif /* ACE_CONFIG_H */ |