aboutsummaryrefslogtreecommitdiff
path: root/update.sh
diff options
context:
space:
mode:
authorBrent Cook <busterb@gmail.com>2014-11-20 00:24:20 -0600
committerBrent Cook <bcook@openbsd.org>2014-12-03 17:03:47 -0600
commit1bbde19a7c0db8d25fb496dea3e05e3dbc0bbeaf (patch)
tree0758b56c2bfcae4f5df1db8bf241a17b8d59d8c5 /update.sh
parent96bf8be098b434ec19146d5724b60179ae56e00a (diff)
downloadportable-1bbde19a7c0db8d25fb496dea3e05e3dbc0bbeaf.tar.gz
portable-1bbde19a7c0db8d25fb496dea3e05e3dbc0bbeaf.tar.bz2
portable-1bbde19a7c0db8d25fb496dea3e05e3dbc0bbeaf.zip
add minimal poll(2) implementation for Windows
This provides sufficient functionality to run openssl(1) from a Windows console. This is based on the original select-based version from from songdongsheng@live.cn. Changes: * use nfds_t directly for iterating the fds. * add WSAGetLastError -> errno mappings * handle POLLHUP and the OOB data cases for revents * handle sparse arrays of fds correctly * KNF style updates * teach poll how to handle file handles as well as sockets This handles the socket/non-socket issue by alternating a loop between WaitForMultipleObjects for non-sockets and and select for sockets. One would think this would be terrible for performance, but as of this writing, poll consumes about 6% of the time doing a bulk transfer between a Linux box and 'openssl.exe s_server'. I tried to implement this all in terms of WaitForMultipleObjects with a select 'poll' at the end to get extra specific socket status. However, the cost of setting up an event handle for each socket, setting the WSAEventSelect attributes, and cleaning them up reliably was pretty high. Since the event handle associated with a socket is also global, creating a new one cancels the previous one or can be disabled externally. In addition, the 'FD_WRITE' status of a socket event handle does not behave in an expected fashion, being triggered by an edge on a write event rather than being level triggered. Another fun horror story is how stdin in windows might be a console, it might be a pipe, it might be something else. If these all worked in the same way, it would be great. But, since a console-stdin can also signal on a mouse or window event, it means we can easily get stuck in a blocking read (you can't make stdin non-blocking) if the non-character events are not filtered out. So, poll does that too. See here for various additional horror stories: http://www.postgresql.org/message-id/4351.1336927207@sss.pgh.pa.us
Diffstat (limited to 'update.sh')
-rwxr-xr-xupdate.sh2
1 files changed, 1 insertions, 1 deletions
diff --git a/update.sh b/update.sh
index cda2766..1038bb3 100755
--- a/update.sh
+++ b/update.sh
@@ -283,7 +283,6 @@ copy_crypto x509v3 "v3_bcons.c v3_bitst.c v3_conf.c v3_extku.c v3_ia5.c v3_lib.c
283 pcy_cache.c pcy_node.c pcy_data.c pcy_map.c pcy_tree.c pcy_lib.c 283 pcy_cache.c pcy_node.c pcy_data.c pcy_map.c pcy_tree.c pcy_lib.c
284 pcy_int.h ext_dat.h" 284 pcy_int.h ext_dat.h"
285 285
286rm -f apps/*.c apps/*.h
287for i in $openssl_cmd_src/*; do 286for i in $openssl_cmd_src/*; do
288 cp $i apps 287 cp $i apps
289done 288done
@@ -444,6 +443,7 @@ crypto_win32_only=(
444# conditional compiles 443# conditional compiles
445$CP $libc_src/stdlib/strtonum.c apps/ 444$CP $libc_src/stdlib/strtonum.c apps/
446apps_excludes=( 445apps_excludes=(
446 poll.c
447 strtonum.c 447 strtonum.c
448 ) 448 )
449apps_posix_only=( 449apps_posix_only=(