aboutsummaryrefslogtreecommitdiff
path: root/share
diff options
context:
space:
mode:
authorIan Lepore <ian@FreeBSD.org>2015-03-14 16:02:11 +0000
committerIan Lepore <ian@FreeBSD.org>2015-03-14 16:02:11 +0000
commitf4d281428f9eb458ffc19df9a1ed9e2af0950b8e (patch)
treeb813677c9c4b7e360751c72e9aef619ad8632058 /share
parentdf57ec493334287c783526f6d5b4e83722031dc6 (diff)
downloadsrc-f4d281428f9eb458ffc19df9a1ed9e2af0950b8e.tar.gz
src-f4d281428f9eb458ffc19df9a1ed9e2af0950b8e.zip
Add a new flag, SBUF_INCLUDENUL, and new get/set/clear functions for flags.
The SBUF_INCLUDENUL flag causes the nulterm byte at the end of the string to be counted in the length of the data. If copying the data using the sbuf_data() and sbuf_len() functions, or if writing it automatically with a drain function, the net effect is that the nulterm byte is copied along with the rest of the data.
Notes
Notes: svn path=/head/; revision=279992
Diffstat (limited to 'share')
-rw-r--r--share/man/man9/sbuf.925
1 files changed, 24 insertions, 1 deletions
diff --git a/share/man/man9/sbuf.9 b/share/man/man9/sbuf.9
index 495726c5fb16..f696307179ca 100644
--- a/share/man/man9/sbuf.9
+++ b/share/man/man9/sbuf.9
@@ -25,7 +25,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd April 11, 2013
+.Dd March 14, 2015
.Dt SBUF 9
.Os
.Sh NAME
@@ -34,6 +34,9 @@
.Nm sbuf_new_auto ,
.Nm sbuf_new_for_sysctl ,
.Nm sbuf_clear ,
+.Nm sbuf_get_flags ,
+.Nm sbuf_set_flags ,
+.Nm sbuf_clear_flags ,
.Nm sbuf_setpos ,
.Nm sbuf_bcat ,
.Nm sbuf_bcopyin ,
@@ -67,6 +70,12 @@
.Ft void
.Fn sbuf_clear "struct sbuf *s"
.Ft int
+.Fn sbuf_get_flags "struct sbuf *s"
+.Ft void
+.Fn sbuf_set_flags "struct sbuf *s" "int flags"
+.Ft void
+.Fn sbuf_clear_flags "struct sbuf *s" "int flags"
+.Ft int
.Fn sbuf_setpos "struct sbuf *s" "int pos"
.Ft int
.Fn sbuf_bcat "struct sbuf *s" "const void *buf" "size_t len"
@@ -159,6 +168,8 @@ Attempting to extend the sbuf beyond this size results in an overflow condition.
.It Dv SBUF_AUTOEXTEND
This indicates that the storage buffer may be extended as necessary, so long
as resources allow, to hold additional data.
+.It Dv SBUF_INCLUDENUL
+This causes the final nulterm byte to be counted in the length of the data.
.El
.Pp
Note that if
@@ -211,6 +222,18 @@ function invalidates the contents of the
and resets its position to zero.
.Pp
The
+.Fn sbuf_get_flags
+function returns the current user flags.
+The
+.Fn sbuf_set_flags
+and
+.Fn sbuf_get_flags
+functions set or clear one or more user flags, respectively.
+The user flags are described under the
+.Fn sbuf_new
+function.
+.Pp
+The
.Fn sbuf_setpos
function sets the
.Fa sbuf Ns 's