Commit Graph

2830 Commits

Author SHA1 Message Date
Christopher Faylor a864f241f1 * winbase.h: Fix all ilock defs as per cygwin 1.5.10 release. 2004-06-03 18:55:56 +00:00
Christopher Faylor e847fe136d add missing changelog entry 2004-06-02 21:25:57 +00:00
Christopher Faylor 1a21f33188 * spawn.cc (find_exec): Use has_slash to determine if path has a slash rather
than calculating this twice.
2004-06-02 21:20:54 +00:00
Pierre Humblet 2d5afa98a2 2004-05-30 Pierre Humblet <pierre.humblet@ieee.org>
* path.cc (mount_info::add_item): Make sure native path has drive
	or UNC form. Call normalize_xxx_path instead of [back]slashify.
	Remove test for double slashes. Reorganize to always debug_print.
2004-05-31 02:20:39 +00:00
Christopher Faylor c4c9eb5fd6 * fhandler_disk_file.cc (fhandler_disk_file::fchmod): Only try to open the file
if it uses an acl.
2004-05-29 00:51:16 +00:00
Christopher Faylor e3778517d9 * path.cc (chdir): Always use the normalized_path as posix_cwd, except if it
starts with a drive.

Also perform whitespace cleanup.
2004-05-28 19:50:07 +00:00
Christopher Faylor 37eadb6fb1 * winbase.h: Semi-revert previous patch as it caused strange behavior. Use
syntax similar to that recommended in mingw-dvlpr.
2004-05-25 20:00:19 +00:00
Christopher Faylor 9a17d61b09 * include/cygwin/version.h: Bump DLL minor number to 11. 2004-05-25 16:01:49 +00:00
Christopher Faylor 1b1f85fa0c * winbase.h: Add proper attributions for memory operands throughout. 2004-05-25 04:00:49 +00:00
Christopher Faylor 41bba72eb4 * include/cygwin/version.h: Bump api minor version number.
* cygwin.din: Export atoll.
2004-05-25 03:21:34 +00:00
Christopher Faylor bfa768973c * tty.cc (tty_list::allocate_tty): Leave tty_mutex armed on successful return
from !with_console
* fhandler_tty.cc (fhandler_pty_master::open): Release tty_mutex here after all
initialization is done.
2004-05-20 17:32:12 +00:00
Corinna Vinschen aac9c88c24 * grp.cc (getgrgid_r): Replace struct group by struct __group32 in
argument definition.
	(getgrnam_r): Ditto.
2004-05-17 16:14:01 +00:00
Corinna Vinschen 68509b303e * cygwin.din: Add symbols flockfile, ftrylockfile, funlockfile,
getgrgid_r, getgrnam_r and getlogin_r.
	* grp.cc (getgrgid_r): New function.
	(getgrnam_r): Ditto.
	* syscalls.cc (flockfile): Ditto.
	(ftrylockfile): Ditto.
	(funlockfile): Ditto.
	* sysconf.cc (sysconf): Return LOGIN_NAME_MAX in case of
	_SC_LOGIN_NAME_MAX.
	* thread.cc (__cygwin_lock_trylock): Define int.  Return value from
	call to pthread_mutex_trylock.
	* uinfo.cc (getlogin_r): New function.
	* include/limits.h: Define LOGIN_NAME_MAX.
	* include/cygwin/version.h: Bump API minor number.
	* include/sys/lock.h: Add declarations for __cygwin_lock_xxx functions.
	* include/sys/stdio.h: Add define for _ftrylockfile.
2004-05-17 16:06:02 +00:00
Christopher Faylor 3271e9f9e3 * tty.cc (tty_list::init): Move hmaster initialization earlier to prevent
compilation error.
2004-05-17 15:55:42 +00:00
Christopher Faylor 641654f72a Change the name "title_mutex" to "tty_mutex" throughout.
* tty.h (tty_list::allocate_tty): Turn argument into a boolean.
* tty.cc (tty_list::init): Protect entire allocation operation with tty_mutex
(formerly title_mutex) to protect against allocation races.
2004-05-17 15:27:56 +00:00
Christopher Faylor fb4489a53f add missing file 2004-05-16 16:38:27 +00:00
Corinna Vinschen 32880f1e4a * fhandler_socket.cc (fhandler_socket::recvfrom): Use original flags
value in each WSARecvFrom call.
	(fhandler_socket::recvmsg): Ditto.  Reformat slightly.
2004-05-16 15:38:03 +00:00
Christopher Faylor 0c565ab35b * cygthread.cc (cygthread::is): Eliminate.
* cygthread.h (cygthread::is): Eliminate declaratin.
* fhandler_console.cc (fhandler_console::read): Only wait for signal_arrived in
the main thread.
* fhandler_socket.cc: Include new "wininfo.h".
(fhandler_socket::ioctl): Use 'winmsg' rather than 'gethwnd()'.
* sync.cc (muto::grab): Define new function.
(muto::acquire): Use tls pointer rather than tid.
(muto::acquired): Ditto.
(muto::reset): Delete.
(muto::release): Ditto.  Also implement "close on last release".
* sync.h (muto::tid): Delete.
(muto::tls): New field.
(muto::ismine): Delete.
(muto::owner): Delete.
(muto::unstable): Delete.
(muto::reset): Delete.
(muto::upforgrabs): New method.
(muto::grab): Ditto.
(new_muto_name): New define.
* wininfo.h: New file.
(wininfo): New class.
* window.cc: Rework throughout to use winfo class for controlling invisible
window operation.
(gethwnd): Delete definition.
* winsup.h (gethwnd): Delete declaration.
2004-05-16 04:18:50 +00:00
Christopher Faylor aafd8a545f revert previous not-ready-for-primetime checkin. 2004-05-15 16:10:41 +00:00
Christopher Faylor 71af2ed39e * cygheap.h: Remove some parameter names from declarations throughout.
(cygheap::set): Reflect changes in declaration for arguments and return value
from previous checkin.
2004-05-15 16:09:04 +00:00
Christopher Faylor 982c8ecdb4 * cygheap.h (cwdstuff::set): Modify return value and arguments.
* path.cc (chdir): Specify PC_POSIX.  Do not call SetCurrentDirectory.  Set
posix_cwd in a way that does not break find.exe.  Change call to cwd.set.
(cwdstuff::get_initial): Do not call GetCurrentDirectory here.
(cwdstuff::set): Call SetCurrentDirectory and GetCurrentDirectory as needed.
2004-05-15 15:55:43 +00:00
Christopher Faylor f30298c13b remove keyword stuff 2004-05-12 16:21:18 +00:00
Corinna Vinschen 8d8bc1e139 * path.cc (path_conv::check): Don't bail out with error if path is "//". 2004-05-12 14:04:23 +00:00
Corinna Vinschen 191ea07aa5 * cygheap.h (struct init_cygheap): Add mt_h member.
* fhandler_tape.cc (mt_h): Drop in favor of cygheap based handle.
	(mtinfo_init): Use cygheap->mt_h handle.  Protect it.
2004-05-12 12:28:59 +00:00
Pierre Humblet 8bdfa78a69 2004-05-12 Pierre Humblet <pierre.humblet@ieee.org>
* tty.h: Remove the %d or %x from all cygtty strings.
	(tty::open_output_mutex): Only declare.
	(tty::open_input_mutex): Ditto.
	(tty::open_mutex): New definition.
	* fhandlet_tty.cc (fhandler_tty_slave::open): Declare buf with
	size CYG_MAX_PATH and replace __small_printf calls by shared_name.
	* tty.cc (tty::create_inuse): Ditto.
	(tty::get_event): Ditto.
	(tty::common_init): Ditto.
	(tty::open_output_mutex): New method definition.
	(tty::open_input_mutex): Ditto.
	(tty::open_mutex): New method.
2004-05-12 01:44:11 +00:00
Corinna Vinschen 0175b5311e * fhandler.cc (fhandler_base::open): Set file attributes to correct
value when creating files.
	* path.h (class path_conv): Add write accessor for file_attributes.
2004-05-11 15:39:50 +00:00
Corinna Vinschen 75b5f30fdd * fhandler.h (class fhandler_socket): Add "owner" status flag.
* fhandler_socket.cc (wait): Take flag parameter to take FD_OOB into
	account.  Don't wait infinitely.
	(fhandler_socket::recvfrom): Also wait for FD_OOB if socket owner.
	(fhandler_socket::recvmsg): Ditto.
	(fhandler_socket::sendto): Ditto.
	(fhandler_socket::sendmsg): Ditto.
	(fhandler_socket::fcntl): Set owner status flag if F_SETOWN with own
	pid is called.
2004-05-10 15:21:01 +00:00
Pierre Humblet 94f29ccdf6 2004-05-09 Pierre Humblet <pierre.humblet@ieee.org>
* environ.cc (build_env): Only try to construct required-but-missing
        variables while issetuid.
2004-05-09 15:17:15 +00:00
Christopher Faylor ac3003157b * syscalls.cc: Include environ.h.
(chroot): Set errno in case of path error.  Call getwinenv.
* environ.cc: Remove the NO_COPY attribute of conv_envvars.
2004-05-08 02:55:38 +00:00
Corinna Vinschen f8aae275a4 * fhandler_mem.cc (fhandler_dev_mem::fhandler_dev_mem): Move
initialization of "mem_size" from here...
	(fhandler_dev_mem::open): ...to here.  Fix typo in FH_PORT case.
2004-05-07 21:28:53 +00:00
Corinna Vinschen 367ff06ea4 * fhandler_dsp.cc (fhandler_dev_dsp::Audio_out::stop): Move delete of
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.
2004-05-07 07:54:28 +00:00
Corinna Vinschen 3e101fb2cd Revert code reversion from 2004-04-03. So, revert to async I/O again.
* fhandler.h (status): Add "closed" flag.
	(prepare): New method declaration.
	(wait): Ditto.
	(release): Ditto.
	* fhandler_socket.cc: Don't include wsock_event.h.
	(fhandler_socket::prepare): New method, moved from wsock_event.
	(fhandler_socket::wait): Ditto.
	(fhandler_socket::release): New method.
	(fhandler_socket::recvfrom): Simplify loop.
	(fhandler_socket::recvmsg): Ditto.
	(fhandler_socket::sendto): Ditto.
	(fhandler_socket::sendmsg): Ditto.
	* net.cc: Don't include wsock_event.h.
	(wsock_event::prepare): Remove.
	(wsock_event::wait): Ditto.
	* wsock_event.h: Remove.
2004-05-07 07:51:31 +00:00
Christopher Faylor dab22ff6e6 fix entry 2004-05-07 03:51:22 +00:00
Christopher Faylor 9b0b76ba92 * thread.cc (pthread::create): Move postcreate call to avoid a potential race.
(pthread::cancelable_wait): Don't allow signal interrupt unless main thread.
2004-05-07 03:31:04 +00:00
Christopher Faylor 1940656ab9 Christopher Faylor <cgf@timesys.com>
* path.cc (mount_info::conv_to_posix_path): Add return.
2004-05-07 03:27:37 +00:00
Pierre Humblet 14017d5313 2004-05-06 Pierre Humblet <pierre.humblet@ieee.org>
* path.cc (path_conv::check): Strip trailing dots and spaces and
        return error if the final component had only dots and spaces.
        (normalize_posix_path): Revert 2004-04-30.
        (chdir): Do not check for trailing spaces. Do not set native_dir
        to c:\ for virtual devices. Pass only native_dir to cwd.set.
        (cwdstuff::set): Assume posix_cwd is already normalized.
2004-05-06 16:26:10 +00:00
Christopher Faylor 6767691ff0 fix changelog dates 2004-05-05 03:55:48 +00:00
Christopher Faylor 5cc2189c09 * path.cc (normalize_win32_path): Detect components with only dots. Remove a
final .  if it follows '\\'.
(mount_info::conv_to_win32_path): Only backslashify the path when no mount is
found.
(chdir): Do not look for components with only dots.
2004-05-04 15:14:48 +00:00
Christopher Faylor 3dcb399b58 * path.cc (is_unc_share): Remove redundant tests. 2004-05-04 15:09:58 +00:00
Corinna Vinschen 423ea473f4 * crt0.o (mainCRTStartup): 16 byte align stack for main function. 2004-05-04 14:46:25 +00:00
Corinna Vinschen ad7ba32b2d * path.cc (check_sysfile): Don't scan string twice. 2004-05-04 10:54:06 +00:00
Corinna Vinschen 1e98729b2a * dir.cc (writable_directory): Remove.
(mkdir): Remove call to writable_directory.
	* syscalls.cc (unlink): Ditto.
	(rename): Ditto.
	* winsup.h (writable_directory): Remove declaration.
2004-05-03 11:53:07 +00:00
Corinna Vinschen 43b2d5bace * fhandler.cc (fhandler_base::open): Call path_conv::get_nt_native_path
for evaluating NT path.
	* path.cc (normalize_posix_path): Remove trailing dots and spaces.
	(path_conv::get_nt_native_path): New function.
	* path.h (class path_conv): Declare get_nt_native_path method.
2004-04-30 17:36:36 +00:00
Corinna Vinschen e6b21dafc1 * fhandler.cc (fhandler_base::open): Fix NT native path evaluation
to allow opening serial ports.
2004-04-30 14:02:37 +00:00
Corinna Vinschen 72f3756e07 * init.cc (threadfunc_fe): Hack to make thread stacks always 16
byte aligned.
2004-04-30 13:27:27 +00:00
Corinna Vinschen b7ede86cfe * syscalls.cc (lseek64): Fix debug_printf format string.
(truncate64): Ditto.

	* fhandler.cc (fhandler_base::lseek): Force res to -1 on error.
2004-04-21 08:16:13 +00:00
Christopher Faylor f4a395ef78 fix comment 2004-04-20 18:46:15 +00:00
Christopher Faylor 9f9231b314 * path.cc (is_unc_share): Rename from slash_unc_prefix_p throughout.
* path.cc (normalize_posix_path): Process all Posix paths and map three or more
initial slashes to a single one.  Simplify processing following two initial
slashes.
(normalize_win32_path): Make last argument non-optional and do not check for
NULL value.
2004-04-20 18:45:16 +00:00
Corinna Vinschen c8daf9983b * fhandler_disk_file.cc (fhandler_base::open_fs): Change
set_file_attribute call to indicate that NT security isn't used.
	(fhandler_disk_file::fchmod): Rearrange to isolate 9x related
	statements.
	Do not set FILE_ATTRIBUTE_SYSTEM.
	(fhandler_disk_file::fchown): Check noop case first.
	* fhandler.cc (fhandler_base::open9x): Remove ntsec related statements.
	(fhandler_base::set_name): Do not set namehash.
	* fhandler.h (fhandler_base::get_namehash): Compute and set namehash if
	needed.
	* syscalls.cc (access): Verify that fh is not NULL. Do not set PC_FULL.
	(chmod): Ditto.
	(chown_worker): Ditto.
	(stat_worker): Ditto. Verify if the path exists.
2004-04-20 15:51:24 +00:00
Corinna Vinschen 1b557b4333 * fhandler.cc (fhandler_base::open): Remove special DEV_FLOPPY_MAJOR
treatment.
	* fhandler_raw.cc (fhandler_dev_raw::open): Simplify write-only case.
	* fhandler_tape.cc (fhandler_dev_tape::raw_write): Add accidentally
	dropped condition.
2004-04-20 11:01:22 +00:00
Corinna Vinschen fc0ac9dfe6 * fhandler.cc (fhandler_base::open): Add FILE_READ_ATTRIBUTES when
only GENERIC_WRITE access is requested.
2004-04-20 10:24:37 +00:00
Corinna Vinschen f9e8db240f * include/cygwin/mtio.h (GMT_ASYNC): New define.
(MT_ST_ASYNC_WRITES): Remove "Not supported" comment.
2004-04-19 19:41:13 +00:00
Corinna Vinschen 0c8731b8f4 * errno.cc (errmap): Handle ERROR_IO_PENDING.
* fhandler.cc (fhandler_base::open): Make tape I/O asynchronous.
	* fhandler.h (class fhandler_dev_tape): Add mt_evt member.
	* fhandler_tape.cc (mtinfo_drive::initialize): Initialize async_writes.
	(mtinfo_drive::close): Handle async writes.
	(mtinfo_drive::read): Add mt_evt parameter.  Use overlapped I/O.
	(mtinfo_drive::async_wait): New function.
	(mtinfo_drive::write): Add mt_evt parameter.  Use overlapped I/O.
	Handle async writes.
	(mtinfo_drive::_set_pos): Handle async writes.
	(mtinfo_drive::set_partition): Ditto.
	(mtinfo_drive::prepare): Ditto.
	(mtinfo_drive::get_status): Drop useless "else".  Handle async_writes
	flag.
	(mtinfo_drive::set_options): Handle async_writes flags.
	(fhandler_dev_tape::close): Close mt_evt handle.
	(fhandler_dev_tape::raw_read): Create mt_evt handle and use in call
	to mtinfo_drive::read.
	(fhandler_dev_tape::raw_write): Create mt_evt handle and use in call
	to mtinfo_drive::write.
	* mtinfo.h (MTINFO_VERSION): Bump.
	(enum dirty_state): Add async_write_pending state.
	(class mtinfo_drive): Add OVERLAPPED struct "ov".  Add async_writes
	flag.
	(mtinfo_drive::async_wait): Add declaration.
	(mtinfo_drive::read): Add mt_evt parameter.
	(mtinfo_drive::write): Ditto.

	* registry.cc (load_registry_hive): Call enable_restore_privilege
	instead of set_process_privilege.
2004-04-19 19:29:10 +00:00
Corinna Vinschen 1facc71a35 * fhandler_tape.cc (mtinfo_drive::_set_pos): Take additional dont_wait
parameter.  Use in call to SetTapePosition.
	(mtinfo_drive::set_pos): Accomodate _set_pos calls to above change.
	(mtinfo_drive::set_partition): Ditto.
	* mtinfo.h (mtinfo_drive::_set_pos): Change declaration accordingly.
2004-04-19 13:07:55 +00:00
Christopher Faylor ebd2f65c4e fix comments 2004-04-17 17:53:29 +00:00
Corinna Vinschen e859706578 * autoload.cc (NtCreateFile): Add.
* dir.cc (mkdir): Change set_file_attribute call to indicate that
	NT security isn't used.
	* fhandler.cc (fhandler_base::open_9x): New method, created from
	fhandler_base::open.
	(fhandler_base::open): Rearrange to use NtCreateFile instead of
	CreateFile.
	* fhandler.h (enum query_state): Redefine query_null_access to
	query_stat_control.  query_null_access isn't allowed in NtCreateFile.
	(fhandler_base::open_9x): Declare.
	* fhandler_disk_file.cc (fhandler_base::fstat_fs): Use
	query_stat_control first, query_read_control if that fails.
	(fhandler_disk_file::fchmod): Call enable_restore_privilege before
	trying to open for query_write_control.  Don't fall back to
	opening for query_read_control.
	(fhandler_disk_file::fchown): Ditto.
	(fhandler_disk_file::facl):  Only request restore privilege and query
	access necessary for given cmd.
	* fhandler_raw.cc (fhandler_dev_raw::open): Call fhandler_base::open
	instead of opening device here.
	* ntdll.h (NtCreateFile): Declare.
	* path.cc (symlink_worker): Change set_file_attribute call to indicate
	that NT security isn't used.
	* sec_acl.cc (getacl): Fix bracketing.
	* sec_helper.cc (enable_restore_privilege): New function.
	* security.cc (str2buf2uni_cat): New function.
	(write_sd): Don't request restore permission here.
	* security.h (set_process_privileges): Drop stale declaration.
	(str2buf2uni): Declare.
	(str2buf2uni_cat): Declare.
	(enable_restore_privilege): Declare.
	* syscalls.cc (fchown32): Return immediate success on 9x.
2004-04-16 21:22:13 +00:00
Christopher Faylor 4be0ce3219 . 2004-04-16 01:48:37 +00:00
Christopher Faylor 45f41f1720 Check in missed file. 2004-04-15 17:38:23 +00:00
Christopher Faylor ee0afa428a * autoload.cc (dll_chain1): Rename to dll_chain. Remove old dll_chain code.
(wsock_init): Avoid unneeded winsock_active tests.
* winsup.h (winsock_active): Delete.
2004-04-15 17:38:02 +00:00
Corinna Vinschen 703b16e3ab * fhandler_disk_file.cc (fhandler_disk_file::fchmo): Try opening
in query_read mode if query_write fails.
	* fhandler_disk_file.cc (fhandler_disk_file::fchown): Ditto.
	* fhandler_disk_file.cc (fhandler_disk_file::facl): Ditto.
2004-04-15 15:56:52 +00:00
Corinna Vinschen ca1b76b8c2 Fix case. 2004-04-14 21:16:31 +00:00
Corinna Vinschen e84c7766c3 * ntdll.h: Fix copyright date.
* sec_acl.cc (acl_worker): delete allocated fhandler.
	* syscalls.cc (chown_worker): Ditto.
	(chmod): Ditto.
	(stat_worker): Use get_namehash instead of hash_path_name.
2004-04-14 21:11:45 +00:00
Corinna Vinschen a653f600f5 * sec_acl.cc (getacl): Avoid compiler warning.
* security.cc (write_sd): Ditto.  Fix error handling.
2004-04-14 20:16:29 +00:00
Corinna Vinschen 0c5f00f98a * syscalls.cc (fstat64): Use get_namehash instead of hash_path_name. 2004-04-14 16:51:28 +00:00
Corinna Vinschen e3d1d51579 * fhandler.cc (fhandler_base::open): Simplify access evaluation
expression.
	(fhandler_base::facl): New method.
	* fhandler.h: Declare facl method in fhandler_base,
	fhandler_disk_file and fhandler_virtual.
	* fhandler_disk_file.cc (fhandler_disk_file::facl): New method.
	* fhandler_virtual.cc (fhandler_virtual::facl): New method.
	* sec_acl.cc: Remove forward declaration for aclsort32 and acl32.
	(setacl): Remove static.  Add and use handle parameter.
	(getacl): Ditto.
	(acl_worker): Reorganize to call fhandler's facl method eventually.
	(facl32): Ditto.
	* security.cc (get_nt_object_security): Remove static.
	* security.h: Add extern declarations for get_nt_object_security,
	aclsort32, acl32, getacl and setacl.


	Apply missing syscalls.cc patch and ChangeLog of previous check in.
	* syscalls.cc (chown_worker): Reorganize to call fhandler's fchown
	method eventually.
	(fchown): Ditto.
2004-04-14 16:36:26 +00:00
Corinna Vinschen ddf9c4a744 * fhandler.cc (fhandler_base::open): Accomodate query_write_control
query_state.
	(fhandler_base::fchown): New method.
	* fhandler.h: Declare fchown method in fhandler_base,
	fhandler_disk_file and fhandler_virtual.
	(enum query_state): Add query_write_control.
	* fhandler_disk_file.cc (fhandler_disk_file::fchmod): Set query_state
	to query_write_control.  Only remove FILE_ATTRIBUTE_READONLY if not
	setting security descriptor.
	(fhandler_disk_file::fchown): New method.
	* fhandler_virtual.cc (fhandler_virtual::fchown): New method.
	* sec_acl.cc (setacl): Call write_sd with additional handle attribute.
	* security.cc (write_sd): Take handle argument.  Only request owner
	if getting SE_RESTORE_NAME privilege failed.  Only open file if
	NtSetSecurityObject failed or handle is NULL.
	(set_nt_attribute): Call write_sd with additional handle attribute.
	* security.h (write_sd): Declare with additional handle argument.
2004-04-14 13:40:07 +00:00
Corinna Vinschen f4ae6dc62c * autoload.cc (NtSetSecurityObject): Add.
* fhandler_disk_file.cc (fhandler_disk_file::fchmod): Only request
	READ_CONTROL rights when opening the file.
	* ntdll.h (NtSetSecurityObject): Add declaration.
	* security.cc (write_sd): Call NtSetSecurityObject instead of
	BackupWrite.
	(get_nt_object_security): Don't free security descriptor here.

	* syscalls.cc (ttyname): Use buffer of length TTY_NAME_MAX + 1.
	* sysconf.cc (sysconf): Handle _SC_TTY_NAME_MAX request.
	* include/limits.h: Define TTY_NAME_MAX and _POSIX_TTY_NAME_MAX.
2004-04-14 10:20:26 +00:00
Corinna Vinschen 93d66ddc20 * cygwin.din: Export rand_r and ttyname_r.
* syscalls.cc (ttyname_r): New function.
	(ttyname): Move functionality to ttyname_r.  Call it from here.
	* include/cygwin/version.h: Bump API minor number.
2004-04-14 09:12:04 +00:00
Pierre Humblet b923181eca 2004-04-14 Pierre Humblet <pierre.humblet@ieee.org>
* path.h (path_conv::set_symlink): Add argument.
        (path_conv::get_symlink_length): New method.
        (path_conv::symlink_length): New member.
        * path.cc (path_conv::check): Pass symlen to set_symlink.
        * fhandler_disk_file.cc (fhandler_base::fstat_helper): For symlinks
        set st_size from get_symlink_length.
2004-04-14 03:08:00 +00:00
Corinna Vinschen 29b6b8ca64 * security.cc (set_nt_attribute): Only call get_nt_object_security
if handle is NULL.
2004-04-13 20:45:14 +00:00
Corinna Vinschen 854c870051 * dir.cc (mkdir): Call set_file_attribute with additional handle
argument.
	* fhandler.cc (fhandler_base::fchmod): New method.
	* fhandler.h: Declare fchmod method in fhandler_base,
	fhandler_disk_file and fhandler_virtual.
	* fhandler_disk_file.cc (fhandler_disk_file::fchmod): New method.
	(fhandler_base::open_fs): Call set_file_attribute with additional
	handle argument.
	* fhandler_virtual.cc (fhandler_virtual::fchmod): New method.
	* path.cc (symlink_worker): Call set_file_attribute with additional
	handle argument.
	* security.cc (get_nt_object_security): New function.
	(get_nt_object_attribute): Call get_nt_object_security.
	(set_nt_attribute): Add handle argument.  Call get_nt_object_security
	first, read_sd only if that fails.
	(set_file_attribute): Add handle argument.
	* security.h (set_file_attribute): Declare with additional handle
	argument.
	* syscalls.cc (stat_suffixes): Move to beginning of file.
	(chown_worker): Call set_file_attribute with additional handle argument.
	(chmod): Reorganize to call fhandler's fchmod method eventually.
	(fchmod): Ditto.
2004-04-13 20:36:58 +00:00
Corinna Vinschen 71ffba498c * autoload.cc (NtQuerySecurityObject): Add.
* ntdll.h (STATUS_BUFFER_TOO_SMALL): Add definition.
	(NtQuerySecurityObject): Add declaration.
	* security.cc (get_nt_object_attribute): Always use
	NtQuerySecurityObject to retrieve security descriptor.
2004-04-13 12:14:59 +00:00
Corinna Vinschen 37194b25f6 * fhandler_dsp.cc (fhandler_dev_dsp::Audio_out::stop): Add optional
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.
2004-04-13 09:38:32 +00:00
Corinna Vinschen 825b388289 * winsup.h (IMPLEMENT_STATUS_FLAG): New macro to define status flag
accessor methods unambiguously.
	* fhandler.h: Use IMPLEMENT_STATUS_FLAG throughout where possible.
	* fhandler_termios.cc (fhandler_termios::tcinit): Call corrected
	accessor for initialized status flag.
	* mtinfo.h (class mtinfo_drive): Use IMPLEMENT_STATUS_FLAG throughout.
	* path.cc (fs_info::update): Remove duplicate call to flags().
	* path.h (struct fs_info): Use IMPLEMENT_STATUS_FLAG where possible.
	(path_conv::is_auto_device): Fix spacing.
	* tty.h (class tty_min): Use IMPLEMENT_STATUS_FLAG throughout.
2004-04-13 09:04:22 +00:00
Christopher Faylor d84a4e2e71 * thread.cc (pthread::thread_init_wrapper): Wait later to get more parallel
behavior.
2004-04-13 03:25:50 +00:00
Christopher Faylor 3e78b5d75c * thread.cc (pthread::create): Use thread mutex to control synchronization
rather than creating a suspended thread.  Wait for "cancellation event" to
indicate that started thread has been properly initialized.
(pthread::thread_init_wrapper): Use set_tls_self_pointer() to set tid and
cygtls.  Signal with cancel_event when done.
2004-04-13 02:59:19 +00:00
Pierre Humblet b96dbd203d 2004-04-12 Pierre Humblet <pierre.humblet@ieee.org>
* path.cc (path_conv::check): Fix "tail filling" logic.
2004-04-12 23:59:23 +00:00
Christopher Faylor 1ed8d18733 * cygheap.h: Replace inexplicably removed closing brace. 2004-04-11 17:36:05 +00:00
Christopher Faylor 0cb38eb551 * cygheap.h (CYGHEAP_SLOP): Reduce drastically to avoid collisions. 2004-04-11 04:07:18 +00:00
Christopher Faylor 3301015bdb * dtable.cc (dtable::extend): Change order of memcpy and cfree. 2004-04-11 04:00:01 +00:00
Corinna Vinschen 66d9ac398a * syscalls.cc (sync): Define void according to SUSv3. 2004-04-10 20:40:41 +00:00
Corinna Vinschen bb0906507b * sec_acl.cc (setacl): Use correct offset when trying to combine
standard and default entry of same type.
2004-04-10 20:18:11 +00:00
Corinna Vinschen 7224437c62 * fhandler.cc (rootdir): Add and use second argument.
* winsup.h (rootdir): Add second argument in declaration.
	* path.cc (fs_info::update): Modify call to rootdir.
	* syscalls.cc (check_posix_perm): Ditto.
	(statfs): Ditto. Move syscall_printf near top.
2004-04-10 19:24:55 +00:00
Corinna Vinschen 56551a9bfb * Use new unified status_flag accessor methods from classes fhandler_*,
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.
2004-04-10 13:45:10 +00:00
Christopher Faylor 56a188d1f3 * thread.h (pthread::init_mainthread): Remove parameter forked.
(pthread::set_tls_self_pointer): New static function.
* thread.cc (MTinterface::fixup_after_fork): Change call to
pthread::init_mainthread.
(pthread::init_mainthread): Remove parameter forked.  Simplify thread self
pointer handling.
(pthread::self): Set thread self pointer to null_pthread if thread has not been
initialized.
(pthread::set_tls_self_pointer): New static function.
2004-04-10 00:53:25 +00:00
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
Pierre Humblet 83f96e3fbd 2004-03-19 Pierre Humblet <pierre.humblet@ieee.org>
* dir.cc (rmdir): Reorganize error handling to reduce indentation.
2004-03-20 00:03:32 +00:00
Christopher Faylor 61f50f94d2 * include/cygwin/version.h: Bump DLL minor number to 10. 2004-03-19 18:00:08 +00:00
Christopher Faylor d8f87fba65 * child_info.h (CURR_CHILD_INFO_MAGIC): Reset to new value.
(child_info::cygheap_alloc_sz): New field.
* cygheap.cc (init_cheap): Reduce size of cygwin stack until minimal hit when
attempting initial allocation.
(cygheap_setup_for_child): Use alloc_sz to create secondary memory mapped
entry.  Store alloc_sz in cygheap_alloc_sz.
(cygheap_fixup_in_child): Use cygheap_alloc_sz to map parent's cygheap.
* cygheap.h (_CYGHEAPSIZE_SLOP): New define.
(CYGHEAPSIZE): Use _CYGHEAPSIZE_SLOP.
2004-03-18 19:30:51 +00:00
Corinna Vinschen 891d1990ab * fhandler_proc.cc (format_proc_meminfo): On NT, try to figure out
real swap file usage by requesting SystemPagefileInformation.  Use
	GlobalMemoryStatus as fallback.
	* ntdll.h (_SYSTEM_INFORMATION_CLASS): Add SystemPagefileInformation.
	(struct _SYSTEM_PAGEFILE_INFORMATION): Define.
2004-03-18 12:28:47 +00:00
Christopher Faylor 12d545fb65 add missing changelog entry 2004-03-17 16:39:35 +00:00
Christopher Faylor 7faaacbbf1 * include/cygwin/version.h: Bump DLL minor number to 9. 2004-03-17 16:38:48 +00:00
Christopher Faylor fbdfd5f8a9 * sigproc.cc (proc_terminate): Release sync_proc_subproc when done terminating
or suffer potential hangs.
(get_proc_lock): Reorganize debugging output slightly.
2004-03-16 05:05:22 +00:00
Christopher Faylor e867f8f1d4 * cygtls.cc (_cygtls::fixup_after_fork): Just manipulate the signal stack if a
signal occurred during the parent's fork.  Otherwise leave it alone.
2004-03-16 04:39:38 +00:00
Christopher Faylor c25695bbb9 * exceptions.cc (try_to_debug): Report on tid of caller.
* sync.cc (muto::acquire): Fix some races.
* sync.h (muto): Expose some fields for easier debugging.
2004-03-15 15:50:20 +00:00
Corinna Vinschen 80c74a5f38 Fix ChangeLog dates.
* fhandler.h (fhandler_dev_tape::tape_get_pos): Declare with extra
	parameter for partition number.
	(fhandler_dev_tape::_tape_set_pos): Ditto.
	(fhandler_dev_tape::tape_partition): New method.
	(fhandler_dev_tape::tape_set_partition): New method.
	* fhandler_tape.cc (fhandler_dev_tape::open): Call private methods
	directly instead of ioctl.
	(fhandler_dev_tape::ioctl): Use long erase on MTERASE by default.
	Don't use absolute positioning on MTSEEK.  Call tape_set_partition
	on MTSETPART, tape_partition on MTMKPART.
	(fhandler_dev_tape::tape_get_pos): Add partition number parameter.
	Prefer logical position information over absolute position information.
	Return partition number.
	(fhandler_dev_tape::_tape_set_pos): Add partition number parameter.
	Use in SetTapePosition.
	(fhandler_dev_tape::tape_set_pos): Remove special TAPE_ABSOLUTE_BLOCK
	handling.
	(fhandler_dev_tape::tape_erase): Rewind before erasing.
	(fhandler_dev_tape::tape_status): Rearrange slightly. Try to get a
	MediaType even if no tape is loaded. Store active partition in
	mt_resid as on Linux.
	(fhandler_dev_tape::tape_partition): New method.
	(fhandler_dev_tape::tape_set_partition): New method.
	* include/cygwin/mtio.h: Fix copyright. Add comment to explain
	mt_resid content.
	* include/cygwin/version.h: Bump API minor number.
2004-03-15 11:37:37 +00:00
Christopher Faylor 168d7785fc * cygtls.cc (_cygtls::remove): Call remove_wq even when we can't necessarily
get the cygtls table lock.
* cygtls.h (_cygtls::remove_wq): Add wait argument.
* sigproc.cc (_cygtls::remove_wq): Honor wait argument when acquiring lock.
(proc_terminate): Don't NULL sync_proc_subproc since other threads may still
try to access it.
2004-03-15 02:47:35 +00:00
Corinna Vinschen 6644f5097c * errno.cc (errmap): Map ERROR_BEGINNING_OF_MEDIA and
ERROR_SETMARK_DETECTED to EIO instead of ESPIPE.
	Handle ERROR_FILEMARK_DETECTED.
	* fhandler_tape.cc (TAPE_FUNC): Add comment that ERROR_BUS_RESET
	has still to be handled correctly.
	(fhandler_dev_tape::open): Accomodate fact that get.mt_dsreg
	also contains density code.
	(fhandler_dev_tape::ioctl): Rearrange slightly.  Reset devbuf also on
	MTNOP, MTWSM, MTSETBLK, MTSETDRVBUFFER, MTSETPART and MTMKPART.
	(fhandler_dev_tape::tape_set_pos): Rearrange.  Match behaviour to
	the Linux tape driver.
	(fhandler_dev_tape::tape_status): Call IOCTL_STORAGE_GET_MEDIA_TYPES_EX
	if available.  Return device type and density code in appropriate
	mtget members.
	* wincap.h (wincaps::has_ioctl_storage_get_media_types_ex): New element.
	* wincap.cc: Implement above element throughout.
	* include/cygwin/mtio.h: Add tape device types as returned by
	IOCTL_STORAGE_GET_MEDIA_TYPES_EX.
	(MT_TAPE_INFO): Use above type codes.
	(struct mtget): Change mt_dsreg comment.
2004-03-14 18:01:45 +00:00
Pierre Humblet 83a74ea24a 2004-03-14 Pierre Humblet <pierre.humblet@ieee.org>
* dir.cc (rmdir): Construct real_dir with flag PC_FULL.
        Use a loop instead of recursion to handle the current directory.
2004-03-14 16:16:45 +00:00
Christopher Faylor f8a8e7a1f6 * cygtls.cc (_cygtls::remove): Call remove_wq to ensure that wait stuff is
removed from proc_subproc linked list.
* cygtls.h (_cygtls::remove_wq): Declare.
* sigproc.cc (_cygtls::remove_wq): Define.
(proc_subproc): Label event handle appropriately.
* spawn.cc (spawn_guts): Return -1 when wait() fails for spawn types that
require waiting.
2004-03-14 06:34:05 +00:00
Christopher Faylor 8308950ca5 minor cleanup 2004-03-14 05:35:19 +00:00