Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

IO_SAP.cpp

Go to the documentation of this file.
00001 #include "ace_pch.h"
00002 // IO_SAP.cpp
00003 // $Id: IO_SAP.cpp,v 1.1.1.3.40.1 2003/03/13 19:44:21 chad Exp $
00004 
00005 #include "ace/IO_SAP.h"
00006 #include "ace/Log_Msg.h"
00007 
00008 #if defined (ACE_LACKS_INLINE_FUNCTIONS)
00009 #include "ace/IO_SAP.i"
00010 #endif /* ACE_LACKS_INLINE_FUNCTIONS */
00011 
00012 ACE_RCSID(ace, IO_SAP, "$Id: IO_SAP.cpp,v 1.1.1.3.40.1 2003/03/13 19:44:21 chad Exp $")
00013 
00014 ACE_ALLOC_HOOK_DEFINE(ACE_IO_SAP)
00015 
00016 // This is the do-nothing constructor.  It does not perform a
00017 // ACE_OS::open system call.
00018 
00019 ACE_IO_SAP::ACE_IO_SAP (void)
00020   : handle_ (ACE_INVALID_HANDLE)
00021 {
00022   ACE_TRACE ("ACE_IO_SAP::ACE_IO_SAP");
00023 }
00024 
00025 void
00026 ACE_IO_SAP::dump (void) const
00027 {
00028   ACE_TRACE ("ACE_IO_SAP::dump");
00029 
00030   ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
00031   ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("handle_ = %d"), this->handle_));
00032   ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\npid_ = %d"), this->pid_));
00033   ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
00034 }
00035 
00036 // Cache for the process ID.
00037 pid_t ACE_IO_SAP::pid_ = 0;
00038 
00039 int
00040 ACE_IO_SAP::enable (int value) const
00041 {
00042   ACE_TRACE ("ACE_IO_SAP::enable");
00043   /* First-time in initialization. */
00044   if (ACE_IO_SAP::pid_ == 0)
00045     ACE_IO_SAP::pid_ = ACE_OS::getpid ();
00046 
00047 #if !defined(ACE_WIN32) && !defined (VXWORKS)
00048 
00049   switch (value)
00050     {
00051 #if defined (SIGURG)
00052     case SIGURG:
00053     case ACE_SIGURG:
00054 #if defined (F_SETOWN)
00055       return ACE_OS::fcntl (this->handle_,
00056                             F_SETOWN,
00057                             ACE_IO_SAP::pid_);
00058 #else
00059       ACE_NOTSUP_RETURN (-1);
00060 #endif /* F_SETOWN */
00061 #endif /* SIGURG */
00062 #if defined (SIGIO)
00063     case SIGIO:
00064     case ACE_SIGIO:
00065 #if defined (F_SETOWN) && defined (FASYNC)
00066       if (ACE_OS::fcntl (this->handle_,
00067                          F_SETOWN,
00068                          ACE_IO_SAP::pid_) == -1
00069           || ACE_Flag_Manip::set_flags (this->handle_,
00070                              FASYNC) == -1)
00071         return -1;
00072       break;
00073 #else
00074       ACE_NOTSUP_RETURN (-1);
00075 #endif /* F_SETOWN && FASYNC */
00076 #else  // <==
00077       ACE_NOTSUP_RETURN (-1);
00078 #endif /* SIGIO <== */
00079     case ACE_NONBLOCK:
00080       if (ACE_Flag_Manip::set_flags (this->handle_,
00081                           ACE_NONBLOCK) == -1)
00082         return -1;
00083       break;
00084     default:
00085       return -1;
00086     }
00087 #else
00088   ACE_UNUSED_ARG (value);
00089 #endif /* !ACE_WIN32 */
00090 
00091   return 0;
00092 }
00093 
00094 int
00095 ACE_IO_SAP::disable (int value) const
00096 {
00097   ACE_TRACE ("ACE_IO_SAP::disable");
00098 
00099 #if !defined(ACE_WIN32) && !defined (VXWORKS)
00100   switch (value)
00101     {
00102 #if defined (SIGURG)
00103     case SIGURG:
00104     case ACE_SIGURG:
00105 #if defined (F_SETOWN)
00106       if (ACE_OS::fcntl (this->handle_,
00107                          F_SETOWN, 0) == -1)
00108         return -1;
00109       break;
00110 #else
00111       ACE_NOTSUP_RETURN (-1);
00112 #endif /* F_SETOWN */
00113 #endif /* SIGURG */
00114 #if defined (SIGIO)
00115     case SIGIO:
00116     case ACE_SIGIO:
00117 #if defined (F_SETOWN) && defined (FASYNC)
00118       if (ACE_OS::fcntl (this->handle_,
00119                          F_SETOWN,
00120                          0) == -1
00121           || ACE_Flag_Manip::clr_flags (this->handle_, FASYNC) == -1)
00122         return -1;
00123       break;
00124 #else
00125       ACE_NOTSUP_RETURN (-1);
00126 #endif /* F_SETOWN && FASYNC */
00127 #else  // <==
00128       ACE_NOTSUP_RETURN (-1);
00129 #endif /* SIGIO <== */
00130     case ACE_NONBLOCK:
00131       if (ACE_Flag_Manip::clr_flags (this->handle_,
00132                                      ACE_NONBLOCK) == -1)
00133         return -1;
00134       break;
00135     default:
00136       return -1;
00137     }
00138   return 0;
00139 #else
00140   ACE_UNUSED_ARG (value);
00141   ACE_NOTSUP_RETURN (-1);
00142 #endif /* !ACE_WIN32 */
00143 }

Generated on Mon Jun 16 11:19:54 2003 for ACE by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002