Commit Graph

2645 Commits

Author SHA1 Message Date
Christopher Faylor 60210cc795 * path.cc (path_conv::check): Optimize symlink replacements.
* path.cc (normalize_posix_path): Add "tail" argument and set it.  Always have
a final slash for directories.  Pass 3rd argument to normalize_win32_path.
(path_conv::check): Pass tail to normalize_posix_path.  Set need_directory and
remove final slash after that call.  Remove last argument to
mount_table->conv_to_win32_path().  Remove noop dostail check.  Remove
fs.update() from inner loop.  Improve tail finding search.
(normalize_win32_path): Add and set tail argument.
(mount_item::build_win32): Avoid calling strcpy.
(mount_info::conv_to_win32_path): Remove third argument and simplify because
the source is normalized.  Keep /proc path in Posix form.  Call
win32_device_name() only once.
(mount_info::conv_to_posix_path): Add and use 3rd argument to
normalize_win32_path to avoid calling strlen.
(cwdstuff::set): Add 3rd argument to normalize_posix_path and remove final
slash if any.
* shared_info.h (mount_info::conv_to_win32_path): Remove last argument in
declaration.
2004-04-10 00:50:16 +00:00
Corinna Vinschen ff0843433a * fhandler.h (class fhandler_dev_raw): Move status bits into protected
bitfield struct type status_flags.  Drop unused has_written bit.
	Add accessor methods.
	(fhandler_dev_raw::clear): Remove.
	(fhandler_dev_raw::reset_devbuf): Remove.
	* fhandler_floppy.cc (fhandler_dev_floppy::lseek): Use accessor method
	for is_writing.
	* fhandler_raw.cc: Use status accessor methods throughout.
	(fhandler_dev_raw::clear): Remove.
	(fhandler_dev_raw::fhandler_dev_raw): Drop clear call.
	(fhandler_dev_raw::~fhandler_dev_raw): Ditto.
	* fhandler_tape.cc: Use mtinfo::status accessor methods throughout.
	(mtinfo_drive::close): Fix conditional to enable BSD semantics
	correctly.
	(mtinfo_drive::get_status): Rename from mtinfo_drive::status.
	* mtinfo.h (class mtinfo_drive): Move status bits into private bitfield
	struct type status_flags.  Add accessor methods.
	Rename status method to get_status.
2004-04-09 20:39:19 +00:00
Corinna Vinschen 535309a6e3 * path.cc (fsinfo): Global storage for file system information.
(fs_info::update): Store file system information also in fsinfo and
	short circuit GetVolumeInformation by using alredy stored file system
	information.
2004-04-09 19:33:07 +00:00
Corinna Vinschen 7aa88267c1 * fhandler.h (fhandler_base::status): Declare private.
(fhandler_base::open_status): Ditto.
	(class fhandler_socket): Move status bits into private bitfield struct
	type status_flags.  Change accessor methods appropriately.
	* fhandler_socket.cc (fhandler_socket::fhandler_socket): Accomodate
	above status bit changes.
	* tty.h: Remove status bit enumerator.
	(TTYISSETF): Remove.
	(TTYSETF): Remove.
	(TTYCLEARF): Remove.
	(TTYCONDSETF): Remove.
	(tty_min::status): Define as private bitfield struct type status_flags.
	Add appropriate accessor methods.
	* fhandler_console.cc: Use tty_min::status accessor methods throughout.
	* fhandler_termios.cc: Ditto.
	* winsup.h (__ISSETF): Remove.
	(__SETF): Remove.
	(__CLEARF): Remove.
	(__CONDSETF): Remove.
2004-04-09 12:09:45 +00:00
Corinna Vinschen b79f85c28b * fhandler.cc (fhandler_base::write): Use bool parameter in calls to
set_did_lseek.
	(fhandler_base::fhandler_base): Accomodate new status and open_status
	constructor.
	* fhandler.h: Remove status bit enumerator.
	(FHDEVN): Remove.
	(FHISSETF): Remove.
	(FHSETF): Remove.
	(FHCLEARF): Remove.
	(FHCONDSETF): Remove.
	(FHSTATOFF): Remove.
	(UNCONNECTED, CONNECT_PENDING, CONNECTED): Substitute by enum
	connect_state.
	(fhandler_base::status): Define as bitfield struct type status_flags.
	Remove unused flags entirely.  Accomodate all status access methods.
	(open_status): Define as bitfield struct type status_flags.
	(fhandler_socket): Move socket related status bits to here.  Redefine
	had_connect_or_listen to be part of these status bits.  Accomodate
	related access methods.
	* fhandler_disk_file.cc (fhandler_base::fstat_helper): Use pc.issymlink
	instead of dropped method get_symlink_p.
	(fhandler_base::open_fs): Remove setting dropped status flags.
	* fhandler_socket.cc: Use values from enum connect_state throughout.
	(fhandler_socket::fhandler_socket): Initialize status bits.
	* fhandler_virtual.cc (fhandler_virtual::open): Remove setting dropped
	status flags.
	* net.cc: Use values from enum connect_state throughout.
	* select.cc: Ditto.
	* shared_info.h: Protect struct console_state using _FHANDLER_H_
	instead of FHDEVN.
2004-04-09 08:43:29 +00:00
Corinna Vinschen 00dd058f7e * security.cc (get_file_attribute): Fix conditional. 2004-04-09 07:55:56 +00:00
Christopher Faylor 6ea87bc144 * child_info.h: Update CHILD_INFO_MAGIC after 2004-04-03 change. 2004-04-08 15:44:53 +00:00
Christopher Faylor 1b957b1c9f fix email address 2004-04-08 13:34:37 +00:00
Corinna Vinschen 6eee18ea6e * path.cc (hash_path_name): Replace hash algorithm with SDBM. 2004-04-08 12:21:15 +00:00
Corinna Vinschen a9a5b2eab0 * fhandler.cc (fhandler_base::open): Set query access mode according
to query_open setting.
	(fhandler_base::fhandler_base): Initialize query_open.
	* fhandler.h (FH_QUERYOPEN): Drop.
	(enum query_state): Add.
	(class fhandler_base): Add query_open member.
	(fhandler_base::get_query_open): Redefine to use query_open.
	(fhandler_base::set_query_open): Ditto.
	* fhandler_disk_file.cc (fhandler_base::fstat_fs): Remove O_DIROPEN
	from open_flags since it's added in open_fs anyway.  Remove
	query_open_already.  Use new query_open settings.  Rearrange slightly.
	(fhandler_base::fstat_helper): Add get_io_handle as parameter to
	get_file_attribute.
	* security.cc (get_nt_object_attribute): Make returning an int.
	Return -1 on error, 0 otherwise.
	(get_file_attribute): Take an object handle as argument. Move down
	to allow calling get_nt_object_attribute in case a non-NULL handle
	is given.
	* security.h (get_file_attribute): Add handle to argument list.
	* syscalls.cc (chown_worker): Accomodate new definition of
	get_file_attribute.
2004-04-08 07:57:28 +00:00
Christopher Faylor 284a55c33e * path.cc (path_prefix_p): Optimize test order. 2004-04-08 01:33:00 +00:00
Corinna Vinschen 49294f009e * Makefile.in (EXTRALIBS): Add libtextreadmode.a.
(INSTOBJS): Add textreadmode.o.
	* textreadmode.c: New file.
2004-04-06 14:22:43 +00:00
Corinna Vinschen b8eac1dee4 * fhandler_disk_file.cc (fhandler_base::fstat_helper): Request
compressed size only if the matching attributes are set.  Use
	NtQueryInformationFile instead of GetCompressedFileSize.
	(fhandler_base::fstat_by_handle): Remove NT 3.5 cruft since
	local.dwVolumeSerialNumber isn't used subsequently.
	* ntdll.h: Add typedefs for FILE_COMPRESSION_INFORMATION and
	FILE_INFORMATION_CLASS.
2004-04-06 10:19:31 +00:00
Corinna Vinschen cffd8968e3 * fhandler_raw.cc (fhandler_dev_raw::open): Actually use "options". 2004-04-06 07:57:59 +00:00
Corinna Vinschen 7e57d6d268 * fhandler_dsp.cc (fhandler_dev_dsp::ioctl): Add implementation
for ioctl codes SNDCTL_DSP_CHANNELS and SNDCTL_DSP_GETCAPS.
2004-04-05 08:30:41 +00:00
Christopher Faylor 129c8a0e81 * child_info.h (child_info::cygheap_reserve_sz): Rename from cygheap_alloc_sz.
* cygheap.cc: Rename alloc_sz to reserve_sz throughout.
2004-04-04 04:14:11 +00:00
Corinna Vinschen 321ddf2422 * fhandler.h (class fhandler_socket): Remove has_been_closed member.
* fhandler_socket.cc (fhandler_socket::recvfrom): Revert to
	overlapped I/O.
	(fhandler_socket::recvmsg): Ditto.
	(fhandler_socket::sendto): Ditto.
	(fhandler_socket::sendmsg): Ditto.
	* net.cc (wsock_event::prepare): Ditto.
	(wsock_event::wait): Ditto.  Evaluate overlapped result also after
	calling CancelIo (thanks to Patrick Samson <p_samson@yahoo.com>).
	(wsock_event::release): Remove.
	* wsock_event.h: Revert to overlapped I/O.
2004-04-03 19:07:59 +00:00
Corinna Vinschen f5da8224f6 * net.cc (wsock_event::release): Use NULL handle in call to
WSAEventSelect to resolve KB 168349.
2004-04-02 10:29:53 +00:00
Corinna Vinschen b6edea61f2 * fhandler_socket.cc (fhandler_socket::recvfrom): Rearrange loop
so that WSARecvFrom is always called before waiting.
	(fhandler_socket::recvmsg): Ditto.
2004-04-01 17:00:21 +00:00
Corinna Vinschen 4cfacffa79 * net.cc (wsock_event::wait): Make wsa_err an int. Don't set
ret to 0 if any error has happened.
2004-04-01 10:36:40 +00:00
Corinna Vinschen 54aefcc6bc * fhandler_socket.cc (fhandler_socket::sendto): Drop out of loop if
has_been_closed gets set.
	(fhandler_socket::sendmsg): Ditto.
	* net.cc (wsock_event::wait): Don't initialize evts.  Don't try to
	evaluate network events if WSAEnumNetworkEvents fails.
	(wsock_event::release): Save last WSA error and set it again unless
	resetting to blocking socket fails.
	* wsock_event.h (class wsock_event): Remove destructor.
2004-04-01 09:48:15 +00:00
Corinna Vinschen fbba4780af * fhandler_tape.cc (mtinfo::initialize): Fix fatal error message. 2004-03-31 19:34:27 +00:00
Corinna Vinschen 455bbeae38 * fhandler_socket.cc (fhandler_socket::recvfrom): Always initialize
ret to 0 when using in Winsock call.
	(fhandler_socket::recvmsg): Ditto.
	(fhandler_socket::sendto): Ditto.
	(fhandler_socket::sendmsg): Ditto.
2004-03-31 15:33:33 +00:00
Corinna Vinschen decd3e5d72 * fhandler_tape.cc (mtinfo_drive::get_pos): Only set partition if
GetTapePosition returned a non-zero partition number.
	(mtinfo_drive::create_partitions): Reinitialize to partition 0.
	Support TAPE_DRIVE_INITIATOR and TAPE_DRIVE_FIXED partitioning.
	(mtinfo_drive::set_partition): Initialize new partition.
	(mtinfo_drive::status): Readd accidentally dropped setting of mt_resid.

	* net.cc (wsock_event::prepare): Always print debug output in case
	of error.
2004-03-31 12:04:07 +00:00
Corinna Vinschen 93ba120429 * fhandler_socket.cc (fhandler_socket::sendmsg): Add SIGPIPE handling. 2004-03-31 10:10:59 +00:00
Corinna Vinschen 4450172a6c * fhandler_socket.cc (fhandler_socket::recvfrom): Initialize res to
SOCKET_ERROR.  Use SOCKET_ERROR instead of -1 throughout.
	(fhandler_socket::recvmsg): Ditto.
	(fhandler_socket::sendto): Ditto.
	(fhandler_socket::sendmsg): Ditto.
	* net.cc (wsock_event::prepare): Call WSASetLastError instead of
	SetLastError.
	(wsock_event::wait): Use SOCKET_ERROR instead of -1.
2004-03-31 09:13:54 +00:00
Christopher Faylor c83bdbf65e * thread.h (pthread::init_mainthread): Add parameter forked. Set forked
default to false..
* thread.cc (MTinterface::fixup_after_fork): Call pthread::init_mainthread with
forked = true.
(pthread::init_mainthread): Add parameter forked.  Do not change thread self
pointer when forked.
2004-03-30 21:27:50 +00:00
Corinna Vinschen 5c7b73ed97 * shm.cc (shmat): If shmid is unknown, call a special variation
of shmget to retrieve the shared memory segment from Cygserver
	instead of failing immediately.
	* include/cygwin/ipc.h (IPC_KEY_IS_SHMID): New internal flag for
	shmget when called from shmat.
2004-03-30 15:20:08 +00:00
Corinna Vinschen 81f5200ba3 * fhandler.h (class fhandler_socket): Add has_been_closed member.
* fhandler_socket.cc (fhandler_socket::fhandler_socket): Initialize
	has_been_closed to 0.
	(fhandler_socket::recvfrom): Use new asynchronous I/O driven
	wsock_event methods.
	(fhandler_socket::recvmsg): Ditto.
	(fhandler_socket::sendto): Ditto.
	(fhandler_socket::sendmsg): Ditto.
	* net.cc (wsock_event::prepare): Reimplement using asynchronous I/O.
	(wsock_event::wait): Ditto.
	(wsock_event::release): New method.
	* wsock_event.h (class wsock_event): Remove ovr member.  Accomodate
	new implementation of prepare and wait methods.  Add release method.
2004-03-29 19:41:17 +00:00
Christopher Faylor c7f060d0da * thread.cc (pthread::atforkprepare): Call MT_INTERFACE->fixup_before_fork at
the end of atforkprepare.
2004-03-29 15:14:07 +00:00
Corinna Vinschen 2b2cc75f6b * net.cc (wsock_event::wait): Change scope of local "len" variable. 2004-03-29 14:08:44 +00:00
Corinna Vinschen 83216c72ec * shm.cc (shmat): Return (void *) -1 on error instead of NULL. 2004-03-28 21:01:33 +00:00
Christopher Faylor f19da5f77d * fhandler_nodevice.cc (fhandler_nodevice::open): Assume that errno has already
been set if pc.error is nonzero.
2004-03-27 18:01:04 +00:00
Christopher Faylor 58ea4db2fa * cygheap.cc (cygheap_fixup_in_child): Improve strace output. 2004-03-26 22:48:47 +00:00
Corinna Vinschen dee563095d * errno.cc (errmap): Map ERROR_SHARING_VIOLATION to EBUSY,
ERROR_EOM_OVERFLOW and ERROR_NO_DATA_DETECTED to EIO.  Add mappings
	for ERROR_NO_MEDIA_IN_DRIVE, ERROR_DEVICE_REQUIRES_CLEANING and
	ERROR_DEVICE_DOOR_OPEN.
	* fhandler.h (class fhandler_dev_raw): Drop varblkop member.
	(fhandler_dev_raw::is_eom): De-virtualize.
	(fhandler_dev_raw::is_eof): Ditto.
	(class fhandler_dev_tape): Drop lasterr and dp member.  Add mt_mtx
	member.  Drop all private methods formerly used by ioctl.
	(fhandler_dev_tape::is_rewind_device): Use get_minor for clarity.
	(fhandler_dev_tape::driveno): New method.
	(fhandler_dev_tape::drive_init): New method.
	(fhandler_dev_tape::clear): Remove method.
	(fhandler_dev_tape::is_eom): Ditto.
	(fhandler_dev_tape::is_eof): Ditto.
	(fhandler_dev_tape::write_file): Ditto.
	(fhandler_dev_tape::read_file): Ditto.
	(fhandler_dev_tape::_lock): New method.
	(fhandler_dev_tape::unlock): New method.
	(fhandler_dev_tape::raw_read): New method.
	(fhandler_dev_tape::raw_write): New method.
	* fhandler_raw.cc (fhandler_dev_raw::is_eom): New method.
	(fhandler_dev_raw::is_eof): New method.
	(fhandler_dev_raw::open): Allow setting write through option by
	using the O_TEXT flag as ... flag.
	(fhandler_dev_raw::writebuf): Remove usage of varblkop and other
	tape specific code.
	(fhandler_dev_raw::raw_read): Ditto.
	(fhandler_dev_raw::dup): Ditto.
	* fhandler_tape.cc: Rewrite tape operations entirely.  Implement
	new tape driver classes mtinfo, mtinfo_drive and mtinfo_part.
	Reduce fhandler_dev_tape methods to mostly just calling appropriate
	mtinfo_drive methods.
	(mtinfo_init): New function adding the mtinfo shared memory area.
	* mtinfo.h: New file, containing the definition of the new tape
	driver classes.
	* shared.cc: Include mtinfo.h.
	(offsets): Add entry for mtinfo shared memory area.
	(memory_init): Call mtinfo_init.
	* shared_info.h (shared_locations): Add SH_MTINFO shared location.
	* include/cygwin/mtio.h: Change and add various comments.  Add GMT_xxx
	macros for new generic flags.  Add MT_ST_xxx bitfield definitions
	for MTSETDRVBUFFER ioctl.
	* include/cygwin/version.h: Bump API minor version number.
2004-03-26 21:43:49 +00:00
Christopher Faylor 359b6e4c49 add missing files 2004-03-26 21:17:07 +00:00
Christopher Faylor 11a9a1cfbd * path.cc (path_conv::check): Use 'strchr' rather than 'strrchr' to find end of
string, for efficiency.
* include/cygwin/_types.h: New file.
* include/sys/lock.h: Ditto.
* include/sys/stdio.h: Ditto.
* thread.cc: Include sys/lock.h
(__cygwin_lock_init): New function.
(__cygwin_lock_init_recursive): Ditto.
(__cygwin_lock_fini): Ditto.
(__cygwin_lock_lock): Ditto.
(__cygwin_lock_trylock): Ditto.
(__cygwin_lock_unlock): Ditto.
(pthread::atforkprepare): Lock file pointer before fork.
(pthread::atforkparent): Unlock file pointer after fork.
(pthread::atforkchild): Ditto.
2004-03-26 20:02:01 +00:00
Corinna Vinschen 6b0d86c56d * sem.cc (semget): Fix debug string.
(semop): Ditto.
	* shm.cc (fixup_shms_after_fork): Ditto.
	(shmat): Ditto.
	(shmdt): Ditto.
	(shmget): Ditto.
2004-03-26 16:24:24 +00:00
Christopher Faylor 85427a949a * sigproc.cc (wait_sig): Make sure that SIGCHLD is handled regardless of
whether a signal is queued.
2004-03-26 16:15:23 +00:00
Christopher Faylor 27ec638b25 * sigproc.cc (wait_sig): Report if not trying to send signal due to queued
signal.
2004-03-26 05:43:11 +00:00
Christopher Faylor 474048c26e * path.cc (normalize_posix_path): Reorganize to short circuit to DOS path
handling whenever a '\' is detected.
* signal.cc (sigaction): Make strace output more informative.
* sigproc.cc (pending_signals::add): Just index directly into signal array
rather than treating the array as a heap.
(pending_signals::del): Ditto.
(wait_sig): Don't send signal if we already have a similar signal queued.
* sigproc.h (call_signal_handler_now): Remove obsolete declaration.
2004-03-25 15:15:27 +00:00
Christopher Faylor 9b8c338884 update copyright. Minor reformatting. 2004-03-24 21:46:09 +00:00
Corinna Vinschen a65cfe3c8c * fhandler_dsp.cc (fhandler_dev_dsp::write): Remove type
cast from argument to audio_out_->parsewav() to make reference
	work properly. Now .wav file headers are properly discarded.
2004-03-24 08:57:17 +00:00
Christopher Faylor 914777261b white space fixup 2004-03-23 18:52:39 +00:00
Corinna Vinschen 88506c6752 * fhandler_disk_file.cc (fhandler_base::fstat_fs): Use created
handle regardless of nohandle state.  Clean up afterwards.
2004-03-23 11:26:54 +00:00
Corinna Vinschen 6653af6cc2 * autoload.cc: Load eight more functions for waveIn support.
* 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.
2004-03-23 11:05:56 +00:00
Christopher Faylor 6b89a541db Christopher Faylor <cgf@redhat.com>
* init.cc (munge_threadfunc): Handle all instances of search_for.
(prime_threads): Test threadfunc_ix[0].
2004-03-22 18:30:38 +00:00
Christopher Faylor c7c7492aab * cygheap.cc (init_cheap): Set initial_sz to something or suffer spurious
output.
(cygheap_fixup_in_child): Set alloc_sz to passed in size to ensure that
children will have the right size heap.
(_csbrk): Make output conditional on DEBUGGING.
2004-03-21 22:24:06 +00:00
Christopher Faylor e362f67fef * cygheap.cc (init_cheap): Conditionalize debugging code. 2004-03-21 21:51:26 +00:00
Christopher Faylor c795774c91 * cygheap.cc (init_cheap): Add ability to specify minimal cygwin heap size when
debugging.
(_csbrk): Report error in allocation to stderr.
(ccalloc): Ditto.
* dtable.cc (dtable::find_fifo): Remove use of atoms.
* dtable.h (dtable::find_fifo): Ditto.
* fhandler.h (fhandler_fifo): Ditto.
* fhandler_fifo.cc (fhandler_fifo::fhandler_fifo): Ditto.
(fhandler_fifo::set_use): Ditto.
(fhandler_fifo::open_not_mine): Ditto.
(fhandler_fifo::open): Ditto.
* pinfo.cc (_pinfo::commune_recv): Ditto.
(_pinfo::commune_send): Ditto.
2004-03-21 17:41:40 +00:00