xref: /netbsd-src/share/man/man3/cdefs.3 (revision bfcdd97237fbae73b7674d256cbc4f20df0403c2)
1.\" $NetBSD: cdefs.3,v 1.5 2019/11/10 18:45:09 christos Exp $
2.\"
3.\" Copyright (c) 2010 The NetBSD Foundation, Inc.
4.\" All rights reserved.
5.\"
6.\" This code is derived from software contributed to The NetBSD Foundation
7.\" by Jukka Ruohonen.
8.\"
9.\" Redistribution and use in source and binary forms, with or without
10.\" modification, are permitted provided that the following conditions
11.\" are met:
12.\" 1. Redistributions of source code must retain the above copyright
13.\"    notice, this list of conditions and the following disclaimer.
14.\" 2. Redistributions in binary form must reproduce the above copyright
15.\"    notice, this list of conditions and the following disclaimer in the
16.\"    documentation and/or other materials provided with the distribution.
17.\"
18.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28.\" POSSIBILITY OF SUCH DAMAGE.
29.\"
30.Dd November 10, 2019
31.Dt CDEFS 3
32.Os
33.Sh NAME
34.Nm cdefs
35.Nd common definitions and macros
36.Sh SYNOPSIS
37.In sys/cdefs.h
38.Sh DESCRIPTION
39The
40.In sys/cdefs.h
41header includes some common definitions and macros
42typical to the C language conventions of
43.Nx .
44Among these are:
45.Bl -bullet -offset indent
46.It
47Certain C language properties and definitions that
48are versioned according to the support in compilers.
49Examples include the
50.Em __func__
51keyword and the
52.Em restrict
53type qualifier from
54.Tn C99 .
55.It
56Macros and definitions specific to compilers, preprocessors, and linkers; see
57.Xr __BIT 3 ,
58.Xr __BITS 3 ,
59.Xr __CONCAT 3 ,
60.Xr __FPTRCAST 3 ,
61.Xr __SHIFTIN 3 ,
62.Xr __SHIFTOUT 3 ,
63.Xr __SHIFTOUT_MASK 3 ,
64.Xr __UNCONST 3 ,
65.Xr __UNVOLATILE 3 ,
66.Xr __USE 3 ,
67.Xr __insn_barrier 3 ,
68and
69.Xr attribute 3 .
70.It
71Utility macros provided for convenience; see
72.Xr __arraycount 3
73and
74.Xr bits 3 .
75.El
76.Pp
77The header also contains the
78.Fn __RCSID
79and
80.Fn __KERNEL_RCSID
81macros used for version control system
82.Pq Tn VCS
83identifiers.
84Thus, all
85.Nx
86source code files typically include
87.In sys/cdefs.h ,
88included as the first thing right after any possible copyright texts;
89.Bd -literal -offset indent
90/*-
91 * Copyright (c) 1984 John Doe
92 * All rights reserved.
93 *
94 * Redistribution and use in source and binary forms,
95 * with or without modification, are permitted.
96 */
97
98#include <sys/cdefs.h>
99__RCSID("$NetBSD: cdefs.3,v 1.5 2019/11/10 18:45:09 christos Exp $");
100.Ed
101.Pp
102It is possible to identify the
103.Tn RCS
104keyword strings by using
105.Xr ident 1 .
106.Sh SEE ALSO
107.Xr ident 1 ,
108.Xr param 3 ,
109.Xr stddef 3 ,
110.Xr types 3 ,
111.Xr c 7
112.Sh HISTORY
113The
114.In sys/cdefs.h
115header was originally imported from
116.Bx 386 .
117