diff options
author | Ian Lepore <ian@FreeBSD.org> | 2015-03-14 16:02:11 +0000 |
---|---|---|
committer | Ian Lepore <ian@FreeBSD.org> | 2015-03-14 16:02:11 +0000 |
commit | f4d281428f9eb458ffc19df9a1ed9e2af0950b8e (patch) | |
tree | b813677c9c4b7e360751c72e9aef619ad8632058 /sys/sys/sbuf.h | |
parent | df57ec493334287c783526f6d5b4e83722031dc6 (diff) | |
download | src-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 'sys/sys/sbuf.h')
-rw-r--r-- | sys/sys/sbuf.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/sys/sys/sbuf.h b/sys/sys/sbuf.h index 9816a4cd6c54..40de36e38d3a 100644 --- a/sys/sys/sbuf.h +++ b/sys/sys/sbuf.h @@ -48,6 +48,7 @@ struct sbuf { ssize_t s_len; /* current length of string */ #define SBUF_FIXEDLEN 0x00000000 /* fixed length buffer (default) */ #define SBUF_AUTOEXTEND 0x00000001 /* automatically extend buffer */ +#define SBUF_INCLUDENUL 0x00000002 /* nulterm byte is counted in len */ #define SBUF_USRFLAGMSK 0x0000ffff /* mask of flags the user may specify */ #define SBUF_DYNAMIC 0x00010000 /* s_buf must be freed */ #define SBUF_FINISHED 0x00020000 /* set by sbuf_finish() */ @@ -64,6 +65,9 @@ __BEGIN_DECLS struct sbuf *sbuf_new(struct sbuf *, char *, int, int); #define sbuf_new_auto() \ sbuf_new(NULL, NULL, 0, SBUF_AUTOEXTEND) +int sbuf_get_flags(struct sbuf *); +void sbuf_clear_flags(struct sbuf *, int); +void sbuf_set_flags(struct sbuf *, int); void sbuf_clear(struct sbuf *); int sbuf_setpos(struct sbuf *, ssize_t); int sbuf_bcat(struct sbuf *, const void *, size_t); |