Skip to content

Commit 080ac30

Browse files
committed
www: update documentation for iov api
Signed-off-by: Michał Łyszczek <michal.lyszczek@bofc.pl>
1 parent 1620464 commit 080ac30

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+2193
-194
lines changed

man/rb_cleanup.3

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
2727
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
2828
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
2929
..
30-
.TH "RB_CLEANUP" "3" "Oct 18, 2025" "" "librb"
30+
.TH "RB_CLEANUP" "3" "Oct 31, 2025" "" "librb"
3131
.SH NAME
3232
.sp
3333
\fI\%rb_destroy(3)\fP, \fI\%rb_cleanup(3)\fP, \fI\%rb_stop(3)\fP \- stop, destroy and cleanup ring buffer
@@ -118,9 +118,10 @@ void *producer(void *arg) {
118118
.SH SEE ALSO
119119
.sp
120120
\fI\%rb_new(3)\fP, \fI\%rb_init(3)\fP, \fI\%rb_destroy(3)\fP, \fI\%rb_cleanup(3)\fP, \fI\%rb_write(3)\fP, \fI\%rb_send(3)\fP,
121-
\fI\%rb_read(3)\fP, \fI\%rb_recv(3)\fP, \fI\%rb_read_claim(3)\fP, \fI\%rb_read_commit(3)\fP, \fI\%rb_write_claim(3)\fP,
122-
\fI\%rb_write_commit(3)\fP, \fI\%rb_clear(3)\fP, \fI\%rb_discard(3)\fP, \fI\%rb_count(3)\fP, \fI\%rb_space(3)\fP,
123-
\fI\%rb_stop(3)\fP, \fI\%rb_peek_size(3)\fP, \fI\%rb_set_hard_max_count(3)\fP
121+
\fI\%rb_writev(3)\fP, \fI\%rb_sendv(3)\fP, \fI\%rb_read(3)\fP, \fI\%rb_recv(3)\fP, \fI\%rb_readv(3)\fP, \fI\%rb_recvv(3)\fP,
122+
\fI\%rb_read_claim(3)\fP, \fI\%rb_read_commit(3)\fP, \fI\%rb_write_claim(3)\fP, \fI\%rb_write_commit(3)\fP,
123+
\fI\%rb_clear(3)\fP, \fI\%rb_discard(3)\fP, \fI\%rb_count(3)\fP, \fI\%rb_space(3)\fP, \fI\%rb_stop(3)\fP,
124+
\fI\%rb_peek_size(3)\fP, \fI\%rb_set_hard_max_count(3)\fP
124125
.SH AUTHOR
125126
Michał Łyszczek <michal.lyszczek@bofc.pl>
126127
.SH COPYRIGHT

man/rb_clear.3

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
2727
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
2828
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
2929
..
30-
.TH "RB_CLEAR" "3" "Oct 18, 2025" "" "librb"
30+
.TH "RB_CLEAR" "3" "Oct 31, 2025" "" "librb"
3131
.SH NAME
3232
.sp
3333
\fI\%rb_clear(3)\fP, \fI\%rb_discard(3)\fP \- remove data from buffer without performing any read
@@ -60,9 +60,10 @@ threads may return \fBEAGAIN\fP errors during the clear operation.
6060
.SH SEE ALSO
6161
.sp
6262
\fI\%rb_new(3)\fP, \fI\%rb_init(3)\fP, \fI\%rb_destroy(3)\fP, \fI\%rb_cleanup(3)\fP, \fI\%rb_write(3)\fP, \fI\%rb_send(3)\fP,
63-
\fI\%rb_read(3)\fP, \fI\%rb_recv(3)\fP, \fI\%rb_read_claim(3)\fP, \fI\%rb_read_commit(3)\fP, \fI\%rb_write_claim(3)\fP,
64-
\fI\%rb_write_commit(3)\fP, \fI\%rb_clear(3)\fP, \fI\%rb_discard(3)\fP, \fI\%rb_count(3)\fP, \fI\%rb_space(3)\fP,
65-
\fI\%rb_stop(3)\fP, \fI\%rb_peek_size(3)\fP, \fI\%rb_set_hard_max_count(3)\fP
63+
\fI\%rb_writev(3)\fP, \fI\%rb_sendv(3)\fP, \fI\%rb_read(3)\fP, \fI\%rb_recv(3)\fP, \fI\%rb_readv(3)\fP, \fI\%rb_recvv(3)\fP,
64+
\fI\%rb_read_claim(3)\fP, \fI\%rb_read_commit(3)\fP, \fI\%rb_write_claim(3)\fP, \fI\%rb_write_commit(3)\fP,
65+
\fI\%rb_clear(3)\fP, \fI\%rb_discard(3)\fP, \fI\%rb_count(3)\fP, \fI\%rb_space(3)\fP, \fI\%rb_stop(3)\fP,
66+
\fI\%rb_peek_size(3)\fP, \fI\%rb_set_hard_max_count(3)\fP
6667
.SH AUTHOR
6768
Michał Łyszczek <michal.lyszczek@bofc.pl>
6869
.SH COPYRIGHT

man/rb_count.3

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
2727
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
2828
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
2929
..
30-
.TH "RB_COUNT" "3" "Oct 18, 2025" "" "librb"
30+
.TH "RB_COUNT" "3" "Oct 31, 2025" "" "librb"
3131
.SH NAME
3232
.sp
3333
\fI\%rb_count(3)\fP, \fI\%rb_space(3)\fP, \fI\%rb_peek_size(3)\fP \- get information about space available
@@ -100,9 +100,10 @@ size = rb_peek_size(rb); /* will return 5 */
100100
.SH SEE ALSO
101101
.sp
102102
\fI\%rb_new(3)\fP, \fI\%rb_init(3)\fP, \fI\%rb_destroy(3)\fP, \fI\%rb_cleanup(3)\fP, \fI\%rb_write(3)\fP, \fI\%rb_send(3)\fP,
103-
\fI\%rb_read(3)\fP, \fI\%rb_recv(3)\fP, \fI\%rb_read_claim(3)\fP, \fI\%rb_read_commit(3)\fP, \fI\%rb_write_claim(3)\fP,
104-
\fI\%rb_write_commit(3)\fP, \fI\%rb_clear(3)\fP, \fI\%rb_discard(3)\fP, \fI\%rb_count(3)\fP, \fI\%rb_space(3)\fP,
105-
\fI\%rb_stop(3)\fP, \fI\%rb_peek_size(3)\fP, \fI\%rb_set_hard_max_count(3)\fP
103+
\fI\%rb_writev(3)\fP, \fI\%rb_sendv(3)\fP, \fI\%rb_read(3)\fP, \fI\%rb_recv(3)\fP, \fI\%rb_readv(3)\fP, \fI\%rb_recvv(3)\fP,
104+
\fI\%rb_read_claim(3)\fP, \fI\%rb_read_commit(3)\fP, \fI\%rb_write_claim(3)\fP, \fI\%rb_write_commit(3)\fP,
105+
\fI\%rb_clear(3)\fP, \fI\%rb_discard(3)\fP, \fI\%rb_count(3)\fP, \fI\%rb_space(3)\fP, \fI\%rb_stop(3)\fP,
106+
\fI\%rb_peek_size(3)\fP, \fI\%rb_set_hard_max_count(3)\fP
106107
.SH AUTHOR
107108
Michał Łyszczek <michal.lyszczek@bofc.pl>
108109
.SH COPYRIGHT

man/rb_destroy.3

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
2727
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
2828
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
2929
..
30-
.TH "RB_DESTROY" "3" "Oct 18, 2025" "" "librb"
30+
.TH "RB_DESTROY" "3" "Oct 31, 2025" "" "librb"
3131
.SH NAME
3232
.sp
3333
\fI\%rb_destroy(3)\fP, \fI\%rb_cleanup(3)\fP, \fI\%rb_stop(3)\fP \- stop, destroy and cleanup ring buffer
@@ -118,9 +118,10 @@ void *producer(void *arg) {
118118
.SH SEE ALSO
119119
.sp
120120
\fI\%rb_new(3)\fP, \fI\%rb_init(3)\fP, \fI\%rb_destroy(3)\fP, \fI\%rb_cleanup(3)\fP, \fI\%rb_write(3)\fP, \fI\%rb_send(3)\fP,
121-
\fI\%rb_read(3)\fP, \fI\%rb_recv(3)\fP, \fI\%rb_read_claim(3)\fP, \fI\%rb_read_commit(3)\fP, \fI\%rb_write_claim(3)\fP,
122-
\fI\%rb_write_commit(3)\fP, \fI\%rb_clear(3)\fP, \fI\%rb_discard(3)\fP, \fI\%rb_count(3)\fP, \fI\%rb_space(3)\fP,
123-
\fI\%rb_stop(3)\fP, \fI\%rb_peek_size(3)\fP, \fI\%rb_set_hard_max_count(3)\fP
121+
\fI\%rb_writev(3)\fP, \fI\%rb_sendv(3)\fP, \fI\%rb_read(3)\fP, \fI\%rb_recv(3)\fP, \fI\%rb_readv(3)\fP, \fI\%rb_recvv(3)\fP,
122+
\fI\%rb_read_claim(3)\fP, \fI\%rb_read_commit(3)\fP, \fI\%rb_write_claim(3)\fP, \fI\%rb_write_commit(3)\fP,
123+
\fI\%rb_clear(3)\fP, \fI\%rb_discard(3)\fP, \fI\%rb_count(3)\fP, \fI\%rb_space(3)\fP, \fI\%rb_stop(3)\fP,
124+
\fI\%rb_peek_size(3)\fP, \fI\%rb_set_hard_max_count(3)\fP
124125
.SH AUTHOR
125126
Michał Łyszczek <michal.lyszczek@bofc.pl>
126127
.SH COPYRIGHT

man/rb_discard.3

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
2727
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
2828
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
2929
..
30-
.TH "RB_DISCARD" "3" "Oct 18, 2025" "" "librb"
30+
.TH "RB_DISCARD" "3" "Oct 31, 2025" "" "librb"
3131
.SH NAME
3232
.sp
3333
\fI\%rb_clear(3)\fP, \fI\%rb_discard(3)\fP \- remove data from buffer without performing any read
@@ -60,9 +60,10 @@ threads may return \fBEAGAIN\fP errors during the clear operation.
6060
.SH SEE ALSO
6161
.sp
6262
\fI\%rb_new(3)\fP, \fI\%rb_init(3)\fP, \fI\%rb_destroy(3)\fP, \fI\%rb_cleanup(3)\fP, \fI\%rb_write(3)\fP, \fI\%rb_send(3)\fP,
63-
\fI\%rb_read(3)\fP, \fI\%rb_recv(3)\fP, \fI\%rb_read_claim(3)\fP, \fI\%rb_read_commit(3)\fP, \fI\%rb_write_claim(3)\fP,
64-
\fI\%rb_write_commit(3)\fP, \fI\%rb_clear(3)\fP, \fI\%rb_discard(3)\fP, \fI\%rb_count(3)\fP, \fI\%rb_space(3)\fP,
65-
\fI\%rb_stop(3)\fP, \fI\%rb_peek_size(3)\fP, \fI\%rb_set_hard_max_count(3)\fP
63+
\fI\%rb_writev(3)\fP, \fI\%rb_sendv(3)\fP, \fI\%rb_read(3)\fP, \fI\%rb_recv(3)\fP, \fI\%rb_readv(3)\fP, \fI\%rb_recvv(3)\fP,
64+
\fI\%rb_read_claim(3)\fP, \fI\%rb_read_commit(3)\fP, \fI\%rb_write_claim(3)\fP, \fI\%rb_write_commit(3)\fP,
65+
\fI\%rb_clear(3)\fP, \fI\%rb_discard(3)\fP, \fI\%rb_count(3)\fP, \fI\%rb_space(3)\fP, \fI\%rb_stop(3)\fP,
66+
\fI\%rb_peek_size(3)\fP, \fI\%rb_set_hard_max_count(3)\fP
6667
.SH AUTHOR
6768
Michał Łyszczek <michal.lyszczek@bofc.pl>
6869
.SH COPYRIGHT

man/rb_init.3

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
2727
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
2828
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
2929
..
30-
.TH "RB_INIT" "3" "Oct 18, 2025" "" "librb"
30+
.TH "RB_INIT" "3" "Oct 31, 2025" "" "librb"
3131
.SH NAME
3232
.sp
3333
\fI\%rb_new(3)\fP, \fI\%rb_init(3)\fP \- initialize new ring buffer
@@ -208,9 +208,10 @@ rb_init(&rb, buffer, rb_array_size(buffer), sizeof(*buffer), 0);
208208
.SH SEE ALSO
209209
.sp
210210
\fI\%rb_new(3)\fP, \fI\%rb_init(3)\fP, \fI\%rb_destroy(3)\fP, \fI\%rb_cleanup(3)\fP, \fI\%rb_write(3)\fP, \fI\%rb_send(3)\fP,
211-
\fI\%rb_read(3)\fP, \fI\%rb_recv(3)\fP, \fI\%rb_read_claim(3)\fP, \fI\%rb_read_commit(3)\fP, \fI\%rb_write_claim(3)\fP,
212-
\fI\%rb_write_commit(3)\fP, \fI\%rb_clear(3)\fP, \fI\%rb_discard(3)\fP, \fI\%rb_count(3)\fP, \fI\%rb_space(3)\fP,
213-
\fI\%rb_stop(3)\fP, \fI\%rb_peek_size(3)\fP, \fI\%rb_set_hard_max_count(3)\fP
211+
\fI\%rb_writev(3)\fP, \fI\%rb_sendv(3)\fP, \fI\%rb_read(3)\fP, \fI\%rb_recv(3)\fP, \fI\%rb_readv(3)\fP, \fI\%rb_recvv(3)\fP,
212+
\fI\%rb_read_claim(3)\fP, \fI\%rb_read_commit(3)\fP, \fI\%rb_write_claim(3)\fP, \fI\%rb_write_commit(3)\fP,
213+
\fI\%rb_clear(3)\fP, \fI\%rb_discard(3)\fP, \fI\%rb_count(3)\fP, \fI\%rb_space(3)\fP, \fI\%rb_stop(3)\fP,
214+
\fI\%rb_peek_size(3)\fP, \fI\%rb_set_hard_max_count(3)\fP
214215
.SH AUTHOR
215216
Michał Łyszczek <michal.lyszczek@bofc.pl>
216217
.SH COPYRIGHT

man/rb_new.3

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
2727
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
2828
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
2929
..
30-
.TH "RB_NEW" "3" "Oct 18, 2025" "" "librb"
30+
.TH "RB_NEW" "3" "Oct 31, 2025" "" "librb"
3131
.SH NAME
3232
.sp
3333
\fI\%rb_new(3)\fP, \fI\%rb_init(3)\fP \- initialize new ring buffer
@@ -208,9 +208,10 @@ rb_init(&rb, buffer, rb_array_size(buffer), sizeof(*buffer), 0);
208208
.SH SEE ALSO
209209
.sp
210210
\fI\%rb_new(3)\fP, \fI\%rb_init(3)\fP, \fI\%rb_destroy(3)\fP, \fI\%rb_cleanup(3)\fP, \fI\%rb_write(3)\fP, \fI\%rb_send(3)\fP,
211-
\fI\%rb_read(3)\fP, \fI\%rb_recv(3)\fP, \fI\%rb_read_claim(3)\fP, \fI\%rb_read_commit(3)\fP, \fI\%rb_write_claim(3)\fP,
212-
\fI\%rb_write_commit(3)\fP, \fI\%rb_clear(3)\fP, \fI\%rb_discard(3)\fP, \fI\%rb_count(3)\fP, \fI\%rb_space(3)\fP,
213-
\fI\%rb_stop(3)\fP, \fI\%rb_peek_size(3)\fP, \fI\%rb_set_hard_max_count(3)\fP
211+
\fI\%rb_writev(3)\fP, \fI\%rb_sendv(3)\fP, \fI\%rb_read(3)\fP, \fI\%rb_recv(3)\fP, \fI\%rb_readv(3)\fP, \fI\%rb_recvv(3)\fP,
212+
\fI\%rb_read_claim(3)\fP, \fI\%rb_read_commit(3)\fP, \fI\%rb_write_claim(3)\fP, \fI\%rb_write_commit(3)\fP,
213+
\fI\%rb_clear(3)\fP, \fI\%rb_discard(3)\fP, \fI\%rb_count(3)\fP, \fI\%rb_space(3)\fP, \fI\%rb_stop(3)\fP,
214+
\fI\%rb_peek_size(3)\fP, \fI\%rb_set_hard_max_count(3)\fP
214215
.SH AUTHOR
215216
Michał Łyszczek <michal.lyszczek@bofc.pl>
216217
.SH COPYRIGHT

man/rb_overview.7

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
2828
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
2929
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
3030
..
31-
.TH "RB_OVERVIEW" "7" "Oct 18, 2025" "" "librb"
31+
.TH "RB_OVERVIEW" "7" "Oct 31, 2025" "" "librb"
3232
.SH NAME
3333
.sp
3434
\fBrb_overview\fP \- quick overview of librb ring buffer library
@@ -315,6 +315,18 @@ T{
315315
T} T{
316316
commit data then immediately claim another buffer without unlocking
317317
T}
318+
_
319+
T{
320+
\fI\%rb_readv(3)\fP, \fI\%rb_recvv(3)\fP
321+
T} T{
322+
takes vector of buffers instead of single buffer \- performs scatter read
323+
T}
324+
_
325+
T{
326+
\fI\%rb_writev(3)\fP, \fI\%rb_sendv(3)\fP
327+
T} T{
328+
takes vector of buffers instead of single buffer \- performs gather write
329+
T}
318330
.TE
319331
.SH DESCRIPTION
320332
.sp

man/rb_peek_size.3

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
2727
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
2828
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
2929
..
30-
.TH "RB_PEEK_SIZE" "3" "Oct 18, 2025" "" "librb"
30+
.TH "RB_PEEK_SIZE" "3" "Oct 31, 2025" "" "librb"
3131
.SH NAME
3232
.sp
3333
\fI\%rb_count(3)\fP, \fI\%rb_space(3)\fP, \fI\%rb_peek_size(3)\fP \- get information about space available
@@ -100,9 +100,10 @@ size = rb_peek_size(rb); /* will return 5 */
100100
.SH SEE ALSO
101101
.sp
102102
\fI\%rb_new(3)\fP, \fI\%rb_init(3)\fP, \fI\%rb_destroy(3)\fP, \fI\%rb_cleanup(3)\fP, \fI\%rb_write(3)\fP, \fI\%rb_send(3)\fP,
103-
\fI\%rb_read(3)\fP, \fI\%rb_recv(3)\fP, \fI\%rb_read_claim(3)\fP, \fI\%rb_read_commit(3)\fP, \fI\%rb_write_claim(3)\fP,
104-
\fI\%rb_write_commit(3)\fP, \fI\%rb_clear(3)\fP, \fI\%rb_discard(3)\fP, \fI\%rb_count(3)\fP, \fI\%rb_space(3)\fP,
105-
\fI\%rb_stop(3)\fP, \fI\%rb_peek_size(3)\fP, \fI\%rb_set_hard_max_count(3)\fP
103+
\fI\%rb_writev(3)\fP, \fI\%rb_sendv(3)\fP, \fI\%rb_read(3)\fP, \fI\%rb_recv(3)\fP, \fI\%rb_readv(3)\fP, \fI\%rb_recvv(3)\fP,
104+
\fI\%rb_read_claim(3)\fP, \fI\%rb_read_commit(3)\fP, \fI\%rb_write_claim(3)\fP, \fI\%rb_write_commit(3)\fP,
105+
\fI\%rb_clear(3)\fP, \fI\%rb_discard(3)\fP, \fI\%rb_count(3)\fP, \fI\%rb_space(3)\fP, \fI\%rb_stop(3)\fP,
106+
\fI\%rb_peek_size(3)\fP, \fI\%rb_set_hard_max_count(3)\fP
106107
.SH AUTHOR
107108
Michał Łyszczek <michal.lyszczek@bofc.pl>
108109
.SH COPYRIGHT

man/rb_read.3

Lines changed: 53 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
2828
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
2929
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
3030
..
31-
.TH "RB_READ" "3" "Oct 18, 2025" "" "librb"
31+
.TH "RB_READ" "3" "Oct 31, 2025" "" "librb"
3232
.SH NAME
3333
.sp
3434
\fI\%rb_read(3)\fP, \fI\%rb_recv(3)\fP, \fI\%rb_read_claim(3)\fP, \fI\%rb_read_commit(3)\fP, \fI\%rb_recv_claim(3)\fP,
35-
\fI\%rb_recv_commit(3)\fP, \fI\%rb_read_commit_claim(3)\fP, \fI\%rb_recv_commit_claim(3)\fP \- read data
36-
from a ring buffer.
35+
\fI\%rb_recv_commit(3)\fP, \fI\%rb_read_commit_claim(3)\fP, \fI\%rb_recv_commit_claim(3)\fP,
36+
\fI\%rb_readv(3)\fP, \fI\%rb_recvv(3)\fP \- read data from a ring buffer.
3737
.SH SYNOPSIS
3838
.INDENT 0.0
3939
.INDENT 3.5
@@ -42,13 +42,16 @@ from a ring buffer.
4242
#include <rb.h>
4343
4444
long rb_read(struct rb *rb, void *buffer, size_t count);
45+
long rb_readv(struct rb *rb, const struct rb_iovec *vec, int iovcnt);
4546
int rb_read_claim(struct rb *rb, void **buffer, size_t *count,
4647
size_t *object_size);
4748
int rb_read_commit(struct rb *rb, size_t count);
4849
int rb_read_commit_claim(struct rb *rb, void **buffer, size_t *count,
4950
size_t *object_size)
5051
5152
long rb_recv(struct rb *rb, void *buffer, size_t count, enum rb_flags flags);
53+
long rb_recvv(struct rb *rb, const struct rb_iovec *vec, int iovcnt,
54+
enum rb_flags flags);
5255
int rb_recv_claim(struct rb *rb, void **buffer, size_t *count,
5356
size_t *object_size, enum rb_flags flags);
5457
int rb_recv_commit(struct rb *rb, size_t count, enum rb_flags flags);
@@ -105,6 +108,23 @@ error.
105108
T}
106109
.TE
107110
.sp
111+
\fI\%rb_readv(3)\fP instead of accepting single buffer, takes vector of buffers instead.
112+
This is scatter \(dqinput\(dq. When \fIrb\fP is not dynamic, this is equivalent of just
113+
calling \fI\%rb_read(3)\fP in a loop, one time for each buffer in \fIvec\fP vector. For
114+
dynamic buffers, created with \fBrb_dynamic\fP flag, this will behave same as
115+
if you passed single buffer with the size of all \fBvec[].len\fP, but data
116+
instead of landing in a single buffer, will be scattered across buffers in
117+
\fIvec\fP\&. This means that only single dynamic object will be taken from the
118+
buffer. Last buffer can be larger than data in the \fIrb\fP buffer, in which
119+
case all buffers will be filled in, and last buffer will have less bytes.
120+
Function returns total number of bytes read, so you should do your own math
121+
if that information matters to you. When function returns success, it is
122+
guaranteed that single call will take single object from \fIrb\fP buffer and
123+
scatter the data without interrupts \- in other words, reads are atomic.
124+
.sp
125+
\fI\%rb_recvv(3)\fP behaves the same but takes same flags as \fI\%rb_recv(3)\fP to alter per
126+
call behavior.
127+
.sp
108128
\fI\%rb_read_claim(3)\fP doesn\(aqt read anything from the \fIrb\fP buffer, but instead gives
109129
you all the information needed for you to perform the read. On successful
110130
return, \fIbuffer\fP will be pointing at first readable byte, and you can read
@@ -134,10 +154,10 @@ to the buffer, same calling \fI\%rb_read_commit(3)\fP\&. As output it defines si
134154
returned \fIbuffer\fP as with \fI\%rb_read_claim(3)\fP\&.
135155
.SH RETURN VALUE
136156
.sp
137-
\fI\%rb_read(3)\fP and \fI\%rb_recv(3)\fP will return number of elements actually read from
138-
ring buffer. \fI\%rb_read_commit(3)\fP, \fI\%rb_read_claim(3)\fP, \fI\%rb_recv_commit(3)\fP,
139-
\fI\%rb_recv_claim(3)\fP, \fI\%rb_read_commit_claim(3)\fP and \fI\%rb_recv_commit_claim(3)\fP return 0
140-
on success.
157+
\fI\%rb_read(3)\fP, \fI\%rb_recv(3)\fP, \fI\%rb_readv(3)\fP and \fI\%rb_recvv(3)\fP will return number of
158+
elements actually read from ring buffer. \fI\%rb_read_commit(3)\fP, \fI\%rb_read_claim(3)\fP,
159+
\fI\%rb_recv_commit(3)\fP, \fI\%rb_recv_claim(3)\fP, \fI\%rb_read_commit_claim(3)\fP and
160+
\fI\%rb_recv_commit_claim(3)\fP return 0 on success.
141161
.sp
142162
All functions will return \-1 on errors with \fIerrno\fP variable set that will
143163
describe an error. If error is returned no data is removed from the buffer.
@@ -219,12 +239,35 @@ rb_read_commit(rb, nwritten / object_size);
219239
.EE
220240
.UNINDENT
221241
.UNINDENT
242+
.sp
243+
Perform scatter read on dynamic ring buffer
244+
.INDENT 0.0
245+
.INDENT 3.5
246+
.sp
247+
.EX
248+
char str[] = \(dqtest\e0data\e0to\e0read\en\e0\(dq;
249+
char a[5], b[5], c[3], d[16];
250+
struct rb_iovec iov[] = {
251+
{ .base = a, .len = sizeof(a) },
252+
{ .base = b, .len = sizeof(b) },
253+
{ .base = c, .len = sizeof(c) },
254+
{ .base = d, .len = sizeof(d) },
255+
};
256+
257+
rb_write(rb, str, sizeof(str));
258+
rb_readv(rb, iov, rb_array_size(iov));
259+
printf(\(dq%s %s %s %s\(dq, a, b, c, d);
260+
/* will print \(dqtest data to read\(dq */
261+
.EE
262+
.UNINDENT
263+
.UNINDENT
222264
.SH SEE ALSO
223265
.sp
224266
\fI\%rb_new(3)\fP, \fI\%rb_init(3)\fP, \fI\%rb_destroy(3)\fP, \fI\%rb_cleanup(3)\fP, \fI\%rb_write(3)\fP, \fI\%rb_send(3)\fP,
225-
\fI\%rb_read(3)\fP, \fI\%rb_recv(3)\fP, \fI\%rb_read_claim(3)\fP, \fI\%rb_read_commit(3)\fP, \fI\%rb_write_claim(3)\fP,
226-
\fI\%rb_write_commit(3)\fP, \fI\%rb_clear(3)\fP, \fI\%rb_discard(3)\fP, \fI\%rb_count(3)\fP, \fI\%rb_space(3)\fP,
227-
\fI\%rb_stop(3)\fP, \fI\%rb_peek_size(3)\fP, \fI\%rb_set_hard_max_count(3)\fP
267+
\fI\%rb_writev(3)\fP, \fI\%rb_sendv(3)\fP, \fI\%rb_read(3)\fP, \fI\%rb_recv(3)\fP, \fI\%rb_readv(3)\fP, \fI\%rb_recvv(3)\fP,
268+
\fI\%rb_read_claim(3)\fP, \fI\%rb_read_commit(3)\fP, \fI\%rb_write_claim(3)\fP, \fI\%rb_write_commit(3)\fP,
269+
\fI\%rb_clear(3)\fP, \fI\%rb_discard(3)\fP, \fI\%rb_count(3)\fP, \fI\%rb_space(3)\fP, \fI\%rb_stop(3)\fP,
270+
\fI\%rb_peek_size(3)\fP, \fI\%rb_set_hard_max_count(3)\fP
228271
.SH AUTHOR
229272
Michał Łyszczek <michal.lyszczek@bofc.pl>
230273
.SH COPYRIGHT

0 commit comments

Comments
 (0)