From owner-p4-projects@FreeBSD.ORG Wed Dec 19 05:23:42 2007 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 55F9116A41B; Wed, 19 Dec 2007 05:23:42 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0FCD716A419 for ; Wed, 19 Dec 2007 05:23:42 +0000 (UTC) (envelope-from kmacy@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id D21BF13C458 for ; Wed, 19 Dec 2007 05:23:41 +0000 (UTC) (envelope-from kmacy@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id lBJ5NfBT036821 for ; Wed, 19 Dec 2007 05:23:41 GMT (envelope-from kmacy@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id lBJ5Nfon036818 for perforce@freebsd.org; Wed, 19 Dec 2007 05:23:41 GMT (envelope-from kmacy@freebsd.org) Date: Wed, 19 Dec 2007 05:23:41 GMT Message-Id: <200712190523.lBJ5Nfon036818@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to kmacy@freebsd.org using -f From: Kip Macy To: Perforce Change Reviews Cc: Subject: PERFORCE change 131216 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Dec 2007 05:23:42 -0000 http://perforce.freebsd.org/chv.cgi?CH=131216 Change 131216 by kmacy@entropy_kmacy_xen31 on 2007/12/19 05:23:33 IFC: #131215 Affected files ... .. //depot/projects/xen31/lib/libc/amd64/Symbol.map#3 integrate .. //depot/projects/xen31/lib/libc/i386/Symbol.map#3 integrate .. //depot/projects/xen31/lib/libc/ia64/Symbol.map#3 integrate .. //depot/projects/xen31/lib/libc/sparc64/Symbol.map#3 integrate .. //depot/projects/xen31/lib/libc/stdio/Symbol.map#2 integrate .. //depot/projects/xen31/lib/libc/stdio/vfwprintf.c#2 integrate .. //depot/projects/xen31/lib/libc/stdlib/malloc.c#4 integrate .. //depot/projects/xen31/lib/libc/stdtime/localtime.c#2 integrate .. //depot/projects/xen31/lib/libc/sys/select.2#2 integrate .. //depot/projects/xen31/lib/libfetch/common.c#3 integrate .. //depot/projects/xen31/lib/libfetch/common.h#3 integrate .. //depot/projects/xen31/lib/libfetch/fetch.3#2 integrate .. //depot/projects/xen31/lib/libfetch/fetch.c#3 integrate .. //depot/projects/xen31/lib/libfetch/ftp.c#3 integrate .. //depot/projects/xen31/lib/libfetch/http.c#3 integrate .. //depot/projects/xen31/lib/libstand/bzipfs.c#2 integrate .. //depot/projects/xen31/lib/libstand/gzipfs.c#2 integrate .. //depot/projects/xen31/lib/msun/Symbol.map#3 integrate .. //depot/projects/xen31/lib/msun/ld128/s_nanl.c#2 integrate .. //depot/projects/xen31/lib/msun/ld80/s_nanl.c#2 integrate .. //depot/projects/xen31/lib/msun/src/math_private.h#2 integrate .. //depot/projects/xen31/lib/msun/src/s_nan.c#2 integrate .. //depot/projects/xen31/lib/msun/src/w_cabs.c#2 integrate .. //depot/projects/xen31/share/man/man9/BUS_SETUP_INTR.9#2 integrate .. //depot/projects/xen31/share/misc/Makefile#2 integrate .. //depot/projects/xen31/sys/boot/powerpc/loader/Makefile#2 delete .. //depot/projects/xen31/sys/boot/powerpc/loader/conf.c#2 delete .. //depot/projects/xen31/sys/boot/powerpc/loader/help.ofw#2 delete .. //depot/projects/xen31/sys/boot/powerpc/loader/ldscript.powerpc#2 delete .. //depot/projects/xen31/sys/boot/powerpc/loader/metadata.c#2 delete .. //depot/projects/xen31/sys/boot/powerpc/loader/start.c#2 delete .. //depot/projects/xen31/sys/boot/powerpc/loader/version#2 delete .. //depot/projects/xen31/sys/dev/cxgb/cxgb_main.c#3 integrate .. //depot/projects/xen31/sys/dev/cxgb/ulp/tom/cxgb_cpl_socket.c#2 integrate .. //depot/projects/xen31/sys/kern/kern_sig.c#5 integrate .. //depot/projects/xen31/sys/modules/cxgb/tom/Makefile#2 integrate .. //depot/projects/xen31/sys/net/if_bridge.c#3 integrate .. //depot/projects/xen31/sys/net/if_lagg.c#5 integrate .. //depot/projects/xen31/sys/netinet/sctp_bsd_addr.c#2 integrate .. //depot/projects/xen31/sys/netinet/tcp_offload.c#2 integrate .. //depot/projects/xen31/sys/netinet/tcp_offload.h#2 integrate .. //depot/projects/xen31/sys/netinet/tcp_subr.c#4 integrate .. //depot/projects/xen31/sys/netinet/tcp_usrreq.c#2 integrate .. //depot/projects/xen31/tools/regression/bin/mv/regress.sh#2 integrate .. //depot/projects/xen31/usr.bin/ipcrm/ipcrm.c#2 integrate .. //depot/projects/xen31/usr.bin/ipcs/ipcs.c#2 integrate .. //depot/projects/xen31/usr.bin/netstat/inet.c#2 integrate .. //depot/projects/xen31/usr.sbin/boot98cfg/boot98cfg.c#2 integrate .. //depot/projects/xen31/usr.sbin/sysinstall/dist.c#3 integrate .. //depot/projects/xen31/usr.sbin/sysinstall/dist.h#3 integrate Differences ... ==== //depot/projects/xen31/lib/libc/amd64/Symbol.map#3 (text) ==== @@ -1,5 +1,5 @@ /* - * $FreeBSD: src/lib/libc/amd64/Symbol.map,v 1.5 2007/12/16 21:15:56 das Exp $ + * $FreeBSD: src/lib/libc/amd64/Symbol.map,v 1.6 2007/12/18 23:46:32 das Exp $ */ /* @@ -71,7 +71,4 @@ _end; __sys_vfork; _vfork; - - /* used in libm */ - __ULtox_D2A; }; ==== //depot/projects/xen31/lib/libc/i386/Symbol.map#3 (text) ==== @@ -1,5 +1,5 @@ /* - * $FreeBSD: src/lib/libc/i386/Symbol.map,v 1.6 2007/12/16 21:15:56 das Exp $ + * $FreeBSD: src/lib/libc/i386/Symbol.map,v 1.7 2007/12/18 23:46:32 das Exp $ */ /* @@ -68,7 +68,4 @@ _brk; .curbrk; .minbrk; - - /* used in libm */ - __ULtox_D2A; }; ==== //depot/projects/xen31/lib/libc/ia64/Symbol.map#3 (text) ==== @@ -1,5 +1,5 @@ /* - * $FreeBSD: src/lib/libc/ia64/Symbol.map,v 1.5 2007/12/16 21:15:57 das Exp $ + * $FreeBSD: src/lib/libc/ia64/Symbol.map,v 1.6 2007/12/18 23:46:32 das Exp $ */ /* @@ -69,7 +69,4 @@ minbrk; .cerror; curbrk; - - /* used in libm */ - __ULtox_D2A; }; ==== //depot/projects/xen31/lib/libc/sparc64/Symbol.map#3 (text) ==== @@ -1,5 +1,5 @@ /* - * $FreeBSD: src/lib/libc/sparc64/Symbol.map,v 1.6 2007/12/16 21:15:57 das Exp $ + * $FreeBSD: src/lib/libc/sparc64/Symbol.map,v 1.7 2007/12/18 23:46:32 das Exp $ */ /* @@ -96,7 +96,4 @@ /* used in src/lib/csu/sparc64/crt1.c */ __sparc_utrap_setup; - - /* used in libm */ - __ULtoQ_D2A; }; ==== //depot/projects/xen31/lib/libc/stdio/Symbol.map#2 (text) ==== @@ -1,5 +1,5 @@ /* - * $FreeBSD: src/lib/libc/stdio/Symbol.map,v 1.5 2007/04/29 14:05:19 deischen Exp $ + * $FreeBSD: src/lib/libc/stdio/Symbol.map,v 1.6 2007/12/18 23:49:05 das Exp $ */ FBSD_1.0 { @@ -108,6 +108,19 @@ __swbuf; wprintf; wscanf; +}; + +FBSDprivate_1.0 { + _flockfile; + _flockfile_debug_stub; + _flockfile_debug; + _ftrylockfile; + _funlockfile; + __vfscanf; + + /* + * xprintf support + */ __use_xprintf; __lowercase_hex; __uppercase_hex; @@ -136,12 +149,3 @@ __printf_arginfo_vis; __printf_render_vis; }; - -FBSDprivate_1.0 { - _flockfile; - _flockfile_debug_stub; - _flockfile_debug; - _ftrylockfile; - _funlockfile; - __vfscanf; -}; ==== //depot/projects/xen31/lib/libc/stdio/vfwprintf.c#2 (text+ko) ==== @@ -36,7 +36,7 @@ #endif /* LIBC_SCCS and not lint */ #endif #include -__FBSDID("$FreeBSD: src/lib/libc/stdio/vfwprintf.c,v 1.27 2007/01/09 00:28:08 imp Exp $"); +__FBSDID("$FreeBSD: src/lib/libc/stdio/vfwprintf.c,v 1.28 2007/12/18 01:20:33 das Exp $"); /* * Actual wprintf innards. @@ -902,6 +902,7 @@ } else cp = (ch >= 'a') ? L"inf" : L"INF"; size = 3; + flags &= ~ZEROPAD; break; } flags |= FPT; ==== //depot/projects/xen31/lib/libc/stdlib/malloc.c#4 (text+ko) ==== @@ -101,7 +101,14 @@ /* #define MALLOC_PRODUCTION */ #ifndef MALLOC_PRODUCTION + /* + * MALLOC_DEBUG enables assertions and other sanity checks, and disables + * inline functions. + */ # define MALLOC_DEBUG + + /* MALLOC_STATS enables statistics calculation. */ +# define MALLOC_STATS #endif /* @@ -119,7 +126,7 @@ #define MALLOC_BALANCE #include -__FBSDID("$FreeBSD: src/lib/libc/stdlib/malloc.c,v 1.153 2007/12/17 01:20:04 jasone Exp $"); +__FBSDID("$FreeBSD: src/lib/libc/stdlib/malloc.c,v 1.154 2007/12/18 05:27:57 jasone Exp $"); #include "libc_private.h" #ifdef MALLOC_DEBUG @@ -156,11 +163,6 @@ #include "un-namespace.h" -/* MALLOC_STATS enables statistics calculation. */ -#ifndef MALLOC_PRODUCTION -# define MALLOC_STATS -#endif - #ifdef MALLOC_DEBUG # ifdef NDEBUG # undef NDEBUG @@ -267,35 +269,40 @@ #define SMALL_MAX_DEFAULT (1U << SMALL_MAX_2POW_DEFAULT) /* - * Maximum desired run header overhead. Runs are sized as small as possible - * such that this setting is still honored, without violating other constraints. - * The goal is to make runs as small as possible without exceeding a per run - * external fragmentation threshold. + * RUN_MAX_OVRHD indicates maximum desired run header overhead. Runs are sized + * as small as possible such that this setting is still honored, without + * violating other constraints. The goal is to make runs as small as possible + * without exceeding a per run external fragmentation threshold. + * + * We use binary fixed point math for overhead computations, where the binary + * point is implicitly RUN_BFP bits to the left. * - * Note that it is possible to set this low enough that it cannot be honored - * for some/all object sizes, since there is one bit of header overhead per - * object (plus a constant). In such cases, this constraint is relaxed. + * Note that it is possible to set RUN_MAX_OVRHD low enough that it cannot be + * honored for some/all object sizes, since there is one bit of header overhead + * per object (plus a constant). This constraint is relaxed (ignored) for runs + * that are so small that the per-region overhead is greater than: * - * RUN_MAX_OVRHD_RELAX specifies the maximum number of bits per region of - * overhead for which RUN_MAX_OVRHD is relaxed. + * (RUN_MAX_OVRHD / (reg_size << (3+RUN_BFP)) */ -#define RUN_MAX_OVRHD 0.015 -#define RUN_MAX_OVRHD_RELAX 1.5 +#define RUN_BFP 12 +/* \/ Implicit binary fixed point. */ +#define RUN_MAX_OVRHD 0x0000003dU +#define RUN_MAX_OVRHD_RELAX 0x00001800U /* Put a cap on small object run size. This overrides RUN_MAX_OVRHD. */ #define RUN_MAX_SMALL_2POW 15 #define RUN_MAX_SMALL (1U << RUN_MAX_SMALL_2POW) #ifdef MALLOC_LAZY_FREE -/* Default size of each arena's lazy free cache. */ -# define LAZY_FREE_2POW_DEFAULT 8 -/* - * Number of pseudo-random probes to conduct before considering the cache to be - * overly full. It takes on average n probes to detect fullness of (n-1)/n. - * However, we are effectively doing multiple non-independent trials (each - * deallocation is a trial), so the actual average threshold for clearing the - * cache is somewhat lower. - */ + /* Default size of each arena's lazy free cache. */ +# define LAZY_FREE_2POW_DEFAULT 8 + /* + * Number of pseudo-random probes to conduct before considering the cache to + * be overly full. It takes on average n probes to detect fullness of + * (n-1)/n. However, we are effectively doing multiple non-independent + * trials (each deallocation is a trial), so the actual average threshold + * for clearing the cache is somewhat lower. + */ # define LAZY_FREE_NPROBES 5 #endif @@ -323,20 +330,20 @@ #define BLOCK_COST_2POW 4 #ifdef MALLOC_BALANCE -/* - * We use an exponential moving average to track recent lock contention, where - * the size of the history window is N, and alpha=2/(N+1). - * - * Due to integer math rounding, very small values here can cause substantial - * degradation in accuracy, thus making the moving average decay faster than it - * would with precise calculation. - */ + /* + * We use an exponential moving average to track recent lock contention, + * where the size of the history window is N, and alpha=2/(N+1). + * + * Due to integer math rounding, very small values here can cause + * substantial degradation in accuracy, thus making the moving average decay + * faster than it would with precise calculation. + */ # define BALANCE_ALPHA_INV_2POW 9 -/* - * Threshold value for the exponential moving contention average at which to - * re-assign a thread. - */ + /* + * Threshold value for the exponential moving contention average at which to + * re-assign a thread. + */ # define BALANCE_THRESHOLD_DEFAULT (1U << (SPIN_LIMIT_2POW-4)) #endif @@ -2468,7 +2475,6 @@ size_t try_run_size, good_run_size; unsigned good_nregs, good_mask_nelms, good_reg0_offset; unsigned try_nregs, try_mask_nelms, try_reg0_offset; - float max_ovrhd = RUN_MAX_OVRHD; assert(min_run_size >= pagesize); assert(min_run_size <= arena_maxclass); @@ -2486,7 +2492,7 @@ */ try_run_size = min_run_size; try_nregs = ((try_run_size - sizeof(arena_run_t)) / bin->reg_size) - + 1; /* Counter-act the first line of the loop. */ + + 1; /* Counter-act try_nregs-- in loop. */ do { try_nregs--; try_mask_nelms = (try_nregs >> (SIZEOF_INT_2POW + 3)) + @@ -2519,9 +2525,8 @@ } while (sizeof(arena_run_t) + (sizeof(unsigned) * (try_mask_nelms - 1)) > try_reg0_offset); } while (try_run_size <= arena_maxclass && try_run_size <= RUN_MAX_SMALL - && max_ovrhd > RUN_MAX_OVRHD_RELAX / ((float)(bin->reg_size << 3)) - && ((float)(try_reg0_offset)) / ((float)(try_run_size)) > - max_ovrhd); + && RUN_MAX_OVRHD * (bin->reg_size << 3) > RUN_MAX_OVRHD_RELAX + && (try_reg0_offset << RUN_BFP) > RUN_MAX_OVRHD * try_run_size); assert(sizeof(arena_run_t) + (sizeof(unsigned) * (good_mask_nelms - 1)) <= good_reg0_offset); ==== //depot/projects/xen31/lib/libc/stdtime/localtime.c#2 (text+ko) ==== @@ -9,7 +9,7 @@ static char elsieid[] __unused = "@(#)localtime.c 7.78"; #endif /* !defined NOID */ #endif /* !defined lint */ -__FBSDID("$FreeBSD: src/lib/libc/stdtime/localtime.c,v 1.41 2007/01/19 01:16:35 imp Exp $"); +__FBSDID("$FreeBSD: src/lib/libc/stdtime/localtime.c,v 1.42 2007/12/19 04:30:10 imp Exp $"); /* ** Leap second handling from Bradley White (bww@k.gp.cs.cmu.edu). @@ -1093,14 +1093,16 @@ struct tm *p_tm; if (__isthreaded != 0) { - _pthread_mutex_lock(&localtime_mutex); if (localtime_key < 0) { - if (_pthread_key_create(&localtime_key, free) < 0) { - _pthread_mutex_unlock(&localtime_mutex); - return(NULL); + _pthread_mutex_lock(&localtime_mutex); + if (localtime_key < 0) { + if (_pthread_key_create(&localtime_key, free) < 0) { + _pthread_mutex_unlock(&localtime_mutex); + return(NULL); + } } + _pthread_mutex_unlock(&localtime_mutex); } - _pthread_mutex_unlock(&localtime_mutex); p_tm = _pthread_getspecific(localtime_key); if (p_tm == NULL) { if ((p_tm = (struct tm *)malloc(sizeof(struct tm))) @@ -1146,16 +1148,18 @@ const long offset; struct tm * const tmp; { - _MUTEX_LOCK(&gmt_mutex); if (!gmt_is_set) { - gmt_is_set = TRUE; + _MUTEX_LOCK(&gmt_mutex); + if (!gmt_is_set) { #ifdef ALL_STATE - gmtptr = (struct state *) malloc(sizeof *gmtptr); - if (gmtptr != NULL) + gmtptr = (struct state *) malloc(sizeof *gmtptr); + if (gmtptr != NULL) #endif /* defined ALL_STATE */ - gmtload(gmtptr); + gmtload(gmtptr); + gmt_is_set = TRUE; + } + _MUTEX_UNLOCK(&gmt_mutex); } - _MUTEX_UNLOCK(&gmt_mutex); timesub(timep, offset, gmtptr, tmp); #ifdef TM_ZONE /* @@ -1187,14 +1191,16 @@ struct tm *p_tm; if (__isthreaded != 0) { - _pthread_mutex_lock(&gmtime_mutex); if (gmtime_key < 0) { - if (_pthread_key_create(&gmtime_key, free) < 0) { - _pthread_mutex_unlock(&gmtime_mutex); - return(NULL); + _pthread_mutex_lock(&gmtime_mutex); + if (gmtime_key < 0) { + if (_pthread_key_create(&gmtime_key, free) < 0) { + _pthread_mutex_unlock(&gmtime_mutex); + return(NULL); + } } + _pthread_mutex_unlock(&gmtime_mutex); } - _pthread_mutex_unlock(&gmtime_mutex); /* * Changed to follow POSIX.1 threads standard, which * is what BSD currently has. ==== //depot/projects/xen31/lib/libc/sys/select.2#2 (text+ko) ==== @@ -26,7 +26,7 @@ .\" SUCH DAMAGE. .\" .\" @(#)select.2 8.2 (Berkeley) 3/25/94 -.\" $FreeBSD: src/lib/libc/sys/select.2,v 1.33 2007/01/09 00:28:15 imp Exp $ +.\" $FreeBSD: src/lib/libc/sys/select.2,v 1.34 2007/12/19 03:33:13 imp Exp $ .\" .Dd November 17, 2002 .Dt SELECT 2 @@ -222,3 +222,6 @@ by the .Fn select system call. +.Fx +does not modify the return value, which can cause problems for applications +ported from other systems. ==== //depot/projects/xen31/lib/libfetch/common.c#3 (text+ko) ==== @@ -27,14 +27,16 @@ */ #include -__FBSDID("$FreeBSD: src/lib/libfetch/common.c,v 1.51 2007/12/14 10:26:58 des Exp $"); +__FBSDID("$FreeBSD: src/lib/libfetch/common.c,v 1.53 2007/12/19 00:26:36 des Exp $"); #include #include #include #include + #include +#include #include #include #include @@ -734,3 +736,51 @@ fclose(f); return (-1); } + +/* + * The no_proxy environment variable specifies a set of domains for + * which the proxy should not be consulted; the contents is a comma-, + * or space-separated list of domain names. A single asterisk will + * override all proxy variables and no transactions will be proxied + * (for compatability with lynx and curl, see the discussion at + * ). + */ +int +fetch_no_proxy_match(const char *host) +{ + const char *no_proxy, *p, *q; + size_t h_len, d_len; + + if ((no_proxy = getenv("NO_PROXY")) == NULL && + (no_proxy = getenv("no_proxy")) == NULL) + return (0); + + /* asterisk matches any hostname */ + if (strcmp(no_proxy, "*") == 0) + return (1); + + h_len = strlen(host); + p = no_proxy; + do { + /* position p at the beginning of a domain suffix */ + while (*p == ',' || isspace((unsigned char)*p)) + p++; + + /* position q at the first separator character */ + for (q = p; *q; ++q) + if (*q == ',' || isspace((unsigned char)*q)) + break; + + d_len = q - p; + if (d_len > 0 && h_len > d_len && + strncasecmp(host + h_len - d_len, + p, d_len) == 0) { + /* domain name matches */ + return (1); + } + + p = q + 1; + } while (*q); + + return (0); +} ==== //depot/projects/xen31/lib/libfetch/common.h#3 (text+ko) ==== @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: src/lib/libfetch/common.h,v 1.29 2007/12/14 10:26:58 des Exp $ + * $FreeBSD: src/lib/libfetch/common.h,v 1.30 2007/12/18 11:03:07 des Exp $ */ #ifndef _COMMON_H_INCLUDED @@ -90,6 +90,7 @@ int fetch_add_entry(struct url_ent **, int *, int *, const char *, struct url_stat *); int fetch_netrc_auth(struct url *url); +int fetch_no_proxy_match(const char *); #define ftp_seterr(n) fetch_seterr(ftp_errlist, n) #define http_seterr(n) fetch_seterr(http_errlist, n) ==== //depot/projects/xen31/lib/libfetch/fetch.3#2 (text+ko) ==== @@ -23,9 +23,9 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/lib/libfetch/fetch.3,v 1.63 2007/05/24 20:28:14 des Exp $ +.\" $FreeBSD: src/lib/libfetch/fetch.3,v 1.64 2007/12/18 11:03:26 des Exp $ .\" -.Dd April 22, 2007 +.Dd December 18, 2007 .Dt FETCH 3 .Os .Sh NAME @@ -532,6 +532,14 @@ .Xr ftp 1 for a description of the file format. This feature is experimental. +.It Ev NO_PROXY +Either a single asterisk, which disables the use of proxies +altogether, or a comma- or whitespace-separated list of hosts for +which proxies should not be used. +.It Ev no_proxy +Same as +.Ev NO_PROXY , +for compatibility. .El .Sh EXAMPLES To access a proxy server on @@ -555,6 +563,14 @@ HTTP_PROXY=http://proxy.example.com:8080 HTTP_PROXY_AUTH=basic:*:: .Ed +.Pp +To disable the use of a proxy for an HTTP server running on the local +host, define +.Ev NO_PROXY +as follows: +.Bd -literal -offset indent +NO_PROXY=localhost,127.0.0.1 +.Ed .Sh SEE ALSO .Xr fetch 1 , .Xr ftpio 3 , ==== //depot/projects/xen31/lib/libfetch/fetch.c#3 (text+ko) ==== @@ -27,7 +27,7 @@ */ #include -__FBSDID("$FreeBSD: src/lib/libfetch/fetch.c,v 1.39 2007/12/14 10:26:58 des Exp $"); +__FBSDID("$FreeBSD: src/lib/libfetch/fetch.c,v 1.41 2007/12/19 00:26:36 des Exp $"); #include #include @@ -369,7 +369,7 @@ /* port */ if (*p == ':') { for (q = ++p; *q && (*q != '/'); q++) - if (isdigit(*q)) + if (isdigit((unsigned char)*q)) u->port = u->port * 10 + (*q - '0'); else { /* invalid port */ @@ -395,7 +395,7 @@ } u->doc = doc; while (*p != '\0') { - if (!isspace(*p)) { + if (!isspace((unsigned char)*p)) { *doc++ = *p++; } else { *doc++ = '%'; ==== //depot/projects/xen31/lib/libfetch/ftp.c#3 (text+ko) ==== @@ -27,7 +27,7 @@ */ #include -__FBSDID("$FreeBSD: src/lib/libfetch/ftp.c,v 1.97 2007/12/14 10:26:58 des Exp $"); +__FBSDID("$FreeBSD: src/lib/libfetch/ftp.c,v 1.100 2007/12/19 00:26:36 des Exp $"); /* * Portions of this code were taken from or based on ftpio.c: @@ -102,11 +102,16 @@ static struct url cached_host; static conn_t *cached_connection; -#define isftpreply(foo) (isdigit(foo[0]) && isdigit(foo[1]) \ - && isdigit(foo[2]) \ - && (foo[3] == ' ' || foo[3] == '\0')) -#define isftpinfo(foo) (isdigit(foo[0]) && isdigit(foo[1]) \ - && isdigit(foo[2]) && foo[3] == '-') +#define isftpreply(foo) \ + (isdigit((unsigned char)foo[0]) && \ + isdigit((unsigned char)foo[1]) && \ + isdigit((unsigned char)foo[2]) && \ + (foo[3] == ' ' || foo[3] == '\0')) +#define isftpinfo(foo) \ + (isdigit((unsigned char)foo[0]) && \ + isdigit((unsigned char)foo[1]) && \ + isdigit((unsigned char)foo[2]) && \ + foo[3] == '-') /* * Translate IPv4 mapped IPv6 address to IPv4 address @@ -150,7 +155,8 @@ } } - while (conn->buflen && isspace(conn->buf[conn->buflen - 1])) + while (conn->buflen && + isspace((unsigned char)conn->buf[conn->buflen - 1])) conn->buflen--; conn->buf[conn->buflen] = '\0'; @@ -414,11 +420,11 @@ ftp_seterr(e); return (-1); } - for (ln = conn->buf + 4; *ln && isspace(*ln); ln++) + for (ln = conn->buf + 4; *ln && isspace((unsigned char)*ln); ln++) /* nothing */ ; - for (us->size = 0; *ln && isdigit(*ln); ln++) + for (us->size = 0; *ln && isdigit((unsigned char)*ln); ln++) us->size = us->size * 10 + *ln - '0'; - if (*ln && !isspace(*ln)) { + if (*ln && !isspace((unsigned char)*ln)) { ftp_seterr(FTP_PROTOCOL_ERROR); us->size = -1; return (-1); @@ -432,7 +438,7 @@ ftp_seterr(e); return (-1); } - for (ln = conn->buf + 4; *ln && isspace(*ln); ln++) + for (ln = conn->buf + 4; *ln && isspace((unsigned char)*ln); ln++) /* nothing */ ; switch (strspn(ln, "0123456789")) { case 14: @@ -691,7 +697,7 @@ switch (e) { case FTP_PASSIVE_MODE: case FTP_LPASSIVE_MODE: - for (p = ln + 3; *p && !isdigit(*p); p++) + for (p = ln + 3; *p && !isdigit((unsigned char)*p); p++) /* nothing */ ; if (!*p) { e = FTP_PROTOCOL_ERROR; @@ -1057,13 +1063,15 @@ * Check the proxy settings */ static struct url * -ftp_get_proxy(const char *flags) +ftp_get_proxy(struct url * url, const char *flags) { struct url *purl; char *p; if (flags != NULL && strchr(flags, 'd') != NULL) return (NULL); + if (fetch_no_proxy_match(url->host)) + return (NULL); if (((p = getenv("FTP_PROXY")) || (p = getenv("ftp_proxy")) || (p = getenv("HTTP_PROXY")) || (p = getenv("http_proxy"))) && *p && (purl = fetchParseURL(p)) != NULL) { @@ -1140,7 +1148,7 @@ FILE * fetchXGetFTP(struct url *url, struct url_stat *us, const char *flags) { - return (ftp_request(url, "RETR", us, ftp_get_proxy(flags), flags)); + return (ftp_request(url, "RETR", us, ftp_get_proxy(url, flags), flags)); } /* @@ -1158,9 +1166,8 @@ FILE * fetchPutFTP(struct url *url, const char *flags) { - return (ftp_request(url, CHECK_FLAG('a') ? "APPE" : "STOR", NULL, - ftp_get_proxy(flags), flags)); + ftp_get_proxy(url, flags), flags)); } /* @@ -1171,9 +1178,10 @@ { FILE *f; - f = ftp_request(url, "STAT", us, ftp_get_proxy(flags), flags); + f = ftp_request(url, "STAT", us, ftp_get_proxy(url, flags), flags); if (f == NULL) return (-1); + fclose(f); return (0); } ==== //depot/projects/xen31/lib/libfetch/http.c#3 (text+ko) ==== @@ -27,7 +27,7 @@ */ #include -__FBSDID("$FreeBSD: src/lib/libfetch/http.c,v 1.79 2007/12/14 10:26:58 des Exp $"); +__FBSDID("$FreeBSD: src/lib/libfetch/http.c,v 1.82 2007/12/19 00:26:36 des Exp $"); /* * The following copyright applies to the base64 code: @@ -137,15 +137,15 @@ if (fetch_getln(io->conn) == -1) return (-1); - if (io->conn->buflen < 2 || !ishexnumber(*io->conn->buf)) + if (io->conn->buflen < 2 || !isxdigit((unsigned char)*io->conn->buf)) return (-1); - for (p = io->conn->buf; *p && !isspace(*p); ++p) { + for (p = io->conn->buf; *p && !isspace((unsigned char)*p); ++p) { if (*p == ';') break; - if (!ishexnumber(*p)) + if (!isxdigit((unsigned char)*p)) return (-1); - if (isdigit(*p)) { + if (isdigit((unsigned char)*p)) { io->chunksize = io->chunksize * 16 + *p - '0'; } else { @@ -417,7 +417,10 @@ return (HTTP_PROTOCOL_ERROR); p += 4; } - if (*p != ' ' || !isdigit(p[1]) || !isdigit(p[2]) || !isdigit(p[3])) + if (*p != ' ' || + !isdigit((unsigned char)p[1]) || + !isdigit((unsigned char)p[2]) || + !isdigit((unsigned char)p[3])) return (HTTP_PROTOCOL_ERROR); conn->err = (p[1] - '0') * 100 + (p[2] - '0') * 10 + (p[3] - '0'); @@ -435,7 +438,7 @@ /* nothing */; if (*str || *hdr != ':') return (NULL); - while (*hdr && isspace(*++hdr)) + while (*hdr && isspace((unsigned char)*++hdr)) /* nothing */; return (hdr); } @@ -450,7 +453,7 @@ if (fetch_getln(conn) == -1) return (hdr_syserror); - while (conn->buflen && isspace(conn->buf[conn->buflen - 1])) + while (conn->buflen && isspace((unsigned char)conn->buf[conn->buflen - 1])) conn->buflen--; conn->buf[conn->buflen] = '\0'; if (conn->buflen == 0) @@ -499,7 +502,7 @@ { off_t len; - for (len = 0; *p && isdigit(*p); ++p) + for (len = 0; *p && isdigit((unsigned char)*p); ++p) len = len * 10 + (*p - '0'); if (*p) return (-1); @@ -524,16 +527,16 @@ first = last = -1; ++p; } else { - for (first = 0; *p && isdigit(*p); ++p) + for (first = 0; *p && isdigit((unsigned char)*p); ++p) first = first * 10 + *p - '0'; if (*p != '-') return (-1); - for (last = 0, ++p; *p && isdigit(*p); ++p) + for (last = 0, ++p; *p && isdigit((unsigned char)*p); ++p) last = last * 10 + *p - '0'; } if (first > last || *p != '/') return (-1); - for (len = 0, ++p; *p && isdigit(*p); ++p) + for (len = 0, ++p; *p && isdigit((unsigned char)*p); ++p) len = len * 10 + *p - '0'; if (*p || len < last - first + 1) return (-1); @@ -718,13 +721,15 @@ } static struct url * -http_get_proxy(const char *flags) +http_get_proxy(struct url * url, const char *flags) { struct url *purl; char *p; if (flags != NULL && strchr(flags, 'd') != NULL) return (NULL); + if (fetch_no_proxy_match(url->host)) + return (NULL); if (((p = getenv("HTTP_PROXY")) || (p = getenv("http_proxy"))) && *p && (purl = fetchParseURL(p))) { if (!*purl->scheme) @@ -747,7 +752,7 @@ comment = tag = 0; while ((line = fgetln(in, &len)) != NULL) { - while (len && isspace(line[len - 1])) + while (len && isspace((unsigned char)line[len - 1])) --len; for (p = q = line; q < line + len; ++q) { if (comment && *q == '-') { @@ -1167,7 +1172,7 @@ FILE * fetchXGetHTTP(struct url *URL, struct url_stat *us, const char *flags) { - return (http_request(URL, "GET", us, http_get_proxy(flags), flags)); + return (http_request(URL, "GET", us, http_get_proxy(URL, flags), flags)); } /* @@ -1197,7 +1202,7 @@ { FILE *f; - f = http_request(URL, "HEAD", us, http_get_proxy(flags), flags); + f = http_request(URL, "HEAD", us, http_get_proxy(URL, flags), flags); if (f == NULL) return (-1); fclose(f); ==== //depot/projects/xen31/lib/libstand/bzipfs.c#2 (text+ko) ==== @@ -26,9 +26,25 @@ */ #include -__FBSDID("$FreeBSD: src/lib/libstand/bzipfs.c,v 1.7 2005/05/17 16:22:54 obrien Exp $"); +__FBSDID("$FreeBSD: src/lib/libstand/bzipfs.c,v 1.8 2007/12/18 01:50:49 sobomax Exp $"); +#ifndef REGRESSION #include "stand.h" +#else +#include +#include +#include +#include + +struct open_file { + int f_flags; /* see F_* below */ + void *f_fsdata; /* file system specific data */ +}; +#define F_READ 0x0001 /* file opened for reading */ +#define EOFFSET (ELAST+8) /* relative seek not supported */ +static inline u_int min(u_int a, u_int b) { return (a < b ? a : b); } +#define panic(x, y) abort() +#endif #include #include @@ -41,6 +57,7 @@ int bzf_rawfd; bz_stream bzf_bzstream; char bzf_buf[BZ_BUFSIZE]; + int bzf_endseen; }; static int bzf_fill(struct bz_file *z); @@ -50,6 +67,7 @@ static off_t bzf_seek(struct open_file *f, off_t offset, int where); static int bzf_stat(struct open_file *f, struct stat *sb); +#ifndef REGRESSION struct fs_ops bzipfs_fsops = { "bzip", bzf_open, @@ -60,6 +78,7 @@ bzf_stat, null_readdir }; +#endif #if 0 void * @@ -220,7 +239,7 @@ bzf->bzf_bzstream.next_out = buf; /* where and how much */ bzf->bzf_bzstream.avail_out = size; - while (bzf->bzf_bzstream.avail_out) { + while (bzf->bzf_bzstream.avail_out && bzf->bzf_endseen == 0) { if ((bzf->bzf_bzstream.avail_in == 0) && (bzf_fill(bzf) == -1)) { printf("bzf_read: fill error\n"); return(EIO); @@ -234,6 +253,7 @@ error = BZ2_bzDecompress(&bzf->bzf_bzstream); /* decompression pass */ if (error == BZ_STREAM_END) { /* EOF, all done */ + bzf->bzf_endseen = 1; break; } if (error != BZ_OK) { /* argh, decompression error */ @@ -301,3 +321,27 @@ { panic("bzipfs: critical error %d in bzip2 library occured\n", errorcode); } + +#ifdef REGRESSION +/* Small test case, open and decompress test.bz2 */ +int main() +{ + struct open_file f; + char buf[1024]; + size_t resid; + int err; + + memset(&f, '\0', sizeof(f)); + f.f_flags = F_READ; + err = bzf_open("test", &f); + if (err != 0) + exit(1); + do { + err = bzf_read(&f, buf, sizeof(buf), &resid); + } while (err == 0 && resid != sizeof(buf)); + + if (err != 0) + exit(2); + exit(0); +} +#endif ==== //depot/projects/xen31/lib/libstand/gzipfs.c#2 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include -__FBSDID("$FreeBSD: src/lib/libstand/gzipfs.c,v 1.13 2004/01/21 20:12:23 jhb Exp $"); +__FBSDID("$FreeBSD: src/lib/libstand/gzipfs.c,v 1.14 2007/12/18 01:50:49 sobomax Exp $"); #include "stand.h" @@ -41,6 +41,7 @@ off_t zf_dataoffset; z_stream zf_zstream; char zf_buf[Z_BUFSIZE]; + int zf_endseen; >>> TRUNCATED FOR MAIL (1000 lines) <<<