freebsd-src/bin/cp
Dag-Erling Smørgrav 6c85042afc cp: Simplify the common case.
* The allocated buffer is only used in the fallback case, so move it
  there.  The argument for passing it in from the caller was that if
  malloc(3) were to fail, we'd want it to fail before we started
  copying anything, but firstly, it was already not in the right place
  to ensure that, and secondly, malloc(3) never fails (except in very
  contrived circumstances, such as an unreasonable RLIMIT_AS or
  RLIMIT_DATA).

* Remove the mmap(2) option.  It is almost never beneficial,
  especially when the alternative is copy_file_range(2), and it adds
  needless complexity and indentation.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	rmacklem, mav
Differential Revision:	https://reviews.freebsd.org/D38291
2023-02-02 15:46:04 +01:00
..
tests cp: Add tests involving sparse files. 2023-02-02 15:45:55 +01:00
cp.1 cp: Make -P work without -R as per POSIX 2022-02-23 12:55:13 -06:00
cp.c cp: fix -R recursion detection 2022-04-05 20:41:00 -05:00
extern.h General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
Makefile cp: Simplify the common case. 2023-02-02 15:46:04 +01:00
Makefile.depend DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
utils.c cp: Simplify the common case. 2023-02-02 15:46:04 +01:00