]> sourceware.org Git - newlib-cygwin.git/commit
Cygwin: FIFO: add a shared fifo_client_handler list
authorKen Brown <kbrown@cornell.edu>
Thu, 23 Apr 2020 22:43:42 +0000 (18:43 -0400)
committerKen Brown <kbrown@cornell.edu>
Fri, 8 May 2020 10:36:31 +0000 (06:36 -0400)
commitd9918451e2bea933955235e07290baf7993e8813
tree7ef8679b956f3f02b1ec7956a71ee96e67897cb8
parentc76ded2ca0bb6136205e69caa073bf19944ae509
Cygwin: FIFO: add a shared fifo_client_handler list

This is in a new shared memory section.  We will use it for temporary
storage of the owner's fc_handler list when we need to change owner.
The new owner can then duplicate the pipe handles from that list
before taking ownership.

Add several shared data members and methods that are needed for the
duplication process

Add methods update_my_handlers and update_shared_handlers that carry
out the duplication.

Allow the shared list to grow dynamically, up to a point.  Do this by
initially reserving a block of memory (currently 100 pages) and only
committing pages as needed.

Add methods create_shared_fc_handler, reopen_shared_fc_handler, and
remap_shared_fc_handler to create the new shared memory section,
reopen it, and commit new pages.  The first is called in open, the
second is called in dup/fork/exec, and the third is called in
update_shared_handlers if more shared memory is needed.

Modify the fifo_reader_thread function to call update_my_handlers when
it finds that there is no owner.  Also make it call
update_shared_handlers when the owner's thread terminates, so that the
new owner will have an accurate shared fc_handler list from which to
duplicate.

For convenience, add new methods cleanup_handlers and
close_all_handlers.  And add an optional arg to add_client_handler
that allows it to create a new fifo_client_handler without creating a
new pipe instance.
winsup/cygwin/fhandler.h
winsup/cygwin/fhandler_fifo.cc
This page took 0.030175 seconds and 5 git commands to generate.