History log of /freebsd-current/usr.bin/truncate/truncate.c
Revision Date Author Comments
# eba230af 25-Sep-2023 John Baldwin <jhb@FreeBSD.org>

Purge more stray embedded $FreeBSD$ strings

These do not use __FBSDID but instead use bare char arrays.

Reviewed by: imp, emaste
Differential Revision: https://reviews.freebsd.org/D41957


# 4d846d26 10-May-2023 Warner Losh <imp@FreeBSD.org>

spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD

The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch
up to that fact and revert to their recommended match of BSD-2-Clause.

Discussed with: pfg
MFC After: 3 days
Sponsored by: Netflix


# 5ee2c357 19-Aug-2021 Ka Ho Ng <khng@FreeBSD.org>

truncate(1): Add hole-punching support

This commit adds hole-punching support to the truncate(1) utility. If
the option -d is specified, truncate(1) performs zeroing, and if
possible hole-punching in case the operation is supported by the
underlying file system of the specified files.

Sponsored by: The FreeBSD Foundation
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D31556


# 89c0d2b1 18-Aug-2021 Ka Ho Ng <khng@FreeBSD.org>

truncate(1): main() return statement style fix

Sponsored by: The FreeBSD Foundation


# ec9eb997 29-Jul-2018 Eitan Adler <eadler@FreeBSD.org>

truncate: delintify


# c517ae76 29-Jul-2018 Eitan Adler <eadler@FreeBSD.org>

truncate: use better type for 'round'


# 10173270 09-Jul-2018 Emmanuel Vadot <manu@FreeBSD.org>

truncate: Add support for -s % and /

% round up to the multiple size and / round down
This is compatible with gnu truncate.
Add tests and document in the man page.


# dde27dbc 09-Jul-2018 Emmanuel Vadot <manu@FreeBSD.org>

truncate: style(9) some parts


# 1de7b4b8 27-Nov-2017 Pedro F. Giffuni <pfg@FreeBSD.org>

various: general adoption of SPDX licensing ID tags.

Mainly focus on files that use BSD 2-Clause license, however the tool I
was using misidentified many licenses so this was mostly a manual - error
prone - task.

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.

No functional change intended.


# fc96358c 09-Jun-2014 Jilles Tjoelker <jilles@FreeBSD.org>

truncate: Detect integer overflow, fix relative sizes, add tests.

The change to expand_number (r204654) broke detection of too large sizes and
relative sizes ('+'/'-').

Also add some tests.

PR: 190735
Submitted by: Kirk Russell
MFC after: 1 week


# a7d5f7eb 19-Oct-2010 Jamie Gritton <jamie@FreeBSD.org>

A new jail(8) with a configuration file, to replace the work currently done
by /etc/rc.d/jail.


# fe0506d7 09-Mar-2010 Marcel Moolenaar <marcel@FreeBSD.org>

Create the altix project branch. The altix project will add support
for the SGI Altix 350 to FreeBSD/ia64. The hardware used for porting
is a two-module system, consisting of a base compute module and a
CPU expansion module. SGI's NUMAFlex architecture can be an excellent
platform to test CPU affinity and NUMA-aware features in FreeBSD.


# 32bdc2b6 03-Mar-2010 Maxim Sobolev <sobomax@FreeBSD.org>

Use expand_number(3) from libutil instead of home-grown function to parse
human-friendly power-of-two numbers (i.e. 2k, 5M etc).

Suggested by: many
MFC after: 1 week


# 614595dc 20-Feb-2009 Xin LI <delphij@FreeBSD.org>

Initialize 'sz' as 0.


# d7f03759 19-Oct-2008 Ulf Lilleengen <lulf@FreeBSD.org>

- Import the HEAD csup code which is the basis for the cvsmode work.


# d59e8ae8 04-Aug-2008 Colin Percival <cperciva@FreeBSD.org>

Don't close file descriptor number <whatever random garbage was on the
stack>.

Found by: LLVM/Clang Static Checker
MFC after: 1 week


# a39846b5 18-Sep-2006 Maxim Konovalov <maxim@FreeBSD.org>

o Don't leak fd on error.
o parselength() returns 0 or -1 so int is enough for its return type.

Submitted by: Ighighi Ighighi, sheldonh
MFC after: 3 weeks


# 0033dba8 07-Sep-2006 Ceri Davies <ceri@FreeBSD.org>

Chase revision 1.10 in usage string and a comment.


# e6f3621d 09-Apr-2006 Pawel Jakub Dawidek <pjd@FreeBSD.org>

Allow to specify size in terabytes by using T or t suffix.
This speeds up my testing a bit. Because truncate(1) doesn't allocate
blocks on file system before they are used, it is very useful to
emulate huge file systems:

# truncate -s 16T fs.img
# mdconfig -a -f fs.img
# newfs /dev/mdX

(-t swap can be used as well)


# f682f10c 21-May-2005 Ruslan Ermilov <ru@FreeBSD.org>

Sync program's usage() with manpage's SYNOPSIS.


# 6b61c155 22-Jul-2004 Lukas Ertl <le@FreeBSD.org>

Make size suffix case insensitive.

PR: bin/27604
Submitted by: David Xu <davidx@viasoft.com.cn>


# 3f330d7d 21-Mar-2002 Warner Losh <imp@FreeBSD.org>

remove __P


# b86e825a 24-Jul-2000 Sheldon Hearn <sheldonh@FreeBSD.org>

Simplify some conditionals.


# dee82c61 24-Jul-2000 Sheldon Hearn <sheldonh@FreeBSD.org>

Shut an optimizing compiler up about possibly (but never) unused
variables.

Submitted by: charnier


# 6b88e76b 24-Jul-2000 Sheldon Hearn <sheldonh@FreeBSD.org>

truncate.c:
Do not include unused header files.
Add rcsid.
Change copyright.

truncate.1:
Add AUTHORS section.

Submitted by: charnier


# 4d532a36 23-Jul-2000 Sheldon Hearn <sheldonh@FreeBSD.org>

Close file descriptors after use so as not to abuse the descriptor
table when a long argument list is given. :-)

Reported by: Sven Agnew <afterhours80@hotmail.com>


# edeb84a1 18-Jul-2000 Sheldon Hearn <sheldonh@FreeBSD.org>

Import the new truncate(1) utility.

Approved by: jdp