xref: /freebsd/share/examples/mdoc/example.9 (revision c16a777f08b568f5ccb99481aeacd6d85ae194ba)
1.\" Copyright (c) [year] [your name]
2.\" All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\"    notice, this list of conditions and the following disclaimer in the
11.\"    documentation and/or other materials provided with the distribution.
12.\"
13.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23.\" SUCH DAMAGE.
24.\"
25.\" $FreeBSD$
26.\"
27.\" Note: The date here should be updated whenever a non-trivial
28.\" change is made to the manual page.
29.Dd January 12, 2005
30.Dt EXAMPLE 9
31.Os
32.Sh NAME
33.Nm example
34.Nd "example kernel interface manual page"
35.Sh SYNOPSIS
36.In example.h
37.Ft int
38.Fn example "char *ptr" "int mode"
39.Sh DESCRIPTION
40This is an example library function manual page for the
41.Fn example
42kernel function.
43It is intended that this example can be used as a template
44when writing a new manual page.
45.Pp
46The
47.Fn example
48function takes two arguments:
49.Fa ptr
50and
51.Fa mode .
52The argument
53.Fa mode
54may have one of the following values:
55.Bl -tag -width ".Dv EXAMPLE_ONE"
56.It Dv EXAMPLE_ONE
57First example of a defined variable.
58.Dv EXAMPLE_ONE
59is described below.
60.It Dv EXAMPLE_TWO
61Second example.
62.El
63.Pp
64The above values are defined in
65.In example.h
66as follows:
67.Bd -literal
68#define EXAMPLE_ONE  1
69#define EXAMPLE_TWO  2
70.Ed
71.Sh IMPLEMENTATION NOTES
72The
73.Fn example
74function is not actually implemented.
75.Sh RETURN VALUES
76The
77.Fn example
78function returns the value 0 if successful;
79otherwise one of the values listed in the
80.Sx ERRORS
81section is returned, to indicate the error.
82.Sh EXAMPLES
83.Bd -literal
84	int val;
85
86	if ((val = example(NULL, EXAMPLE_ONE)) != 0)
87		return (val);
88.Ed
89.Sh COMPATIBILITY
90The
91.Fn example
92function has no known compatibility issues.
93.Sh ERRORS
94.\" Delete any errno's that are not returned by your
95.\" function or system call and then tailor the
96.\" remaining text as needed.
97The
98.Fn example
99function will fail if:
100.Bl -tag -width Er
101.It Bq Er EPERM
102Operation not permitted.
103.It Bq Er ENOENT
104No such file or directory.
105.It Bq Er ESRCH
106No such process.
107.It Bq Er EINTR
108Interrupted system call.
109.It Bq Er EIO
110Input/output error.
111.It Bq Er ENXIO
112Device not configured.
113.It Bq Er E2BIG
114Argument list too long.
115.It Bq Er ENOEXEC
116Exec format error.
117.It Bq Er EBADF
118Bad file descriptor.
119.It Bq Er ECHILD
120No child processes.
121.It Bq Er EDEADLK
122Resource deadlock avoided.
123.It Bq Er ENOMEM
124Cannot allocate memory.
125.It Bq Er EACCES
126Permission denied.
127.It Bq Er EFAULT
128Bad address.
129.It Bq Er ENOTBLK
130Block device required.
131.It Bq Er EBUSY
132Device busy.
133.It Bq Er EEXIST
134File exists.
135.It Bq Er EXDEV
136Cross-device link.
137.It Bq Er ENODEV
138Operation not supported by device.
139.It Bq Er ENOTDIR
140Not a directory.
141.It Bq Er EISDIR
142Is a directory.
143.It Bq Er EINVAL
144Invalid argument.
145.It Bq Er ENFILE
146Too many open files in system.
147.It Bq Er EMFILE
148Too many open files.
149.It Bq Er ENOTTY
150Inappropriate ioctl for device.
151.It Bq Er ETXTBSY
152Text file busy.
153.It Bq Er EFBIG
154File too large.
155.It Bq Er ENOSPC
156No space left on device.
157.It Bq Er ESPIPE
158Illegal seek.
159.It Bq Er EROFS
160Read-only file system.
161.It Bq Er EMLINK
162Too many links.
163.It Bq Er EPIPE
164Broken pipe.
165.It Bq Er EDOM
166Numerical argument out of domain.
167.It Bq Er ERANGE
168Result too large.
169.It Bq Er EAGAIN
170Resource temporarily unavailable.
171.It Bq Er EWOULDBLOCK
172Operation would block.
173.It Bq Er EINPROGRESS
174Operation now in progress.
175.It Bq Er EALREADY
176Operation already in progress.
177.It Bq Er ENOTSOCK
178Socket operation on non-socket.
179.It Bq Er EDESTADDRREQ
180Destination address required.
181.It Bq Er EMSGSIZE
182Message too long.
183.It Bq Er EPROTOTYPE
184Protocol wrong type for socket.
185.It Bq Er ENOPROTOOPT
186Protocol not available.
187.It Bq Er EPROTONOSUPPORT
188Protocol not supported.
189.It Bq Er ESOCKTNOSUPPORT
190Socket type not supported.
191.It Bq Er EOPNOTSUPP
192Operation not supported.
193.It Bq Er EPFNOSUPPORT
194Protocol family not supported.
195.It Bq Er EAFNOSUPPORT
196Address family not supported by protocol family.
197.It Bq Er EADDRINUSE
198Address already in use.
199.It Bq Er EADDRNOTAVAIL
200Cannot assign requested address.
201.It Bq Er ENETDOWN
202Network is down.
203.It Bq Er ENETUNREACH
204Network is unreachable.
205.It Bq Er ENETRESET
206Network dropped connection on reset.
207.It Bq Er ECONNABORTED
208Software causes connection abort.
209.It Bq Er ENOBUFS
210No buffer space available.
211.It Bq Er EISCONN
212Socket is already connected.
213.It Bq Er ENOTCONN
214Socket is not connected.
215.It Bq Er ESHUTDOWN
216Cannot send after socket shutdown.
217.It Bq Er ETOOMANYREFS
218Too many references: cannot splice.
219.It Bq Er ETIMEDOUT
220Operation timed out.
221.It Bq Er ECONNREFUSED
222Connection refused.
223.It Bq Er ELOOP
224Too many levels of symbolic links.
225.It Bq Er ENAMETOOLONG
226File name too long.
227.It Bq Er EHOSTDOWN
228Host is down.
229.It Bq Er EHOSTUNREACH
230No route to host.
231.It Bq Er ENOTEMPTY
232Directory not empty.
233.It Bq Er EPROCLIM
234Too many processes.
235.It Bq Er EUSERS
236Too many users.
237.It Bq Er EDQUOT
238Disc quota exceeded.
239.It Bq Er ESTALE
240Stale NFS file handle.
241.It Bq Er EREMOTE
242Too many levels of remote in path.
243.It Bq Er EBADRPC
244RPC struct is bad.
245.It Bq Er ERPCMISMATCH
246RPC version wrong.
247.It Bq Er EPROGUNAVAIL
248RPC program not available.
249.It Bq Er EPROGMISMATCH
250Program version wrong.
251.It Bq Er EPROCUNAVAIL
252Bad procedure for program.
253.It Bq Er ENOLCK
254No locks available.
255.It Bq Er ENOSYS
256Function not implemented.
257.It Bq Er EFTYPE
258Inappropriate file type or format.
259.It Bq Er EAUTH
260Authentication error.
261.It Bq Er ENEEDAUTH
262Need authenticator.
263.It Bq Er EIDRM
264Identifier removed.
265.It Bq Er ENOMSG
266No message of desired type.
267.It Bq Er EOVERFLOW
268Value too large to be stored in data type.
269.It Bq Er ECANCELED
270Operation canceled.
271.It Bq Er EILSEQ
272Illegal byte sequence.
273.It Bq Er ENOATTR
274Attribute not found.
275.It Bq Er EDOOFUS
276Programming error.
277.El
278.Sh LOCKING
279The
280.Va example_lock
281lock must be held before
282.Fn example
283is called.
284.Pp
285Since
286.Va example_lock
287is a
288.Xr mutex 9 ,
289no sleepable locks (i.e.,
290.Xr sx 9
291locks) can be acquired in
292.Fn example .
293.Sh SEE ALSO
294.Xr example 1 ,
295.Xr example 3 ,
296.Xr example 4 ,
297.Xr mdoc 7
298.Rs
299.%A "A. B. Author"
300.%T "Example RFC Title"
301.%O RFC0000
302.Re
303.Rs
304.%A "A. B. Author"
305.%B "Example Book Title"
306.%O ISBN-0-000-00000-0
307.Re
308.Rs
309.%A "A. B. Author"
310.%D "January 1997"
311.%J "Example Journal Name"
312.%T "Example Article Title"
313.Re
314.Sh HISTORY
315The
316.Nm
317manual page example first appeared in
318.Fx 6.0 .
319.Pp
320Some other common
321.Sx HISTORY
322section examples are:
323.Pp
324The
325.Nm
326manual page example first appeared in
327.Bx 4.4 .
328.Pp
329The
330.Nm
331manual page example first appeared in
332.At v6 .
333.Sh AUTHORS
334This
335manual page was written by
336.An Giorgos Keramidas Aq keramida@FreeBSD.org .
337.Sh BUGS
338The actual code for this function is vaporware.
339