1 #include "ace/Flag_Manip.h"
3 #if defined (ACE_LACKS_FCNTL)
4 # include "ace/OS_NS_stropts.h"
5 # include "ace/OS_NS_errno.h"
6 #endif /* ACE_LACKS_FCNTL */
8 #if defined (ACE_LACKS_IOCTL)
9 # include "ace/OS_NS_devctl.h"
12 #if !defined (__ACE_INLINE__)
13 #include "ace/Flag_Manip.inl"
14 #endif /* __ACE_INLINE__ */
16 #if defined (CYGWIN32)
17 # include "ace/os_include/os_termios.h"
20 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
22 // Flags are file status flags to turn on.
25 ACE::set_flags (ACE_HANDLE handle
, int flags
)
27 ACE_TRACE ("ACE::set_flags");
28 #if defined (ACE_LACKS_FCNTL)
32 // nonblocking argument (1)
36 # if defined (ACE_LACKS_IOCTL)
38 return ACE_OS::posix_devctl (handle
, FIONBIO
, &nonblock
,
39 sizeof nonblock
, &dev_info
);
41 return ACE_OS::ioctl (handle
, FIONBIO
, &nonblock
);
45 ACE_NOTSUP_RETURN (-1);
48 int val
= ACE_OS::fcntl (handle
, F_GETFL
, 0);
54 ACE_SET_BITS (val
, flags
);
56 if (ACE_OS::fcntl (handle
, F_SETFL
, val
) == -1)
60 #endif /* ACE_LACKS_FCNTL */
63 // Flags are the file status flags to turn off.
66 ACE::clr_flags (ACE_HANDLE handle
, int flags
)
68 ACE_TRACE ("ACE::clr_flags");
69 #if defined (ACE_LACKS_FCNTL)
73 // nonblocking argument (1)
77 # if defined (ACE_LACKS_IOCTL)
79 return ACE_OS::posix_devctl (handle
, FIONBIO
, &nonblock
,
80 sizeof nonblock
, &dev_info
);
82 return ACE_OS::ioctl (handle
, FIONBIO
, &nonblock
);
86 ACE_NOTSUP_RETURN (-1);
89 int val
= ACE_OS::fcntl (handle
, F_GETFL
, 0);
95 ACE_CLR_BITS (val
, flags
);
97 if (ACE_OS::fcntl (handle
, F_SETFL
, val
) == -1)
101 #endif /* ACE_LACKS_FCNTL */
104 ACE_END_VERSIONED_NAMESPACE_DECL