libmicrohttpd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [libmicrohttpd] Remove plibc?


From: LRN
Subject: Re: [libmicrohttpd] Remove plibc?
Date: Thu, 30 Jan 2014 21:03:00 +0400
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:29.0) Gecko/20100101 Thunderbird/29.0a1

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 30.01.2014 20:45, Evgeny Grin wrote:
> 26.01.2014, 19:23, "LRN" <address@hidden>:
>> On 26.01.2014 18:29, Evgeny Grin wrote:
>> 
>>> On 26.01.2014, 04:21, "LRN" wrote:
>>>> Going back to the list of imports: Wrappers that ARE needed 
>>>> (require errno conversion): _win_recv _win_send _win_accept 
>>>> _win_socket
>>>> 
>>>> Wrappers that are NOT needed, but are good to have for error 
>>>> reporting (again, they do errno conversion): _win_setsockopt 
>>>> _win_bind _win_listen
>>>> 
>>>> Implementations (may or may not be simplified, depends on
>>>> the case): _win_mmap _win_munmap _win_select _win_socketpair 
>>>> _win_strerror
>>>> 
>>>> Wrappers that are not needed: _win_close - define CLOSE(s) 
>>>> closesocket(s) _win_shutdown - define SHUTDOWN(s)
>>>> shutdown(s) _win_write - wrapper
>>>> 
>>>> Utility functions that are likely not needed: 
>>>> _SetErrnoFromWinError - client and wrapper/implementation
>>>> code will be synchronized with regards to error handling
>>>> (i.e. the function will only convert the errors that the
>>>> caller checks for), so this generic function is only needed
>>>> for error reporting (and having actual W32 error codes is
>>>> usually better for that purpose anyway). plibc_init     -
>>>> they mostly do unneeded stuff, however WS2 startup
>>>> plibc_shutdown - and cleanup functions may need to be called
>>>> in MHD.
>>>> 
>>>> Implementations that are not needed (already in MHD): 
>>>> _win_tdelete _win_tfind _win_tsearch
>>> Good! So, to remove plibc form code we need: * implement
>>> simplified errnoFromLastErr() * add _win_recv, _win_send,
>>> _win_accept, _win_socket, _win_setsockopt, _win_bind and
>>> _win_listen to MHD. And all of them will be { _type ret =
>>> func(); errnoFromLastErr(); return ret; } For compilers with
>>> inline support they can be inlined.
>> 
>> Yep
>> 
>>> * add simplified implementation of _win_socketpair(). I'd name
>>> it MHD_pipe and remove #ifdef from code.
>> 
>> There may be objections from grothoff's side. I, personally,
>> don't care.
>> 
>>> * add very simplified implementation of _win_strerror(): it
>>> must process only winsock specific errors and call host
>>> strerror() for rest of errors. * add native Win32 parts to
>>> memorypool.c
>> 
>> Yep
>> 
>>> Is implementation of select() really required? Isn't simple
>>> wrapper enough?
>> 
>> No, since we don't deal with pipes anymore, it's OK to call WS2 
>> select() (well, it's _probably_ ok)
>> 
>> 
> 
> First two commits were added to
> https://github.com/Karlson2k/libmicrohttpd/commits/remove_plibc To
> get them as patches: 
> https://github.com/Karlson2k/libmicrohttpd/commit/06d862a22f93d131490f576da8732284aedb0114.patch
>  
> https://github.com/Karlson2k/libmicrohttpd/commit/0e49f7a9794272e813edce47deeb1199ca717da7.patch
>
>  Could you review them as W32-port maintainer? If they are OK in
> general, I'll continue to working on MHD code.
> 

Are you absolutely sure that it's OK to use close() on sockets?
Because this does not seem to be documented.
OTOH, W32 is known for neat undocumented features, so if this works on
XP, and 7, it might be OK to use; though a simple #define CLOSE(s)
closesocket(s) for W32 would have sufficed...

VirtualAlloc is probably OK

- -- 
O< ascii ribbon - stop html email! - www.asciiribbon.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (MingW32)

iQEcBAEBAgAGBQJS6oXDAAoJEOs4Jb6SI2Cw4JsIALwPD78A2NVTZIshhyLLvAxE
e1o2eQhXo0EdVErGJDFzZkieVQhWYn4DaxZVyLxUBnnpK6/H03Pu5zqLLhK7qwdt
wsDoCftnMrW9+eVF8r+EuW3VAe6JzHCXC4AcV3s9zjNi74ckiRjHcAO3880Wh1XY
HLOJC9hob9VsNWv6q5sbfNvb29YPsKZnxSnY6pUWyloJmUuY6k4jfWnEoGiMxagZ
zDhGZ1sCLBR5vrlObzu9WSItrNAVPpy21BK+coYBTpmzo5a3u9EJGmL4IroJ6udz
sQ2NDiNh0vfyoRcWGaUy2vCgwSeV2jytRarAbRPDyISYwrrQjZ1CDCDmEKNi1Zs=
=hs6J
-----END PGP SIGNATURE-----



reply via email to

[Prev in Thread] Current Thread [Next in Thread]