diff options
Diffstat (limited to 'editors/emacs/patches/patch-aj')
-rw-r--r-- | editors/emacs/patches/patch-aj | 150 |
1 files changed, 68 insertions, 82 deletions
diff --git a/editors/emacs/patches/patch-aj b/editors/emacs/patches/patch-aj index 5383bc56c7a..7270e29d633 100644 --- a/editors/emacs/patches/patch-aj +++ b/editors/emacs/patches/patch-aj @@ -1,7 +1,7 @@ -$NetBSD: patch-aj,v 1.7 2000/06/24 17:03:38 minoura Exp $ +$NetBSD: patch-aj,v 1.8 2000/09/08 16:56:58 itojun Exp $ --- src/process.c.orig Wed May 24 04:10:16 2000 -+++ src/process.c Sun Jun 18 09:20:15 2000 ++++ src/process.c Mon Sep 4 14:15:19 2000 @@ -1,7 +1,18 @@ +/* + * Locally hacked process.c to add ipv6 support. -wsr @@ -25,8 +25,12 @@ $NetBSD: patch-aj,v 1.7 2000/06/24 17:03:38 minoura Exp $ { Lisp_Object proc; register int i; -+ -+#ifndef HAVE_GETADDRINFO ++#ifdef HAVE_GETADDRINFO ++ struct addrinfo hints, *res, *lres; ++ int ret = 0; ++ int xerrno = 0; ++ char *portstring, portbuf [128]; ++#else /* HAVE_GETADDRINFO */ struct sockaddr_in address; struct servent *svc_info; struct hostent *host_info_ptr, host_info; @@ -37,12 +41,8 @@ $NetBSD: patch-aj,v 1.7 2000/06/24 17:03:38 minoura Exp $ - int port; struct hostent host_info_fixed; + int port; -+#else /* HAVE_GETADDRINFO */ -+ struct addrinfo hints, *res, *lres; -+ int ret; -+ char *portstring, portbuf [128]; +#endif /* HAVE_GETADDRINFO */ -+ int s, outch, inch; ++ int s = -1, outch, inch; struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; int retry = 0; int count = specpdl_ptr - specpdl; @@ -69,105 +69,91 @@ $NetBSD: patch-aj,v 1.7 2000/06/24 17:03:38 minoura Exp $ if (INTEGERP (service)) port = htons ((unsigned short) XINT (service)); else -@@ -1841,6 +1874,8 @@ +@@ -1841,6 +1874,7 @@ error ("Unknown service \"%s\"", XSTRING (service)->data); port = svc_info->s_port; } +#endif /* HAVE_GETADDRINFO */ -+ /* Slow down polling to every ten seconds. Some kernels have a bug which causes retrying connect to fail -@@ -1850,6 +1885,88 @@ +@@ -1850,6 +1884,75 @@ #endif #ifndef TERM -+#ifdef HAVE_GETADDRINFO /* We have a modern OS. -wsr */ -+ { -+ immediate_quit = 1; -+ QUIT; -+ memset(&hints, 0, sizeof(hints)); -+ hints.ai_flags = AI_NUMERICHOST; -+ hints.ai_family = AF_UNSPEC; -+ hints.ai_socktype = SOCK_STREAM; -+ hints.ai_protocol = 0; -+ ret = getaddrinfo(XSTRING (host)->data, portstring, &hints, &res); -+ if (!ret) { /* numeric */ -+ freeaddrinfo(res); -+ hints.ai_flags = AI_CANONNAME; -+ } else { /* non-numeric */ -+ hints.ai_flags = 0; -+ } -+ ret = getaddrinfo(XSTRING (host)->data, portstring, &hints, &res); -+ if (ret){ -+ error("%s/%s %s", XSTRING (host)->data, portstring, -+ gai_strerror(ret)); -+ } -+ immediate_quit = 0; -+ } -+ -+ lres = res; -+ addrloop: /* address loop */ ++#ifdef HAVE_GETADDRINFO /* We have a modern OS. -wsr */ ++ immediate_quit = 1; ++ QUIT; ++ memset(&hints, 0, sizeof(hints)); ++ hints.ai_flags = 0; ++ hints.ai_family = AF_UNSPEC; ++ hints.ai_socktype = SOCK_STREAM; ++ hints.ai_protocol = 0; ++ ret = getaddrinfo(XSTRING (host)->data, portstring, &hints, &res); ++ if (ret) ++ error("%s/%s %s", XSTRING (host)->data, portstring, gai_strerror(ret)); ++ immediate_quit = 0; ++ ++ for (lres = res; lres ; lres = lres->ai_next) ++ { + s = socket(lres->ai_family, lres->ai_socktype, lres->ai_protocol); -+ if (s < 0) -+ report_file_error ("error creating socket", Fcons (name, Qnil)); ++ if (s < 0) ++ { ++ xerrno = errno; ++ continue; ++ } + + /* Kernel bugs (on Ultrix at least) cause lossage (not just EINTR) -+ when connect is interrupted. So let's not let it get interrupted. -+ Note we do not turn off polling, because polling is only used -+ when not interrupt_input, and thus not normally used on the systems -+ which have this bug. On systems which use polling, there's no way -+ to quit if polling is turned off. */ ++ when connect is interrupted. So let's not let it get interrupted. ++ Note we do not turn off polling, because polling is only used ++ when not interrupt_input, and thus not normally used on the systems ++ which have this bug. On systems which use polling, there's no way ++ to quit if polling is turned off. */ + if (interrupt_input) -+ unrequest_sigio (); -+ -+ loop: ++ unrequest_sigio (); + ++ loop: + immediate_quit = 1; + QUIT; + -+ if (connect(s, lres->ai_addr, lres->ai_addrlen) == -1 -+ && errno != EISCONN) -+ { -+ int xerrno = errno; -+ -+ immediate_quit = 0; -+ -+ if (errno == EINTR) -+ goto loop; -+ if (errno == EADDRINUSE && retry < 20) -+ { -+ /* A delay here is needed on some FreeBSD systems, -+ and it is harmless, since this retrying takes time anyway -+ and should be infrequent. */ -+ Fsleep_for (make_number (1), Qnil); -+ retry++; -+ goto loop; -+ } -+ -+ close (s); -+ -+ if (interrupt_input) -+ request_sigio (); ++ if (connect(s, lres->ai_addr, lres->ai_addrlen) == 0 || ++ errno == EISCONN) ++ break; + -+ if (lres->ai_next) { -+ lres = lres->ai_next; -+ goto addrloop; -+ } ++ xerrno = errno; ++ immediate_quit = 0; + ++ if (errno == EINTR) ++ goto loop; ++ if (errno == EADDRINUSE && retry < 20) ++ { ++ /* A delay here is needed on some FreeBSD systems, ++ and it is harmless, since this retrying takes time anyway ++ and should be infrequent. */ ++ Fsleep_for (make_number (1), Qnil); ++ retry++; ++ goto loop; ++ } ++ ++ close(s); ++ s = -1; ++ } + -+ errno = xerrno; -+ report_file_error ("connection failed", -+ Fcons (host, Fcons (name, Qnil))); -+ } -+ /* address loop */ + freeaddrinfo(res); ++ if (s < 0) ++ { ++ if (interrupt_input) ++ request_sigio (); ++ ++ errno = xerrno; ++ report_file_error ("connection failed", ++ Fcons (host, Fcons (name, Qnil))); ++ } +#else /* HAVE_GETADDRINFO */ -+ while (1) { #ifdef TRY_AGAIN -@@ -1940,6 +2057,7 @@ +@@ -1940,6 +2043,7 @@ report_file_error ("connection failed", Fcons (host, Fcons (name, Qnil))); } |