FreeBSD Bugzilla – Attachment 179123 Details for
Bug 165471
bsdgrep(1) hang/very slow with mmap
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Proposed patch to address issues with bsdgrep --mmap
grep-mmap.patch (text/plain), 820 bytes, created by
Kyle Evans
on 2017-01-20 04:59:42 UTC
(
hide
)
Description:
Proposed patch to address issues with bsdgrep --mmap
Filename:
MIME Type:
Creator:
Kyle Evans
Created:
2017-01-20 04:59:42 UTC
Size:
820 bytes
patch
obsolete
>diff --git a/usr.bin/grep/file.c b/usr.bin/grep/file.c >index 81f227d8073..ef36a10559c 100644 >--- a/usr.bin/grep/file.c >+++ b/usr.bin/grep/file.c >@@ -219,12 +219,17 @@ grep_fgetln(struct file *f, size_t *lenp) > if (bufrem == 0) > /* EOF: return partial line */ > break; >- if ((p = memchr(bufpos, '\n', bufrem)) == NULL) >+ if ((p = memchr(bufpos, '\n', bufrem)) == NULL && filebehave != FILE_MMAP) > continue; >- /* got it: finish up the line (like code above) */ >- ++p; >- diff = p - bufpos; >- len += diff; >+ if (p == NULL) >+ /* mmap EOF: return partial line, consume rest of buffer */ >+ diff = len; >+ else { >+ /* got it: finish up the line (like code above) */ >+ ++p; >+ diff = p - bufpos; >+ len += diff; >+ } > if (grep_lnbufgrow(len)) > goto error; > memcpy(lnbuf + off, bufpos, diff);
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 165471
: 179123