CDEFS(3)
π CDEFS(3) π
okay so this is from the Library Functions Manual bestie, buckle up π
β¨ NAME β¨
cdefs β common definitions and macros, aka the little header that runs the whole friend group π
β¨ SYNOPSIS β¨
#include <sys/cdefs.h>
β¨ DESCRIPTION β¨
So the <sys/cdefs.h> header is literally carrying some common definitions and macros that are, like, typical to the C language conventions of NetBSD. no cap. Among these are:
- Certain C language properties and definitions that get versioned according to what the compilers actually support π¦ β examples include the
__func__keyword and therestricttype qualifier from C99. iconic behaviour tbh. - Macros and definitions that are specific to compilers, preprocessors, and linkers π β go look at
__BIT(3),__BITS(3),__CONCAT(3),__FPTRCAST(3),__SHIFTIN(3),__SHIFTOUT(3),__SHIFTOUT_MASK(3),__UNCONST(3),__UNVOLATILE(3),__USE(3),__insn_barrier(3), andattribute(3). that's a whole squad fr fr. - Utility macros provided purely for convenience π β see
__arraycount(3)andbits(3). they're just being nice to you.
The header also contains the __RCSID() and __KERNEL_RCSID() macros, which are used for version control system (VCS) identifiers π. The way that works: all NetBSD source code files typically include <sys/cdefs.h>, and they include it as the first thing right after any possible copyright texts. like, first in line, main character energy β
/*-
* Copyright (c) 1984 John Doe
* All rights reserved.
*
* Redistribution and use in source and binary forms,
* with or without modification, are permitted.
*/
#include <sys/cdefs.h>
__RCSID("$NetBSD: cdefs.3,v 1.5 2019/11/10 18:45:09 christos Exp $");
And yeah β it is possible to identify the RCS keyword strings by using ident(1) π iykyk.
β¨ SEE ALSO β¨
ident(1), param(3), stddef(3), types(3), c(7) π«Ά go read them, they're all in the group chat.
β¨ HISTORY β¨
The <sys/cdefs.h> header was originally imported from 386BSD π§ giving ancestral legend, honestly.
k that's the whole page bestie π this cutie dropped from Debian on November 10, 2019. go forth and #include responsibly π
π¦ where this page comes from
- nixpkgs unstable: netbsd-source 11.0
- Copyright (c) 2010 The NetBSD Foundation, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms