FreeBSD Bugzilla – Attachment 159771 Details for
Bug 202197
net/dante 1.4.1 fails to build on AMD64
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
unoffical patch from inet.no
dante-1.4.1-pipebuffer-freebsd.patch (text/plain), 17.82 KB, created by
Thomas Scholten
on 2015-08-11 15:37:02 UTC
(
hide
)
Description:
unoffical patch from inet.no
Filename:
MIME Type:
Creator:
Thomas Scholten
Created:
2015-08-11 15:37:02 UTC
Size:
17.82 KB
patch
obsolete
>diff -c -r dante-1.4.1/configure dante-1.4.1-mod/configure >*** dante-1.4.1/configure Wed Sep 3 16:52:29 2014 >--- dante-1.4.1-mod/configure Mon Aug 10 17:39:13 2015 >*************** >*** 16705,17017 **** > > #try to determine pipe buffer type > >! unset pipeside >! #Some systems seem to base how much can be written to the pipe based >! #on the size of the socket receive buffer (read-side), while others >! #on the size of the socket send buffer (send-side). >! # >! #This little hack tries to make an educated guess as to what is the >! #case on this particular system. >! { $as_echo "$as_me:${as_lineno-$LINENO}: checking read/send-side pipe system" >&5 >! $as_echo_n "checking read/send-side pipe system... " >&6; } >! if test "$cross_compiling" = yes; then : >! { $as_echo "$as_me:${as_lineno-$LINENO}: result: cross-compiling" >&5 >! $as_echo "cross-compiling" >&6; } >! else >! cat confdefs.h - <<_ACEOF >conftest.$ac_ext >! /* end confdefs.h. */ > >! #include <sys/types.h> >! #include <sys/socket.h> > >! #include <assert.h> >! #include <stdio.h> >! #include <stdlib.h> >! #include <string.h> >! #include <unistd.h> >! #include <fcntl.h> >! #include <errno.h> > >! #ifndef MIN >! #define MIN(a,b) ((a) < (b) ? (a) : (b)) >! #endif /* !MIN */ > >! #if NEED_AF_LOCAL >! #define AF_LOCAL AF_UNIX >! #endif /* NEED_AF_LOCAL */ > >! #define PACKETSIZE (1024) > >! #define PADBYTES (sizeof(short) * (64)) >! /* >! * Just a wild guess. Dante uses sizeof(long). >! */ > >! #define SEND_PIPE (0) >! #define RECV_PIPE (1) > >! #define EXIT_OK (0) /* type successfully determined */ >! #define EXIT_UNKNOWN (1) /* error: unable to determine type */ > >! static void >! setsockets(const int doreverse, const size_t packetsize, >! const int s, const int r, >! int *sndbuf, int *sndbuf_set, >! int *rcvbuf, int *rcvbuf_set); > >! static size_t >! sendtest(const int s, const char *buf, const size_t buflen); > >! void >! reswrite(const char *res); > >! int >! main(void) >! { >! size_t sent, packetcount; >! int sndbuf, sndbuf_set, rcvbuf, rcvbuf_set; >! char buf[PACKETSIZE]; >! int datapipev[2]; > >! if (socketpair(AF_LOCAL, SOCK_DGRAM, 0, datapipev) != 0) { >! perror("socketpair()"); >! exit(EXIT_UNKNOWN); >! } > >! setsockets(0, >! PACKETSIZE, >! datapipev[SEND_PIPE], >! datapipev[RECV_PIPE], >! &sndbuf, &sndbuf_set, >! &rcvbuf, &rcvbuf_set); > >! packetcount = MIN(sndbuf, sndbuf_set) / (PACKETSIZE + PADBYTES); > >! fprintf(stderr, >! "Requested sndbuf to be %d, is %d. " >! "Requested rcvbuf to be %d, is %d.\n" >! "Calculated packetcount is %lu\n", >! sndbuf, sndbuf_set, >! rcvbuf, rcvbuf_set, >! (unsigned long)packetcount); > >! sent = sendtest(datapipev[SEND_PIPE], buf, PACKETSIZE) / PACKETSIZE; > >! if (sent >= packetcount) { >! fprintf(stderr, "status determined by send-side\n"); >! reswrite("sendbased"); >! exit(EXIT_OK); >! } > >! /* >! * Try the reverse. Perhaps this system wants a large rcvbuf rather than >! * a large sndbuf. >! */ >! close(datapipev[SEND_PIPE]); >! close(datapipev[RECV_PIPE]); > >! if (socketpair(AF_LOCAL, SOCK_DGRAM, 0, datapipev) != 0) { >! perror("socketpair()"); >! exit(EXIT_UNKNOWN); >! } > >! setsockets(1, >! PACKETSIZE, >! datapipev[SEND_PIPE], >! datapipev[RECV_PIPE], >! &sndbuf, &sndbuf_set, >! &rcvbuf, &rcvbuf_set); > >! packetcount = MIN(rcvbuf, rcvbuf_set) / (PACKETSIZE + PADBYTES); > >! fprintf(stderr, >! "Requested sndbuf to be %d, is %d. " >! "Requested rcvbuf to be %d, is %d.\n" >! "Calculated packetcount is %lu\n", >! sndbuf, sndbuf_set, >! rcvbuf, rcvbuf_set, >! (unsigned long)packetcount); > >! sent = sendtest(datapipev[SEND_PIPE], buf, PACKETSIZE) / PACKETSIZE; > >! if (sent >= packetcount) { >! fprintf(stderr, "status determined by read-side\n"); >! reswrite("recvbased"); >! exit(EXIT_OK); >! } > >! fprintf(stderr, "status is unknown\n"); >! return EXIT_UNKNOWN; >! } > >! static void >! setsockets(doreverse, packetsize, s, r, sndbuf, sndbuf_set, rcvbuf, rcvbuf_set) >! const int doreverse; >! const size_t packetsize; >! const int s; >! const int r; >! int *sndbuf, *sndbuf_set; >! int *rcvbuf, *rcvbuf_set; >! { >! socklen_t len; >! int p; > >! if ((p = fcntl(s, F_GETFL, 0)) == -1 >! || fcntl(s, F_SETFL, p | O_NONBLOCK) == -1 >! || fcntl(r, F_SETFL, p | O_NONBLOCK) == -1) { >! perror("fcntl(F_SETFL/F_GETFL, O_NONBLOCK) failed"); >! exit(EXIT_UNKNOWN); >! } > >! len = sizeof(*sndbuf_set); > >! if (doreverse) { >! *sndbuf = packetsize + PADBYTES; > >! if (setsockopt(s, SOL_SOCKET, SO_SNDBUF, sndbuf, sizeof(*sndbuf)) != 0) { >! perror("setsockopt(SO_SNDBUF)"); >! exit(EXIT_UNKNOWN); >! } > >! if (getsockopt(s, SOL_SOCKET, SO_SNDBUF, sndbuf_set, &len) != 0) { >! perror("getsockopt(SO_SNDBUF)"); >! exit(EXIT_UNKNOWN); >! } > >! *rcvbuf = *sndbuf_set * 10; >! if (setsockopt(r, SOL_SOCKET, SO_RCVBUF, rcvbuf, sizeof(*rcvbuf)) != 0) { >! perror("setsockopt(SO_RCVBUF)"); >! exit(EXIT_UNKNOWN); >! } >! } >! else { >! *rcvbuf = packetsize + PADBYTES; > >! if (setsockopt(r, SOL_SOCKET, SO_RCVBUF, rcvbuf, sizeof(*rcvbuf)) != 0) { >! perror("setsockopt(SO_RCVBUF)"); >! exit(EXIT_UNKNOWN); >! } > >! if (getsockopt(r, SOL_SOCKET, SO_RCVBUF, rcvbuf_set, &len) != 0) { >! perror("getsockopt(SO_RCVBUF)"); >! exit(EXIT_UNKNOWN); >! } > >! *sndbuf = *rcvbuf_set * 10; >! if (setsockopt(s, SOL_SOCKET, SO_SNDBUF, sndbuf, sizeof(*sndbuf)) != 0) { >! perror("setsockopt(SO_SNDBUF)"); >! exit(EXIT_UNKNOWN); >! } >! } > >! if (getsockopt(s, SOL_SOCKET, SO_SNDBUF, sndbuf_set, &len) != 0 >! || getsockopt(r, SOL_SOCKET, SO_RCVBUF, rcvbuf_set, &len) != 0) { >! perror("getsockopt(SO_SNDBUF/SO_RCVBUF)"); >! exit(EXIT_UNKNOWN); >! } > >! fprintf(stderr, "sndbuf is %lu, rcvbuf is %lu\n", >! (unsigned long)*sndbuf_set, (unsigned long)*rcvbuf_set); > >! if (doreverse) { >! if (*rcvbuf_set < *rcvbuf) { >! fprintf(stderr, "failed to set rcvbuf to %lu. Is %lu\n", >! (unsigned long)*rcvbuf, (unsigned long)*rcvbuf_set); >! exit(EXIT_UNKNOWN); >! } >! } >! else { >! if (*sndbuf_set < *sndbuf) { >! fprintf(stderr, "failed to set sndbuf to %lu (is %lu)\n", >! (unsigned long)*sndbuf, (unsigned long)*sndbuf_set); >! exit(EXIT_UNKNOWN); >! } >! } >! } > >! static size_t >! sendtest(s, buf, buflen) >! const int s; >! const char *buf; >! const size_t buflen; >! { >! ssize_t rc; >! size_t sent; >! int i; > >! i = 1; >! sent = 0; >! errno = 0; > >! while (1) { >! if ((rc = write(s, buf, buflen)) == -1) >! break; >! else { >! assert(rc == (ssize_t)buflen); > >! ++i; >! sent += rc; >! } >! } > >! fprintf(stderr, >! "failed sending packet #%d, sent %ld/%ld. " >! "Total bytes sent: %lu. Error on last packet: %s\n", >! i, >! (long)rc, >! (unsigned long)buflen, >! (unsigned long)sent, >! strerror(errno)); > >! return sent; >! } > >! void >! reswrite(res) >! const char *res; >! { >! FILE *fp; >! if ((fp = fopen("conftest.out", "w")) == NULL) { >! perror("fopen"); >! exit(1); >! } >! fprintf(fp, "%s\n", res); >! fclose(fp); >! } >! _ACEOF >! if ac_fn_c_try_run "$LINENO"; then : >! pipeside=`cat conftest.out` >! { $as_echo "$as_me:${as_lineno-$LINENO}: result: $pipeside" >&5 >! $as_echo "$pipeside" >&6; } > >! else >! { $as_echo "$as_me:${as_lineno-$LINENO}: result: unknown" >&5 >! $as_echo "unknown" >&6; } >! fi >! rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ >! conftest.$ac_objext conftest.beam conftest.$ac_ext >! fi > > >! case $pipeside in >! recvbased) > >! $as_echo "#define HAVE_PIPEBUFFER_RECV_BASED 1" >>confdefs.h > >! ;; >! sendbased) > >! $as_echo "#define HAVE_PIPEBUFFER_SEND_BASED 1" >>confdefs.h > >! ;; >! *) > > $as_echo "#define HAVE_PIPEBUFFER_UNKNOWN 1" >>confdefs.h > >- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unable to determine PIPEBUFFER type" >&5 >- $as_echo "$as_me: WARNING: unable to determine PIPEBUFFER type" >&2;} >- ;; >- esac > > #obtain highest valid select() timeout seconds value > DEFAULTMAX=33333333 #corresponds roughly to one year >--- 16705,17022 ---- > > #try to determine pipe buffer type > >! # unset pipeside >! # #Some systems seem to base how much can be written to the pipe based >! # #on the size of the socket receive buffer (read-side), while others >! # #on the size of the socket send buffer (send-side). >! # # >! # #This little hack tries to make an educated guess as to what is the >! # #case on this particular system. >! # { $as_echo "$as_me:${as_lineno-$LINENO}: checking read/send-side pipe system" >&5 >! # $as_echo_n "checking read/send-side pipe system... " >&6; } >! # if test "$cross_compiling" = yes; then : >! # { $as_echo "$as_me:${as_lineno-$LINENO}: result: cross-compiling" >&5 >! # $as_echo "cross-compiling" >&6; } >! # else >! # cat confdefs.h - <<_ACEOF >conftest.$ac_ext >! # /* end confdefs.h. */ > >! # #include <sys/types.h> >! # #include <sys/socket.h> > >! # #include <assert.h> >! # #include <stdio.h> >! # #include <stdlib.h> >! # #include <string.h> >! # #include <unistd.h> >! # #include <fcntl.h> >! # #include <errno.h> > >! # #ifndef MIN >! # #define MIN(a,b) ((a) < (b) ? (a) : (b)) >! # #endif /* !MIN */ > >! # #if NEED_AF_LOCAL >! # #define AF_LOCAL AF_UNIX >! # #endif /* NEED_AF_LOCAL */ > >! # #define PACKETSIZE (1024) > >! # #define PADBYTES (sizeof(short) * (64)) >! # /* >! # * Just a wild guess. Dante uses sizeof(long). >! # */ > >! # #define SEND_PIPE (0) >! # #define RECV_PIPE (1) > >! # #define EXIT_OK (0) /* type successfully determined */ >! # #define EXIT_UNKNOWN (1) /* error: unable to determine type */ > >! # static void >! # setsockets(const int doreverse, const size_t packetsize, >! # const int s, const int r, >! # int *sndbuf, int *sndbuf_set, >! # int *rcvbuf, int *rcvbuf_set); > >! # static size_t >! # sendtest(const int s, const char *buf, const size_t buflen); > >! # void >! # reswrite(const char *res); > >! # int >! # main(void) >! # { >! # size_t sent, packetcount; >! # int sndbuf, sndbuf_set, rcvbuf, rcvbuf_set; >! # char buf[PACKETSIZE]; >! # int datapipev[2]; > >! # if (socketpair(AF_LOCAL, SOCK_DGRAM, 0, datapipev) != 0) { >! # perror("socketpair()"); >! # exit(EXIT_UNKNOWN); >! # } > >! # setsockets(0, >! # PACKETSIZE, >! # datapipev[SEND_PIPE], >! # datapipev[RECV_PIPE], >! # &sndbuf, &sndbuf_set, >! # &rcvbuf, &rcvbuf_set); > >! # packetcount = MIN(sndbuf, sndbuf_set) / (PACKETSIZE + PADBYTES); > >! # fprintf(stderr, >! # "Requested sndbuf to be %d, is %d. " >! # "Requested rcvbuf to be %d, is %d.\n" >! # "Calculated packetcount is %lu\n", >! # sndbuf, sndbuf_set, >! # rcvbuf, rcvbuf_set, >! # (unsigned long)packetcount); > >! # sent = sendtest(datapipev[SEND_PIPE], buf, PACKETSIZE) / PACKETSIZE; > >! # if (sent >= packetcount) { >! # fprintf(stderr, "status determined by send-side\n"); >! # reswrite("sendbased"); >! # exit(EXIT_OK); >! # } > >! # /* >! # * Try the reverse. Perhaps this system wants a large rcvbuf rather than >! # * a large sndbuf. >! # */ >! # close(datapipev[SEND_PIPE]); >! # close(datapipev[RECV_PIPE]); > >! # if (socketpair(AF_LOCAL, SOCK_DGRAM, 0, datapipev) != 0) { >! # perror("socketpair()"); >! # exit(EXIT_UNKNOWN); >! # } > >! # setsockets(1, >! # PACKETSIZE, >! # datapipev[SEND_PIPE], >! # datapipev[RECV_PIPE], >! # &sndbuf, &sndbuf_set, >! # &rcvbuf, &rcvbuf_set); > >! # packetcount = MIN(rcvbuf, rcvbuf_set) / (PACKETSIZE + PADBYTES); > >! # fprintf(stderr, >! # "Requested sndbuf to be %d, is %d. " >! # "Requested rcvbuf to be %d, is %d.\n" >! # "Calculated packetcount is %lu\n", >! # sndbuf, sndbuf_set, >! # rcvbuf, rcvbuf_set, >! # (unsigned long)packetcount); > >! # sent = sendtest(datapipev[SEND_PIPE], buf, PACKETSIZE) / PACKETSIZE; > >! # if (sent >= packetcount) { >! # fprintf(stderr, "status determined by read-side\n"); >! # reswrite("recvbased"); >! # exit(EXIT_OK); >! # } > >! # fprintf(stderr, "status is unknown\n"); >! # return EXIT_UNKNOWN; >! # } > >! # static void >! # setsockets(doreverse, packetsize, s, r, sndbuf, sndbuf_set, rcvbuf, rcvbuf_set) >! # const int doreverse; >! # const size_t packetsize; >! # const int s; >! # const int r; >! # int *sndbuf, *sndbuf_set; >! # int *rcvbuf, *rcvbuf_set; >! # { >! # socklen_t len; >! # int p; > >! # if ((p = fcntl(s, F_GETFL, 0)) == -1 >! # || fcntl(s, F_SETFL, p | O_NONBLOCK) == -1 >! # || fcntl(r, F_SETFL, p | O_NONBLOCK) == -1) { >! # perror("fcntl(F_SETFL/F_GETFL, O_NONBLOCK) failed"); >! # exit(EXIT_UNKNOWN); >! # } > >! # len = sizeof(*sndbuf_set); > >! # if (doreverse) { >! # *sndbuf = packetsize + PADBYTES; > >! # if (setsockopt(s, SOL_SOCKET, SO_SNDBUF, sndbuf, sizeof(*sndbuf)) != 0) { >! # perror("setsockopt(SO_SNDBUF)"); >! # exit(EXIT_UNKNOWN); >! # } > >! # if (getsockopt(s, SOL_SOCKET, SO_SNDBUF, sndbuf_set, &len) != 0) { >! # perror("getsockopt(SO_SNDBUF)"); >! # exit(EXIT_UNKNOWN); >! # } > >! # *rcvbuf = *sndbuf_set * 10; >! # if (setsockopt(r, SOL_SOCKET, SO_RCVBUF, rcvbuf, sizeof(*rcvbuf)) != 0) { >! # perror("setsockopt(SO_RCVBUF)"); >! # exit(EXIT_UNKNOWN); >! # } >! # } >! # else { >! # *rcvbuf = packetsize + PADBYTES; > >! # if (setsockopt(r, SOL_SOCKET, SO_RCVBUF, rcvbuf, sizeof(*rcvbuf)) != 0) { >! # perror("setsockopt(SO_RCVBUF)"); >! # exit(EXIT_UNKNOWN); >! # } > >! # if (getsockopt(r, SOL_SOCKET, SO_RCVBUF, rcvbuf_set, &len) != 0) { >! # perror("getsockopt(SO_RCVBUF)"); >! # exit(EXIT_UNKNOWN); >! # } > >! # *sndbuf = *rcvbuf_set * 10; >! # if (setsockopt(s, SOL_SOCKET, SO_SNDBUF, sndbuf, sizeof(*sndbuf)) != 0) { >! # perror("setsockopt(SO_SNDBUF)"); >! # exit(EXIT_UNKNOWN); >! # } >! # } > >! # if (getsockopt(s, SOL_SOCKET, SO_SNDBUF, sndbuf_set, &len) != 0 >! # || getsockopt(r, SOL_SOCKET, SO_RCVBUF, rcvbuf_set, &len) != 0) { >! # perror("getsockopt(SO_SNDBUF/SO_RCVBUF)"); >! # exit(EXIT_UNKNOWN); >! # } > >! # fprintf(stderr, "sndbuf is %lu, rcvbuf is %lu\n", >! # (unsigned long)*sndbuf_set, (unsigned long)*rcvbuf_set); > >! # if (doreverse) { >! # if (*rcvbuf_set < *rcvbuf) { >! # fprintf(stderr, "failed to set rcvbuf to %lu. Is %lu\n", >! # (unsigned long)*rcvbuf, (unsigned long)*rcvbuf_set); >! # exit(EXIT_UNKNOWN); >! # } >! # } >! # else { >! # if (*sndbuf_set < *sndbuf) { >! # fprintf(stderr, "failed to set sndbuf to %lu (is %lu)\n", >! # (unsigned long)*sndbuf, (unsigned long)*sndbuf_set); >! # exit(EXIT_UNKNOWN); >! # } >! # } >! # } > >! # static size_t >! # sendtest(s, buf, buflen) >! # const int s; >! # const char *buf; >! # const size_t buflen; >! # { >! # ssize_t rc; >! # size_t sent; >! # int i; > >! # i = 1; >! # sent = 0; >! # errno = 0; > >! # while (1) { >! # if ((rc = write(s, buf, buflen)) == -1) >! # break; >! # else { >! # assert(rc == (ssize_t)buflen); > >! # ++i; >! # sent += rc; >! # } >! # } > >! # fprintf(stderr, >! # "failed sending packet #%d, sent %ld/%ld. " >! # "Total bytes sent: %lu. Error on last packet: %s\n", >! # i, >! # (long)rc, >! # (unsigned long)buflen, >! # (unsigned long)sent, >! # strerror(errno)); > >! # return sent; >! # } > >! # void >! # reswrite(res) >! # const char *res; >! # { >! # FILE *fp; >! # if ((fp = fopen("conftest.out", "w")) == NULL) { >! # perror("fopen"); >! # exit(1); >! # } >! # fprintf(fp, "%s\n", res); >! # fclose(fp); >! # } >! # _ACEOF >! # if ac_fn_c_try_run "$LINENO"; then : >! # pipeside=`cat conftest.out` >! # { $as_echo "$as_me:${as_lineno-$LINENO}: result: $pipeside" >&5 >! # $as_echo "$pipeside" >&6; } > >! # else >! # { $as_echo "$as_me:${as_lineno-$LINENO}: result: unknown" >&5 >! # $as_echo "unknown" >&6; } >! # fi >! # rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ >! # conftest.$ac_objext conftest.beam conftest.$ac_ext >! # fi > > >! # case $pipeside in >! # recvbased) > >! # $as_echo "#define HAVE_PIPEBUFFER_RECV_BASED 1" >>confdefs.h > >! # ;; >! # sendbased) > >! # $as_echo "#define HAVE_PIPEBUFFER_SEND_BASED 1" >>confdefs.h > >! # ;; >! # *) > >+ # $as_echo "#define HAVE_PIPEBUFFER_UNKNOWN 1" >>confdefs.h >+ >+ # { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unable to determine PIPEBUFFER type" >&5 >+ # $as_echo "$as_me: WARNING: unable to determine PIPEBUFFER type" >&2;} >+ # ;; >+ # esac >+ > $as_echo "#define HAVE_PIPEBUFFER_UNKNOWN 1" >>confdefs.h >+ { $as_echo "$as_me:${as_lineno-$LINENO}: NOTICE: skipping PIPEBUFFER type check on this plaform" >&5 >+ $as_echo "$as_me: NOTICE: skipping PIPEBUFFER type check on this plaform" >&2;} > > > #obtain highest valid select() timeout seconds value > DEFAULTMAX=33333333 #corresponds roughly to one year
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 202197
: 159771