kgio RubyGem user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
From: Jeremy Evans <code@jeremyevans.net>
To: kgio@librelist.com
Subject: Fixes for OpenBSD
Date: Thu, 5 May 2011 11:18:46 -0700	[thread overview]
Message-ID: <20110505181846.GB9693@jeremyevans.local> (raw)
In-Reply-To: <20110505181846.GB9693@jeremyevans.local>

I'm not sure if these issues are specific to OpenBSD or not, but they
are required on OpenBSD.

With these two patches, kgio-2.3.3 passes the included tests on OpenBSD
except for one failure:

1) Failure:
test_wait_writable_set(TestKgioTcpConnect) [test/test_tcp_connect.rb:69]:
<"waited"> expected but was
<nil>.

Hope this helps,
Jeremy

Fix kgio_peek by adding an empty kgio_autopush_recv
if !KGIO_NOPUSH.

--- ext/kgio/autopush.c.orig	Thu May  5 11:02:08 2011
+++ ext/kgio/autopush.c	Thu May  5 11:02:12 2011
@@ -242,6 +242,7 @@ static void push_pending_data(VALUE io)
 		rb_sys_fail("setsockopt(TCP_CORK/TCP_NOPUSH, 1)");
 }
 #else /* !KGIO_NOPUSH */
+void kgio_autopush_recv(VALUE io){}
 void init_kgio_autopush(void)
 {
 }

getaddrinfo gives an error if you use AF_UNSPEC as the ai_family,
the man page says PF_UNSPEC should be used.  And other entries
in hints need to be 0 or NULL.  

--- ext/kgio/connect.c.orig	Wed Dec 31 16:00:00 1969
+++ ext/kgio/connect.c	Thu May  5 10:47:10 2011
@@ -69,7 +69,8 @@ static VALUE tcp_connect(VALUE klass, VALUE ip, VALUE 
 	rc = snprintf(ipport, sizeof(ipport), "%u", uport);
 	if (rc >= (int)sizeof(ipport) || rc <= 0)
 		rb_raise(rb_eArgError, "invalid TCP port: %u", uport);
-	hints.ai_family = AF_UNSPEC;
+	memset(&hints, 0, sizeof(hints));
+	hints.ai_family = PF_UNSPEC;
 	hints.ai_socktype = SOCK_STREAM;
 	hints.ai_protocol = IPPROTO_TCP;
 	/* disallow non-deterministic DNS lookups */


       reply	other threads:[~2011-05-05 18:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-05 18:18 Jeremy Evans [this message]
2011-05-05 18:45 ` Fixes for OpenBSD Eric Wong
2011-05-05 19:29   ` Jeremy Evans
2011-05-05 19:33     ` Eric Wong
2011-05-05 19:35 ` Eric Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://yhbt.net/kgio/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110505181846.GB9693@jeremyevans.local \
    --to=code@jeremyevans.net \
    --cc=kgio@librelist.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhbt.net/kgio.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).