1GETBSIZE(3bsd)                       LOCAL                      GETBSIZE(3bsd)
2

NAME

4     getbsize — get preferred block size
5

LIBRARY

7     Utility functions from BSD systems (libbsd, -lbsd)
8

SYNOPSIS

10     #include <stdlib.h>
11     (See libbsd(7) for include usage.)
12
13     char *
14     getbsize(int *headerlenp, long *blocksizep);
15

DESCRIPTION

17     The getbsize() function returns a preferred block size for reporting by
18     system utilities df(1), du(1), ls(1) and systat(1), based on the value of
19     the BLOCKSIZE environment variable.  BLOCKSIZE may be specified directly
20     in bytes, or in multiples of a kilobyte by specifying a number followed
21     by ``K'' or ``k'', in multiples of a megabyte by specifying a number fol‐
22     lowed by ``M'' or ``m'' or in multiples of a gigabyte by specifying a
23     number followed by ``G'' or ``g''.  Multiples must be integers.
24
25     Valid values of BLOCKSIZE are 512 bytes to 1 gigabyte.  Sizes less than
26     512 bytes are rounded up to 512 bytes, and sizes greater than 1 GB are
27     rounded down to 1 GB.  In each case getbsize() produces a warning mes‐
28     sage.
29
30     The getbsize() function returns a pointer to a null-terminated string
31     describing the block size, something like “1K-blocks”.  The memory refer‐
32     enced by headerlenp is filled in with the length of the string (not
33     including the terminating null).  The memory referenced by blocksizep is
34     filled in with block size, in bytes.
35

SEE ALSO

37     df(1), du(1), ls(1), systat(1), environ(7)
38

HISTORY

40     The getbsize() function first appeared in 4.4BSD.
41
42BSD                            November 16, 2012                           BSD
Impressum