logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

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

Name

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

Return Values

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

See Also

gensio_err(3), gensio(5)

                                                   27 Feb 2019                                   gensio_close(3)

Synopsis

#include<gensio/gensio.h>typedefvoid(*gensio_done)(structgensio*io,void*close_data);intgensio_close(structgensio*io,gensio_doneclose_done,void*close_data);

       int gensio_close_s(struct gensio *io);

       void gensio_disable(struct gensio *io);

       void gensio_free(struct gensio *io);

       gensio_close  closes an open gensio.  Note that the close operation is not complete until close_done() is
       called.  This shuts down internal file descriptors and such, but does not free the gensio.  If the gensio
       is a connecting one, you can generally re-open it.  If you gensio_close before an open done is  reported,
       the  results  (primarily  whether the open done is called) are undefined.  If the open done is called, it
       will be called before the close done.

       gensio_close_s is like gensio_close, but blocks until the operation is complete.  BEVERYCAREFULWITHTHISFUNCTION.   Do  not call it from a callback because it waits until all operations on the gensio are
       done, and they won't be done until the callback returns.  You will deadlock if you do this.

       gensio_disable disables operation of the gensio so that  closing  will  not  result  in  any  data  being
       transmitted.   THISISFOREXTREMELYLIMITEDUSE.  This will not close file descriptors nor disable I/O,
       necessarily, but will put the gensio stack into a state where freeing will not result in any transmission
       of data to the other end.  You MUST be in a state where no callbacks are running or  can  run.   This  is
       primarily  to  allow  a close of something like an SSL connection after a fork.  If you didn't have this,
       the normal close in the one fork would shut down the  SSL  connection  for  the  other  fork,  too.   See
       gensio(5) for details on forking.

       gensio_free  frees  data  associated  with the gensio.  If it is open, the gensio is closed.  If you call
       gensio_free after gensio_close before the close_done callback is called, whether close_done is called  is
       undefined.

See Also