Commit Graph

3826 Commits

Author SHA1 Message Date
Christopher Faylor 6f9b3203f2 * sigproc.cc (wait_for_sigthread): Use the current user sid when setting up the
signal pipe rather than relying on (eventually) the effective sid.
2006-03-30 00:57:59 +00:00
Christopher Faylor 12b3371289 * dcrt0.cc (child_info_fork::handle_fork): Set uid/gid in myself so that it can
be used by subsequent startup functions.
(dll_crt0_0): Issue a warning if DuplicateTokenEx fails and DEBUGGING.
(dll_crt0_1): Move user_data->{resourcelocks,threadinterface} initialization
here from dll_crt0_0.
* fork.cc (frok::child): Tell wait_for_sigthread that this is fork.
(frok::parent): Only initialize start_time once.  Tighten time when we're
"deimpersonated".
* sigproc.cc (signal_fixup_after_exec): Rework (futiley) sa_buf stuff.  Add
debugging output.
(wait_for_sigthread): Accept an argument which illustrates whether we are
forked or not.
(wait_sig): Avoid using myself pointer.
* winsup.h ((wait_for_sigthread): Reflect change to argument.
2006-03-29 06:35:25 +00:00
Christopher Faylor 8b9fb6fffd * spawn.cc (spawn_guts): Close handles if we know that we will not be seeing a
sync event from the child.
2006-03-27 03:52:24 +00:00
Christopher Faylor ec54178c36 * sigproc.cc (wait_sig): Move myself manipulation...
(wait_for_sigthread): ...to here.
2006-03-27 01:10:48 +00:00
Corinna Vinschen 3ff1a063a1 * fhandler_floppy.cc: Include ntdef.h and ntdll.h.
(fhandler_dev_floppy::get_drive_info): Rearrange so that now
	NtQueryVolumeInformationFile is called on drives which don't support
	IOCTL_DISK_GET_DRIVE_GEOMETRY.
	* ntdll.h (struct _FILE_FS_SIZE_INFORMATION): Add.
	(enum _FSINFOCLASS): Add missing values.
2006-03-24 14:52:08 +00:00
Christopher Faylor f12c262a43 * fhandler_console.cc (fhandler_console::fixup_after_fork_exec): Make error
message more explicit.
* pinfo.cc (_pinfo::commune_request): Don't lock process unless we're looking
for fifos.
2006-03-23 23:58:52 +00:00
Christopher Faylor 3eb92a58f8 * dcrt0.cc (child_info_spawn::handle_spawn): Don't initialize the console
handler here.
* dtable.cc (dtable::stdio_init): Initialize console handler here.
2006-03-23 16:52:34 +00:00
Christopher Faylor dccd2abec6 * sigproc.cc (sigalloc): Don't set SA_RESTART here.
* signal.cc (_SA_NORESTART): New flag.
(sigaction_worker): New function, derived from sigaction.  Don't set internal
flags unless called internally.
(sigaction): Use sigaction_worker.
(signal): Honor new _SA_NORESTART flag.
(siginterrupt): Set _SA_NORESTART flag appropriately.  Use sigaction_worker to
set flags.
* include/cygwin/signal.h: Define _SA_INTERNAL_MASK here.
2006-03-23 15:55:59 +00:00
Corinna Vinschen f352ebca02 * thread.cc (pthread_mutex::is_good_initializer_or_bad_object): Delete.
(pthread_cond::is_good_initializer_or_bad_object): Delete.
	(pthread_rwlock::is_good_initializer_or_bad_object): Delete.
	(pthread_cond::init): Remove disabled code.  Guard assignment to
	object to initialize against access violation.
	(pthread_rwlock::init): Ditto.
	(pthread_mutex::init): Ditto.
2006-03-22 20:38:26 +00:00
Christopher Faylor 81010d21e6 * fhandler.cc (fcntl): Print flags in hex.
* dcrt0.cc (dll_crt0_0): Semi-revert 2006-03-14 change which moved pinfo_init
and uinfo_init here.
(dll_crt0_1): Ditto.
(__dll_crt0): Ditto.  Don't call update_envptrs here.
(dll_crt0_1): Ditto.  Move wait_for_sigthread call here from dll_crt0_0.
* environ.cc (environ_init): Call it here instead.
* sigproc.cc (my_readsig): New static variable.
(wait_for_sigthread): Set up read pipe here since we are assured that we have
the proper privileges when this is called.
(talktome): Eliminate second argument since it is available as a global now.
(wait_sig): Reflect use of my_readsig.
2006-03-22 16:42:45 +00:00
Corinna Vinschen 69769b7cb5 * thread.cc (pthread_cond::init): Disable validity test of object
to initialize since test of uninitialized content is unreliable.
	(pthread_rwlock::init): Ditto.
	(pthread_mutex::init): Ditto.
2006-03-22 12:52:26 +00:00
Christopher Faylor 70fde4154f * signal.cc (signal): Don't set SA_RESTART here.
(siginterrupt): White space.
* sigproc.cc (sigalloc): Set SA_RESTART here, on initialization.
2006-03-22 04:13:55 +00:00
Christopher Faylor 76ef40d69f * child_info.h (child_status): Fix typo which made it impossible to set
iscygwin.
(child_info::isstraced): Booleanize.
(child_info::iscygwin): Ditto.
* sigproc.cc (child_info::child_info): Minor cleanup of flag setting.
* spawn.cc (spawn_guts): Only close_all_files when we know the process has
started successfully.
* exceptions.cc (init_console_handler): Fix indentation.
2006-03-22 03:20:28 +00:00
Christopher Faylor d4d63ebf22 * dcrt0.cc (dll_crt0_0): Call SetErrorMode earlier.
* pinfo.cc (_pinfo::dup_proc_pipe): Reset wr_proc_pipe on failure.  Return
previous pipe handle.
* pinfo.h (_pinfo::dup_proc_pipe): Reflect change to return value.
* spawn.cc (spawn_guts): Restore previous proc pipe on retry or if process
exits before synchronization.
2006-03-21 01:37:25 +00:00
Christopher Faylor c1494e03a2 * child_info.h (child_status): New enum.
(child_info::flag): Rename from 'straced'.
(child_info::isstraced): New function.
(child_info::iscygwin): Ditto.
(child_info_fork::handle_fork): Reparmize.
(child_info_fork::handle_failure): Ditto.
(child_info_spawn::handle_spawn): New function.
* dcrt0.cc (get_cygwin_startup_info): Use isstraced method.
(child_info_spawn::handle_spawn): Define new function from code previously in
dll_crt0_0.
(dll_crt0_0): Move spawn stuff into handle_spawn.  Only call
init_console_handler for fork case.
* sigproc.cc (child_info::child_info): Set flag appropriately.
(child_info::proc_retry): Treat exit code as "funny" if it's a cygwin process.
* spawn.cc (spawn_guts): Remove commented out flag setting.
2006-03-20 18:01:17 +00:00
Christopher Faylor 4aedb28796 revert previous debugging checkin 2006-03-20 02:01:50 +00:00
Christopher Faylor c5c3d69d8a * pinfo.cc (commune_process): Fix randomly invalid pointer which caused fifos
to work incorrectly.
2006-03-20 01:59:23 +00:00
Christopher Faylor 7d85b417f1 * dcrt0.cc (dll_crt0_0): Oops. We need to bother with setting this in the
fork/exec case.
2006-03-20 01:16:39 +00:00
Christopher Faylor cba9ecfffd * dcrt0.cc (dll_crt0_0): Don't bother with setting init_console_handler here
since it will be set later when we discover if we have a ctty or not.
* exceptions.cc (init_console_handler): Properly remove NULL handler.
2006-03-20 01:11:30 +00:00
Christopher Faylor 3b69aaa932 * pinfo.h (EXITCODE_OK): Define new constant.
* sigproc.cc (child_info::sync): Return EXITCODE_OK if entering with exit_code
== 0.
(sig_send): Don't complain if sending signals while blocked if the sender isn't
in the main thread.
2006-03-18 19:28:59 +00:00
Christopher Faylor a939686807 * child_info.h (CURR_CHILD_INFO_MAGIC): Regenerate.
(child_info::retry): Move here from fork subclass.
(child_info::exit_code): New field.
(child_info::retry_count): Max retry count for process start.
(child_info::proc_retry): Declare new function.
(child_info_fork::retry): Move to parent.
(child_info_fork::fork_retry): Ditto.
* dcrt0.cc (child_info::fork_retry): Rename and move.
(child_info_fork::handle_failure): Move.
(dll_crt0_0): Initialize console handler based on whether we have a controlling
tty or not.  Avoid nonsensical check for fork where it can never occur.
* environ.cc (set_proc_retry): Rename from set_fork_retry.  Set retry_count in
child_info.
(parse_thing): Reflect above change.
* exceptions.cc (dummy_ctrl_c_handler): Remove unused variable name.
(ctrl_c_handler): Always return TRUE for the annoying CTRL_LOGOFF_EVENT.
* fhandler_termios.cc (fhandler_termios::tcsetpgrp): Remove call to
init_console_handler.
* fhandler_tty.cc (fhandler_tty_slave::open): Just call mange_console_count
here and let it decide what to do with initializing console control handling.
* fork.cc (fork_retry): Remove definition.
(frok::parent): Define static errbuf and use in error messages (not thread safe
yet).  Close pi.hThread as soon as possible.  Protect pi.hProcess as soon as
possible.  Don't set retry_count.  That happens automatically in the
constructor now.  Accommodate name change from fork_retry to proc_retry.
* init.cc (dll_entry): Turn off ctrl-c handling early until we know how it is
supposed to be handled.
* pinfo.cc (_pinfo::dup_proc_pipe): Remember original proc pipe value for
failure error message.  Tweak debug message slightly.
* sigproc.cc (child_info::retry_count): Define.
(child_info::child_info): Initialize retry count.
(child_info::sync): Set exit code if process dies before synchronization.
(child_info::proc_retry): Rename from child_info_fork::fork_retry.  Use
previously derived exit code.  Be more defensive about what is classified as an
error exit.
(child_info_fork::handle_failure): Move here from dcrt0.cc.
* spawn.cc (spawn_guts): Maintain error mode when starting new process to avoid
annoying pop ups.  Move deimpersonate call within new loop.  Move envblock
freeing to end.  Loop if process dies prematurely with bad exit code.
* syscalls.cc (init_console_handler): Remove hopefully unneeded call to
init_console_handler.
2006-03-18 19:17:21 +00:00
Christopher Faylor 974f27a51a * cygheap.cc (init_cygheap::manage_console_count): Turn console control handler
on/off depending on whether we have allocated a console or not.
* dcrt0.cc (child_info_fork::fork_retry): Add more potential retry statuses.
(dll_crt0_0): Turn on/off console control depending on whether we have a
controlling tty or not.
* exceptions.cc (init_console_handler): Change BOOL to bool.
* fhandler_console.cc (fhandler_console::need_invisible): Cosmetic change.
* winsup.h (init_console_handler): Reflect argument type change.
* wincap.h (supports_setconsolectrlhandler_null): Remove duplicate capability
throughout.
* wincap.cc: Ditto.
2006-03-16 02:57:37 +00:00
Christopher Faylor f02400f7c9 * child_info.h (child_info_fork::fork_retry): Declare new function.
* dcrt0.cc (child_info_fork::fork_retry): Define new function.
* fork.cc (frok::parent): Move retry decision into child_info_fork::fork_retry
and honor what it tells us to do.
* sigproc.cc (sig_send): Unhold signals on __SIGEXIT.
2006-03-15 00:29:14 +00:00
Christopher Faylor 67f85ee7b2 * fork.cc (frok::parent): Improve error message. 2006-03-14 21:01:35 +00:00
Christopher Faylor e5aa298da5 * dcrt0.cc (main_environ): Initialize to &__cygwin_environment.
(dll_crt0_1): Move resourcelocks, thread interface, pinfo_init, and
uinfo_init...
(dll_crt0_0): ...to here.
(_dll_crt0): Call update_envptrs here after setting main_environ.
* environ.cc (environ_init): Eliminate initted variable.  Don't call
update_envptrs here.
* sigproc.cc (wait_sig): Use my_sendsig when calling CreatePipe to avoid a
dereference.
2006-03-14 19:07:36 +00:00
Christopher Faylor 84d3817405 * child_info.h (child_info_fork::handle_failure): Declare new function.
(child_info_fork::retry): New field.
* dcrt0.cc (__api_fatal_exit_val): Define.
(child_info_fork::handle_failure): Define new function.
(__api_fatal): Exit using __api_fatal_exit_val value.
* environ.cc (set_fork_retry): Set fork_retry based on CYGWIN environment
variable.
(parse_thing): Add "fork_retry" setting.
* fork.cc (fork_retry): Define.
(frok::parent): Reorganize to allow retry of failed child creation if child
signalled that it was ok to do so.
* heap.cc (heap_init): Signal parent via handle_failure when VirtualAlloc
fails.
* pinfo.h (EXITCODE_RETRY): Declare.
* sigproc.cc (child_info::sync): Properly exit with failure condition if called
for fork and didn't see subproc_ready.
* spawn.cc (spawn_guts): Use windows pid as first argument.
* winsup.h: Remove obsolete NEW_MACRO_VARARGS define.
(__api_fatal_exit_val): Declare.
(set_api_fatal_return): Define.
(in_dllentry): Declare.
* exceptions.cc (inside_kernel): Remove unneeded in_dllentry declaration.
2006-03-13 21:10:14 +00:00
Christopher Faylor bbca1e4cb9 * dcrt0.cc (dll_crt0_0): Reorganize so that sigproc_init is called a little
later.  Add a comment.
* fork.cc (resume_child): Make void.
(frok::parent): Only zero pi when necessary.  Explicitly zero si.  Set
this_errno when child_copy fails.  Accommodate change to resume_child.
* sigproc.cc (sigalloc): Move global_sigs initialization here.
(sigproc_init): Move global_sigs.
(sig_send): Just check for flush signals once.
* wincap.h: Define supports_setconsolectrlhandler_null throughout.
* wincap.cc: Ditto.
2006-03-13 18:29:48 +00:00
Corinna Vinschen d6382e653a Fix typo. 2006-03-13 11:25:07 +00:00
Corinna Vinschen 75c7893797 * autoload.cc (LoadDLLfuncNt): New define to wrap NT native functions.
Use for NT native functions throughout.
	* dtable.cc (handle_to_fn): Treate return value of NtQueryObject as
	NTSTATUS value.
2006-03-13 11:22:51 +00:00
Christopher Faylor 57001a7f10 tweak last ChangeLog description 2006-03-13 05:21:05 +00:00
Christopher Faylor 9badd94adb * cygtls.cc (_cygtls::remove): Reset initialized flag right away if we were
previously initialized.
* cygtls.h (_cygtls::initialized): Move nearer the end to catch situation when
Windows 98 mysteriously changes pieces of cygtls when thread is detaching.
* gendef (__sigfe_maybe): Simplify slightly.
* tlsoffsets.h: Regenerate.
2006-03-13 04:26:57 +00:00
Christopher Faylor 51f90b2f01 * cygtls.h (CYGTLS_INITIALIZED): Change to a little more unlikely value.
(CYGTLSMAGIC): Delete.
* dcrt0.cc (dll_crt0_0): Call sigproc_init during init startup.
(_dll_crt0): Don't worry about sync_startup.  Just wait for sigthread here.
* dll_init.cc (cygwin_detach_dll): Only pick up tls version of retaddr if we
have a valid tls.
* fork.cc (frok::child): Remove sigproc_init initialization since it happens
much earlier now.
* gendef: Recognize SIGFE_MAYBE.
(fefunc): Generate calls to _sigfe_maybe, if appropriate.
(_sigfe_maybe): New function.
* init.cc (search_for): Always initialize search_for, even on fork.
(calibration_thread): Delete.
(calibration_id): Delete.
(prime_threads): Delete.
(munge_threadfunc): Remove calibration_thread special case.  Avoid calling
thread function if we haven't yet hit the "search_for" thread.
(dll_entry): Remove prime_threads call.  Only call munge_threadfunc when
hwait_sig is active.  Ditto.  for _my_tls.remove ();
* sigproc.cc (hwait_sig): Make global.
(sigproc_init): Don't bother with sync_startup.
(sig_send): Treat flush as a no-op when signals are held.
(wait_sig): Cause signals to be held after fork.
2006-03-12 23:57:05 +00:00
Corinna Vinschen 75fbcb4488 * syscalls.cc (rename): Move existance check for oldpath further up
to the start of the function.  Avoid another case of a name collision
	if oldpath is a shortcut and a file or directory newpath already exists.
2006-03-09 15:31:08 +00:00
Corinna Vinschen e9c8cb3193 * autoload.cc (NtClose): Define.
(NtOpenDirectoryObject): Define.
	(NtQueryDirectoryObject): Define.
	* fhandler_proc.cc: Include ctype.h and wchar.h.
	(format_proc_partitions): Revamp loop over existing harddisks by
	scanning the NT native \Device object directory and looking for
	Harddisk entries.
	* ntdll.h: Rearrange system call declarations alphabetically.
	(DIRECTORY_QUERY): Define.
	(struct _DIRECTORY_BASIC_INFORMATION): Define.
	(NtOpenDirectoryObject): Declare.
	(NtQueryDirectoryObject): Declare.
2006-03-09 09:01:08 +00:00
Corinna Vinschen 4db3b4496e Remove accidentally checked in ChangeLog entry. 2006-03-09 09:00:10 +00:00
Christopher Faylor 9aca6a48a5 * cygtls.h (_cygtls::retaddr): New method.
* dll_init.cc (cygwin_detach_dll): Use new tls function to find return address
since this function is now signal guarded.
(update_envptrs): Remove unneeded braces.
* syscalls.cc (statvfs): Coerce full_path to avoid a gcc warning.
2006-03-08 23:55:14 +00:00
Corinna Vinschen 6ca5318940 * syscalls.cc (statvfs): Simplify path name expression. 2006-03-08 16:10:55 +00:00
Corinna Vinschen 6022cd2ef9 * syscalls.cc: Include winioctl.h.
(statvfs): Request correct volume size using DeviceIoControl if
	quotas are enforced on the file system.
2006-03-08 16:07:28 +00:00
Corinna Vinschen ecdee6e98a * dir.cc (opendir): Fix indentation.
* fhandler_disk_file.cc (fhandler_disk_file::opendir): Move storing
	fhandler in file descriptor table to some point very late in function
	to avoid double free'ing.  Add comment to explain what happens.
	Add label free_mounts and don't forget to delete __DIR_mounts structure
	if NtOpenFile fails.
2006-03-03 20:19:26 +00:00
Corinna Vinschen 7b8b467def * syscalls.cc (chroot): Disallow chroot into special directories.
Return EPERM instead.
2006-03-02 18:08:09 +00:00
Corinna Vinschen 471573dc77 * fhandler_disk_file.cc (__DIR_mounts::check_missing_mount): Check
cygdrive string length for those who have cygdrive mapped to "/".
2006-03-02 09:48:42 +00:00
Corinna Vinschen 352059d4b1 * sec_helper.cc (set_cygwin_privileges): Request SE_BACKUP_NAME
privileges.
2006-03-01 23:14:25 +00:00
Corinna Vinschen 24f0349c1e * fhandler_proc.cc (fhandler_proc::fstat): Always return fixed link
count of 1 for /proc directory instead of incorrect PROC_LINK_COUNT.
2006-03-01 22:56:12 +00:00
Corinna Vinschen c115f31ff2 * fhandler.h (enum dirent_states): Remove dirent_saw_cygdrive,
dirent_saw_dev and dirent_saw_proc.
	(fhandler_cygdrive::open): Declare.
	(fhandler_cygdrive::close): Declare.
	* fhandler_disk_file.cc (class __DIR_mounts): Move to beginning of file.
	(__DIR_mounts::check_mount): New parameter to indicate if inode number
	is needed in calling function or not. Add /proc and /cygdrive handling.
	(__DIR_mounts::check_missing_mount): Ditto.
	(path_conv::ndisk_links): Use __DIR_mounts class to create correct
	hardlink count for directories with mount points in them.
	(fhandler_disk_file::readdir_helper): Remove /dev, /proc and /cygdrive
	handling.
	(fhandler_cygdrive::open): New method.
	(fhandler_cygdrive::close): New method.
	(fhandler_cygdrive::fstat): Always return fixed inode number 2 and
	fixed link count of 1. Drop call to set_drives.
	(fhandler_cygdrive::opendir): Drop call to get_namehash.
	(fhandler_cygdrive::readdir): Handle "." entry to return fixed inode
	number 2.
2006-03-01 22:37:25 +00:00
Christopher Faylor 8d0f58ef37 * cygwin.din: Fix some erroneous SIGFE/NOSIGFE settings.
* cygthread.cc (cygthread::callfunc): Revert below change.  Make ev a manual
reset event again.  so that it will be reset by WaitFor*Object as appropriate.
(cygthread::stub): Ditto.
(cygthread::terminate_thread): Reset ev if it was found to have been set.
2006-03-01 21:31:24 +00:00
Christopher Faylor ee93375872 * analyze_sigfe: New script.
* dllfixdbg: Add copyright.
* gendef: Ditto.
* gendevices: Ditto.
* gentls_offsets: Ditto.
2006-03-01 20:20:22 +00:00
Christopher Faylor 3b1f276fca * cygthread.cc (cygthread::callfunc): Create ev as an auto-reset event so that
it will be reset by WaitFor*Object as appropriate.
(cygthread::stub): Ditto.
(cygthread::terminate_thread): Remove forced setting of thread termination.
2006-03-01 18:23:24 +00:00
Corinna Vinschen e817fd3c8b * include/sys/dirent.h (struct __DIR): Rename __d_unused to
__d_internal.
	* fhandler_disk_file.cc (struct __DIR_cache): Remove useless "typedef".
	(d_dirname): Remove useless "struct".
	(d_cachepos): Ditto.
	(d_cache): Ditto.
	(class __DIR_mounts): New class, implementing mount point tracking
	for readdir.
	(d_mounts): New macro for easy access to __DIR_mounts structure.
	(fhandler_disk_file::opendir): Allocate __DIR_mounts structure and
	let __d_internal element of dir point to it.
	(fhandler_disk_file::readdir_helper): Add mount points in the current
	directory, which don't have a real directory backing them.
	Don't generate an inode number for /dev.  Add comment, why.
	(fhandler_disk_file::readdir): Move filling fname to an earlier point.
	Check if current entry is a mount point and evaluate correct inode
	number for it.
	(fhandler_disk_file::readdir_9x): Ditto.
	(fhandler_disk_file::rewinddir): Set all mount points in this directory
	to "not found" so that they are listed again after calling rewinddir().
	(fhandler_disk_file::closedir): Deallocate __DIR_mounts structure.
	* path.cc (mount_info::get_mounts_here): New method to evaluate a list
	of mount points in a given parent directory.
	* shared_info.h (class mount_info): Declare get_mounts_here.
2006-03-01 13:47:49 +00:00
Corinna Vinschen b7d7223947 * fhandler_disk_file.cc (fhandler_disk_file::opendir): Use iscygdrive
instead of isspecial.
	* path.h (path_conv::iscygdrive): New method.
2006-02-28 20:26:52 +00:00
Christopher Faylor d405630e71 * exceptions.cc (_cygtls::interrupt_now): Remove "inside cygwin" check since
some cygwin functions are meant to be interrupted.
2006-02-28 20:02:16 +00:00
Corinna Vinschen 6fb7c8ae78 * cygwin.din: Export __isinff, __isinfd, __isnanf, __isnand.
* include/cygwin/version.h: Bump API minor number to 155.
2006-02-28 15:32:48 +00:00
Corinna Vinschen 5d93840135 * dir.cc (readdir_worker): Use slash as path separator when evaluating
namehash for paths below /proc.
	* fhandler_netdrive.cc (fhandler_netdrive::readdir): Use expensive
	inode number evaluation on share names.
2006-02-28 12:20:11 +00:00
Christopher Faylor 4f1558d132 * fhandler_disk_file.cc (fhandler_disk_file::opendir): Only set d_cachepos
under NT or suffer memory corruption.
(fhandler_disk_file::readdir_helper): Avoid else with a return.  Just calculate
extension location once when doing symlink checks.
(fhandler_disk_file::readdir): Make debug output more useful.
(fhandler_disk_file::readdir_9x): Ditto.  Eliminate redundant variable.
2006-02-28 04:23:17 +00:00
Christopher Faylor 6a7a2f4bbe * include/sys/termios.h (cfsetispeed): Just define as a function rather than
resorting to a macro.
(cfsetospeed): Ditto.
2006-02-28 01:31:04 +00:00
Christopher Faylor f6f3b1ee46 * sigproc.cc: Fix a comment. 2006-02-28 01:28:28 +00:00
Christopher Faylor e41ff6093e * cygthread.cc (cygthread::release): Add a comment. 2006-02-28 01:27:41 +00:00
Corinna Vinschen 47a5b664e5 * fhandler_netdrive.cc (fhandler_netdrive::fstat): Create unambiguous
inode number.
	(fhandler_netdrive::readdir): Ditto.
2006-02-27 17:46:29 +00:00
Christopher Faylor ad37df4814 * sigproc.cc (sigheld): Define new variable.
(sig_dispatch_pending): Don't check sigq since that's racy.
(sig_send): Set sigheld flag if __SIGHOLD is specified, reset it if __SIGNOHOLD
is specified.  Ignore flush signals if we're holding signals.
2006-02-24 21:40:28 +00:00
Christopher Faylor 1b845df5ac * cygwin.din (_exit): Use signal front end.
(exit): Ditto.
2006-02-24 02:08:56 +00:00
Christopher Faylor 7fbfec2b64 * winsup.h (cygwin_hmodule): Declare.
* exceptions.cc (inside_kernel): Reverse return values to reflect function
name.  Return true if we're in cygwin1.dll or if we're executing in dll_entry.
(_cygtls::interrupt_now): Reflect reversal of inside_kernel return value.
* hookapi.cc (cygwin_hmodule): Remove declaration.
* init.cc (dll_entry): Use in_dllentry global to record that we are executing
in dllentry.
2006-02-23 19:21:21 +00:00
Corinna Vinschen 2eecb0478c * exceptions.cc (_cygtls::interrupt_now): Reorder conditional
to call inside_kernel only if this isn't locked.
2006-02-22 17:06:14 +00:00
Corinna Vinschen b65479ca2e * fhandler.cc (fhandler_base::open): Add FILE_READ_ATTRIBUTES to
access flags in case of query_read_control case, add FILE_READ_DATA
	in case of query_stat_control.
2006-02-22 16:40:42 +00:00
Christopher Faylor 8aaf07c7a2 fix typo 2006-02-20 16:26:16 +00:00
Christopher Faylor 0a5f931a43 * spawn.cc (av::fixup): Check for .bat and friends specifically now since these
extensions are no longer automatically detected.
2006-02-20 16:15:51 +00:00
Christopher Faylor badc494165 revert erroneous checkin 2006-02-20 02:06:37 +00:00
Christopher Faylor a339c989c7 * exceptions.cc (stackdump): Avoid dumping more than once. 2006-02-20 02:04:31 +00:00
Christopher Faylor 6d61866578 * fhandler_disk_file.cc (fhandler_disk_file::opendir): Use NtOpenFile to open
the directory.
(fhandler_disk_file::readdir): Use NT_SUCCESS to determine if status represents
success.
2006-02-19 21:18:36 +00:00
Corinna Vinschen d4e9248df3 * fhandler_disk_file.cc (fhandler_disk_file::opendir): Drop generating
path_conv for root.
2006-02-19 08:34:25 +00:00
Corinna Vinschen 408b92dbb5 * fhandler_disk_file.cc (FS_IS_SAMBA): Move out of
path_conv::hasgood_inode.
	(path_conv::is_samba): New method.
	(fhandler_base::fstat_by_handle): Don't even try to use
	FileIdBothDirectoryInformation on Samba.
	* path.h (class path_conv): Declare is_samba method.
2006-02-18 10:46:53 +00:00
Christopher Faylor 753702223c * path.cc (conv_path_list): Eat empty paths when converting to POSIX.
(cygwin_conv_to_win32_path): Deal with Cygwin's necessity of adding a '/' to
the end of a path ending in '.'.
2006-02-17 20:12:11 +00:00
Corinna Vinschen c6e48b1cd1 * cygwin.din: Export sigignore and sigset.
* exceptions.cc (sigset): New function.
	(sigignore): New function.
	* include/cygwin/signal.h (SIG_HOLD): Define.
	(sigignore): Declare.
	(sigset): Declare.
	* include/cygwin/version.h: Bump API minor number to 154.
2006-02-16 18:21:49 +00:00
Christopher Faylor 5e8b96517c minor comment restructuring 2006-02-15 22:11:13 +00:00
Christopher Faylor 49bc9a6939 * include/mntent.h: Add missing #include. 2006-02-13 19:01:32 +00:00
Christopher Faylor 462c98e96a * gentls_offsets: Fix typo in error message. 2006-02-13 18:59:01 +00:00
Christopher Faylor 472130e897 * fhandler_process.cc (format_process_stat): Use cygwin-derived start time even
on NT since it is the logical start time of the "process".
* pinfo.cc (set_myself): Don't set start time when it should have already been
set previously.
2006-02-11 04:53:14 +00:00
Christopher Faylor 5a8a5efcfd revert previously applied patch. 2006-02-11 00:07:43 +00:00
Christopher Faylor 7f8c7bff6f * times.cc (clock_getres): Use correct conversion from milliseconds to
seconds/nanoseconds.
(clock_setres): Use correct conversion to nanoseconds.
2006-02-11 00:06:50 +00:00
Christopher Faylor 9a08fd5a50 * external.cc (sync_winenv): Rename from "setup_winenv". Use same mechanism as
spawn to determine environment variables which should be converted back to
windows form.
(cygwin_internal): Reflect setup_winenv -> sync_winenv name change.
* include/sys/cygwin.h: Ditto.
2006-02-10 17:22:34 +00:00
Corinna Vinschen 30f1c8a675 * fhandler_disk_file.cc (fhandler_disk_file::opendir): Only set
the dirent_get_d_ino flag on filesystems having useful File IDs.
	Add comment explaining why.
2006-02-09 14:42:48 +00:00
Corinna Vinschen 03a49a00ab * dtable.cc (handle_to_fn): Accomodate new argument order in call to
sys_wcstombs.
	* fhandler_disk_file.cc (fhandler_disk_file::readdir): Call sys_wcstombs
	instead of just wcstombs to accomodate OEM codepages.
	* miscfuncs.cc (sys_wcstombs): Split len argument in source and target
	length.  Always 0-terminate result in target string.
	* security.cc (lsa2wchar): Remove unused function.
	(lsa2str): Ditto.
	(get_lsa_srv_inf): Ditto.
	(get_logon_server): Accomodate new argument order in call to
	sys_wcstombs.
	(get_user_groups): Ditto.
	(get_user_local_groups): Ditto.
	(get_priv_list): Call sys_wcstombs directly instead of lsa2str.
	* uinfo.cc (cygheap_user::ontherange): Accomodate new argument order
	in call to sys_wcstombs.
	* winsup.h (sys_wcstombs): Change prototype to match new argument order.
2006-02-07 15:49:08 +00:00
Corinna Vinschen 3cb155a97f * init.cc (respawn_wow64_process): Exit with the exit code returned
by the respawned process.
2006-02-07 09:57:43 +00:00
Christopher Faylor 985d0e68c5 Always zero all elements of siginfo_t throughout.
* cygtls.h (_cygtls::thread_context): Declare new field.
(_cygtls::thread_id): Ditto.
(_cygtls::signal_exit): Move into this class.
(_cygtls::copy_context): Declare new function.
(_cygtls::signal_debugger): Ditto.
* cygtls.cc (_cygtls::init_thread): Fill out thread id field.
* exceptions.cc (exception): Change message when exception info is unknown.
Copy context to thread local storage.
(_cygtls::handle_exceptions): Avoid double test for fault_guarded.  Reflect
move of signal_exit to _cygtls class.
(sigpacket::process): Copy context to thread local storage.
(_cygtls::signal_exit): Move to _cygtls class.  Call signal_debugger to notify
debugger of exiting signal (WIP).  Call stackdump here (WIP).
(_cygtls::copy_context): Define new function.
(_cygtls::signal_debugger): Ditto.
* tlsoffsets.h: Regenerate.
* include/cygwin.h (_fpstate): New internal structure.
(ucontext): Declare new structure (WIP).
(__COPY_CONTEXT_SIZE): New define.
* exceptions.cc (_cygtls::interrupt_setup): Clear "threadkill" field when there
is no sigwaiting thread.
(setup_handler): Move event handling into interrupt_setup.
2006-02-06 18:24:11 +00:00
Corinna Vinschen 125ff9be63 * fhandler_socket.cc (fhandler_socket::connect): Fix formatting.
(fhandler_socket::wait): Handle SA_RESTART when signal arrives.
2006-02-06 17:50:23 +00:00
Corinna Vinschen 29b3c9cc3e * include/cygwin/socket.h (CMSG_FIRSTHDR): Avoid compiler warning. 2006-02-06 10:01:37 +00:00
Corinna Vinschen 6da41754a4 * include/features.h: Add comment to explain what's going to happen
here at one point.
	* include/sys/stdio.h: Guard getline and getdelim prototypes with
	_GNU_SOURCE to avoid collision with old-style declarations.
2006-02-05 20:30:24 +00:00
Corinna Vinschen fbae2bf864 * environ.cc (struct parse_thing): Add transparent_exe option.
* fhandler_disk_file.cc (fhandler_disk_file::link): Accomodate
	transparent_exe option.  Add .exe suffix for links to executable files,
	if transparent_exe is set.
	* fhandler_process.cc (fhandler_process::fill_filebuf): Remove .exe
	suffix if transparent_exe option is set.
	* path.cc (symlink_worker): Accomodate transparent_exe option.
	(realpath): Don't tack on .exe suffix if transparent_exe is set.
	* syscalls.cc (transparent_exe): New global variable.
	(unlink): Accomodate transparent_exe option.
	(open): Ditto.
	(link): Ditto.
	(rename): Ditto. Maybe add .exe suffix when renaming executable files.
	(pathconf): Accomodate transparent_exe option.
	* winsup.h: Declare transparent_exe.
2006-02-05 18:18:02 +00:00
Corinna Vinschen 0913522dbd * fhandler_disk_file.cc (fhandler_disk_file::readdir_9x): Remove
useless code.
2006-02-05 18:11:03 +00:00
Corinna Vinschen da3374d695 * fhandler_disk_file.cc (fhandler_disk_file::rewinddir): Remove label
"out".  Move test for NULL __handle ...
	(fhandler_disk_file::rewinddir_9x): ... here.
2006-02-05 11:17:03 +00:00
Corinna Vinschen a80fb27643 ... and the ChangeLog, never forget the ChangeLog... 2006-02-05 10:55:59 +00:00
Corinna Vinschen 0856c0bb2c * dir.cc (rewinddir): Keep dirent_get_d_ino and dirent_set_d_ino flags. 2006-02-05 10:55:23 +00:00
Christopher Faylor c6e665bb95 * fhandler_disk_file.cc (fhandler_disk_file::readdir): Don't close dir handle
when we hit EOF since rewwindir may reactivate it.
(fhandler_disk_file::readdir_9x): Eliminate superfluous temporary variable.
(fhandler_disk_file::closedir): Return EBADF when trying to close unopened DIR.
Reorganize slightly.  Return actual derived error value rather than always
returning 0.
2006-02-05 07:03:24 +00:00
Christopher Faylor 25bafd7b0e * dir.cc (rmdir): Reorganize check for trailing dot to return correct error
when directory does not exist.
2006-02-04 19:02:42 +00:00
Christopher Faylor 324ce34bd5 * dir.cc (mkdir): Reorganize check for trailing dot to return correct error
when directory exists.
* fhandler_disk_file.cc (fhandler_disk_file::mkdir): Remove special test for
path ending in '.'.
2006-02-04 04:31:34 +00:00
Corinna Vinschen 1912201029 * path.cc (suffix_scan::lnk_match): Return true beginning with
SCAN_APPENDLNK.
	(suffix_scan::next): Rearrange code to make .lnk append order slightly
	more deterministic.
	* spawn.cc (exe_suffixes): Try no suffix before .exe suffix to align
	evaluation with stat_suffixes.
	(dll_suffixes): Ditto.
2006-02-03 21:33:09 +00:00
Christopher Faylor d6b2195f1c * cygwin/version.h: Mention CW_SETUP_WINENV in comment for API minor 153. 2006-02-02 23:16:26 +00:00
Corinna Vinschen c0b0336f36 * cygwin.din (updwtmpx): Export.
* syscalls.cc (updwtmpx): New function.
	* include/utmpx.h (updwtmpx): Declare.
	* include/cygwin/version.h: Bump API minor number to 153.
2006-02-02 22:46:37 +00:00
Christopher Faylor 6577c186c9 * external.cc (setup_winenv): New function.
(cygwin_internal): Implement CW_SETUP_WINENV.
* sys/cygwin.h (cygwin_getinfo_types): Define CW_SETUP_WINENV.
2006-02-02 19:55:45 +00:00
Corinna Vinschen bb6f800d18 * security.cc (is_group_member): Fix comment. 2006-02-02 11:35:52 +00:00
Corinna Vinschen 49e803c0b6 * security.cc (is_group_member): Use local group info type 1. Test
group for being a global group or a well-known SID before adding it
	to the group list.  Add comment.
2006-02-02 11:22:10 +00:00
Corinna Vinschen 0ee535ccb1 * autoload.cc (GetTcpTable): Define.
* fhandler_socket.cc (address_in_use): New function to check if
	sockaddr_in address is already in use.
	(fhandler_socket::bind): Check if address is alreay in use in case of
	SO_REUSEADDR, to circumvent WinSock non-standard behaviour.
2006-02-01 11:10:53 +00:00