1gensio_write(3)            Library Functions Manual            gensio_write(3)
2
3
4

NAME

6       gensio_write - Write data to a gensio
7

SYNOPSIS

9       #include <gensio/gensio.h>
10
11       int gensio_write(struct gensio *io, gensiods *count,
12                           const void *buf, gensiods buflen,
13                           const char *const *auxdata);
14
15       struct gensio_sg {
16           const void *buf;
17           gensiods buflen;
18       };
19
20       int gensio_write_sg(struct gensio *io, gensiods *count,
21                           const struct gensio_sg *sg, gensiods sglen,
22                           const char *const *auxdata);
23

DESCRIPTION

25       Write  data  to the given gensio.  The data is in buf and the length of
26       the data is in buflen.  Note that gensio_write may not write all of the
27       data given, depending on the gensio type and the internal buffer space.
28       It will return the number of bytes actually written in count which  may
29       be NULL if you don't care.  (Hint: you should almost always care.)
30
31       If  gensio_write is unable to write the full amount of data, you should
32       generally buffer the unwritten  data  and  call  gensio_set_write_call‐
33       back_enable(3)  to  know when you can write the rest of the data.  Many
34       applications always buffer the data and enable the write callback to do
35       the write and then disable the write callback when all data is written,
36       for consistency.
37
38       gensio_write will never block, if it cannot write all the data it  will
39       write what it can and return.
40
41       auxdata  is used to pass in gensio specific auxiliary data, such as the
42       stream number for SCTP or whether the data is out of band data for SCTP
43       or TCP.
44
45       gensio_write_sg  is  like  gensio_write,  but it takes a scatter-gather
46       structure to allow you to combine multiple chunks of data without copy‐
47       ing.   Note  that if you get a partial write, you must figure out where
48       the write ended in your scatter-gather list and start  the  next  write
49       from there.
50

RETURN VALUES

52       Zero is returned on success, or a gensio error on failure.
53

SEE ALSO

55       gensio_err(3), gensio(5)
56
57
58
59                                  24 Feb 2019                  gensio_write(3)
Impressum