EXAMPLE(9)

NAME
example - example kernel interface manual page

SYNOPSIS
#include <sys/example.h>
int
example(char *ptr, int mode);

DESCRIPTION
This is an example manual page for the example() kernel function. It is intended that this example can be used as a template when writing a new manual page.

The example() function takes two arguments: ptr and mode. The argument mode may have one of the following values:

EXAMPLE_ONE
    First example of a defined variable. EXAMPLE_ONE is described below.

EXAMPLE_TWO
    Second example.

The above values are defined in <example.h> as follows:

    #define EXAMPLE_ONE  1
    #define EXAMPLE_TWO  2

IMPLEMENTATION NOTES
The example() function is not actually implemented.

LOCKING
The example_lock lock must be held before example() is called.

Since example_lock is a mutex(9), no sleepable locks (i.e., sx(9) locks) can be acquired in example().

RETURN VALUES
The example() function returns the value 0 if successful; otherwise one of the values listed in the ERRORS section is returned, to indicate the error.

EXAMPLES

    	int error;
    	mtx_lock(&example_lock);
    	if ((error = example(NULL, EXAMPLE_ONE)) != 0) {
    		mtx_unlock(&example_lock);
    		return (error);
    	}
    	mtx_unlock(&example_lock);

COMPATIBILITY
The example() function has no known compatibility issues.

ERRORS
The example() function will fail if:

[EPERM]
    Operation not permitted.

[ENOENT]
    No such file or directory.

[ESRCH]
    No such process.

[EINTR]
    Interrupted system call.

[EIO]
    Input/output error.

[ENXIO]
    Device not configured.

[E2BIG]
    Argument list too long.

[ENOEXEC]
    Exec format error.

[EBADF]
    Bad file descriptor.

[ECHILD]
    No child processes.

[EDEADLK]
    Resource deadlock avoided.

[ENOMEM]
    Cannot allocate memory.

[EACCES]
    Permission denied.

[EFAULT]
    Bad address.

[ENOTBLK]
    Block device required.

[EBUSY]
    Device busy.

[EEXIST]
    File exists.

[EXDEV]
    Cross-device link.

[ENODEV]
    Operation not supported by device.

[ENOTDIR]
    Not a directory.

[EISDIR]
    Is a directory.

[EINVAL]
    Invalid argument.

[ENFILE]
    Too many open files in system.

[EMFILE]
    Too many open files.

[ENOTTY]
    Inappropriate ioctl for device.

[ETXTBSY]
    Text file busy.

[EFBIG]
    File too large.

[ENOSPC]
    No space left on device.

[ESPIPE]
    Illegal seek.

[EROFS]
    Read-only file system.

[EMLINK]
    Too many links.

[EPIPE]
    Broken pipe.

[EDOM]
    Numerical argument out of domain.

[ERANGE]
    Result too large.

[EAGAIN]
    Resource temporarily unavailable.

[EWOULDBLOCK]
    Operation would block.

[EINPROGRESS]
    Operation now in progress.

[EALREADY]
    Operation already in progress.

[ENOTSOCK]
    Socket operation on non-socket.

[EDESTADDRREQ]
    Destination address required.

[EMSGSIZE]
    Message too long.

[EPROTOTYPE]
    Protocol wrong type for socket.

[ENOPROTOOPT]
    Protocol not available.

[EPROTONOSUPPORT]
    Protocol not supported.

[ESOCKTNOSUPPORT]
    Socket type not supported.

[EOPNOTSUPP]
    Operation not supported.

[EPFNOSUPPORT]
    Protocol family not supported.

[EAFNOSUPPORT]
    Address family not supported by protocol family.

[EADDRINUSE]
    Address already in use.

[EADDRNOTAVAIL]
    Cannot assign requested address.

[ENETDOWN]
    Network is down.

[ENETUNREACH]
    Network is unreachable.

[ENETRESET]
    Network dropped connection on reset.

[ECONNABORTED]
    Software causes connection abort.

[ENOBUFS]
    No buffer space available.

[EISCONN]
    Socket is already connected.

[ENOTCONN]
    Socket is not connected.

[ESHUTDOWN]
    Cannot send after socket shutdown.

[ETOOMANYREFS]
    Too many references: cannot splice.

[ETIMEDOUT]
    Operation timed out.

[ECONNREFUSED]
    Connection refused.

[ELOOP]
    Too many levels of symbolic links.

[ENAMETOOLONG]
    File name too long.

[EHOSTDOWN]
    Host is down.

[EHOSTUNREACH]
    No route to host.

[ENOTEMPTY]
    Directory not empty.

[EPROCLIM]
    Too many processes.

[EUSERS]
    Too many users.

[EDQUOT]
    Disc quota exceeded.

[ESTALE]
    Stale NFS file handle.

[EREMOTE]
    Too many levels of remote in path.

[EBADRPC]
    RPC struct is bad.

[ERPCMISMATCH]
    RPC version wrong.

[EPROGUNAVAIL]
    RPC program not available.

[EPROGMISMATCH]
    Program version wrong.

[EPROCUNAVAIL]
    Bad procedure for program.

[ENOLCK]
    No locks available.

[ENOSYS]
    Function not implemented.

[EFTYPE]
    Inappropriate file type or format.

[EAUTH]
    Authentication error.

[ENEEDAUTH]
    Need authenticator.

[EIDRM]
    Identifier removed.

[ENOMSG]
    No message of desired type.

[EOVERFLOW]
    Value too large to be stored in data type.

[ECANCELED]
    Operation canceled.

[EILSEQ]
    Illegal byte sequence.

[ENOATTR]
    Attribute not found.

[EDOOFUS]
    Programming error.

SEE ALSO
example(1), example(3), example(4), mdoc(7), mutex(9) A. B. Author, Example RFC Title, RFC0000. A. B. Author, Example Book Title, ISBN-0-000-00000-0. A. B. Author, January 1997, Example Journal Name, Example Article Title.

HISTORY
The example manual page example first appeared in FreeBSD 6.0.

Some other common HISTORY section examples are:

The example manual page example first appeared in 4.4BSD.

The example manual page example first appeared in AT&T UNIX.

AUTHORS
This manual page was written by Giorgos Keramidas <keramida@FreeBSD.org>.

BUGS
The actual code for this function is vaporware.