#
3d7c8f08 |
| 16-May-2024 |
Pierre Pronchery <pierre@freebsdfoundation.org> |
cp: avoid a resource leak
In copy_file(), make sure the from_fd file descriptor is closed even when the operation failed early.
Reported by: Coverity Scan CID: 1545036 Sponsored by: The FreeBSD Fo
cp: avoid a resource leak
In copy_file(), make sure the from_fd file descriptor is closed even when the operation failed early.
Reported by: Coverity Scan CID: 1545036 Sponsored by: The FreeBSD Foundation
Reviewed by: imp, emaste Pull Request: https://github.com/freebsd/freebsd-src/pull/1238
show more ...
|
#
9075d4cf |
| 17-Apr-2024 |
Dag-Erling Smørgrav <des@FreeBSD.org> |
cp: Additional sanity check.
Once we've successfully opened the file we've been asked to copy, check that it's of the same type as FTS told us it was.
MFC after: 1 week Sponsored by: Klara, Inc. Re
cp: Additional sanity check.
Once we've successfully opened the file we've been asked to copy, check that it's of the same type as FTS told us it was.
MFC after: 1 week Sponsored by: Klara, Inc. Reviewed by: allanjude, markj Differential Revision: https://reviews.freebsd.org/D44806
show more ...
|
Revision tags: release/13.3.0 |
|
#
8b864151 |
| 13-Feb-2024 |
Collin Funk <collin.funk1@gmail.com> |
cp: Remove useless ssize_t cast
Both wcount and wresid are ssize_t so this cast is not needed. Just remove it so the code is easier to read.
Signed-off-by: Collin Funk <collin.funk1@gmail.com> Revi
cp: Remove useless ssize_t cast
Both wcount and wresid are ssize_t so this cast is not needed. Just remove it so the code is easier to read.
Signed-off-by: Collin Funk <collin.funk1@gmail.com> Reviewed by: emaste, zlei Pull Request: https://github.com/freebsd/freebsd-src/pull/1116
show more ...
|
#
38509270 |
| 14-Dec-2023 |
Dag-Erling Smørgrav <des@FreeBSD.org> |
cp: Further simplify the core logic.
If the destination file exists but we decide unlink it, set the dne flag. This means we don't need to re-check the conditions that would have caused us to delet
cp: Further simplify the core logic.
If the destination file exists but we decide unlink it, set the dne flag. This means we don't need to re-check the conditions that would have caused us to delete the file when we later need to decide whether to create or replace it.
MFC after: 1 week Sponsored by: Klara, Inc. Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D43064
show more ...
|
#
d002316f |
| 14-Dec-2023 |
Dag-Erling Smørgrav <des@FreeBSD.org> |
cp: Refactor the core logic.
Rewrite `copy_file()` so the lflag and sflag are handled as early as possible instead of constantly checking that they're not set and then handling them at the end. Thi
cp: Refactor the core logic.
Rewrite `copy_file()` so the lflag and sflag are handled as early as possible instead of constantly checking that they're not set and then handling them at the end. This also opens the door to changing the failure logic at some future point (for instance, we might decide to fall back to copying if `errno` indicates that the file system does not support links).
MFC after: 1 week Sponsored by: Klara, Inc. Reviewed by: kevans, allanjude Differential Revision: https://reviews.freebsd.org/D43055
show more ...
|
#
3e7e3b5b |
| 07-Dec-2023 |
Warner Losh <imp@FreeBSD.org> |
cp: Don't warn for chflags() failing with EOPNOTSUPP if flags == 0
From NetBSD's utils.c 1.5 importing importing BSDI change, with light formatting changes: Author: cgd <cgd@NetBSD.org> Date
cp: Don't warn for chflags() failing with EOPNOTSUPP if flags == 0
From NetBSD's utils.c 1.5 importing importing BSDI change, with light formatting changes: Author: cgd <cgd@NetBSD.org> Date: Wed Feb 26 14:40:51 1997 +0000
Patch from BSDI (via Keith Bostic): >NFS doesn't support chflags; ignore errors unless there's reason >to believe we're losing bits. (Note, this still won't be right >if the server supports flags and we were trying to *remove* flags >on a file that we copied, i.e., that we didn't create.)
CVS Info: utils.c 1.6
Obtained from: NetBSD Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D42674
show more ...
|
#
5a52e3d0 |
| 07-Dec-2023 |
Warner Losh <imp@FreeBSD.org> |
cp: Add -N flag, inspired by NetBSD's similar flag
Add -N to supress copying of file flags when -p is specified (explicitly or implicitly). Often times we don't care about the flags or wish to be ab
cp: Add -N flag, inspired by NetBSD's similar flag
Add -N to supress copying of file flags when -p is specified (explicitly or implicitly). Often times we don't care about the flags or wish to be able to copy to NFS, and this comes in handy for that. FreeBSD's and NetBSD's cp are somewhat different, so I had to reimplement all but one of the patch hunks...
Obtained from: NetBSD (cp.1 1.25, cp.c 1.37, utils.c 1.28 by elad) Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D42673
show more ...
|
#
e043f372 |
| 24-Nov-2023 |
Warner Losh <imp@FreeBSD.org> |
bin: Automated cleanup of cdefs and other formatting
Apply the following automated changes to try to eliminate no-longer-needed sys/cdefs.h includes as well as now-empty blank lines in a row.
Remov
bin: Automated cleanup of cdefs and other formatting
Apply the following automated changes to try to eliminate no-longer-needed sys/cdefs.h includes as well as now-empty blank lines in a row.
Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/ Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/ Remove /\n+#if.*\n#endif.*\n+/ Remove /^#if.*\n#endif.*\n/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/
Sponsored by: Netflix
show more ...
|
#
90aea514 |
| 23-Nov-2023 |
Warner Losh <imp@FreeBSD.org> |
bin: Remove ancient SCCS tags.
Remove ancient SCCS tags from the tree, automated scripting, with two minor fixup to keep things compiling. All the common forms in the tree were removed with a perl s
bin: Remove ancient SCCS tags.
Remove ancient SCCS tags from the tree, automated scripting, with two minor fixup to keep things compiling. All the common forms in the tree were removed with a perl script.
Sponsored by: Netflix
show more ...
|
Revision tags: release/14.0.0 |
|
#
1d386b48 |
| 16-Aug-2023 |
Warner Losh <imp@FreeBSD.org> |
Remove $FreeBSD$: one-line .c pattern
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
|
#
c5b5f2d8 |
| 24-Apr-2023 |
Mateusz Guzik <mjg@FreeBSD.org> |
cp: Revert "If copy_file_range(2) fails with EXDEV, use fall-back."
This reverts commit 64333654908153cd8e2dcb408c57cc3e3c4f29af.
The error is not valid per api contract, it showed up as a regressi
cp: Revert "If copy_file_range(2) fails with EXDEV, use fall-back."
This reverts commit 64333654908153cd8e2dcb408c57cc3e3c4f29af.
The error is not valid per api contract, it showed up as a regression after 15f0b8c309dea1dcb14d3e374686576ff68ac43f
15f0b8c309dea1dc ("zfs: merge openzfs/zfs@9cd71c860 (master)") and was subsequently in d012836fb6165494 ("zfs: fix up EXDEV handling for clone_range").
Sponsored by: Rubicon Communications, LLC ("Netgate")
show more ...
|
Revision tags: release/13.2.0 |
|
#
64333654 |
| 04-Apr-2023 |
Poul-Henning Kamp <phk@FreeBSD.org> |
If copy_file_range(2) fails with EXDEV, use fall-back.
|
#
cb96a0ef |
| 03-Feb-2023 |
Dag-Erling Smørgrav <des@FreeBSD.org> |
cp: Minor code cleanup.
* Fix includes in utils.c, cf. style(9). * Fix type mismatch: readlink(2) returns ssize_t, not int. * It is not necessary to set errno to 0 as fts_read(3) already does it.
M
cp: Minor code cleanup.
* Fix includes in utils.c, cf. style(9). * Fix type mismatch: readlink(2) returns ssize_t, not int. * It is not necessary to set errno to 0 as fts_read(3) already does it.
MFC after: 1 week Sponsored by: Klara, Inc. Reviewed by: allanjude Differential Revision: https://reviews.freebsd.org/D38369
show more ...
|
#
6c85042a |
| 01-Feb-2023 |
Dag-Erling Smørgrav <des@FreeBSD.org> |
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
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
show more ...
|
Revision tags: release/12.4.0 |
|
#
35b7759c |
| 30-Aug-2022 |
Alexander Motin <mav@FreeBSD.org> |
cp: Fix build without VM_AND_BUFFER_CACHE_SYNCHRONIZED.
It allows to not use mmap() for small files, which is not helpful in case of ZFS. Should be no functional change.
MFC after: 1 week
|
Revision tags: release/13.1.0, release/12.3.0, release/13.0.0 |
|
#
45b252fc |
| 26-Jan-2021 |
Baptiste Daroussin <bapt@FreeBSD.org> |
cp: fix indentation
No functional changes
|
#
c98a764c |
| 03-Jan-2021 |
Rick Macklem <rmacklem@FreeBSD.org> |
cp(1): fix performance issue for large non-sparse file copies
PR252358 reported a serious performance problem when copying a large non-sparse file on a UFS file system. This problem seems to have be
cp(1): fix performance issue for large non-sparse file copies
PR252358 reported a serious performance problem when copying a large non-sparse file on a UFS file system. This problem seems to have been caused by a large number of SEEK_HOLE operations, with one done for each copy_file_range(2) call.
This patch modifies cp(1) to use a large (SSIZE_MAX) len argument, reducing the number of system calls and resolving the performance issue.
While here, convert the type of the "rcount" from "int" to "ssize_t" so that it is consistent with that returned by both read(2) and copy_file_range(2).
PR: 252358 Reviewed by: asomers Differential Revision: https://reviews.freebsd.org/D27937
show more ...
|
Revision tags: release/12.2.0 |
|
#
1ea95ba2 |
| 11-Sep-2020 |
Alan Somers <asomers@FreeBSD.org> |
cp: fall back to read/write if copy_file_range fails
Even though copy_file_range has a file-system agnostic version, it still fails on devfs (perhaps because the file descriptor is non-seekable?) In
cp: fall back to read/write if copy_file_range fails
Even though copy_file_range has a file-system agnostic version, it still fails on devfs (perhaps because the file descriptor is non-seekable?) In that case, fallback to old-fashioned read/write. Fixes "cp /dev/null /tmp/null"
PR: 249248 Reported by: Michael Butler Reviewed by: mjg MFC-With: 365549 Differential Revision: https://reviews.freebsd.org/D26395
show more ...
|
#
c01816a9 |
| 10-Sep-2020 |
Alan Somers <asomers@FreeBSD.org> |
cp: use copy_file_range(2)
This has three advantages over write(2)/read(2):
* Fewer context switches and data copies * Mostly preserves a file's sparseness * On some file systems (currently NFS 4.2
cp: use copy_file_range(2)
This has three advantages over write(2)/read(2):
* Fewer context switches and data copies * Mostly preserves a file's sparseness * On some file systems (currently NFS 4.2) the file system will perform the copy in an especially efficient way.
Reviewed by: rmacklem MFC after: 2 weeks Sponsored by: Axcient Differential Revision: https://reviews.freebsd.org/D26377
show more ...
|
Revision tags: release/11.4.0, release/12.1.0, release/11.3.0, release/12.0.0, release/11.2.0 |
|
#
82725ba9 |
| 23-Nov-2017 |
Hans Petter Selasky <hselasky@FreeBSD.org> |
Merge ^/head r325999 through r326131.
|
#
8a16b7a1 |
| 20-Nov-2017 |
Pedro F. Giffuni <pfg@FreeBSD.org> |
General further adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 3-Clause license.
The Software Package Data Exchange (SPDX) group provides a specification to make it easier f
General further adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 3-Clause license.
The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts.
Special thanks to Wind River for providing access to "The Duke of Highlander" tool: an older (2014) run over FreeBSD tree was useful as a starting point.
show more ...
|
Revision tags: release/10.4.0, release/11.1.0 |
|
#
348238db |
| 01-Mar-2017 |
Dimitry Andric <dim@FreeBSD.org> |
Merge ^/head r314420 through r314481.
|
#
fbbd9655 |
| 01-Mar-2017 |
Warner Losh <imp@FreeBSD.org> |
Renumber copyright clause 4
Renumber cluase 4 to 3, per what everybody else did when BSD granted them permission to remove clause 3. My insistance on keeping the same numbering for legal reasons is
Renumber copyright clause 4
Renumber cluase 4 to 3, per what everybody else did when BSD granted them permission to remove clause 3. My insistance on keeping the same numbering for legal reasons is too pedantic, so give up on that point.
Submitted by: Jan Schaumann <jschauma@stevens.edu> Pull Request: https://github.com/freebsd/freebsd/pull/96
show more ...
|
Revision tags: release/11.0.1, release/11.0.0, release/10.3.0, release/10.2.0 |
|
#
416ba5c7 |
| 22-Jun-2015 |
Navdeep Parhar <np@FreeBSD.org> |
Catch up with HEAD (r280229-r284686).
|
#
dad2fb7e |
| 15-Jun-2015 |
Baptiste Daroussin <bapt@FreeBSD.org> |
Merge from head
|