(init_cygheap::console_count): Renamed from open_fhs. Make private.
* cygheap.cc (init_cygheap::manage_console_count): Define new function.
* dtable.cc (dtable::fixup_after_exec): Always call fixup_after_exec on
elements of fd even when they are about to be closed.
* fhandler.h (report_tty_counts): Remove open_fhs from debugging output.
* fhandler_console.cc (fhandler_console::open): Use manage_console_count rather
than manipulating count directly.
(fhandler_console::close): Ditto.
(fhandler_console::fixup_after_fork): Ditto.
(fhandler_console::fixup_after_exec): Ditto. Don't close handles if
close_on_exec.
* fhandler_tty.cc (fhandler_tty_slave::open): Use manage_console_count() rather
than manipulating count directly. Reflect change in arguments to
report_tty_counts().
(fhandler_tty_slave::close): Ditto for both.
(fhandler_tty_slave::dup): Ditto for both.
(fhandler_tty_slave::ioctl): Use myctty() rather than raw ctty #.
(fhandler_tty_slave::fixup_after_fork): Reflect change in arguments to
report_tty_counts().
(fhandler_tty_master::init_console): Use manage_console_count() rather than
manipulating count directly.
* fhandler_clipboard.cc (fhandler_dev_clipboard::fixup_after_exec): Don't
perform any operations if close_on_exec.
* fhandler_dsp.cc (fhandler_dev_dsp::fixup_after_exec): Ditto.
* fhandler_raw.cc (fhandler_dev_raw::fixup_after_exec): Ditto.
* fhandler_serial.cc (fhandler_serial::fixup_after_exec): Ditto.
* pinfo.h (_pinfo::_ctty): Declare new function.
(myctty): Declare new macro.
(__ctty): Declare new macro.
* pinfo.cc (_pinfo::_ctty): Define new function.
(_pinfo::set_ctty): Use manage_console_count() rather than manipulating count
directly.
* signal.cc (kill_pgrp): Use myctty() and __ctty() macros rather than raw ctty
#.
* syscalls.cc (setsid): Ditto. Use manage_console_count() rather than
manipulating count directly.
eof_detected status flag. Delete is_eom and is_eof methods.
Move drive_size, bytes_per_sector, eom_detected status flag, as well
as the methods read_file, write_file, raw_read and raw_write to ...
(class fhandler_dev_floppy): ... here. Remove is_eom and is_eof
methods. Add dup method.
* fhandler_floppy.cc (IS_EOM): New macro.
(fhandler_dev_floppy::is_eom): Remove.
(fhandler_dev_floppy::is_eof): Remove.
(fhandler_dev_floppy::fhandler_dev_floppy): Initialize status flags.
(fhandler_dev_floppy::get_drive_info): Only call EX functions on
systems supporting them and stop suffering strange delays.
(fhandler_dev_floppy::read_file): Move here, drop setting
current_position.
(fhandler_dev_floppy::write_file): Move here, drop setting
current_position.
(fhandler_dev_floppy::open): Rearrange comment.
(fhandler_dev_floppy::dup): New method.
(fhandler_dev_floppy::get_current_position): New inline method. Use
instead of former current_position were appropriate.
(fhandler_dev_floppy::raw_read): Move here. Drop EOF handling.
(fhandler_dev_floppy::raw_write): Move here. Drop EOF handling.
(fhandler_dev_floppy::lseek): Remove useless conditions. Convert
sector_aligned_offset to LARGE_INTEGER to improve SetFilePointer call.
(fhandler_dev_floppy::ioctl): Move blocksize check in RDSETBLK case
to here.
* fhandler_raw.cc (fhandler_dev_raw::is_eom): Remove.
(fhandler_dev_raw::is_eof): Remove.
(fhandler_dev_raw::write_file): Remove.
(fhandler_dev_raw::read_file): Remove.
(fhandler_dev_raw::raw_read): Remove.
(fhandler_dev_raw::raw_write): Remove.
(fhandler_dev_raw::dup): Drop copying removed members.
(fhandler_dev_raw::ioctl): Drop blocksize testing.
* wincap.h: Implement has_disk_ex_ioctls throughout.
* wincap.cc: Ditto.
(wincap_vista): Preliminary wincaps for Windows Vista/Longhorn.
(wincapc::init): Add Vista/Longhorn handling.
starting.
* child_info.h (init_child_info): Remove pid argument from declaration.
* cygheap.h (init_cygheap::pid): New element.
* dcrt0.cc (dll_crt0_0): Eliminate handling of now-noexistent cygpid parameter
in child_info struct. Set forkee to 'true' rather than cygpid since the pid
value was never used.
(dll_crt0_1): Ditto.
(_dll_crt0): Ditto.
* fork.cc (fork_child): Don't wait for sigthread. This is handled in the fork
call now.
(fork_parent): Remove obsolete pid argument from init_child_info call. Don't
do anything special with cygpid when DEBUGGING.
(fork): Delay all signals during fork.
(fork_init): Don't do anything special when DEBUGGING.
* pinfo.cc (set_myself): Remove pid parameter. Use new pid field in cygheap.
(pinfo_init): Don't pass pid argument to set_myself.
* sigproc.cc (sig_send): Wait for dwProcessId to be non-zero as well as
sendsig.
(init_child_info): Eliminate handling of pid.
(wait_sig): Implement method to temporarily hold off sending signals.
* sigproc.h (__SIGHOLD): New enum.
(__SIGNOHOLD): Ditto.
* spawn.cc (spawn_guts): Remove obsolete pid argument from init_child_info
call.
(fhandler_dev_dsp::open_count): Delete.
(fhandler_dev_dsp::close_audio_in): New method declaration.
(fhandler_dev_dsp::close_audio_in): Ditto.
* fhandler_dsp.cc: Add and edit debug_printf throughout.
(fhandler_dev_dsp::Audio::denyAccess): Delete.
(fhandler_dev_dsp::Audio::fork_fixup): Ditto.
(fhandler_dev_dsp::Audio::getOwner): Ditto.
(fhandler_dev_dsp::Audio::clearOwner): Ditto.
(fhandler_dev_dsp::Audio::owner_): Ditto.
(fhandler_dev_dsp::Audio::setformat): Ditto, rename to setconvert.
(fhandler_dev_dsp::Audio::lock): Ditto, move to queue.
(fhandler_dev_dsp::Audio::unlock): Ditto.
(fhandler_dev_dsp::Audio::lock_): Ditto.
(fhandler_dev_dsp::Audio::bufferIndex_): New member, from Audio_out
and Audio_in.
(fhandler_dev_dsp::Audio::pHdr_): Ditto.
(fhandler_dev_dsp::Audio::wavehdr_): Ditto.
(fhandler_dev_dsp::Audio::bigwavebuffer_): ditto.
(fhandler_dev_dsp::Audio::Qisr2app_): Ditto.
(fhandler_dev_dsp::Audio::setconvert): New method, from old setformat.
(fhandler_dev_dsp::Audio::queue::lock): New method.
(fhandler_dev_dsp::Audio::queue::unlock): Ditto.
(fhandler_dev_dsp::Audio::queue::dellock): Ditto.
(fhandler_dev_dsp::Audio::queue::isvalid): Ditto.
(fhandler_dev_dsp::Audio::queue::lock_): New member.
(fhandler_dev_dsp::Audio::queue::depth1_): Delete.
(fhandler_dev_dsp::Audio_out::fork_fixup): New method.
(fhandler_dev_dsp::Audio_out::isvalid): New method.
(fhandler_dev_dsp::Audio_out::start): Remove arguments.
(fhandler_dev_dsp::Audio_out::parsewav): Change arguments and set
internal state.
(fhandler_dev_dsp::Audio_out::emptyblocks): Delete.
(fhandler_dev_dsp::Audio_out::Qapp2app_): Ditto.
(fhandler_dev_dsp::Audio_out::Qisr2app_): Ditto, move to Audio.
(fhandler_dev_dsp::Audio_out::bufferIndex_): Ditto.
(fhandler_dev_dsp::Audio_out::pHdr_): Ditto.
(fhandler_dev_dsp::Audio_out::wavehdr_): Ditto.
(fhandler_dev_dsp::Audio_out::bigwavefuffer_): Ditto.
(fhandler_dev_dsp::Audio_out::freq_): New member.
(fhandler_dev_dsp::Audio_out::bits_): New member.
(fhandler_dev_dsp::Audio_out::channels_): New member.
(fhandler_dev_dsp::Audio_in::fork_fixup): New method.
(fhandler_dev_dsp::Audio_in::isvalid): New method.
(fhandler_dev_dsp::Audio_in::Qapp2app_): Delete.
(fhandler_dev_dsp::Audio_in::Qisr2app_): Ditto, move to Audio.
(fhandler_dev_dsp::Audio_in::bufferIndex_): Ditto.
(fhandler_dev_dsp::Audio_in::pHdr_): Ditto.
(fhandler_dev_dsp::Audio_in::wavehdr_): Ditto.
(fhandler_dev_dsp::Audio_in::bigwavefuffer_): Ditto.
(fhandler_dev_dsp::Audio::queue::queue): Simplify.
(fhandler_dev_dsp::Audio::queue::send): Use lock.
(fhandler_dev_dsp::Audio::queue::query): Do not use depth1_.
(fhandler_dev_dsp::Audio::queue::recv): Ditto.
(fhandler_dev_dsp::Audio::Audio): Adapt to new class members.
(fhandler_dev_dsp::Audio::~Audio): Ditto
(fhandler_dev_dsp::Audio_out::start): Reorganize.
(fhandler_dev_dsp::Audio_out::stop): Simplify.
(fhandler_dev_dsp::Audio_out::init): Reset the queue and clear flag.
(fhandler_dev_dsp::Audio_out::write): Reorganize to allocate audio_out.
(fhandler_dev_dsp::Audio_out::buf_info): Use appropriate block size.
(fhandler_dev_dsp::Audio_out::callback_sampledone): Do not use lock.
(fhandler_dev_dsp::Audio_out::waitforspace): Simplify.
(fhandler_dev_dsp::Audio_out::waitforallsent):Ditto.
(fhandler_dev_dsp::Audio_out::sendcurrent): Reorganize.
Clear flag before requeuing.
(fhandler_dev_dsp::Audio_out::parsewav):
(fhandler_dev_dsp::Audio_in::start): Reorganize.
(fhandler_dev_dsp::Audio_in::stop): Simplify.
(fhandler_dev_dsp::Audio_in::queueblock): Ditto.
Requeue header in case of error.
(fhandler_dev_dsp::Audio_in::init): Reset the queue and clear flag.
(fhandler_dev_dsp::Audio_in::waitfordata): Simplify.
Do not UnprepareHeader if the flag is zero.
(fhandler_dev_dsp::Audio_in::buf_info): Ditto.
(fhandler_dev_dsp::Audio_in::callback_blockfull): Do not use lock.
(fhandler_dev_dsp::open_count): Delete.
(fhandler_dev_dsp::open): Only check existence, do not allocate
anything. Set flags appropriately. Create archetype.
(fhandler_dev_dsp::write): Call archetype as needed. Create audio_out.
(fhandler_dev_dsp::read): Call archetype as needed. Create audio_in.
(fhandler_dev_dsp::close): Call archetype as needed.
Call close_audio_in and close_audio_out.
(fhandler_dev_dsp::close_audio_in): New function.
(fhandler_dev_dsp::close_audio_out): New function.
(fhandler_dev_dsp::dup): Use archetypes.
(fhandler_dev_dsp::ioctl): Call archetype as needed. Reorganize for
new structures.
(fhandler_dev_dsp::fixup_after_fork): Call archetype as needed.
(fhandler_dev_dsp::fixup_after_exec): Call archetype as needed.
Clear audio_in and audio_out.
bigwavebuffer_ so that it is always cleaned, also in child processes.
(fhandler_dev_dsp::Audio_in::stop): Ditto.
(fhandler_dev_dsp::close): Stop audio play immediately in case of
abnormal exit.
boolean argument so that playing can be stopped without playing
pending buffers.
(fhandler_dev_dsp::ioctl): Stop playback immediately for
SNDCTL_DSP_RESET. Do not reset audio parameters in this case.
Add support for ioctl SNDCTL_DSP_GETISPACE.
(fhandler_dev_dsp::Audio_out::emptyblocks): Now returns the number of
completely empty blocks.
(fhandler_dev_dsp::Audio_out::buf_info): p->fragments is now the number
of completely empty blocks. This conforms with the OSS specification.
(fhandler_dev_dsp::Audio_out::parsewav): Ignore wave headers that are
not aligned on four byte boundary.
(fhandler_dev_dsp::Audio_in::buf_info): New, needed for
SNDCTL_DSP_GETISPACE.
tty_min, mtinfo and fs_info thoroughout.
* fhandler.h: Redefine all set_close_on_exec methods to take a bool
argument.
(enum conn_state): Rename from connect_state.
(class fhandler_base): Rename some status flags to align with
accessor method names. Drop encoded flag entirely. Unify status
accessor methods. Const'ify all read accessor methods.
(class fhandler_socket): Ditto.
(class fhandler_dev_raw): Ditto.
* fhandler_disk_file.cc (fhandler_base::fstat_fs): Use fs.fs_is_fat()
instead of evaluating FATness of file system here.
(fhandler_disk_file::opendir): Drop call to set_encoded().
(fhandler_disk_file::readdir): Use pc.isencoded() directly.
* mtinfo.h (class mtinfo_drive): Const'ify all read accessor methods.
* path.cc (fsinfo_cnt): Add.
(fs_info::update): Accomodate class changes. Evaluate file system
name specific flags right here. Add thread safety for reading and
writing global fsinfo array.
* path.h (enum path_types): Drop values for flags kept in fs already.
(struct fs_info): Move status informatin into private struct type
status_flags. Add accessor methods. Remove path and file system
name string arrays in favor of status bits.
(class path_conv): Use new fs_info status information where
appropriate.
(path_conf::fs_has_ea): Rename from fs_fast_ea.
(path_conf::fs_has_acls): New method.
(path_conf::root_dir): Remove.
(path_conf::volname): Remove.
* syscalls (statfs): Evaluate root dir locally.
* tty.h (class tty_min): Unify status accessor methods. Const'ify
all read accessor methods.
* fhandler.h (class fhandler_dev_dsp): Add class Audio, class Audio_in
and class Audio_out members and audio_in_, audio_out_ pointers so
that future changes are restricted to file fhandler_dsp.cc.
* fhandler_dsp.cc (fhandler_dev_dsp::Audio): Add this class to treat
things common to audio recording and playback.
Add more format conversions.
(fhandler_dev_dsp::Audio::queue): New queues for buffer management
to fix incomplete cleanup of buffers passed to the wave device.
(fhandler_dev_dsp::Audio_in): New, added class to implement audio
recording.
(fhandler_dev_dsp::Audio_out): Rework to use functionality provided
by fhandler_dev_dsp::Audio. Allocate memory audio buffers late,
just before write.
(fhandler_dev_dsp::Audio_out::start): Size of wave buffer allocated
here depends on audio rate/bits/channels.
(fhandler_dev_dsp::Audio_in::start): Ditto.
(fhandler_dev_dsp::setupwav): Replaced by following function.
(fhandler_dev_dsp::Audio_out::parsewav): Does not setup wave device
any more. Discard wave header properly.
(fhandler_dev_dsp::open): Add O_RDONLY and_RDWR as legal modes.
Protect against re-open. Activate fork_fixup.
(fhandler_dev_dsp::ioctl): Protect against actions when audio is
active. SNDCTL_DSP_GETFMTS only returns formats supported by
mmsystem wave API, not all supported formats. SNDCTL_DSP_GETBLKSIZE
result now depends on current audio format.
(fhandler_dev_dsp::fixup_after_fork): Call fork_fixup for the Audio
classes to let them duplicate the CRITICAL_SECTION.
* devices.gperf: New file.
* devices.shilka: New file.
* cygwin-gperf: New file.
* cygwin-shilka: New file.
* fhandler_fifo.cc: New file.
* fhandler_nodevice.cc : New file. Reorganize headers so that path.h precedes
fhandler.h throughout. Remove device argument and unit arguments from fhandler
constructors throughout. Remove pc arguments to fhandler functions and use
internal pc element instead, throughout. Use dev element in pc throughout.
Use major/minor elements rather than units and device numbers previously in
fhandler class. Use correct methods for fhandler file names rather than
directly accessing file name variables, throughout.
* Makefile.in (DLL_OFILES): Add devices.o, fhandler_fifo.o
* dcrt0.cc (dll_crt0_1): Call device::init.
* devices.h: Renumber devices based on more Linux-like major/minor numbers.
Add more devices. Declare standard device storage.
(device): Declare struct.
* dir.cc (opendir): Use new 'build_fh_name' to construct a fhandler_* type.
* dtable.cc (dtable::get_debugger_info): Ditto.
(cygwin_attach_handle_to_fd): Ditto.
(dtable::release): Remove special FH_SOCKET case in favor of generic
"need_fixup_before" test.
(dtable::init_std_file_from_handle): Use either build_fh_dev or build_fh_name
to build standard fhandler.
(dtable::build_fh_name): Renamed from dtable::build_fhandler_from_name. Move
out of dtable class. Don't accept a path_conv argument. Just build it here
and pass it to:
(build_fh_pc): Renamed from dtable::build_fhandler. Move out of dtable class.
Use intrinsic device type in path_conv to create new fhandler.
(build_fh_dev): Renamed from dtable::build_fhandler. Move out of dtable class.
Simplify arguments to just take new 'device' type and a name. Just return
pointer to fhandler rather than trying to insert into dtable.
(dtable::dup_worker): Accommodate above build_fh name changes.
(dtable::find_fifo): New (currently broken) function.
(handle_to_fn): Use strechr for efficiency.
* dtable.h: Reflect above build_fh name changes and argument differences.
(fhandler_base *&operator []): Return self rather than copy of self.
* fhandler.cc (fhandler_base::operator =): Use pc element to set normalized
path.
(fhandler_base::set_name): Ditto.
(fhandler_base::raw_read): Use method to access name.
(fhandler_base::write): Correctly use get_output_handle rather than get_handle.
(handler_base::device_access_denied): New function.
(fhandler_base::open): Eliminate pc argument and use pc element of
fhandler_base throughout.
(fhandler_base::fstat): Detect if device is based in filesystem and use
fstat_fs to calculate stat, if so.
(fhandler_base::fhandler_base): Eliminate handling of file names and, instead,
just free appropriate component from pc.
(fhandler_base::opendir): Remove path_conv parameter.
* fhandler.h: Remove all device flags.
(fhandler_base::pc): New element.
(fhandler_base::set_name): Change argument to path_conv.
(fhandler_base::error): New function.
(fhandler_base::exists): New function.
(fhandler_base::pc_binmode): New function.
(fhandler_base::dev): New function.
(fhandler_base::open_fs): New function.
(fhandler_base::fstat_fs): New function.
(fhandler_base::fstat_by_name): New function.
(fhandler_base::fstat_by_handle): New function.
(fhandler_base::isfifo): New function.
(fhandler_base::is_slow): New function.
(fhandler_base::is_auto_device): New function.
(fhandler_base::is_fs_special): New function.
(fhandler_base::device_access_denied): New function.
(fhandler_base::operator DWORD&): New operator.
(fhandler_base::get_name): Return normalized path from pc.
(fhandler_base::get_win32_name): Return windows path from pc.
(fhandler_base::isdevice): Renamed from is_device.
(fhandler_base::get_native_name): Return device format.
(fhandler_fifo): New class.
(fhandler_nodevice): New class.
(select_stuff::device_specific): Remove array.
(select_stuff::device_specific_pipe): New class element.
(select_stuff::device_specific_socket): New class element.
(select_stuff::device_specific_serial): New class element.
(select_stuff::select_stuff): Initialize new elements.
* fhandler_disk_file.cc (fhandler_base::fstat_by_handle): Move to base class
from fhandler_disk_file.
(fhandler_base::fstat_by_name): Ditto.
(fhandler_base::fstat_by_name): Ditto.
(fhandler_disk_file::open): Move most functionality into
fhandler_base::open_fs.
(fhandler_base::open_fs): New function.
(fhandler_disk_file::close): Move most functionality into
fhandler_base::close_fs.
(fhandler_base::close_fs): New function.
* fhandler_mem.cc (fhandler_dev_mem::open): Use device name in debugging
output.
* fhandler_socket.cc (fhandler_socket::set_connect_secret): Copy standard
urandom device into appropriate place.
(fhandler_socket::accept): Reflect change in fdsock return value.
* fhandler_tty.cc: See "throughouts" above.
* net.cc: Accommodate fdsock change throughout.
(fdsock): Return success or failure, accept fd argument and device argument.
* path.cc (symlink_info::major): New element.
(symlink_info::minor): New element.
(symlink_info::parse_device): Declare new function.
(fs_info::update): Accommodate changes in path_conv class.
(path_conv::fillin): Ditto.
(path_conv::return_and_clear_normalized_path): Eliminate.
(path_conv::set_normalized_path): New function.
(path_conv::path_conv): Set info in dev element. Use path_conv methods Check
for FH_FS rather than FH_BAD to indicate when to fill in filesystem stuff.
where appropriate rather than direct access. Use set_normalized_path to set
normalized path.
(windows_device_names): Eliminate.
(get_dev): Ditto.
(get_raw_device_number): Ditto.
(get_device_number): Ditto.
(win32_device_name): Call new device name parser to do most of the heavy
lifting.
(mount_info::conv_to_win32_path): Fill in dev field as appropriate.
(symlink_worker): Handle new device files.
(symlink_info::check): Ditto.
(symlink_info::parse_device): Define new function.
* path.h (executable_states): Move here from fhandler.h.
(fs_info): Rename variables to *_storage and create methods for accessing same.
(path_conv): Add dev element, remove devn and unit and adjust inline methods to
accommodate.
(set_normalized_path): Declare new function.
* pinfo.cc (_pinfo::commune_recv): Add broken support for handling fifos.
(_pinfo::commune_send): Ditto.
* pipe.cc (fhandler_pipe::close): check for existence of handle before closing
it.
(handler_pipe::create): Rename from make_pipe. Change arguments to accept
fhandler_pipe array. Accommodate fifos.
(pipe): Rework to deal with fhandler_pipe::create changes.
(_pipe): Ditto.
* select.cc: Use individual device_specific types throughout rather than
indexing with obsolete device number.
(set_bits): Use is_socket call rather than checking device number.
* shared_info.h (CURR_MOUNT_MAGIC): Update.
(conv_to_win32_path): Reflect addition of device argument.
* syscalls.cc (mknod_worker): New function.
(open): Use build_fh_name to build fhandler.
(chown_worker): Detect if this is an 'auto' device rather than an on-filesystem
device and handle appropriately.
(chmod_device): New function.
(chmod): Detect if this is an 'auto' device rather than an on-filesystem device
and handle appropriately. Use chmod_device to set mode of in-filesystem
devices.
(stat_worker): Eliminate path_conv argument. Call build_fh_name to construct
fhandler. Use fh->error() rather than pc->error to detect errors in fhandler
construction.
(access_worker): New function pulled from access. Accommodate in-filesystem
devices.
(access): Use access_worker.
(fpathconf): Detect if this is an 'auto' device rather than an on-filesystem
device and handle appropriately.
(mknod_worker): New function.
(mknod32): New function.
(chroot): Free normalized path -- assuming it was actually cmalloced.
* tty.cc (create_tty_master): Tweak for new device class.
(tty::common_init): Ditto.
* winsup.h (stat_worker): Remove.
(symlink_worker): Declare.
* exceptions.cc (set_process_mask): Just call sig_dispatch_pending and don't
worry about pending_signals since sig_dispatch_pending should always do the
right thing now.
(sig_handle): Reorganize SIGCONT handling to more closely conform to SUSv3.
* pinfo.h: Move __SIG enum to sigproc.h.
(PICOM_FIFO): New enum element.
(_pinfo): Remove 'thread2signal' stuff throughout class.
(_pinfo::commune_send): Make varargs.
(_pinfo::sigtodo): Eliminate.
(_pinfo::thread2signal): Ditto.
* signal.cc (kill_worker): Eliminate call to setthread2signal.
* sigproc.cc (local_sigtodo): Eliminate.
(getlocal_sigtodo): Ditto.
(sigelem): New class.
(pending_signals): New class.
(sigqueue): New variable, start of sigqueue linked list.
(sigcatch_nonmain): Eliminate.
(sigcatch_main): Eliminate.
(sigcatch_nosync): Eliminate.
(sigcomplete_nonmain): Eliminate.
(pending_signals): Eliminate.
(sig_clear): Call signal thread to clear pending signals, unless already in
signal thread.
(sigpending): Call signal thread to get pending signals.
(sig_dispatch_pending): Eliminate use of pending_signals and just check
sigqueue.
(sigproc_terminate): Eliminate all of the obsolete semaphore stuff. Close
signal pipe handle.
(sig_send): Eliminate all of the obsolete semaphore stuff and use pipe to send
signals.
(getevent): Eliminate.
(pending_signals::add): New function.
(pending_signals::del): New function.
(pending_signals::next): New function.
(wait_sig): Eliminate all of the obsolete semaphore stuff. Use pipe to
communicate and maintain a linked list of signals.
* sigproc.h: Move __SIG defines here. Add __SIGPENDING.
(sig_dispatch_pending): Remove "C" specifier.
(sig_handle): Accept a mask argument.
* thread.cc: Remove signal handling considerations throughout.
cygerrno.h.
* include/cygwin/config.h (__DYNAMIC_REENT__): Define.
* include/cygwin/version.h: Bump API minor version.
* cygwin.din: Export __getreent
* cygerrno.h: Include errno.h. Fix places where _impure_ptr is used directly
to store the errno value.
* debug.cc (__set_errno): Ditto.
* errno.cc: Remove _RRENT_ONLY define to get errno.cc compiled.
* signal.cc: Rename _reent_clib to _REENT throughout.
* thread.h (reent_clib): Remove prototype.
* thread.cc (reent_clib): Rename reent_clib to __getreent. Return _impure_ptr
until MTinterface is initialized.
(reent_winsup): Fix a possible SEGV when _r == NULL. Return NULL instead.
* MTinterface::fixup_after_fork: Switch reent back to _impure_ptr to keep
signal handling running when fork is called from a thread other than the
mainthread.
whose second arguments are both the lenght and the return value.
* fhandler.cc (fhandler_base::read): Rework slightly to use second argument as
input/output. Tweak CRLF stuff.
(fhandler_base::readv): Accommodate fhandler_*::read changes.
* cygthread.h (cygthread::detach): Declare as taking optional handle argument.
(cygthread::detach): When given a handle argument, wait for the handle to be
signalled before waiting for thread to detach. Return true when signal
detected.
* fhandler.h: Move fcntl.h include here.
(fhandler_base::set_flags): Accept supplied_bin argument. Make non-inlined.
* dtable.cc (dtable::init_std_file_from_handle): Just use binmode from pc.
(reset_to_open_binmode): Use set_flags.
* cygwin.din (open): Avoid newlib wrapper.
(read): Ditto.
(unlink): Ditto.
(write): Ditto.
* fhandler.cc (fhandler_base::set_flags): Accept supplied_bin argument. Make
binmode decisions here.
(fhandler_base::open): Avoid using pc if it is NULL. Eliminate binmode logic.
Just call set_flags with binmode argument.
(fhandler_base::init): Call set_flags with binmode argument.
* fhandler_clipboard.cc (fhandler_dev_clipboard::open): Ditto.
* fhandler_console.cc (fhandler_console::open): Ditto.
(fhandler_console::init): Force binary on open.
* fhandler_disk_file.cc (fhandler_disk_file::open): Don't set binmode here.
Let it happen in base class.
* fhandler_dsp.cc (fhandler_dev_dsp::open): Force binmode open. Set return
value appropriately if unable to open.
* fhandler_proc.cc (fhandler_proc::open): Make sure flags are set before
open_status.
* fhandler_process.cc (fhandler_process::open): Ditto.
* fhandler_registry.cc (fhandler_registry::open): Ditto.
* fhandler_random.cc (fhandler_dev_random::fhandler_dev_random): Ditto.
* fhandler_raw.cc (fhandler_dev_raw::open): Force O_BINARY by default.
* fhandler_serial.cc (fhandler_serial::init): Ditto.
* fhandler_tty.cc (fhandler_tty_slave::open): Ditto.
(fhandler_pty_master::open): Ditto.
* fhandler_virtual.cc (fhandler_virtual::open): Ditto.
* fhandler_windows.cc (fhandler_windows::open): Ditto.
* fhandler_zero.cc (fhandler_dev_zero::open): Ditto.
* net.cc (fdsock): Ditto.
* path.cc (path_conv::check): Avoid checking for extension when error or
directory.
(set_flags): Set PATH_TEXT explicitly, when appropriate.
(mount_info::conv_to_win32_path): Use set_flags() to set path flags.
* path.h (PATH_TEXT): New enum.
(path_conv::binmode): Return appropriate constant based on binmode.
* pipe.cc (make_pipe): Set binmode to O_TEXT xor O_BINARY.
* syscalls.cc (setmode_helper): Make debugging message a little clearer.
(setmode): Set binmode via set_flags.
SNDCTL_DSP_GETBLKSIZE operation. Remove obsolete 'name' arg from fhandler_*
constructors throughout.
* winsup.h (winsock_active): New macro.
(winsock2_active): Ditto.
* autoload.cc (wsock_init): Use new macros to decide if winsock or winsock2 is
loaded.
(nonexist_wsock32): Dummy function to force winsock load.
(nonexist_ws2_32): Dummy function to force winsock2 load.
* fhandler.h (fhandler_socket::fstat): Declare new method. Currently unused.
* fhandler_socket.cc (fhandler_socket::fixup_before_fork_exec): Check that
winsock2 is active before trying WSADuplicateSocketA.
(fhandler_socket::fixup_after_fork): Add extra check for winsock2_active.
Otherwise use iffy procedures for Windows 95.
(fhandler_socket::fixup_after_exec): Add debugging.
(fhandler_socket::dup): Add debugging.
(fhandler_socket::fstat): New method.
(fhandler_socket::set_close_on_exec): Attempt to perform iffy stuff on Windows
95.
* errno.cc (_sys_nerr): Work around compiler strangeness.
* pinfo.cc (winpids::add): Add extra element at end of allocated array for
setting to NULL.
(winpids::enumNT): Ditto.
(winpids::init): Don't modify pidlist if it hasn't been allocated
(possibly due to malloc problem).
* fork.cc (vfork): Add debugging statements.
* path.cc (get_device_number): Make static. Rewrite to inspect both unix and
windows paths.
(get_raw_device_number): Just check for parts of raw device that we care about.
(get_devn): New function, pulled from get_device_number.
(win32_device_name): Accomodate arg changes to get_device_number.
(mount_info::get_device_number): Call get_device_number on translated Windows
path.
* spawn.cc (spawn_guts): Don't treat P_VFORK differently from P_NOWAIT. Add
handle to child's shared region to child so that it will be preserved if the
parent goes away.
* fhandler.h: Throughout, simplify to one open method for all fhandler classes,
requiring a path_conv first element.
* fhandler.cc (fhandler_base::open): Remove obsolete method. Generalize to
require path_conv * as first argument.
(fhandler_disk_file::open): Remove obsolete method.
(fhandler_disk_file::open): Use path_conv pointer rather than reference.
* fhandler_clipboard.cc (fhandler_dev_clipboard::dup): Use new open method.
(fhandler_dev_clipboard::open): Accomodate new argument for open methods.
* fhandler_console.cc (fhandler_console::open): Ditto.
(fhandler_console::dup): Use new open method.
(fhandler_console::fixup_after_fork): Ditto.
(fhandler_console::fixup_after_exec): Ditto.
* fhandler_dsp.cc (fhandler_dev_dsp::open): Accomodate new argument for open
methods.
* fhandler_floppy.cc (fhandler_dev_floppy::open): Ditto.
* fhandler_mem.cc (fhandler_dev_mem::open): Ditto.
* fhandler_random (fhandler_dev_random::open): Ditto.
* fhandler_raw.cc (fhandler_dev_raw::open): Ditto.
* fhandler_serial.cc (fhandler_serial::open): Ditto.
* fhandler_tape.cc (fhandler_dev_tape::open): Ditto.
* fhandler_tty.cc (fhandler_tty_slave::open): Ditto.
(fhandler_pty_master::open): Ditto.
* fhandler_windows.cc (fhandler_windows::open): Ditto.
* fhandler_zero.cc (fhandler_dev_zero::open): Ditto.
* fhandler_socket.cc (fhandler_socket::set_connect_secret): Accomodate new
argument for open methods.
* syscalls.cc (_open): Ditto.
(stat_worker): Ditto.
fhandler.h.
* fhandler.h (fhandler_base::get_inheritance): New method.
* fhandler_socket.cc (fhandler_socket::create_secret_event): Use proper
close-on-exec inheritance when creating.
(fhandler_socket::check_peer_secret_event): Create handle as non-inheritable.
* thread.cc (pthread_cond::TimedWait): Check for WAIT_TIMEOUT as well as
WAIT_ABANDONED.
(__pthread_cond_timedwait): Calculate a relative wait from the abstime
parameter.
* fhandler.h (fhandler_base::set_open_status): New method. Stores original
open status.
(fhandler_base::get_open_status): New method. Retrieves original open status.
(fhandler_base::reset_to_open_binmode): New method.
* fhandler.cc (fhandler_base::open): Save open status.
(fhandler_base::init): Ditto.
* fhandler_clipboard.cc (fhandler_clipboard::open): Ditto.
* fhandler_console.cc (fhandler_console::open): Ditto.
* fhandler_dsp.cc (fhandler_dsp::open): Ditto.
* fhandler_dev_mem.cc (fhandler_dev_mem::open): Ditto.
* fhandler_dev_random.cc (fhandler_dev_random::open): Ditto.
* fhandler_serial.cc (fhandler_serial::open): Ditto.
* fhandler_tty_slave.cc (fhandler_tty_slave::open): Ditto.
* fhandler_tty_master.cc (fhandler_tty_master::open): Ditto.
* fhandler_dev_zero.cc (fhandler_dev_zero::open): Ditto.
* syscalls.cc (setmode): Rework so that 0 mode value causes reversion to open
state.
* fhandler_tty_slave.cc (fhandler_tty_slave::read): Use correct multiplier when
converting from deciseconds to milliseconds.
* fhandler_dsp.cc: New file. Implements OSS like /dev/dsp.
* include/sys/soundcard.h: New file. User land includes for OSS /dev/dsp.
* fhandler.h: Add new class fhandler_dev_dsp and a FH_OSS_DSP definition.
* dtable.cc (dtable::build_fhandler): Allow creation of the /dev/dsp device.
* path.cc (windows_device_names): Add /dev/dsp into list of device names.
* Makefile.in (DLL_OFILES): Add fhandler_dsp.o.