getbsize(3bsd)
β¨ getbsize β get preferred block size β¨
okay bestie, so we're in getbsize(3bsd) territory, a lil LOCAL page from the BSD world, and honestly? it's giving "quiet utility that runs the whole vibe." let's get into it π
πΈ LIBRARY πΈ
Utility functions from BSD systems β that's libbsd, link it with -lbsd. π«Ά
π¦ SYNOPSIS π¦
#include <stdlib.h>
(See libbsd(7) for include usage.)
char *
getbsize(int *headerlenp, long *blocksizep);
heads up bestie: peep libbsd(7) for the whole include-usage situation, it's a whole thing.
π DESCRIPTION π
so getbsize() hands you back a preferred block size β the number that system utilities like df(1), du(1), ls(1) and systat(1) use when they're reporting stuff to you. and where does it get that number? from the BLOCKSIZE environment variable, no cap. β¨
and BLOCKSIZE can be written a few different ways:
- straight up in bytes, just a plain number π
- in multiples of a kilobyte β number followed by
Kork - in multiples of a megabyte β number followed by
Morm - in multiples of a gigabyte β number followed by
Gorg
β οΈ the multiples must be integers. no decimals, no fractions, don't try it bestie. π«
now, the valid range for BLOCKSIZE is 512 bytes all the way up to 1 gigabyte. and here's the dramatic part:
- sizes less than
512bytes get rounded up to512bytes β¬οΈ - sizes greater than
1 GBget rounded down to1 GBβ¬οΈ
and in each of those cases, getbsize() produces a warning message. so likeβ¦ it'll still work, but it's gonna tell you about it. periodt. π
π what you actually get back π
getbsize() returns a pointer to a null-terminated string describing the block size β something like β1K-blocksβ. iconic lil label tbh. β¨
and then:
- the memory that
headerlenppoints at gets filled in with the length of that string β and no, the terminating null does not count, we're not counting that bestie π - the memory that
blocksizeppoints at gets filled in with the block size, in bytes
so like, one pointer gives you the pretty string, the other gives you the actual number. both. at once. main character energy fr fr. π
π SEE ALSO π
π HISTORY π
getbsize() first appeared in 4.4BSD. an OG, a legend, a founding mother of block sizes. π
and that's the whole page bestie, you ate it π
β¨ this lil slice of Debian-flavored BSD goodness is dated November 16, 2012, and yeah the footer is literally just Debian and getbsize(3bsd) β so consider yourself signed off on, mwah π«Άπ
π¦ where this page comes from
- alpine 3.22: libbsd-doc 0.12.2-r0 Β· BSD-3-Clause
- alpine 3.23: libbsd-doc 0.12.2-r0 Β· BSD-3-Clause
- alpine 3.24: libbsd-doc 0.12.2-r0 Β· BSD-3-Clause
- arch rolling: libbsd 0.12.2-2 Β· custom
- debian bookworm: libbsd-dev 0.11.7-2
- debian trixie: libbsd-dev 0.12.2-2
- epel 10: libbsd-devel 0.12.2-4.el10_0 Β· Beerware AND BSD-2-Clause AND BSD-3-Clause AND ISC AND libutil-David-Nugent AND MIT AND LicenseRef-Fedora-Public-Domain
- epel 9: libbsd-devel 0.12.2-1.el9 Β· Beerware AND BSD-2-Clause AND BSD-3-Clause AND ISC AND libutil-David-Nugent AND MIT AND LicenseRef-Fedora-Public-Domain
- fedora 43: libbsd-devel 0.12.2-6.fc43 Β· Beerware AND BSD-2-Clause AND BSD-3-Clause AND ISC AND libutil-David-Nugent AND MIT AND LicenseRef-Fedora-Public-Domain
- fedora 43: libbsd-devel 0.12.2-6.fc43 Β· Beerware AND BSD-2-Clause AND BSD-3-Clause AND ISC AND libutil-David-Nugent AND MIT AND LicenseRef-Fedora-Public-Domain
- fedora 44: libbsd-devel 0.12.2-7.fc44 Β· Beerware AND BSD-2-Clause AND BSD-3-Clause AND ISC AND libutil-David-Nugent AND MIT AND LicenseRef-Fedora-Public-Domain
- fedora 44: libbsd-devel 0.12.2-7.fc44 Β· Beerware AND BSD-2-Clause AND BSD-3-Clause AND ISC AND libutil-David-Nugent AND MIT AND LicenseRef-Fedora-Public-Domain
- nixos 26.05: libbsd 0.12.2
- nixpkgs unstable: libbsd 0.12.2
- opensuse-leap 16.0: libbsd-devel 0.11.7-160000.3.2 Β· BSD-3-Clause
- opensuse-leap 16.0: libbsd-devel 0.11.7-160000.3.2 Β· BSD-3-Clause
- opensuse-leap 16.0: libbsd-devel 0.11.7-160000.3.2 Β· BSD-3-Clause
- opensuse-leap 16.0: libbsd-devel 0.11.7-160000.3.2 Β· BSD-3-Clause
- ubuntu noble: libbsd-dev 0.12.1-1build1
- ubuntu noble: libbsd-dev 0.12.1-1build1.1
- ubuntu questing: libbsd-dev 0.12.2-2build1
- ubuntu resolute: libbsd-dev 0.12.2-2build2
- ubuntu stonking: libbsd-dev 0.12.2-3
- Copyright (c) 1993 The Regents of the University of California. All rights reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms