off_t(3type)
π off_t β file sizes, bestie π
okay so this is the off_t page from section 3type of the Linux manual β like, the type-definitions corner of the man pages, iykyk. we got three little friends here: off_t, off64_t, and loff_t, and they're all about how big a file is. let's get into it π
β¨ LIBRARY β¨
Standard C library (libc) π«Ά
πΈ SYNOPSIS πΈ
#include <sys/types.h>
typedef /* ... */ off_t;
#define _LARGEFILE64_SOURCE
#include <sys/types.h>
typedef /* ... */ off64_t [[deprecated]];
#define _GNU_SOURCE
#include <sys/types.h>
typedef /* ... */ loff_t;
okay so notice how off64_t needs that _LARGEFILE64_SOURCE macro and loff_t needs _GNU_SOURCE β and also π off64_t is literally tagged [[deprecated]] in the source. the compiler is giving you the side-eye. not me pointing that out or anything π
π DESCRIPTION π
off_t is the one you use for describing file sizes. it's a signed integer type. periodt.
off64_t is a 64-bit version of the type, and it's the one used in glibc. π
loff_t is also a 64-bit version, but this one was introduced by the Linux kernel. king behavior tbh π
β STANDARDS β
off_tβ POSIX.1-2024. iconic, standardized, we love to see it β¨off64_tβ None. literally nobody claimed it. it's giving rogue π«loff_tβ Linux. homegrown Linux energy π§
π¦ HISTORY π¦
off_tβ POSIX.1-1988. an elder. a legend. been here since the 80s π«off64_tβ came from the Large File Summit (LFS). yes that's a real thing that really happened ποΈ- alsoooo
<aio.h>and<stdio.h>have definedoff_tsince POSIX.1-2008. so like, the glow-up was gradual π
π NOTES π
on some architectures, the width of off_t can be controlled with the feature test macro _FILE_OFFSET_BITS. so like, it's not always the same size everywhere β vibe check your target arch first, bestie.
and these headers also hand you off_t:
<aio.h><fcntl.h><stdio.h><sys/mman.h><sys/stat.h><unistd.h>
so if you're wondering where it even came from, surprise, it's everywhere π«Ά
π₯ SEE ALSO π₯
copy_file_range(2), lseek(2), mmap(2), posix_fadvise(2), pread(2), readahead(2), sync_file_range(2), truncate(2), fseeko(3), lockf(3), posix_fallocate(3), feature_test_macros(7)
π reminder bestie: off64_t is deprecated, so don't go building your whole personality around it. and always check the header before assuming you got the type for free β¨
okay bye ily, this was Linux man-pages 6.20, dated 2026-06-13 β go read feature_test_macros(7) next, it's lowkey a bop ππΈπ¦
π¦ where this page comes from
- arch rolling: man-pages 6.20-1 Β· BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
- nixpkgs unstable: man-pages 6.20
- π the page's license: Linux-man-pages-copyleft
- Copyright 2020, Michael Kerrisk <mtk.manpages@gmail.com>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms