OS_NS_sys_select.inl

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // $Id: OS_NS_sys_select.inl 80826 2008-03-04 14:51:23Z wotte $
00004 
00005 #include "ace/OS_NS_errno.h"
00006 #include "ace/OS_NS_macros.h"
00007 #include "ace/Time_Value.h"
00008 
00009 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00010 
00011 // It would be really cool to add another version of select that would
00012 // function like the one we're defending against below!
00013 ACE_INLINE int
00014 ACE_OS::select (int width,
00015                 fd_set *rfds, fd_set *wfds, fd_set *efds,
00016                 const ACE_Time_Value *timeout)
00017 {
00018   ACE_OS_TRACE ("ACE_OS::select");
00019 #if defined (ACE_HAS_NONCONST_SELECT_TIMEVAL)
00020   // We must defend against non-conformity!
00021   timeval copy;
00022   timeval *timep = 0;
00023 
00024   if (timeout != 0)
00025     {
00026       copy = *timeout;
00027       timep = ©
00028     }
00029   else
00030     timep = 0;
00031 #else
00032   const timeval *timep = (timeout == 0 ? (const timeval *)0 : *timeout);
00033 #endif /* ACE_HAS_NONCONST_SELECT_TIMEVAL */
00034 #if defined (ACE_LACKS_SELECT)
00035   ACE_UNUSED_ARG (width);
00036   ACE_UNUSED_ARG (rfds);
00037   ACE_UNUSED_ARG (wfds);
00038   ACE_UNUSED_ARG (efds);
00039   ACE_UNUSED_ARG (timeout);
00040   ACE_NOTSUP_RETURN (-1);
00041 #elif defined(ACE_TANDEM_T1248_PTHREADS)
00042   ACE_SOCKCALL_RETURN (::spt_select (width, rfds, wfds, efds, timep),
00043                        int, -1);
00044 #else
00045   ACE_SOCKCALL_RETURN (::select (width, rfds, wfds, efds, timep),
00046                        int, -1);
00047 #endif
00048 }
00049 
00050 ACE_INLINE int
00051 ACE_OS::select (int width,
00052                 fd_set *rfds, fd_set *wfds, fd_set *efds,
00053                 const ACE_Time_Value &timeout)
00054 {
00055   ACE_OS_TRACE ("ACE_OS::select");
00056 #if defined (ACE_HAS_NONCONST_SELECT_TIMEVAL)
00057 # define ___ACE_TIMEOUT &copy
00058   timeval copy = timeout;
00059 #else
00060 # define ___ACE_TIMEOUT timep
00061   const timeval *timep = timeout;
00062 #endif /* ACE_HAS_NONCONST_SELECT_TIMEVAL */
00063 #if defined (ACE_LACKS_SELECT)
00064   ACE_UNUSED_ARG (width);
00065   ACE_UNUSED_ARG (rfds);
00066   ACE_UNUSED_ARG (wfds);
00067   ACE_UNUSED_ARG (efds);
00068   ACE_UNUSED_ARG (timeout);
00069   ACE_NOTSUP_RETURN (-1);
00070 #elif defined(ACE_TANDEM_T1248_PTHREADS)
00071   ACE_SOCKCALL_RETURN (::spt_select (width, rfds, wfds, efds, ___ACE_TIMEOUT),
00072                        int, -1);
00073 #else
00074   ACE_SOCKCALL_RETURN (::select (width, rfds, wfds, efds, ___ACE_TIMEOUT),
00075                        int, -1);
00076 #endif
00077 #undef ___ACE_TIMEOUT
00078 }
00079 
00080 ACE_END_VERSIONED_NAMESPACE_DECL

Generated on Tue Feb 2 17:18:41 2010 for ACE by  doxygen 1.4.7