summaryrefslogtreecommitdiff
path: root/devel/boost-libs/files/patch-boost_asio-ioctl
blob: 2422f44875afff29573b6b9b37877827d7b61ede (plain) (blame)
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
--- boost/asio/detail/io_control.hpp.orig	2011-06-06 03:21:43.000000000 +0400
+++ boost/asio/detail/io_control.hpp	2012-07-10 13:24:45.000000000 +0400
@@ -44,9 +44,9 @@
   }
 
   // Get the name of the IO control command.
-  int name() const
+  ioctl_cmd_type name() const
   {
-    return static_cast<int>(FIONBIO);
+    return static_cast<ioctl_cmd_type>(FIONBIO);
   }
 
   // Set the value of the I/O control command.
@@ -94,9 +94,9 @@
   }
 
   // Get the name of the IO control command.
-  int name() const
+  ioctl_cmd_type name() const
   {
-    return static_cast<int>(FIONREAD);
+    return static_cast<ioctl_cmd_type>(FIONREAD);
   }
 
   // Set the value of the I/O control command.
--- boost/asio/detail/descriptor_ops.hpp.orig	2010-12-06 01:55:08.000000000 +0300
+++ boost/asio/detail/descriptor_ops.hpp	2010-12-06 01:55:39.000000000 +0300
@@ -79,7 +79,7 @@
     const buf* bufs, std::size_t count,
     boost::system::error_code& ec, std::size_t& bytes_transferred);
 
-BOOST_ASIO_DECL int ioctl(int d, state_type& state, long cmd,
+BOOST_ASIO_DECL int ioctl(int d, state_type& state, ioctl_cmd_type cmd,
     ioctl_arg_type* arg, boost::system::error_code& ec);
 
 BOOST_ASIO_DECL int fcntl(int d, long cmd, boost::system::error_code& ec);
--- boost/asio/detail/socket_ops.hpp.orig	2010-12-06 01:58:36.000000000 +0300
+++ boost/asio/detail/socket_ops.hpp	2010-12-06 01:59:42.000000000 +0300
@@ -222,7 +222,7 @@
     std::size_t* addrlen, boost::system::error_code& ec);
 
 BOOST_ASIO_DECL int ioctl(socket_type s, state_type& state,
-    int cmd, ioctl_arg_type* arg, boost::system::error_code& ec);
+    ioctl_cmd_type cmd, ioctl_arg_type* arg, boost::system::error_code& ec);
 
 BOOST_ASIO_DECL int select(int nfds, fd_set* readfds, fd_set* writefds,
     fd_set* exceptfds, timeval* timeout, boost::system::error_code& ec);
--- boost/asio/detail/impl/descriptor_ops.ipp.orig	2010-12-06 01:44:38.000000000 +0300
+++ boost/asio/detail/impl/descriptor_ops.ipp	2010-12-06 01:41:33.000000000 +0300
@@ -251,7 +251,7 @@
   }
 }
 
-int ioctl(int d, state_type& state, long cmd,
+int ioctl(int d, state_type& state, ioctl_cmd_type cmd,
     ioctl_arg_type* arg, boost::system::error_code& ec)
 {
   if (d == -1)
@@ -273,7 +273,7 @@
     // descriptor is put into the state that has been requested by the user. If
     // the ioctl syscall was successful then we need to update the flags to
     // match.
-    if (cmd == static_cast<long>(FIONBIO))
+    if (cmd == static_cast<ioctl_cmd_type>(FIONBIO))
     {
       if (*arg)
       {
--- boost/asio/detail/impl/socket_ops.ipp.orig	2010-12-06 01:46:05.000000000 +0300
+++ boost/asio/detail/impl/socket_ops.ipp	2010-12-06 01:49:39.000000000 +0300
@@ -1414,7 +1414,7 @@
   return result;
 }
 
-int ioctl(socket_type s, state_type& state, int cmd,
+int ioctl(socket_type s, state_type& state, ioctl_cmd_type cmd,
     ioctl_arg_type* arg, boost::system::error_code& ec)
 {
   if (s == invalid_socket)
@@ -1424,15 +1424,10 @@
   }
 
   clear_last_error();
-#if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
-  int result = error_wrapper(::ioctlsocket(s, cmd, arg), ec);
-#elif defined(__MACH__) && defined(__APPLE__) \
-  || defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__)
+
   int result = error_wrapper(::ioctl(s,
-        static_cast<unsigned int>(cmd), arg), ec);
-#else
-  int result = error_wrapper(::ioctl(s, cmd, arg), ec);
-#endif
+        static_cast<ioctl_cmd_type>(cmd), arg), ec);
+
   if (result >= 0)
   {
     ec = boost::system::error_code();
@@ -1442,7 +1437,7 @@
     // the correct state. This ensures that the underlying socket is put into
     // the state that has been requested by the user. If the ioctl syscall was
     // successful then we need to update the flags to match.
-    if (cmd == static_cast<int>(FIONBIO))
+    if (cmd == static_cast<ioctl_cmd_type>(FIONBIO))
     {
       if (*arg)
       {
--- boost/asio/detail/socket_types.hpp.orig	2010-12-06 01:35:39.000000000 +0300
+++ boost/asio/detail/socket_types.hpp	2010-12-06 01:36:05.000000000 +0300
@@ -147,6 +147,12 @@
 typedef sockaddr_storage sockaddr_storage_type;
 typedef sockaddr_un sockaddr_un_type;
 typedef addrinfo addrinfo_type;
+#if (defined(__MACH__) && defined(__APPLE__)) || defined(__DragonFly__) || \
+    defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
+typedef unsigned long ioctl_cmd_type;
+#else
+typedef int ioctl_cmd_type;
+#endif
 typedef int ioctl_arg_type;
 typedef uint32_t u_long_type;
 typedef uint16_t u_short_type;