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