summaryrefslogtreecommitdiff
path: root/share/man/man9/sbuf.9
diff options
context:
space:
mode:
authorRuslan Ermilov <ru@FreeBSD.org>2006-09-18 15:24:20 +0000
committerRuslan Ermilov <ru@FreeBSD.org>2006-09-18 15:24:20 +0000
commit81ae4b8da9920ccfb697984dbb2e8751573d183a (patch)
tree7ce11c80607432aa06e11d08d3f4089cbe22b8a5 /share/man/man9/sbuf.9
parent584eddcad1d4257c2725ee9c86cf0f57773592dd (diff)
downloadsrc-test2-81ae4b8da9920ccfb697984dbb2e8751573d183a.tar.gz
src-test2-81ae4b8da9920ccfb697984dbb2e8751573d183a.zip
Notes
Diffstat (limited to 'share/man/man9/sbuf.9')
-rw-r--r--share/man/man9/sbuf.922
1 files changed, 16 insertions, 6 deletions
diff --git a/share/man/man9/sbuf.9 b/share/man/man9/sbuf.9
index ca9aa857d1dd..1a752dbc45fd 100644
--- a/share/man/man9/sbuf.9
+++ b/share/man/man9/sbuf.9
@@ -29,6 +29,7 @@
.Dt SBUF 9
.Os
.Sh NAME
+.Nm sbuf ,
.Nm sbuf_new ,
.Nm sbuf_clear ,
.Nm sbuf_setpos ,
@@ -92,7 +93,7 @@
.Fn sbuf_delete "struct sbuf *s"
.Sh DESCRIPTION
The
-.Nm sbuf
+.Nm
family of functions allows one to safely allocate, construct and
release bounded null-terminated strings in kernel space.
Instead of arrays of characters, these functions operate on structures
@@ -308,37 +309,46 @@ size of its storage buffer using
or it is reinitialized to a sufficiently short string using
.Fn sbuf_cpy .
.Sh RETURN VALUES
+The
.Fn sbuf_new
-returns
+function returns
.Dv NULL
if it failed to allocate a storage buffer, and a pointer to the new
.Fa sbuf
otherwise.
.Pp
+The
.Fn sbuf_setpos
-returns \-1 if
+function returns \-1 if
.Fa pos
was invalid, and zero otherwise.
.Pp
+The
.Fn sbuf_cat ,
.Fn sbuf_cpy ,
.Fn sbuf_printf ,
.Fn sbuf_putc ,
and
.Fn sbuf_trim
+functions
all return \-1 if the buffer overflowed, and zero otherwise.
.Pp
+The
.Fn sbuf_overflowed
+function
returns a non-zero value if the buffer overflowed, and zero otherwise.
.Pp
+The
.Fn sbuf_data
and
.Fn sbuf_len
-return
+functions return
.Dv NULL
and \-1, respectively, if the buffer overflowed.
.Pp
+The
.Fn sbuf_copyin
+function
returns \-1 if copying string from userland failed, and number of bytes
copied otherwise.
.Sh SEE ALSO
@@ -350,13 +360,13 @@ copied otherwise.
.Xr printf 9
.Sh HISTORY
The
-.Nm sbuf
+.Nm
family of functions first appeared in
.Fx 4.4 .
.Sh AUTHORS
.An -nosplit
The
-.Nm sbuf
+.Nm
family of functions was designed by
.An Poul-Henning Kamp Aq phk@FreeBSD.org
and implemented by