diff options
author | Robin H. Johnson <robbat2@gentoo.org> | 2015-08-08 13:49:04 -0700 |
---|---|---|
committer | Robin H. Johnson <robbat2@gentoo.org> | 2015-08-08 17:38:18 -0700 |
commit | 56bd759df1d0c750a065b8c845e93d5dfa6b549d (patch) | |
tree | 3f91093cdb475e565ae857f1c5a7fd339e2d781e /app-shells/bash/files/bash-4.2-speed-up-read-N.patch | |
download | gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.gz gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.bz2 gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.zip |
proj/gentoo: Initial commit
This commit represents a new era for Gentoo:
Storing the gentoo-x86 tree in Git, as converted from CVS.
This commit is the start of the NEW history.
Any historical data is intended to be grafted onto this point.
Creation process:
1. Take final CVS checkout snapshot
2. Remove ALL ChangeLog* files
3. Transform all Manifests to thin
4. Remove empty Manifests
5. Convert all stale $Header$/$Id$ CVS keywords to non-expanded Git $Id$
5.1. Do not touch files with -kb/-ko keyword flags.
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
X-Thanks: Alec Warner <antarus@gentoo.org> - did the GSoC 2006 migration tests
X-Thanks: Robin H. Johnson <robbat2@gentoo.org> - infra guy, herding this project
X-Thanks: Nguyen Thai Ngoc Duy <pclouds@gentoo.org> - Former Gentoo developer, wrote Git features for the migration
X-Thanks: Brian Harring <ferringb@gentoo.org> - wrote much python to improve cvs2svn
X-Thanks: Rich Freeman <rich0@gentoo.org> - validation scripts
X-Thanks: Patrick Lauer <patrick@gentoo.org> - Gentoo dev, running new 2014 work in migration
X-Thanks: Michał Górny <mgorny@gentoo.org> - scripts, QA, nagging
X-Thanks: All of other Gentoo developers - many ideas and lots of paint on the bikeshed
Diffstat (limited to 'app-shells/bash/files/bash-4.2-speed-up-read-N.patch')
-rw-r--r-- | app-shells/bash/files/bash-4.2-speed-up-read-N.patch | 112 |
1 files changed, 112 insertions, 0 deletions
diff --git a/app-shells/bash/files/bash-4.2-speed-up-read-N.patch b/app-shells/bash/files/bash-4.2-speed-up-read-N.patch new file mode 100644 index 000000000000..b96ad0c887e1 --- /dev/null +++ b/app-shells/bash/files/bash-4.2-speed-up-read-N.patch @@ -0,0 +1,112 @@ +http://lists.gnu.org/archive/html/bug-bash/2012-11/msg00034.html + +From 530d4988afd68ea9d2cf1b0267d4dc821d0d204f Mon Sep 17 00:00:00 2001 +From: Mike Frysinger <vapier@gentoo.org> +Date: Mon, 19 Nov 2012 17:58:51 -0500 +Subject: [PATCH] bash: speed up `read -N` + +Rather than using 1 byte reads, use the existing cache read logic. +This could be sped up more, but this change is not as invasive and +should (hopefully) be fairly safe. + +Signed-off-by: Mike Frysinger <vapier@gentoo.org> +--- + builtins/read.def | 21 ++++++++++++++++----- + externs.h | 1 + + lib/sh/zread.c | 15 +++++++++++++-- + 3 files changed, 30 insertions(+), 7 deletions(-) + +diff --git a/builtins/read.def b/builtins/read.def +index e32dec7..81a1b3f 100644 +--- a/builtins/read.def ++++ b/builtins/read.def +@@ -457,7 +457,10 @@ read_builtin (list) + interrupt_immediately++; + terminate_immediately++; + +- unbuffered_read = (nchars > 0) || (delim != '\n') || input_is_pipe; ++ if ((nchars > 0) && !input_is_tty && ignore_delim) ++ unbuffered_read = 2; ++ else if ((nchars > 0) || (delim != '\n') || input_is_pipe) ++ unbuffered_read = 1; + + if (prompt && edit == 0) + { +@@ -505,10 +508,18 @@ read_builtin (list) + print_ps2 = 0; + } + +- if (unbuffered_read) +- retval = zread (fd, &c, 1); +- else +- retval = zreadc (fd, &c); ++ switch (unbuffered_read) ++ { ++ case 2: ++ retval = zreadcn (fd, &c, nchars - nr); ++ break; ++ case 1: ++ retval = zread (fd, &c, 1); ++ break; ++ default: ++ retval = zreadc (fd, &c); ++ break; ++ } + + if (retval <= 0) + { +diff --git a/externs.h b/externs.h +index 09244fa..a5ad645 100644 +--- a/externs.h ++++ b/externs.h +@@ -479,6 +479,7 @@ extern ssize_t zread __P((int, char *, size_t)); + extern ssize_t zreadretry __P((int, char *, size_t)); + extern ssize_t zreadintr __P((int, char *, size_t)); + extern ssize_t zreadc __P((int, char *)); ++extern ssize_t zreadcn __P((int, char *, int)); + extern ssize_t zreadcintr __P((int, char *)); + extern void zreset __P((void)); + extern void zsyncfd __P((int)); +diff --git a/lib/sh/zread.c b/lib/sh/zread.c +index 5db21a9..af7d02b 100644 +--- a/lib/sh/zread.c ++++ b/lib/sh/zread.c +@@ -101,15 +101,18 @@ static char lbuf[128]; + static size_t lind, lused; + + ssize_t +-zreadc (fd, cp) ++zreadcn (fd, cp, len) + int fd; + char *cp; ++ int len; + { + ssize_t nr; + + if (lind == lused || lused == 0) + { +- nr = zread (fd, lbuf, sizeof (lbuf)); ++ if (len > sizeof (lbuf)) ++ len = sizeof (lbuf); ++ nr = zread (fd, lbuf, len); + lind = 0; + if (nr <= 0) + { +@@ -123,6 +126,14 @@ zreadc (fd, cp) + return 1; + } + ++ssize_t ++zreadc (fd, cp) ++ int fd; ++ char *cp; ++{ ++ return zreadcn (fd, cp, sizeof (lbuf)); ++} ++ + /* Don't mix calls to zreadc and zreadcintr in the same function, since they + use the same local buffer. */ + ssize_t +-- +1.7.12.4 + |