xref: /freebsd/lib/libc/gen/getbsize.3 (revision dc36d6f9bb1753f3808552f3afd30eda9a7b206a)
158f0484fSRodney W. Grimes.\" Copyright (c) 1993
258f0484fSRodney W. Grimes.\"	The Regents of the University of California.  All rights reserved.
358f0484fSRodney W. Grimes.\"
458f0484fSRodney W. Grimes.\" Redistribution and use in source and binary forms, with or without
558f0484fSRodney W. Grimes.\" modification, are permitted provided that the following conditions
658f0484fSRodney W. Grimes.\" are met:
758f0484fSRodney W. Grimes.\" 1. Redistributions of source code must retain the above copyright
858f0484fSRodney W. Grimes.\"    notice, this list of conditions and the following disclaimer.
958f0484fSRodney W. Grimes.\" 2. Redistributions in binary form must reproduce the above copyright
1058f0484fSRodney W. Grimes.\"    notice, this list of conditions and the following disclaimer in the
1158f0484fSRodney W. Grimes.\"    documentation and/or other materials provided with the distribution.
12fbbd9655SWarner Losh.\" 3. Neither the name of the University nor the names of its contributors
1358f0484fSRodney W. Grimes.\"    may be used to endorse or promote products derived from this software
1458f0484fSRodney W. Grimes.\"    without specific prior written permission.
1558f0484fSRodney W. Grimes.\"
1658f0484fSRodney W. Grimes.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
1758f0484fSRodney W. Grimes.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1858f0484fSRodney W. Grimes.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1958f0484fSRodney W. Grimes.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2058f0484fSRodney W. Grimes.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2158f0484fSRodney W. Grimes.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2258f0484fSRodney W. Grimes.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2358f0484fSRodney W. Grimes.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2458f0484fSRodney W. Grimes.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2558f0484fSRodney W. Grimes.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2658f0484fSRodney W. Grimes.\" SUCH DAMAGE.
2758f0484fSRodney W. Grimes.\"
285e3f43f2SEnji Cooper.Dd June 11, 2017
2958f0484fSRodney W. Grimes.Dt GETBSIZE 3
30a307d598SRuslan Ermilov.Os
3158f0484fSRodney W. Grimes.Sh NAME
3258f0484fSRodney W. Grimes.Nm getbsize
33c90e9317SGreg Lehey.Nd get preferred block size
3425bb73e0SAlexey Zelkin.Sh LIBRARY
3525bb73e0SAlexey Zelkin.Lb libc
3658f0484fSRodney W. Grimes.Sh SYNOPSIS
3732eef9aeSRuslan Ermilov.In stdlib.h
3858f0484fSRodney W. Grimes.Ft char *
39c2e55537SDavid E. O'Brien.Fn getbsize "int *headerlenp" "long *blocksizep"
4058f0484fSRodney W. Grimes.Sh DESCRIPTION
4158f0484fSRodney W. GrimesThe
42bf5a138eSMike Pritchard.Fn getbsize
43c90e9317SGreg Leheyfunction returns a preferred block size for reporting by system utilities
44c90e9317SGreg Lehey.Xr df 1 ,
45*8d06c3e7SMichael Reifenberger.Xr du 1
46c90e9317SGreg Leheyand
47*8d06c3e7SMichael Reifenberger.Xr ls 1 ,
48c90e9317SGreg Leheybased on the value of the
4990c819e0SJoel Dahl.Ev BLOCKSIZE
50c90e9317SGreg Leheyenvironment variable.
5190c819e0SJoel Dahl.Ev BLOCKSIZE
52c90e9317SGreg Leheymay be specified directly in bytes, or in multiples of a kilobyte by
53c90e9317SGreg Leheyspecifying a number followed by ``K'' or ``k'', in multiples of a
54c90e9317SGreg Leheymegabyte by specifying a number followed by ``M'' or ``m'' or in
55c90e9317SGreg Leheymultiples of a gigabyte by specifying a number followed by ``G'' or
56c90e9317SGreg Lehey``g''.
57c90e9317SGreg LeheyMultiples must be integers.
58c90e9317SGreg Lehey.Pp
59c90e9317SGreg LeheyValid values of
6090c819e0SJoel Dahl.Ev BLOCKSIZE
61c90e9317SGreg Leheyare 512 bytes to 1 gigabyte.
62c90e9317SGreg LeheySizes less than 512 bytes are rounded up to 512 bytes, and sizes
63c90e9317SGreg Leheygreater than 1 GB are rounded down to 1 GB.
64c90e9317SGreg LeheyIn each case
65c90e9317SGreg Lehey.Fn getbsize
665e3f43f2SEnji Cooperproduces a warning message via
675e3f43f2SEnji Cooper.Xr warnx 3 .
6858f0484fSRodney W. Grimes.Pp
6958f0484fSRodney W. GrimesThe
70bf5a138eSMike Pritchard.Fn getbsize
7158f0484fSRodney W. Grimesfunction returns a pointer to a null-terminated string describing
7258f0484fSRodney W. Grimesthe block size, something like
7358f0484fSRodney W. Grimes.Dq 1K-blocks .
7458f0484fSRodney W. GrimesThe memory referenced by
7558f0484fSRodney W. Grimes.Fa headerlenp
7658f0484fSRodney W. Grimesis filled in with the length of the string (not including the
7758f0484fSRodney W. Grimesterminating null).
7858f0484fSRodney W. GrimesThe memory referenced by
7958f0484fSRodney W. Grimes.Fa blocksizep
8058f0484fSRodney W. Grimesis filled in with block size, in bytes.
8158f0484fSRodney W. Grimes.Sh SEE ALSO
8258f0484fSRodney W. Grimes.Xr df 1 ,
8358f0484fSRodney W. Grimes.Xr du 1 ,
8458f0484fSRodney W. Grimes.Xr ls 1 ,
8558f0484fSRodney W. Grimes.Xr systat 1 ,
8658f0484fSRodney W. Grimes.Xr environ 7
8758f0484fSRodney W. Grimes.Sh HISTORY
8858f0484fSRodney W. GrimesThe
89bf5a138eSMike Pritchard.Fn getbsize
90712dc76eSMike Pritchardfunction first appeared in
9158f0484fSRodney W. Grimes.Bx 4.4 .
92