xref: /freebsd/lib/libc/gen/getbsize.3 (revision fbc400a67a4e6979c5d99fe59d904cf08992a98f)
1.\" Copyright (c) 1993
2.\"	The Regents of the University of California.  All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\"    notice, this list of conditions and the following disclaimer in the
11.\"    documentation and/or other materials provided with the distribution.
12.\" 3. All advertising materials mentioning features or use of this software
13.\"    must display the following acknowledgement:
14.\"	This product includes software developed by the University of
15.\"	California, Berkeley and its contributors.
16.\" 4. Neither the name of the University nor the names of its contributors
17.\"    may be used to endorse or promote products derived from this software
18.\"    without specific prior written permission.
19.\"
20.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE.
31.\"
32.\"     @(#)getbsize.3	8.1 (Berkeley) 6/4/93
33.\"     $Id$
34.\"
35.Dd June 4, 1993
36.Dt GETBSIZE 3
37.Os BSD 4.4
38.Sh NAME
39.Nm getbsize
40.Nd get user block size
41.Sh SYNOPSIS
42.Fd #include <stdlib.h>
43.Ft char *
44.Fn getbsize "int *headerlenp" "long *blocksizep"
45.Sh DESCRIPTION
46The
47.Fn getbsize
48function determines the user's preferred block size based on the value of the
49.Dq BLOCKSIZE
50environment variable; see
51.Xr environ 7
52for details on its use and format.
53.Pp
54The
55.Fn getbsize
56function returns a pointer to a null-terminated string describing
57the block size, something like
58.Dq 1K-blocks .
59The memory referenced by
60.Fa headerlenp
61is filled in with the length of the string (not including the
62terminating null).
63The memory referenced by
64.Fa blocksizep
65is filled in with block size, in bytes.
66.Pp
67If the user's block size is unreasonable, a warning message is
68written to standard error and the returned information reflects
69a block size of 512 bytes.
70.Sh SEE ALSO
71.Xr df 1 ,
72.Xr du 1 ,
73.Xr ls 1 ,
74.Xr systat 1 ,
75.Xr environ 7
76.Sh HISTORY
77The
78.Fn getbsize
79function first appeared in
80.Bx 4.4 .
81