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

NAME

6       gensio_close, gensio_close_s, gensio_disable, gensio_free - Stop/free a
7       gensio that is open
8

SYNOPSIS

10       #include <gensio/gensio.h>
11
12       typedef void (*gensio_done)(struct gensio *io, void *close_data);
13
14       int gensio_close(struct gensio *io, gensio_done close_done,
15                           void *close_data);
16
17       int gensio_close_s(struct gensio *io);
18
19       void gensio_disable(struct gensio *io);
20
21       void gensio_free(struct gensio *io);
22
23       gensio_close closes an open gensio.  Note that the close  operation  is
24       not  complete  until  close_done() is called.  This shuts down internal
25       file descriptors and such, but does not free the gensio.  If the gensio
26       is a connecting one, you can generally re-open it.  If you gensio_close
27       before an open done is reported, the  results  (primarily  whether  the
28       open  done  is  called)  are undefined.  If the open done is called, it
29       will be called before the close done.
30
31       gensio_close_s is like gensio_close, but blocks until the operation  is
32       complete.   BE  VERY CAREFUL WITH THIS FUNCTION.  Do not call it from a
33       callback because it waits until all operations on the gensio are  done,
34       and  they  won't be done until the callback returns.  You will deadlock
35       if you do this.
36
37       gensio_disable disables operation of the gensio so  that  closing  will
38       not  result  in any data being transmitted.  THIS IS FOR EXTREMELY LIM‐
39       ITED USE.  This will not close file descriptors nor disable I/O, neces‐
40       sarily,  but  will put the gensio stack into a state where freeing will
41       not result in any transmission of data to the other end.  You  MUST  be
42       in  a state where no callbacks are running or can run.  This is primar‐
43       ily to allow a close of something like an SSL connection after a  fork.
44       If  you  didn't  have this, the normal close in the one fork would shut
45       down the SSL connection for the other fork, too.  See gensio(5) for de‐
46       tails on forking.
47
48       gensio_free  frees data associated with the gensio.  If it is open, the
49       gensio is closed.  If you call gensio_free  after  gensio_close  before
50       the  close_done callback is called, whether close_done is called is un‐
51       defined.
52

RETURN VALUES

54       Zero is returned on success, or a gensio error on failure.
55

SEE ALSO

57       gensio_err(3), gensio(5)
58
59
60
61                                  27 Feb 2019                  gensio_close(3)
Impressum