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 defined off_t since 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
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms