Home | History | Annotate | Download | only in cmp
History log of /src/usr.bin/cmp/regular.c
RevisionDateAuthorComments
 1.26  12-Jan-2025  simonb Make cmp -s and cmp -l much faster by comparing blocks and skipping any
line number calculations not needed. Approx 3-4x faster for two multi-GB
in-cache files on my Zen 3.

Restores the spirit of a NetII optimisation lost with 4.4lite2 import
in 1995.
 1.25  09-Jan-2021  christos PR/55916: William Ahern: cmp -s + regular files + skipping is broken
Move test after length is adjusted
 1.24  20-Nov-2013  kleink Explicitly include <stdint.h> for uintmax_t; from Eitan Adler.
 1.23  28-Nov-2011  wiz branches: 1.23.6;
Remove unused header. From Henning Petersen in PR 45658.
 1.22  18-Apr-2009  lukem branches: 1.22.6;
Compare size_t vs off_t by casting both to uintmax_t
 1.21  11-Apr-2009  lukem Fix WARNS=4 issues (many -Wcast-qual, one -Wsign-compare on amd64)
 1.20  03-Jun-2006  christos branches: 1.20.28;
off-by-one (thanks to our anonymous contributor)
 1.19  03-Jun-2006  christos If one file is shorter than the other, print the byte and line offsets if
available. From our anonymous contributor.
 1.18  11-Apr-2005  enami branches: 1.18.2;
Don't put a space before function call operator.
 1.17  11-Apr-2005  enami byte offset and line count shouldn't be initialized inside the loop.
 1.16  11-Apr-2005  enami Fix indent and wrap long lines.
 1.15  07-Mar-2005  dsl Initialise dfound outside loop so that 0 sized files compare correctly
and to that 'cmp -l' will exit with error is the last block matches.
Pointed out in a private mail bt someone who wishes to remain anonymous.
 1.14  06-Feb-2005  dsl mmap normal files in 1MB chunks.
Due to a bug in mmap() the address space isn't counted against ulimit
until the page is faulted in - so mmapping a large file suceeds, but
cmp SIGSEGVs when it runs out of address space.
Also I don't believe that the madvise( MAP_SEQUENTIAL) has the desired
effect, and mmaping a large file is probably very bad for the UBC.
 1.13  06-Feb-2005  dsl Taking (out) the __P
 1.12  07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22365, verified by myself.
 1.11  04-Jan-2001  lukem use %ll_ instead of the less standard %q_
 1.10  27-Jul-2000  mycroft Use MAP_SHARED.
 1.9  18-Jul-2000  jdolecek Do not mmap() with MAP_PRIVATE - looks like kernel tries to preallocate
some memory in case the mmapped contents would be changed and this fails
for very large files; it's unnecessary anyway, cmp(1) does not change file
contents in any way.
This fixes bin/10625 by Uwe Klaus.

While here, change the code to fallback to classic stdio if mmap fails.
 1.8  20-Mar-2000  kleink branches: 1.8.4;
* Hint MADV_SEQUENTIAL.
* -1 -> MAP_FAILED.
 1.7  25-Aug-1998  ross Add { and } to shut up egcs. Reformat the more questionable code.
 1.6  09-Dec-1997  mrg use MAP_PRIVATE|MAP_FILE rather than "0"
 1.5  19-Oct-1997  mrg fix compile warnings on the alpha.
 1.4  18-Oct-1997  lukem WARNSify, fix .Nm usage
 1.3  09-Jan-1997  tls RCS ID police
 1.2  08-Sep-1995  tls Sync with 4.4lite2
 1.1  04-Sep-1995  tls branches: 1.1.1;
Initial revision
 1.1.1.1  04-Sep-1995  tls imported from 44lite2
 1.8.4.2  24-Aug-2000  enami Pull up rev. 1.10 (approved by thorpej):
date: 2000/07/27 02:58:57; author: mycroft; state: Exp; lines: +4 -4
Use MAP_SHARED.
 1.8.4.1  20-Jul-2000  jdolecek do not mmap() with MAP_PRIVATE - it's not needed for cmp(1) and causes
memory shortage for bigger files.

This fixes bin/10625 by Uwe Klaus.

While here, change the code to fallback to classic stdio in (now unlikely)
case mmap() fails.
 1.18.2.1  19-Jun-2006  chap Sync with head.
 1.20.28.1  13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.22.6.2  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.22.6.1  17-Apr-2012  yamt sync with head
 1.23.6.1  20-Aug-2014  tls Rebase to HEAD as of a few days ago.

RSS XML Feed