diff options
| author | Joseph Koshy <jkoshy@FreeBSD.org> | 2005-01-15 16:01:19 +0000 |
|---|---|---|
| committer | Joseph Koshy <jkoshy@FreeBSD.org> | 2005-01-15 16:01:19 +0000 |
| commit | bff0341efe7715426532bbf7f70f9d6c62d7ef0d (patch) | |
| tree | 4710161820b3733f67e3b0903d69f8705534ea1a /share/examples/mdoc | |
| parent | 1b7525eb4b216a881c3a369ca9965299c9d90106 (diff) | |
Notes
Diffstat (limited to 'share/examples/mdoc')
| -rw-r--r-- | share/examples/mdoc/example.9 | 40 |
1 files changed, 22 insertions, 18 deletions
diff --git a/share/examples/mdoc/example.9 b/share/examples/mdoc/example.9 index f40e3301257a..7eb7088b324e 100644 --- a/share/examples/mdoc/example.9 +++ b/share/examples/mdoc/example.9 @@ -33,11 +33,11 @@ .Nm example .Nd "example kernel interface manual page" .Sh SYNOPSIS -.In example.h +.In sys/example.h .Ft int .Fn example "char *ptr" "int mode" .Sh DESCRIPTION -This is an example library function manual page for the +This is an example manual page for the .Fn example kernel function. It is intended that this example can be used as a template @@ -72,6 +72,21 @@ as follows: The .Fn example function is not actually implemented. +.Sh LOCKING +The +.Va example_lock +lock must be held before +.Fn example +is called. +.Pp +Since +.Va example_lock +is a +.Xr mutex 9 , +no sleepable locks (i.e., +.Xr sx 9 +locks) can be acquired in +.Fn example . .Sh RETURN VALUES The .Fn example @@ -83,8 +98,12 @@ section is returned, to indicate the error. .Bd -literal int val; - if ((val = example(NULL, EXAMPLE_ONE)) != 0) + mutex_lock(&example_lock); + if ((val = example(NULL, EXAMPLE_ONE)) != 0) { + mutex_unlock(&example_lock); return (val); + } + mutex_unlock(&example_lock); .Ed .Sh COMPATIBILITY The @@ -275,21 +294,6 @@ Attribute not found. .It Bq Er EDOOFUS Programming error. .El -.Sh LOCKING -The -.Va example_lock -lock must be held before -.Fn example -is called. -.Pp -Since -.Va example_lock -is a -.Xr mutex 9 , -no sleepable locks (i.e., -.Xr sx 9 -locks) can be acquired in -.Fn example . .Sh SEE ALSO .Xr example 1 , .Xr example 3 , |
