1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
// -*- C++ -*-
// $Id$
#include "ace/OS_NS_errno.h"
#include "ace/OS_NS_macros.h"
#include "ace/Time_Value.h"
// It would be really cool to add another version of select that would
// function like the one we're defending against below!
ACE_INLINE int
ACE_OS::select (int width,
fd_set *rfds, fd_set *wfds, fd_set *efds,
const ACE_Time_Value *timeout)
{
ACE_OS_TRACE ("ACE_OS::select");
#if defined (ACE_HAS_NONCONST_SELECT_TIMEVAL)
// We must defend against non-conformity!
timeval copy;
timeval *timep;
if (timeout != 0)
{
copy = *timeout;
timep = ©
}
else
timep = 0;
#else
const timeval *timep = (timeout == 0 ? (const timeval *)0 : *timeout);
#endif /* ACE_HAS_NONCONST_SELECT_TIMEVAL */
#if defined(ACE_TANDEM_T1248_PTHREADS)
ACE_SOCKCALL_RETURN (::spt_select (width,
(ACE_FD_SET_TYPE *) rfds,
(ACE_FD_SET_TYPE *) wfds,
(ACE_FD_SET_TYPE *) efds,
timep),
int, -1);
#else
ACE_SOCKCALL_RETURN (::select (width,
(ACE_FD_SET_TYPE *) rfds,
(ACE_FD_SET_TYPE *) wfds,
(ACE_FD_SET_TYPE *) efds,
timep),
int, -1);
#endif
}
ACE_INLINE int
ACE_OS::select (int width,
fd_set *rfds, fd_set *wfds, fd_set *efds,
const ACE_Time_Value &timeout)
{
ACE_OS_TRACE ("ACE_OS::select");
#if defined (ACE_HAS_NONCONST_SELECT_TIMEVAL)
# define ___ACE_TIMEOUT ©
timeval copy = timeout;
#else
# define ___ACE_TIMEOUT timep
const timeval *timep = timeout;
#endif /* ACE_HAS_NONCONST_SELECT_TIMEVAL */
#if defined(ACE_TANDEM_T1248_PTHREADS)
ACE_SOCKCALL_RETURN (::spt_select (width,
(ACE_FD_SET_TYPE *) rfds,
(ACE_FD_SET_TYPE *) wfds,
(ACE_FD_SET_TYPE *) efds,
___ACE_TIMEOUT),
int, -1);
#else
ACE_SOCKCALL_RETURN (::select (width,
(ACE_FD_SET_TYPE *) rfds,
(ACE_FD_SET_TYPE *) wfds,
(ACE_FD_SET_TYPE *) efds,
___ACE_TIMEOUT),
int, -1);
#endif
#undef ___ACE_TIMEOUT
}
|