Closed jwt27 closed 1 year ago
Oh, I see libc does provide readv
/writev
, but inc/sys/uio.h
completely hides the libc header. Should have another #include_next
there.
It compiles now, with the missing macros defined to 0. Tried building and running some of the examples too, looks like it all works.
I do think it would be nice to have a consistent definition for ECANCELED
. @gvanem, how would you feel about adding it in Watt32?
I do think it would be nice to have a consistent definition for ECANCELED
Sure, how about just:
diff --git a/util/errnos.c b/util/errnos.c
index 109ab4e..f69758a 100644
--- a/util/errnos.c
+++ b/util/errnos.c
@@ -529,6 +529,7 @@ static const char *err_tab[] = {
"RVD related disk error (EVDBAD)",
"Out of remote working directory stuctures (ENORMTWD)", /* 94 */
"Value too large (EOVERFLOW)",
+ "Operation canceled (ECANCELED)", /* 96 */
};
#define ADD_ERRNO(err_num) add_errno (err_num, #err_num, strerror(err_num))
@@ -1111,6 +1112,12 @@ static void process (void)
#else
NEW_ERRNO (94);
#endif
+
+#ifdef ECANCELED
+ ADD_ERRNO (ECANCELED);
+#else
+ NEW_ERRNO (96);
+#endif
}
The missing support for SA_x
and IPV6_y
stuff would be very tricky to fix.
But besides that, does your merged stuff help the issues in this PR? I'm not familiar with Boost ans Asio.
BTW, I see it is defined in both Cygwin and Andrew's djgpp distro (gcc 12.1.0). Here:
$(DJGPP)/windows/lib/gcc/i586-pc-msdosdjgpp/12.1.0/include/c++/i586-pc-msdosdjgpp/bits/error_constants.h
I do think it would be nice to have a consistent definition for ECANCELED
Sure, how about just:
diff --git a/util/errnos.c b/util/errnos.c index 109ab4e..f69758a 100644 --- a/util/errnos.c +++ b/util/errnos.c @@ -529,6 +529,7 @@ static const char *err_tab[] = { "RVD related disk error (EVDBAD)", "Out of remote working directory stuctures (ENORMTWD)", /* 94 */ "Value too large (EOVERFLOW)", + "Operation canceled (ECANCELED)", /* 96 */ }; #define ADD_ERRNO(err_num) add_errno (err_num, #err_num, strerror(err_num)) @@ -1111,6 +1112,12 @@ static void process (void) #else NEW_ERRNO (94); #endif + +#ifdef ECANCELED + ADD_ERRNO (ECANCELED); +#else + NEW_ERRNO (96); +#endif }
Looks good to me, thanks. And I see you already added it, great!
BTW, I see it is defined in both Cygwin and Andrew's djgpp distro (gcc 12.1.0). Here:
$(DJGPP)/windows/lib/gcc/i586-pc-msdosdjgpp/12.1.0/include/c++/i586-pc-msdosdjgpp/bits/error_constants.h
I added that in case libc or watt32 ever decided to add new errnos (like right now :) ). Asio doesn't seem to need std::errc
though, it has its own equivalent enum here:
https://github.com/chriskohlhoff/asio/blob/master/asio/include/asio/error.hpp
The missing support for
SA_x
andIPV6_y
stuff would be very tricky to fix. But besides that, does your merged stuff help the issues in this PR? I'm not familiar with Boost ans Asio.
The SA_
flags can safely be defined to 0, I'm quite sure. The IPV6 stuff too probably, as long as you don't try to use it.
This is the patch I intend to submit:
https://github.com/chriskohlhoff/asio/compare/master...jwt27:asio:djgpp
Hm, still having some trouble. I'm trying the basic http client example from asio. What it does:
connect()
(returns EINPROGRESS
)poll()
for POLLOUT
eventSO_ERROR
via getsockopt()
This returns EISCONN
, and it gets interpreted as a failure. I think only connect()
should be able to return EISCONN
.
I changed my asio patch so that it uses ioctlsocket()
:
https://github.com/jwt27/asio/commit/011725021975c35563766434148d89a657b4e53a
It requires extra casts since ioctlsocket()
here takes a char*
, but interprets the argument as int
-sized.
Now I'm wondering, why is that? Maybe we can make it use void*
instead?
This all works now, will close. Thanks!
Hi!
I was just looking into using the C++ asio library with djgpp/watt32, but it seems we're missing a few things.
Compiling the above test file, I see:
Missing functions:
readv
/writev
: These already exist asreadv_s
andwritev_s
. Can we get these declared in<sys/uio.h>
?socketpair
: Can be ifdef'd out, as is done for Windows.Missing errno:
ECANCELED
: I suppose I could just define it to some random number.Missing signal options:
SA_RESTART
:SA_NOCLDWAIT
: Should be provided by libc, but I think I can safely define these to 0.Missing ipv6 stuff:
IPPROTO_IPV6
IPV6_JOIN_GROUP
IPV6_LEAVE_GROUP
IPV6_MULTICAST_IF
IPV6_MULTICAST_LOOP
IPV6_MULTICAST_HOPS
IPV6_UNICAST_HOPS
Seems asio expects a complete ipv6 implementation, I don't see an obvious way to disable it. What's the status on that?