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

ACE_Flag_Manip Class Reference

#include <Flag_Manip.h>

Inheritance diagram for ACE_Flag_Manip:

Inheritance graph
[legend]
List of all members.

Static Public Methods

int set_flags (ACE_HANDLE handle, int flags)
 Set flags associated with <handle>. More...

int clr_flags (ACE_HANDLE handle, int flags)
 Clear flags associated with <handle>. More...

int get_flags (ACE_HANDLE handle)
 Return the current setting of flags associated with <handle>. More...


Member Function Documentation

int ACE_Flag_Manip::clr_flags ACE_HANDLE    handle,
int    flags
[static]
 

Clear flags associated with <handle>.

Definition at line 50 of file Flag_Manip.cpp.

References ACE_CLR_BITS, ACE_NONBLOCK, ACE_TRACE, F_GETFL, ACE_OS::fcntl, and ACE_OS::ioctl.

Referenced by ACE_IPC_SAP::disable, ACE_IO_SAP::disable, ACE_Asynch_Connector::handle_connect, ACE::restore_non_blocking_mode, ACE_SOCK_Acceptor::shared_accept_finish, and ACE_MEM_Acceptor::shared_accept_finish.

00051 {
00052   ACE_TRACE ("ACE_Flag_Manip::clr_flags");
00053 
00054 #if defined (ACE_WIN32) || defined (VXWORKS) || defined (ACE_LACKS_FCNTL)
00055   switch (flags)
00056     {
00057     case ACE_NONBLOCK:
00058       // nonblocking argument (1)
00059       // blocking:            (0)
00060       {
00061         u_long nonblock = 0;
00062         return ACE_OS::ioctl (handle, FIONBIO, &nonblock);
00063       }
00064     default:
00065       ACE_NOTSUP_RETURN (-1);
00066     }
00067 #else
00068   int val = ACE_OS::fcntl (handle, F_GETFL, 0);
00069 
00070   if (val == -1)
00071     return -1;
00072 
00073   // Turn flags off.
00074   ACE_CLR_BITS (val, flags);
00075 
00076   if (ACE_OS::fcntl (handle, F_SETFL, val) == -1)
00077     return -1;
00078   else
00079     return 0;
00080 #endif /* ACE_WIN32 || ACE_LACKS_FCNTL */
00081 }

ASYS_INLINE int ACE_Flag_Manip::get_flags ACE_HANDLE    handle [static]
 

Return the current setting of flags associated with <handle>.

Definition at line 7 of file Flag_Manip.i.

References ACE_TRACE, F_GETFL, and ACE_OS::fcntl.

Referenced by ACE::record_and_set_non_blocking_mode, and ACE_SOCK_Acceptor::shared_accept_start.

00008 {
00009   ACE_TRACE ("ACE_Flag_Manip::get_flags");
00010 
00011 #if defined (ACE_LACKS_FCNTL)
00012   // ACE_OS::fcntl is not supported, e.g., on VxWorks.  It
00013   // would be better to store ACE's notion of the flags
00014   // associated with the handle, but this works for now.
00015   ACE_UNUSED_ARG (handle);
00016   return 0;
00017 #else
00018   return ACE_OS::fcntl (handle, F_GETFL, 0);
00019 #endif /* ACE_LACKS_FCNTL */
00020 }

int ACE_Flag_Manip::set_flags ACE_HANDLE    handle,
int    flags
[static]
 

Set flags associated with <handle>.

Definition at line 15 of file Flag_Manip.cpp.

References ACE_NONBLOCK, ACE_SET_BITS, ACE_TRACE, F_GETFL, ACE_OS::fcntl, and ACE_OS::ioctl.

Referenced by ACE_AIOCB_Notify_Pipe_Manager::ACE_AIOCB_Notify_Pipe_Manager, ACE_WIN32_Asynch_Connect::connect_i, ACE_POSIX_Asynch_Connect::connect_i, ACE_IPC_SAP::enable, ACE_IO_SAP::enable, ACE_Select_Reactor_Notify::open, ACE_Dev_Poll_Reactor_Notify::open, ACE::record_and_set_non_blocking_mode, and ACE_SOCK_Acceptor::shared_accept_start.

00016 {
00017   ACE_TRACE ("ACE_Flag_Manip::set_flags");
00018 #if defined (ACE_WIN32) || defined (VXWORKS) || defined (ACE_LACKS_FCNTL)
00019   switch (flags)
00020     {
00021     case ACE_NONBLOCK:
00022       // nonblocking argument (1)
00023       // blocking:            (0)
00024       {
00025         u_long nonblock = 1;
00026         return ACE_OS::ioctl (handle, FIONBIO, &nonblock);
00027       }
00028     default:
00029       ACE_NOTSUP_RETURN (-1);
00030     }
00031 #else
00032   int val = ACE_OS::fcntl (handle, F_GETFL, 0);
00033 
00034   if (val == -1)
00035     return -1;
00036 
00037   // Turn on flags.
00038   ACE_SET_BITS (val, flags);
00039 
00040   if (ACE_OS::fcntl (handle, F_SETFL, val) == -1)
00041     return -1;
00042   else
00043     return 0;
00044 #endif /* ACE_WIN32 || ACE_LACKS_FCNTL */
00045 }


The documentation for this class was generated from the following files:
Generated on Mon Jun 16 12:48:01 2003 for ACE by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002