xref: /netbsd/share/man/man3/cdefs.3 (revision 6550d01e)
1.\" $NetBSD: cdefs.3,v 1.2 2010/12/17 07:10:38 jruoho 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 December 17, 2010
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 __CONCAT 3 ,
58.Xr __UNCONST 3 ,
59.Xr __insn_barrier 3 ,
60and
61.Xr attribute 3 .
62.It
63Utility macros provided for convenience; see
64.Xr __arraycount 3
65and
66.Xr bits 3 .
67.El
68.Pp
69The header also contains the
70.Fn __RCSID
71and
72.Fn __KERNEL_RCSID
73macros used for version control system
74.Pq Tn VCS
75identifiers.
76Thus, all
77.Nx
78source code files typically include
79.In sys/cdefs.h ,
80included as the first thing right after any possible copyright texts;
81.Bd -literal -offset indent
82/*-
83 * Copyright (c) 1984 John Doe
84 * All rights reserved.
85 *
86 * Redistribution and use in source and binary forms,
87 * with or without modification, are permitted.
88 */
89
90#include <sys/cdefs.h>
91__RCSID("$NetBSD: cdefs.3,v 1.2 2010/12/17 07:10:38 jruoho Exp $");
92.Ed
93.Pp
94It is possible to identify the
95.Tn RCS
96keyword strings by using
97.Xr ident 1 .
98.Sh SEE ALSO
99.Xr ident 1 ,
100.Xr stddef 3 ,
101.Xr types 3 ,
102.Xr c 7
103.Sh HISTORY
104The
105.In sys/cdefs.h
106header was originally imported from
107.Bx 386 .
108